📄 install.tcl
字号:
# install.tcl - Installation program for Unix/Windows platforms.## Copyright 1984-1997 Wind River Systems, Inc## Modification history# --------------------# 05j,19mar99,wmd Output to a file any debug messages.# 05i,03mar99,tcy create installCDnumber file in data.XXX for About-Box usage# 05h,01feb99,tcy moved most procedures to wizard files# 05g,30jan99,bjl added setExecutePermissions procedure for Unix.# 05f,27jan99,tcy moved fileNameAbbreviate() to INCLUDE.TCL# 05e,27jan99,wmd Need to remove the continue statements in the new proc# processInstall.# 05d,21jan99,wmd Need to remove comment line after uninstallInitWin32# invocation, causing problems.# 05c,13jan99,wmd Update the file using WRS coding conventions.# 05b,15dec98,tcy copy UNINST and SETUP to bin and user setup directories# respectively# 05a,03dec98,tcy do not copy setup engine files to bin directory# 04z,25nov98,tcy added kbyteToMyte () to calculate disk space on Windows# 04y,24nov98,tcy removed "/" from rawfile variable in setupCopy# for all hosts# 04x,20nov98,bjl return from setupCopy if user chooses to exit Setup.# 04w,19nov98,wmd display path/filename in a shorthand form if it's too long.# 04v,19nov98,tcy remove forward slash so file join could work on UNIX# 04u,12nov98,tcy fixed regsub expression to correctly copy SETUP files# 04t,11nov98,tcy use floating point to calculate part size# 04s,11nov98,wmd reinitialize setupVals(drvIndex) after resetting it.# 04r,10nov98,tcy do not copy files to temp directory before backing up# (fix for SPR 23131)# 04q,07nov98,tcy used setupClusterSizeGet() to get correct cluster size# on Windows and added rootDirGet() (fix for SPR 22931)# 04o,07nov98,wmd need to make setupVals(drvIndex) and array of indices.# 04n,05nov98,tcy added CD manufacturing time to setup.log (fix for SPR 22930)# 04m,29oct98,tcy fixed backup bug which removes backup files from installation# 04l,25oct98,tcy backup files in groups rather than one at a time# 04k,22oct98,bjl changed removeBackground check back to limitColors for bbrd. # 04j,21oct98,tcy fixed librariesUpdate() to correctly update the meter# 04i,21oct98,wmd fixed bad english for non-existing file in MULTIPLE_VERSION.# 04h,20oct98,wmd make setupVals(tornadoIndex) a list of indices.# 04g,19oct98,bjl changed limitColors check to removeBackground for bbrd.# 04f,16oct98,wmd set setupVals(driverIndex) for the driver product.# 04e,09oct98,bjl do not update billboards in filesCopy if color limiting # is set.# 04d,07oct98,bjl cd out of tempdir in uninstStop so that tempdir can be# removed when setup exists, added queueExecute to uninstStop # for Unix machines.# 04c,07oct98,tcy fixed "overwritten" sentence in setup.log# 04b,06oct98,tcy added CD description to DISK_ID# 04a,30sep98,tcy fixed bmp path on UNIX and fixed env(PATH)# 03z,30sep98,tcy change text to "Preparing to copy files ..."# 03y,30sep98,tcy fix hang on UNINST and adjust uninstBinCopy for unix UNINST# 03x,25sep98,bjl flush setup.log.tmp to [destDirGet]/setup.log.abort.# 03w,25sep98,tcy overwrite windows system files even for same file versions# 03v,17sep98,bjl set setupVals(diskfull) if user exits when disk is full.# 03u,14sep98,tcy added setupVals(confirmation) for showing list of products# 03t,11sep98,tcy added checkVersion option to fileDup()# 03s,08sep98,tcy DISK_ID is not copied to user's SETUP directory now# 03r,03sep98,bjl changed setupVals(regHost) to setupVals(registry) for# Unix torVarsCreate.# 03q,01sep98,wmd changed "fixing up filenames" to "resolving version..."# 03p,01sep98,tcy fixed librariesUpdate() to remove relative paths from archive# 03o,25aug98,tcy fixed listDir() to use glob instead of cmd.exe# 03n,20aug98,wmd modify to add write out of destination dir to setup.log.# 03m,17aug98,j_w modified filesCopy() for automated installation# 03l,14aug98,tcy SETUP copied onto user's $WIND_BASE/SETUP directory# 03k,04aug98,tcy fixed meter in libariesUpdate()# 03j,04aug98,bjl fixed overwritten typo.# 03i,04aug98,bjl added ability to install product last through inf file.# 03h,31jul98,wmd added coreProd as flag to fetch for prodObj.# 03g,30jul98,bjl added inf file processing of arflags. # 03f,29jul98,wmd added messageBeep to create audio warning for overwrite case.# 03e,27jul98,wmd added default case for EXIST_AND_NEWER, EXIST_AND_OLDER.# 03d,24jul98,wmd set current_file global val in filesCopy.# 03c,23jul98,tcy added CDnumberGet()# 03b,23jul98,wmd add dialog to get user policy on overwriting of files.# Also added fix for SPR #21090.# 03a,21jul98,tcy archive objects by AR flags and library archives# 02v,17mar98,pdn fixed MULTIPLE_VERSION logic to conform to the design spec.# 02u,02mar98,pdn moved the feature Id/Desc from part to product level.# 02t,14nov97,pdn added a list of overwriten files to the setup.log# 02s,12aug97,pdn moved version string to VERSION.TCL# 02r,04aug97,pdn merged fixed from qms1_0_x branch.# 02q,20jun97,pdn allowed native $(AR), and $(RANLIB) to be defined.# 02p,13jun97,pdn changed to use setup APIs as a DLL.# 02o,19may97,pdn fixed fileNameAbbreviate() to handle the case that regexp# fails to match.# 02n,02may97,pdn added comments.# 02m,08apr97,pdn fixed fileDup() to handle file permission accordingly# 02l,28mar97,pdn added code to support correct uninstall# 02k,10mar97,pdn fixed library update routine.# 02j,08mar97,tcy undo last mod# 02i,07mar97,tcy moved needUpdateWlmd() from INSTTK.TCL to here# 02h,07mar97,pdn fixed uninstStart to allow patch uninstallation.# 02g,05mar97,pdn sorted the product list.# 02f,04mar97,pdn copy ZIP utility to bin directory.# added hook for patch installation.# 02e,25feb97,pdn added function byteToMbyte()# 02d,24feb97,pdn modified fileDup() to allow update/overwrite.# 02c,09feb97,pdn fixed cdInfoGet to return correct selected feature Id list# 02b,04feb97,pdn fixed library updating problem.# 02a,24jan97,pdn rounded up the product size upto 0.1 MB where needed# 01z,24jan97,pdn returned to the calling function when user hit cancel# 01y,22jan97,pdn fixed the ar so that console windows in Windows 95 won't # show up.# 01x,21jan97,pdn fixed fileDup(), and execute().# 01w,20jan97,pdn fixed replicated feature id/name, better error hanlding# 01v,14jan97,pdn updated uninstBinCopy() to support Windows, fixed indentation# 01u,07jan97,pdn updated the pre/post install# implemented billboard cycling from product dir# 01t,18dec96,sks changed location of TCL and BITMAP files; renamed# TEXT.TCL to MESSAGES.TCL # 01s,13dec96,pdn updated postInstall()# 01r,12dec96,pdn added productName to the productObj# 01r,11dec96,pdn fixed cdInfoGet and productInfoGet to return correct# featureId list# 01q,09dec96,pdn added hierachy selection option# 01p,23nov96,sj incorporated post and presinstall mechanisms# 01o,18nov96,sj caught user removing CDROM when files are being # copied over and included the check for backuped# files into backup().# 01m,11nov96,pdn centralized all strings to TEXT.TCL # 01l,08nov96,pdn backup newer files in the same manner as older files.# 01k,06nov96,pdn added retry option for fileDup()# 01j,05nov96,pdn fixed the uninstall logging# 01i,24oct96,pdn added uninstLog()# 01h,21oct96,pdn added pageRemove()# 01g,18oct96,pdn updated uninstStart() to use new uninst dir, and added# uninstBinCopy()# 01f,01oct96,tcy moved umaskGet(), umaskSet(), getSelection() here # 01e,29aug96,pdn allowed non-tk specific installation# 01d,27aug96,pdn handle messages return from zip.# 01c,02jul96,pdn added directory creation, and implement lib update.# 01b,25jun96,pdn modified the GUI to meet the specification.# 01a,11jun96,jco translated to tk from the uitcl/Windows.################################################################################# backup - save the specified file into a zip file.## This procedure stores files in a queue and invokes backupFileQueueFlush()# to zip files in the queue. If the file is previously backed up, # nothing will be done.## SYNOPSIS# backup <fileName>## PARAMETERS:# fileName : a path filename## RETURNS: N/A## ERRORS: N/A#proc backup {fileName} { global backupFileQueue global backupFileArray # backupFileArray contains all files that have been backed up so far if ![info exists backupFileArray($fileName)] { # only interested in the existence of the array element, # not the content set backupFileQueue($fileName) "" set backupFileArray($fileName) "" if {[array size backupFileQueue] > 32} { backupFileQueueFlush } }}################################################################################ backupFileQueueFlush - zip all files in the file queue## This procedure zips the specified file into a zip file. ## SYNOPSIS# backupFileQueueFlush <fileName>## PARAMETERS: N/A## RETURNS: N/A## ERRORS: N/A#proc backupFileQueueFlush {} { global backupFileQueue setupVals if [array exists backupFileQueue] { set saveDir [pwd] cd [destDirGet] set backupList [join [array names backupFileQueue]] set setupVals(uninstFile) [dosToUnix $setupVals(uninstFile)] set cmd "exec ZIP $setupVals(uninstFile) -g -q -1 $backupList" if [catch {eval $cmd} error] { dbgputs "warning: backup fails with : $error" dbgputs "backupList = $backupList" } else { foreach file [array names backupFileQueue] { dbgputs [format "%20s\t%s" BACKED_UP $file] uninstLog backup "wind_base\t$file" } } # clean up queue unset backupFileQueue cd $saveDir }}################################################################################ uninstStart - obtains a zip filename## This procedure obtains a zip filename for use in sub-sequence calls to zip,# creates $WIND_BASE/.wind/uninst if not exist. Must be called prior any zip # function call.## SYNOPSIS# uninstStart [type]## PARAMETERS: # [type] : if 'license' is specified, zip filename w/ extension 001 returns.## RETURNS: zip filename.## ERRORS: N/A#proc uninstStart {{type Software}} { global setupVals uninstHomeDirSet [destDirGet]/.wind/uninst if ![file isdirectory [uninstHomeDirGet]] { catch {file mkdir [uninstHomeDirGet]} } if {"$type" == "license"} { set setupVals(uninstFile) "[uninstHomeDirGet]/data.001" } else { set setupVals(uninstFile) \ "[uninstHomeDirGet]/data.[format "%03d" [expr 1 + \ [llength [glob -nocomplain [uninstHomeDirGet]/data.*]]]]" }}################################################################################ uninstFileClose - close uninstall file descriptions.## This procedure closes uninstall file descriptions if they are still opened.## SYNOPSIS# uninstFileClose## PARAMETERS: N/A## RETURNS: N/A## ERRORS: N/A#proc uninstFileClose {} { global setupVals if {"$setupVals(uninstFileOpen)" == "opened"} { close $setupVals(fInstallFile) close $setupVals(fInstallInfo) close $setupVals(fInstallBackup) close $setupVals(fInstallResource) close $setupVals(fInstallCDnumber) puts $setupVals(fSetupLog) "" close $setupVals(fSetupLog) set setupVals(uninstFileOpen) closed }}################################################################################ uninstFileOpen - opens files for recording uninstall info.## This procedure opens disk files for writing the temporary uninstall records.# These files will be closed by calling uninstFileClose()## SYNOPSIS# uninstFileOpen## PARAMETERS: N/A## RETURNS: N/A## ERRORS: N/A#set setupVals(uninstFileOpen) ""proc uninstFileOpen {} { global setupVals if {"$setupVals(uninstFileOpen)" != "opened"} { set setupLog [tempDirGet]/setup.log.tmp set uninstFile [tempDirGet]/installFile.tmp set uninstResource [tempDirGet]/installResource.tmp set uninstCDnumber [tempDirGet]/installCDnumber.tmp set uninstBackup [tempDirGet]/installBackup.tmp set uninstInfo [tempDirGet]/installInfo.tmp set setupVals(fSetupLog) [open $setupLog "w"] set setupVals(fInstallFile) [open $uninstFile "w"] set setupVals(fInstallInfo) [open $uninstInfo "w"] set setupVals(fInstallBackup) [open $uninstBackup "w"] set setupVals(fInstallResource) [open $uninstResource "w"] set setupVals(fInstallCDnumber) [open $uninstCDnumber "w"] set setupVals(uninstFileOpen) opened }}################################################################################ uninstBinCopy - copies uninstall agent## This procedure copies neccessary files from CDROM to the destination # directory for the uninstall program to work. No-op if patch installation# is detected.## SYNOPSIS# uninstBinCopy## PARAMETERS: N/A## RETURNS: N/A## ERRORS: N/A#proc uninstBinCopy {} { global env if {[instTypeGet] == "patch"} { return } elseif {[windHostTypeGet] == "x86-win32"} { # all the required binary files are copied by setupCopy fileDup [file join [cdromRootDirGet] RESOURCE BITMAPS UNINST.BMP] \ [file join [uninstHomeDirGet] UNINST.BMP] update fileDup [file join [cdromRootDirGet] RESOURCE TCL UNINST.TCL] \ [file join [uninstHomeDirGet] UNINST.TCL] update fileDup [file join [cdromRootDirGet] RESOURCE TCL INCLUDE.TCL] \ [file join [uninstHomeDirGet] INCLUDE.TCL] update } else { # Other shared libraries are copied by the UNINST shell script # because those are untarred from MWUITCL.TAR set usrBinDir [file join [destDirGet] host [windHostTypeGet] bin] set usrSetupDir [file join [destDirGet] SETUP] set env(PATH) $usrBinDir:$env(PATH) fileDup [file join [cdromRootDirGet] RESOURCE TCL UNINST.TCL] \ [file join [uninstHomeDirGet] UNINST.TCL] update fileDup [file join [cdromRootDirGet] RESOURCE TCL INCLUDE.TCL] \ [file join [uninstHomeDirGet] INCLUDE.TCL] update fileDup [file join [cdromRootDirGet] RESOURCE BITMAPS/UNINST.BMP] \ [file join [uninstHomeDirGet] UNINST.BMP] update fileDup [file join [cdromRootDirGet] UNINST] \ [file join $usrBinDir UNINST] update fileDup [file join [cdromRootDirGet] SETUP] \ [file join $usrSetupDir SETUP] update fileDup [file join [cdromBinDirGet] ZIP] \ [file join $usrBinDir ZIP] update fileDup [file join [cdromBinDirGet] SETUPTCL[string toupper \ [info sharedlibextension]]] \ [file join $usrBinDir setuptcl[info sharedlibextension]] update }}################################################################################ uninstStop - wraps up the uninstall process.## This procedure copies uninstall agent, executes all queued commands, closes # all tempfiles, saves the temporary uninstall records into a zip file.## SYNOPSIS# uninstStop## PARAMETERS: N/A## RETURNS: N/A## ERRORS: N/A#proc uninstStop {} { global setupVals if {"$setupVals(uninstLog)" > "0"} { uninstBinCopy if {[windHostTypeGet] == "x86-win32"} { # For Windows hosts, create registry entries and uninstall icon # uninstallInitWin32 was previously called uninstallSetup uninstallInitWin32 queueExecute } else { queueExecute } uninstFileClose if [file exists $setupVals(uninstFile)] { catch {setupUnzip -o -qq $setupVals(uninstFile) \ -d [tempDirGet] "install*"} } fileAppend [file join [tempDirGet] installFile.tmp] \ [file join [tempDirGet] installFile] fileAppend [file join [tempDirGet] installResource.tmp] \ [file join [tempDirGet] installResource] fileAppend [file join [tempDirGet] installCDnumber.tmp] \ [file join [tempDirGet] installCDnumber] fileAppend [file join [tempDirGet] installBackup.tmp] \ [file join [tempDirGet] installBackup] fileAppend [file join [tempDirGet] installInfo.tmp] \ [file join [tempDirGet] installInfo] fileAppend [file join [tempDirGet] setup.log.tmp] \ [file join [destDirGet] setup.log]
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -