⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 install.tcl

📁 windml3.0.3
💻 TCL
📖 第 1 页 / 共 4 页
字号:
# install.tcl - Installation program for Unix/Windows platforms.
#
# Copyright 1984-1997 Wind River Systems, Inc
#
# Modification history
# --------------------
# 03b,05mar02,bwd  Modified SETUP to be non-tornado centric
# 03a,12jun01,j_w  Modified for Tornado 2.2
# 05w,30oct00,j_w  SPR 35775: skip the zip file not found error checking
#                  and set WIND_BASE correctly if running setup /L from the 
#                  installed tree (spr 35775, 35778)
# 05v,13oct00,bwd  setupSDK: modified cdNameGet to check for and allow
#                  CDdescription containing quotes.
# 05u,26jun00,bwd  Initialized CD description from setup.log when not running
#                  SETUP from CD image
# 05t,23jun00,bwd  SPR 31612: initialize CD information using setup.log when
#                  lauching SETUP due to LM errors
# 05s,08jun00,j_w  Backup files one at a time instead of queuing up 32 files
#                  before backing up - SPR 31184
# 05r,02jun00,bwd  Changed all "dialog ok" to use "dialog ok_with_title"
# 05q,08may00,bwd  Fixed SPR 31061. Added "catch" when flushing fSetupLog to
#                  Temp directory (in uninstLog procedure) in case Temp
#                  directory is full
# 05p,02feb00,bwd  Modified codes to log messages in autoSetupLog file and not
#                  display messageBox for test automation
# 05o,17dec99,clc  Add path to ZIP invocation.
# 05n,28oct99,bjl  added disk space check in backup procedures. 
# 05m,19oct99,j_w  Fixed uninstHome to use unix path format. This fixed the
#                  uninstall problem if Tornado is installed 2 directories deep
# 05l,18oct99,bjl  prepend cd directory to ZIP path for backup.
# 05k,14oct99,j_w  Add paramenters to uninstStop
# 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
    global backupFileArraySize
    global setupVals

    if {![info exists setupVals(cancelBackup)]} {
        set setupVals(cancelBackup) 0
    } else {
        if {$setupVals(cancelBackup) == 1} {
            return
        }
    }

    if {![info exists backupFileArraySize]} {
        set backupFileArraySize 0
    }

    set fileSize [file size [destDirGet]/$fileName]

    # file size returns the value in bytes.  Change this
    # to kbytes, since setupDiskSpaceGet or fspace returns its
    # value in kbytes (used in backupFileQueueFlush).  

    set fileSize [expr $fileSize / 1024]

    set backupFileArraySize [expr $backupFileArraySize + $fileSize] 


    # 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) ""

        # backup the file each time
        backupFileQueueFlush
        
        #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 
    global setupVals
    global backupFileArraySize
    global diskSpace
   
    # simply return if the user chose to skip backups.

    if {![info exists setupVals(cancelBackup)]} {
        set setupVals(cancelBackup) 0
    } else {
        if {$setupVals(cancelBackup) == 1} {
            return
        }
    }

    if {![info exists backupFileArraySize]} {
        set backupFileArraySize 0
    }

    # check for available disk space.

    if {[isUnix]} {
        set diskSpace [fspace [destDirGet]]
    } else {
        set diskSpace [setupDiskSpaceGet [destDirGet]]
    }

    # allow some extra temp space for the zip file.

    set spaceRequired [expr 2 * $backupFileArraySize]

    set msg [strTableGet BACKUP_DISK_FULL_WARN]

    # pop up a dialog box if not enough space available
    # to perform the backup.

    while {$spaceRequired > $diskSpace && \
           $setupVals(cancelBackup) != 1} {
        switch [dialog ok_cancel "Setup" $msg question 0] {
            0 {
                # user freed some space.  Check to make sure
                # enough space is now available.

                if {[isUnix]} {
                    set diskSpace [fspace [destDirGet]]
                } else {
                    set diskSpace [setupDiskSpaceGet [destDirGet]]
                }
            }
            1 {
                # user chooses to cancel backups due to lack of
                # disk space.

                set setupVals(cancelBackup) 1
            }
        }
    }
   
    if {$setupVals(cancelBackup) == 1} {
        return
    }
 
    set backupFileArraySize 0

    if [array exists backupFileQueue] {

        set saveDir [pwd]
        cd [destDirGet]

        set backupList [join [array names backupFileQueue]]
        set setupVals(uninstFile) [dosToUnix $setupVals(uninstFile)]
        set cmd "exec [file join [cdromBinDirGet] 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]}
    }

    set uninstHome [dosToUnix [uninstHomeDirGet]]

    if {"$type" == "license"} {
        set setupVals(uninstFile) "$uninstHome/data.001"
    } else {
        set setupVals(uninstFile) \
            "$uninstHome/data.[format "%03d" [expr 1 + \
             [llength [glob -nocomplain $uninstHome/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
#

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -