📄 install.tcl
字号:
## RETURNS: N/A## ERRORS: N/A#proc uninstStop {} { global setupVals if {"$setupVals(uninstLog)" > "0"} { uninstBinCopy if {[windHostTypeGet] == "x86-win32"} { uninstallSetup queueExecute } uninstFileClose if [file exists $setupVals(uninstFile)] { catch {setupUnzip -o -qq $setupVals(uninstFile) \ -d [tempDirGet] "install*"} } fileAppend [tempDirGet]/installFile.tmp [tempDirGet]/installFile fileAppend [tempDirGet]/installResource.tmp [tempDirGet]/installResource fileAppend [tempDirGet]/installBackup.tmp [tempDirGet]/installBackup fileAppend [tempDirGet]/installInfo.tmp [tempDirGet]/installInfo fileAppend [tempDirGet]/setup.log.tmp [destDirGet]/setup.log cd [tempDirGet] if [catch {exec ZIP $setupVals(uninstFile) -g -q -1 -m \ "installFile" "installInfo" "installBackup"\ "installResource"} error] { puts "$error" } } { uninstFileClose }}################################################################################ fileAppend - appends the content of the source to the destination file.## This procedure takes the content of the source file and appends it to the# destination file.## SYNOPSIS# fileAppend <srcFilePath> <destFilePath>## PARAMETERS: # srcFilePath : a path to the source filename# destFilePath : a path to the destination filename## RETURNS: N/A## ERRORS: N/A#proc fileAppend {srcFilePath destFilePath} { global setupVals set ftmp [open $srcFilePath "r"] set f [open $destFilePath "a+"] while {[gets $ftmp line] != "-1"} { puts $f $line } close $ftmp close $f}################################################################################ uninstLog - stores the specified string into the appropriate disk file.## SYNOPSIS# uninstLog <key> <string>## PARAMETERS: # key : a string that long enough to differentiate between disk filenames,# <r>esource, <b>ackup, <f>ileNew, <i>nfo, <s>etupLog# string : string to be stored.## RETURNS: N/A## ERRORS: N/A#set setupVals(uninstLog) 0proc uninstLog {key string} { global setupVals uninstFileOpen if [catch { switch -glob $key { r* { puts $setupVals(fInstallResource) $string incr setupVals(uninstLog) } b* { puts $setupVals(fInstallBackup) $string incr setupVals(uninstLog) } f* { puts $setupVals(fInstallFile) $string incr setupVals(uninstLog) } i* { puts $setupVals(fInstallInfo) $string } s* { puts $setupVals(fSetupLog) "[installDate]\t$string" } default { puts "uninstLog error: $key not match" } } } error] { puts "cannot record \"$string\": $error" } }################################################################################ installDate - forms a simple date string ## SYNOPSIS# installDate## PARAMETERS: N/A## RETURNS: a date string (i.e, 08-Apr-97.18:30)## ERRORS: N/A#proc installDate {} { return [clock format [clock second] -format "%d-%b-%y.%H:%M"]}################################################################################ filesCopy - copies all the selected product files into the user destination# directory.## This routine walks thru each selected product, and do the following actions:## - runs the preInstall.tcl if any# - creates a record to the setup.log# - obtains a list of sub-products, and do the following actions:## + calls setupFileSetMake to build the sub-product filelist# + calls setupFileExtract to extract each file from the filelist. # An internal pointer is advanced until it hits the end of the list.# The setupFileExtract function returns one of the following messages:## Message Next actions # ------- ------------# OK - creates uninstall record, advances file pointer.# EXIST_AND_SAME - skips this file# EXIST_AND_NEWER - backup the original file, and extracts this file # again# EXIST_AND_OLDER - same as above# MULTIPLE_VERSION - keeps the newer version of the file, backup the # original if it's older.# NOT_FOUND - queries for retry until user gives up.# ZIP_ERROR - logs the error message into the setup.log# MEMORY_LOW - queries user for continue or not.# NO_ZIP_FILE - queries for retry until user gives up.# BAD_PARAM - logs the error message into the setup.log# DISK_FULL - queries user for continue or not.# UNEXPECT_EOF - logs the error message into the setup.log# END_OF_LIST - continues w/ the next sub-product.## - runs the postInstall.tcl if any# ## SYNOPSIS# filesCopy## PARAMETERS: N/A## RETURNS: N/A## ERRORS: N/A#proc filesCopy {} { global setupVals cd [destDirGet] set setupVals(cancel) 0 set totalFiles [cdInfoGet totalFile] set desc "Unknown component" set i 0 uninstLog setup "[cdInfoGet number]\t$setupVals(version)" foreach prodIndex [cdInfoGet selectedProdIndexList] { currentIndexSet $prodIndex # Remove objects from vxworks directory set saveDir [pwd] cd "[destDirGet]/target/lib" if {[windHostTypeGet] == "x86-win32"} { set rmTool "[destDirGet]/host/[windHostTypeGet]/bin/rm" set rmTool [dosToUnix $rmTool] } set objsToRemove "u_cset.o u_ctype.o u_stdio.o u_stdlib.o u_string.o u_unistd.o z_all.o z_app.o z_bmap.o z_bmap1.o z_bnum.o z_bnum1.o z_bnum2.o z_border.o z_button.o z_combo.o z_cset.o z_cset1.o z_ctype.o z_data.o z_data1.o z_data2.o z_date.o z_date1.o z_device.o z_dlgwin.o z_dskfil.o z_dsp.o z_error.o z_error1.o z_event.o z_event1.o z_evtmgr.o z_fdata.o z_fdata1.o z_fdata2.o z_fildlg.o z_file.o z_file1.o z_fmtstr.o z_gmgr.o z_gmgr1.o z_gmgr2.o z_gmgr3.o z_gmgr4.o z_group.o z_help.o z_help1.o z_hlist.o z_htips.o z_i18n.o z_icon.o z_icon1.o z_idata.o z_image.o z_int.o z_int1.o z_lang.o z_lang1.o z_list.o z_list1.o z_listen.o z_loc.o z_max.o z_mdiwin.o z_min.o z_mouse.o z_msgwin.o z_mvlst.o z_notebk.o z_notify.o z_pal.o z_plldn.o z_plldn1.o z_popup.o z_popup1.o z_prgrss.o z_print.o z_printf.o z_prntf1.o z_prompt.o z_prst.o z_prst1.o z_prst2.o z_prst3.o z_real.o z_real1.o z_region.o z_repstr.o z_scanf.o z_sclwin.o z_scrll.o z_scrll1.o z_spin.o z_split.o z_status.o z_stdarg.o z_stdio.o z_stdlib.o z_store.o z_store1.o z_str.o z_str1.o z_str2.o z_stredt.o z_string.o z_sys.o z_system.o z_table.o z_table1.o z_table2.o z_tbar.o z_text.o z_time.o z_time1.o z_timer.o z_title.o z_tree.o z_tree1.o z_unistd.o z_utils.o z_utils1.o z_utils2.o z_utime.o z_utime1.o z_vlist.o z_window.o z_window1.o z_winmgr.o z_winobj.o i_border.o i_button.o i_close.o i_combo.o i_cursor.o i_dsp.o i_error1.o i_fildlg.o i_fmtstr.o i_group.o i_hlist.o i_htips.o i_i18n.o i_icon.o i_loc.o i_max.o i_mdiwin.o i_min.o i_mouse.o i_notebk.o i_plldn.o i_plldn1.o i_popup.o i_popup1.o i_print.o i_prompt.o i_sclwin.o i_scrll.o i_spin.o i_status.o i_str.o i_sys.o i_table.o i_table1.o i_table2.o i_tbar.o i_text.o i_title.o i_tree.o i_tree1.o i_ugldsp.o i_vlist.o i_window.o i_winmg1.o i_winmgr.o i_winobj.o v_dskfil.o v_error.o v_evtmgr.o v_idata.o v_image.o v_keybrd.o v_mouse.o v_osevt.o v_print.o v_sem.o v_sim.o v_system.o v_timer.o" if {[catch {set objDirList [glob obj*vx]}] == 0} { foreach element $objDirList { cd $element set curDir [pwd] puts "Removing Zinc 6.0 objects from $curDir" foreach element1 $objsToRemove { if {[file exists $element1]} { if {[windHostTypeGet] == "x86-win32"} { if {[catch "exec $rmTool $element1" error]} { puts "Error: couldn't remove $element1: $errArchive" } } else { if {[catch "exec rm -f $element1" error]} { puts "Error: couldn't remove $element1: $errArchive" } } } } cd .. } } else { puts "No vxworks object directories to clean up: OK" } cd "[destDirGet]/target/lib" if {[catch {set objDirList [glob obj*Ugl]}] == 0} { foreach element $objDirList { cd $element set curDir [pwd] puts "Removing Zinc 6.0 objects from $curDir" foreach element1 $objsToRemove { if {[file exists $element1]} { if {[windHostTypeGet] == "x86-win32"} { if {[catch "exec $rmTool $element1" error]} { puts "Error: couldn't remove $element1: $errArchive" } } else { if {[catch "exec rm -f $element1" error]} { puts "Error: couldn't remove $element1: $errArchive" } } } } cd .. } } else { puts "No Zinc object directories to clean up: OK" } cd $saveDir # Do preinstall if any execute [productInfoGet name $prodIndex]/preInstall.tcl # Append install info to the setup.log set prodNum [productInfoGet number $prodIndex] set desc [productInfoGet desc $prodIndex] uninstLog setup "$prodNum\t$desc" # Append info to the uninstall record uninstLog info "$desc" # Begin the copy loop set prevFileName "" foreach partIndex [productInfoGet selectedPartIndexList $prodIndex] { set partDesc [partInfoGet desc $partIndex] if [catch {setupFileSetMake $partIndex} error] { uninstLog setup "\tskip installing $partDesc: $error" if [debug] { puts "unable to install $partDesc: $error" } lastErrorSet "$error" continue } elseif {[debug]} { puts "Installing [productInfoGet desc $prodIndex] -> $partDesc" } while { 1 } { if {$setupVals(cancel) == 1} {return} set fileName [setupFileNameGet 0] # update meter set percent [expr $i * 100 / $totalFiles] meterUpdate $percent $fileName bbrdUpdate $percent set f [destDirGet]/$fileName catch {setupFileExtract} retVal if [debug] { puts [format "%20s\t%s" $retVal $fileName] } switch $retVal { OK { uninstLog file "wind_base\t$fileName" # Build archList for later updating the archirve. archListPut $fileName $prodIndex setupFileNext } EXIST_AND_SAME { # Workaround the problem that the base product is # reinstalled, and messup the libraries. archListPut $fileName $prodIndex setupFileNext } EXIST_AND_NEWER - EXIST_AND_OLDER { backup $fileName if {[fileRemove $f] == "IGNORE"} { setupFileNext } } MULTIPLE_VERSION { # Setup detected that the file being install has more # than one versions on the CD-ROM. if ![file exists $f._${prodIndex}_] { uninstLog setup "\t$f._${prodIndex}_: not exist" setupFileNext continue } if [file exists $f] { if {[file mtime $f] >= [file mtime $f._${prodIndex}_]} { set retVal [fileRemove $f._${prodIndex}_] if {"$retVal" == "RETRY"} { continue } elseif {"$retVal" == "IGNORE"} { setupFileNext continue } } else { backup $fileName set retVal [fileRemove $f] if {"$retVal" == "RETRY"} { continue } elseif {"$retVal" == "IGNORE"} { setupFileNext continue } file rename $f._${prodIndex}_ $f } } { uninstLog file "wind_base\t$fileName" file rename $f._${prodIndex}_ $f } # Build archList for later updating the archirve. archListPut $fileName $prodIndex setupFileNext } NOT_FOUND { set msg [strTableGet 1380_DEFLATE_ERROR] set logMsg "\terror: can not copy $fileName: not found" switch [dialog re_ig_cancel "Setup" $msg question 0] { 0 {continue} 1 { lastErrorSet $logMsg uninstLog setup $logMsg setupFileNext } default {quitCallback} } } ZIP_ERROR { set logMsg "\terror: can not copy $fileName: zip error" lastErrorSet $logMsg uninstLog setup $logMsg setupFileNext } MEMORY_LOW {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -