📄 app_gen.ins
字号:
puts $FP "Path="
puts $FP "Terminal=true"
puts $FP "Type=Application"
close $FP
# Write the "gfl.desktop" file
if [catch { open [file join $FOLDER "gfl.desktop"] {WRONLY CREAT TRUNC} 0666} FP] {
tku_popup_message error ok $FP
return "error"
}
puts $FP "\[Desktop Entry]"
puts $FP "Comment="
puts $FP "Exec=[file join $EDIR gfl gfl]"
puts $FP "Icon=[file join $EDIR all pixmaps get_flow.xpm]"
puts $FP "Name=Genesis Flow Builder"
puts $FP "Path="
puts $FP "Terminal=true"
puts $FP "Type=Application"
close $FP
# Put a link to a $EDIR/all/linux/applnk directory as
# /etc/X11/applink/Frontline
if [catch {exec ln -s $FOLDER "/etc/X11/applnk/Frontline"} RESPONSE] {
tku_popup_message error ok $RESPONSE
return "error"
}
}
}
tku_message " "
################### End Linux
return "ok"
}
#.................................................................
proc local_startup_write_init_files { CSH_INIT_PATH SH_INIT_PATH } {
global VPIG
global APP_GEN_G
set MAIN "get"
if {[catch {open $CSH_INIT_PATH {CREAT TRUNC WRONLY} 0664} CSH_FP] } {
tku_popup_message error ok \
"Cannot open file for writing\
\nFile = $CSH_INIT_PATH"
return "error"
}
if {[catch {open $SH_INIT_PATH {CREAT TRUNC WRONLY} 0664} SH_FP] } {
tku_popup_message error ok \
"Cannot open file for writing\
\nFile = $SH_INIT_PATH"
return "error"
}
set DIR $APP_GEN_G(DEST_PATH)
set VER_NUM [get_version_number $VPIG(NAME_VERSION)]
set EDIR_LOCATION [get_edir_location $DIR]
if { $EDIR_LOCATION == $DIR } {
set EDIR e$VER_NUM
} else {
set EDIR [file join $EDIR_LOCATION e$VER_NUM]
}
set DATE [clock format [clock seconds] -format "%Y%b%d.%H%M%S"]
puts $CSH_FP "# Created: $DATE By [tclu_get_user]\n#"
puts $SH_FP "# Created: $DATE By [tclu_get_user]\n#"
puts $CSH_FP "setenv GENESIS_DIR $DIR"
puts $SH_FP "GENESIS_DIR=$DIR\nexport GENESIS_DIR"
puts $CSH_FP "setenv GENESIS_VER $VER_NUM"
puts $SH_FP "GENESIS_VER=$VER_NUM\nexport GENESIS_VER"
puts $CSH_FP "setenv GENESIS_EDIR $EDIR"
puts $SH_FP "GENESIS_EDIR=$EDIR\nexport GENESIS_EDIR"
if [string match "/*" $EDIR] {
puts $CSH_FP "alias $MAIN '\$GENESIS_EDIR/get/$MAIN \\!:* &'"
puts $SH_FP "$MAIN='$EDIR/get/$MAIN '\nexport $MAIN"
puts $CSH_FP "alias gfb '\$GENESIS_EDIR/gfb/gfb \\!:* &'"
puts $SH_FP "gfb='$EDIR/gfb/gfb '\nexport gfb"
puts $CSH_FP "alias gfl '\$GENESIS_EDIR/gfl/gfl \\!:* &'"
puts $SH_FP "gfl='$EDIR/gfl/gfl '\nexport gfl"
puts $CSH_FP "alias erfedit '\$GENESIS_EDIR/erf/ERFEditor \\!:* &'"
puts $SH_FP "erfedit='$EDIR/erf/ERFEditor '\nexport erfedit"
} else {
puts $CSH_FP "alias $MAIN '\$GENESIS_DIR/\$GENESIS_EDIR/get/$MAIN \\!:* &'"
puts $SH_FP "$MAIN='$DIR/$EDIR/get/$MAIN '\nexport $MAIN"
puts $CSH_FP "alias gfb '\$GENESIS_DIR/\$GENESIS_EDIR/gfb/gfb \\!:* &'"
puts $SH_FP "gfb='$DIR/$EDIR/gfb/gfb '\nexport gfb"
puts $CSH_FP "alias gfl '\$GENESIS_DIR/\$GENESIS_EDIR/gfl/gfl \\!:* &'"
puts $SH_FP "gfl='$DIR/$EDIR/gfl/gfl '\nexport gfl"
puts $CSH_FP "alias erfedit '\$GENESIS_DIR/\$GENESIS_EDIR/erf/ERFEditor \\!:* &'"
puts $SH_FP "erfedit='$DIR/$EDIR/erf/ERFEditor '\nexport erfedit"
}
puts $CSH_FP "setenv PCMAP 1"
puts $SH_FP "PCMAP=1\nexport PCMAP"
close $CSH_FP
close $SH_FP
return ok
}
#.................................................................
proc local_startup_check_init_files { CSH_INIT_PATH SH_INIT_PATH } {
global VPIG
global APP_GEN_G
set MSG "To create, re-perform this stage in Server Mode installation."
if { ! [tclu_is_path_file $CSH_INIT_PATH] } {
tku_popup_message error ok \
"The file $CSH_INIT_PATH does not exist.\
\n$MSG"
return "error"
}
if { ! [tclu_is_path_file $SH_INIT_PATH] } {
tku_popup_message error ok \
"The file $SH_INIT_PATH does not exist.\
\n$MSG"
return "error"
}
return ok
}
################ Info Section - LICENSE ###########################
set APP_GEN_G(LICENSE_INFO) "
Actions performed during the 'Update license' stage:
User is requested to supply a path to a license file provided
by Frontline.
The license file consists of option lines. Each line describes
one option in the format:
OOOOOOO-L-NNN-MMM-TTT KKKKKKKK
Where:
OOOOOOO - Option name (7 characters)
L - Level of option
NNN - Number of floating terminals
MMM - Number of instances (for fixed-id license)
TTT - Number of months starting January 1993
KKKKKKKK- Key matching the rest of data in the line
The license file will be copied into the directory:
\$GENESIS_DIR/share/license
It will be called:
M84xx-xxxx-xxxx-xxxx
Where:
84xx-xxxx-xxxx-xxxx is the Dongle Id
"
#####################################################################
proc app_gen_license_cb {MODE} {
global VPIG
global APP_GEN_G
set W_L $VPIG(WPLUGIN_FRAME).w_app_gen_license
set W_F $W_L.f
set W_LSF $W_F.sf
set W_LSFB $W_LSF.b
set W_LSFE $W_LSF.e
set W_LD $W_F.d
set W_LBF $W_F.bf
if { $MODE == "Standard" && $APP_GEN_G(INSTALL_TYPE) != "full" } {
return "undone"
}
set DEST_PATH [string trim $APP_GEN_G(DEST_PATH)]
if { [string length $APP_GEN_G(DONGLE)] == 0 } {
set APP_GEN_G(DONGLE) [get_dongle_id]
if { [string length $APP_GEN_G(DONGLE)] == 0 } {
return "error"
}
}
set APP_GEN_G(LICENSE_DEST_PATH) \
[file join $DEST_PATH share license N$APP_GEN_G(DONGLE)]
set DEST_DIR_PATH [file dirname $APP_GEN_G(LICENSE_DEST_PATH)]
if [catch {file mkdir $DEST_DIR_PATH} RESPONSE] {
tku_popup_message error ok $RESPONSE
return "error"
}
if { ! [file writable $DEST_DIR_PATH] } {
tku_popup_message error ok \
[format "Destination directory is not writable\n%s" $DEST_DIR_PATH]
return "error"
}
if { [winfo exists $W_L] } {
destroy $W_L
}
toplevel $W_L
wm title $W_L "License Entry Window"
frame $W_F -bg $VPIG(C_BG)
frame $W_LSF -bg $VPIG(C_BG)
button $W_LSFB -bg [c_yellow] -font [cbr14] \
-text "Source License File" \
-command [list license_source_cb $W_LSFB]
entry $W_LSFE -bg [c_yellow] -font [cbr14] \
-textvariable APP_GEN_G(LICENSE_PATH) -width 60
pack $W_LSFB $W_LSFE -side top
set DEST_LABEL \
"\nDongle ID : $APP_GEN_G(DONGLE)\
\nDestination : $APP_GEN_G(LICENSE_DEST_PATH)"
label $W_LD -bg $VPIG(C_BG) -relief groove -bd 3 -font [cbr14] \
-justify left -text $DEST_LABEL
frame $W_LBF -bg $VPIG(C_BG)
button $W_LBF.view -text "View" -bg [c_aqua] -font [cbr14] \
-command [list license_view_cb $W_L]
button $W_LBF.install -text "Install" -bg [c_aqua] -font [cbr14] \
-command [list license_install_cb $W_L]
button $W_LBF.cancel -text "Cancel" -bg [c_aqua] -font [cbr14] \
-command [list license_cancel_cb $W_L]
pack $W_LBF.view $W_LBF.install $W_LBF.cancel -side left -expand 1 -pady 5
pack $W_LSF $W_LD $W_LBF -side top -expand 1 -fill x
pack $W_F -fill x
set APP_GEN_G(LICENSE_STATUS) 1
wm transient $W_L $VPIG(WPLUGIN_FRAME)
tku_center_on_window . $W_L
wm deiconify $W_L
grab set $W_L
vwait APP_GEN_G(LICENSE_STATUS)
grab release $W_L
return $APP_GEN_G(LICENSE_STATUS)
}
proc license_source_cb {W} {
global VPIG
global APP_GEN_G
set PATH [tk_getOpenFile -parent $W \
-initialdir [tclu_get_dir_for_file $APP_GEN_G(LICENSE_PATH)]]
if { [string length $PATH] > 0 } {
set APP_GEN_G(LICENSE_PATH) $PATH
}
}
proc license_view_cb {W} {
global VPIG
global APP_GEN_G
set PATH $APP_GEN_G(LICENSE_PATH)
if { ! [tclu_is_path_file $PATH] } {
tku_popup_message error ok \
"The path $PATH \
\nis not a file"
}
tku_popup_message info ok "License file: $PATH" $PATH
return
}
proc license_install_cb {W} {
global VPIG
global APP_GEN_G
set PATH $APP_GEN_G(LICENSE_PATH)
set STATUS [verify_license_file_app_gen $PATH]
if { $STATUS != "ok" } {
set APP_GEN_G(LICENSE_STATUS) $STATUS
grab release $W
destroy $W
return
}
set DEST_PATH $APP_GEN_G(LICENSE_DEST_PATH)
if { [file exists $DEST_PATH] } {
set BAK_PATH [tclu_get_bak_name $DEST_PATH]
if { [catch {file rename $DEST_PATH $BAK_PATH} MESSAGE] } {
tku_popup_message error ok $MESSAGE
set APP_GEN_G(LICENSE_STATUS) error
return
}
}
if { [catch {file copy $PATH $DEST_PATH} MESSAGE] } {
tku_popup_message error ok $MESSAGE
set APP_GEN_G(LICENSE_STATUS) error
return
}
set APP_GEN_G(LICENSE_STATUS) ok
grab release $W
destroy $W
return
}
proc verify_license_file_app_gen {PATH} {
global VPIG
global APP_GEN_G
set PATTERN "% Dongle : $APP_GEN_G(DONGLE)"
set STATUS [tclu_find_str_in_file $PATH $PATTERN "" 100]
if { $STATUS == -1 || $STATUS == 0 } {
tku_popup_message error ok \
[format "The file %s\
\ndoes not contain the line\n%s\
\nIt is therefore not the correct license file." \
$PATH, $PATTERN]
return "error"
}
return "ok"
}
proc license_cancel_cb {W} {
global VPIG
global APP_GEN_G
grab release $W
destroy $W
set APP_GEN_G(LICENSE_STATUS) cancel
return
}
proc get_dongle_id {} {
global VPIG
global APP_GEN_G
set DONGLE_ID ""
set DIR $APP_GEN_G(DEST_PATH)
set VER_NUM [get_version_number $VPIG(NAME_VERSION)]
set EDIR_LOCATION [get_edir_location $DIR]
set GENESIS_EDIR [file join $EDIR_LOCATION e$VER_NUM]
set DONGLE_INFO_PATH [file join $GENESIS_EDIR misc]
if {$VPIG(OS) == "nt"} {
set DONGLE_INFO_EXE "dongle_info.exe"
} else {
set DONGLE_INFO_EXE "dongle_info"
}
set DONGLE_INFO [file join $DONGLE_INFO_PATH $DONGLE_INFO_EXE]
set TMP_PATH [tclu_get_tmp_name vpi_dongle]
set TITLE "Searching for hardware key (dongle)..."
set COMMAND [format "%s |& %s bs=1000000 of=%s" \
$DONGLE_INFO \
$VPIG(DD) \
$TMP_PATH]
set STATUS [tku_long_command $COMMAND $TITLE "" \
ignore ""]
if { $STATUS != "ok" } {
tku_popup_message error ok \
[format "%s/n%s" \
"Failed to retrieve the dongle id." \
"Check log file for errors"]
return ""
}
if { [catch {open $TMP_PATH RDONLY} FP] } {
tku_popup_message error ok \
"The command $DONGLE_INFO\
\nproduced no output"
} else {
set DONGLE_DATA [read $FP]
close $FP
foreach WORD $DONGLE_DATA {
if [string match ????-????-????-???? $WORD] {
set DONGLE_ID $WORD
break
}
}
}
if { [string length $DONGLE_ID] == 0 } {
tku_popup_message error ok \
"The command $DONGLE_INFO\
\nproduced the following errors :" $TMP_PATH
}
catch { file delete $TMP_PATH }
return $DONGLE_ID
}
################ Info Section - USERS ###########################
set APP_GEN_G(USERS_INFO) "
Actions performed during the 'Set users/groups' stage:
- The operator fills in a form with the user name and the group
of the system administrator user
- The system creates a skeleton users and groups file inside the
directory \$GENESIS_DIR/share
- If the users and/or group file already exist, they will NOT be
overwritten. Manual instructions are provided in such a case.
"
#####################################################################
proc app_gen_users_cb {MODE} {
global VPIG
global APP_GEN_G
set W_L $VPIG(WPLUGIN_FRAME).w_app_gen_users
set W_F $W_L.f
set W_FL $W_F.l
set W_FU $W_F.u
set W_FP $W_F.p
set W_FG $W_F.g
set W_LBF $W_F.bf
if { $MODE == "Standard" && $APP_GEN_G(INSTALL_TYPE) != "full" } {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -