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

📄 app_gen.ins

📁 genesis 2000 v9.1软件下载
💻 INS
📖 第 1 页 / 共 5 页
字号:
######################################################################
#
#  Genesis Installation plug in
#
#  This plug-in is designed to work with Frontline Pro-Installer
#  -------------------------------------------------------------
#
#  Purposes : Install Full   Version - Installation from scratch
#             Install Update Version - New executables augmenting an existing
#                                      version
#             Install Fix    Version - New executables instead of an existing
#                                      version
#
# The plug in includes stages as detailed in the table  APP_GEN_G(STAGES)
#
# Stages can be performed in sequence during Standard install or selectively
# during Custom install.
#
#     First Version : Oct 26, 1997
#     3 Feb 2002 Ben - Support for VUV removed. Support for Linux added
#    13 Mar 2003 Yefim - Support for W2K added
#     7 Dec 2003 Yefim - Use dongle_info from Genesis (not from ProInstaller) 
#			 ( proc get_dongle_id instead of proc tclu_get_dongle )
#    16 Jan 2005 Yefim - To use for Genesis installation only
#    22 Dec 2005 Yefim - ATGen installation
#    17 Jan 2006 Yefim - GND startup file is used as a link (Linux only)
#
######################################################################
global VPIG
global APP_GEN_G
#
#  Global Variables
#
set APP_GEN_G(PLUGIN_NAME)   		"app_gen"
set APP_GEN_G(DEST_PATH)   		""
set APP_GEN_G(DEFAULTS_PATH)  		\
        [file join [tclu_get_home] .valor_install defaults.app_gen]
set APP_GEN_G(SAVED_DEFAULTS) 		\
         [list DEST_PATH MODE LICENSE_PATH]
set APP_GEN_G(TITLE)  			\
        "CAM之家官方网站\n www.camhome.cn\n 软件汉化:卖血上网\n QQ:36355572"
set APP_GEN_G(MODE)			"Standard"
set APP_GEN_G(WP_STAGES)      		""
set APP_GEN_G(LICENSE_PATH)   		[file join /tmp license]
set APP_GEN_G(LICENSE_STATUS) 		0
set APP_GEN_G(INSTALL_TYPE) 		"full"
set APP_GEN_G(SYSADMIN_USER_NAME)       ""
set APP_GEN_G(SYSADMIN_PASSWORD)        ""
set APP_GEN_G(SYSADMIN_GROUP_NAME)      ""
set APP_GEN_G(USER_STATUS)              ""
set APP_GEN_G(EDIR_LOCATION)            ""
set APP_GEN_G(SC_MODE)                  ""
set APP_GEN_G(INIT_CB)                  "app_gen_init"
set APP_GEN_G(DONGLE)                   ""
set APP_GEN_G(PRODUCT_NAME)             ""

######################################################################
proc app_gen_init { STAGE_INDEX } {
   global VPIG
   global APP_GEN_G

   if { $APP_GEN_G(SC_MODE) == "" } {
     set CHOICES [list 服务端 工作站]
     set CHOICE [tku_popup_message question $CHOICES \
        "请选择服务端或工作站"]
     if { $CHOICE == "工作站" } {
         set APP_GEN_G(SC_MODE) client	
         plugin.set_stage_onoff APP_GEN_G copy     off
         plugin.set_stage_onoff APP_GEN_G perms    off
#         plugin.set_stage_onoff APP_GEN_G license  off
         plugin.set_stage_onoff APP_GEN_G users    off
         plugin.set_stage_onoff APP_GEN_G database off
	 display_mount_message
	 set_edir_location_variable
     } else {
         set APP_GEN_G(SC_MODE) server
     }
   }
   return 0
}

#####################################################################
proc display_mount_message {} {
   global VPIG
   global APP_GEN_G

   set VER_NUM [get_version_number $VPIG(NAME_VERSION)]
   set DEST_MSG \
     "Please specify the directory on the server into which the\
    \nsoftware was installed."
   if {$VPIG(OS) == "nt"} {
      set DEST_MSG "$DEST_MSG\n\
	          \nThe destination directory should be mapped to a \
	          \ndrive letter using the 'Map Network Drive...' option\
	          \nof the 'Network Neighborhood' icon. The drive letter\
	          \nshould be given as a part of the path below."
   } else {
      set DEST_MSG "$DEST_MSG\n\
	          \nThe destination directory should be mounted\
	          \nusing the 'mount' command. the mount point should \
	          \nbe called the same as the destination directory. \
	          \nThis will allow the usage of the same environment\
	          \nvariables for all users."
   }

   set DEST_PATH $APP_GEN_G(DEST_PATH)

   tku_popup_message question ok $DEST_MSG  "" DEST_PATH

   if {! [tclu_is_path_dir $DEST_PATH] }  {
      tku_popup_message  error ok \
        "The directory $DEST_PATH does not exist"
   } else {
      set APP_GEN_G(DEST_PATH) $DEST_PATH
      plugin_save_defaults APP_GEN_G
   }
}

#####################################################################
proc set_edir_location_variable {} {
   global VPIG
   global APP_GEN_G

   set VER_NUM [get_version_number $VPIG(NAME_VERSION)]
   set EDIR_LOCATION_MSG \
     "Please specify the directory on the server in which the\
    \nexecutable tree (e$VER_NUM) for your platform is located.\
    \nThis option is needed for mixed-platform installation\
    \nwhere there are several executable trees.\
    \nIf you specify the path, DO NOT include in its tail e$VER_NUM!"
   set EDIR_LOCATION $APP_GEN_G(DEST_PATH)

   tku_popup_message question ok $EDIR_LOCATION_MSG  "" EDIR_LOCATION

   if {! [tclu_is_path_dir $EDIR_LOCATION] }  {
      tku_popup_message  error ok \
        "The directory $EDIR_LOCATION does not exist"
   } else {
      set APP_GEN_G(EDIR_LOCATION) $EDIR_LOCATION
   }
}


#####################################################################

######################################################################
#
#  The name of the callback routine is derived from the first member.
#      <product_name>_<stage>_cb
#  e.g. the 'copy' callback is 'app_gen_copy_cb'
#
#  The name of the information popup is derived from the first member,
#  and used as an index in the array.
#      <globals array>(INFO_<stage in uppercase>)
#  e.g. the 'copy' information screen is APP_GEN_G(INFO_COPY)
#

  set APP_GEN_G(STAGES) [list   \
			     copy	"复制程序文件   " \
			     perms	"设置文件属性 "	\
			     license	"此步一直往下点,出错不用理会! "	\
			     startup	"更新启动文件 "	\
			     users	"设置用户名和密码    "	\
			     database	"设置genesis数据库的安装位置"	\
			     kernel	"Update O.S. Kernel   "	\
			     check	"检查安装文件   "	\
			    ]

if { $VPIG(OS) == "nt" } {
   set KERNEL_INDEX [lsearch -exact $APP_GEN_G(STAGES) kernel]
   if {$KERNEL_INDEX != -1} {
      set APP_GEN_G(STAGES) \
         [lreplace $APP_GEN_G(STAGES) $KERNEL_INDEX [expr $KERNEL_INDEX + 1]]
   } else {
      tku_popup_message error ok "Kernel stage is missing from APP_GEN_G"
   }
   
}

################ Info Section - COPY ###########################

set APP_GEN_G(COPY_INFO) "
Actions performed during the 'Copy product files' stage:

This stage copies all the product files into the destination
directory.
The product data is kept as one file in tgz (tar gnu-zipped)
format. The copy process:

- Verifies the destination directory as follows:
  - If it does not exist - it will create one, after user confirmation
  - If it exists and empty, will install the full version into it
  - If it exists and non-empty:
    - If a previous version was installed in it, will install
      an update only - the executables.
      If the new executables are of the same version as the ones installed,
      the user will be given the option to copy the executables aside.
    - If no previous version was installed in it, will confirm the
      continuation with the user

- Checks the file(s) validity
- Unzips and untars the file into the proper destination directory
"
#####################################################################
proc app_gen_copy_cb {MODE} {
   global VPIG
   global APP_GEN_G

   set VER_NUM [get_version_number $VPIG(NAME_VERSION)]
   get_version_type $VPIG(NAME_VERSION) IS_FIX VTYPE FIX_ID PFIX_ID

   #
   # Sub dirs which cannot be overwritten
   set APP_GEN_SUB_DIRS_PROTECTED [list \
	share  fw 	hosts   sys ]
   set APP_GEN_SUB_DIRS_REQUIRED [list \
	hosts	 logs	 tmp    sys ]

   set ROOT_MODE error
   if { $MODE != "Standard" } {
      set ROOT_MODE warning
   }
   if { ! [tku_is_root $ROOT_MODE] } {
      return "error"
   }
  #
  #  Verify the correct O.S. is installed
  #
  set NAME_OS [string tolower $VPIG(NAME_OS)]
  if { $NAME_OS == "sol26" } { # Patch   -- Ben 23 May 2000
     set NAME_OS "solaris"
  }
  if { $NAME_OS == "w2k" } { # Yefim 13 Mar 2003
     set NAME_OS "nt"
  }
  if { $VPIG(OS) != $NAME_OS } {
     set CHOICE [tku_popup_message warning yesno \
	"You are trying to install a version for $NAME_OS\
       \non a workstation running $VPIG(OS).\
       \nContinue ?"]
     if { $CHOICE == "no" } {
	return "cancel"
     }
  }
  #
  #  Check for the existence of the data file (app_gen.tgz) which will
  #  be unzipped and untarred
  #
  set DATA_PATH [file join $VPIG(PRODUCT_PATH) $VPIG(NAME).tgz]
  if { ! [tclu_is_path_file $DATA_PATH] } {
      tku_popup_message error ok \
         [format "The data file to be installed does not exist.\
                \nFile=%s"  \
                 $DATA_PATH]
      return error	
  }
  set SIZE [tclu_get_gz_size $DATA_PATH]
  set CHOICE [tku_prompt_size $SIZE]
  if { $CHOICE != 1 } {
    return "cancel"
  }
  set SUM_PATH [file join $VPIG(PRODUCT_PATH) $VPIG(NAME).sum]
  set STATUS [tclu_check_sum_file $DATA_PATH $SUM_PATH]
  if { $STATUS != 0 } {
      tku_popup_message error ok \
         [format "The data file to be installed does not match the checksum\
	        \nfile (Sum or size). Data may have not been rerieved properly.\
                \nData File=%s\
		\nSum  File=%s"\
                 $DATA_PATH $SUM_PATH]
      return error	
  }

  set DEST_PATH [string trim $APP_GEN_G(DEST_PATH)]
	
  set DIR_IS_EMPTY                 0
  set DIR_IS_WRITABLE              0
  set DIR_HAS_PROTECTED_SUBDIRS    0
  set DIR_HAS_ALL_REQUIRED_SUBDIRS 0

  #........ Examine the destination directory..........#
  if { ! [tclu_is_path_dir $DEST_PATH] } {

     # Directory does not exist - create one with permission

     set STATUS [tclu_mkdir $DEST_PATH]
     if {$STATUS != 0} { return "error" }
     set DIR_IS_EMPTY 1
     set DIR_IS_WRITABLE 1
  } else {
     set DIR_IS_WRITABLE [file writable $DEST_PATH]
     if {! $DIR_IS_WRITABLE} {
	tku_popup_message error ok \
	   "The destination directory is not writable."
	return "error"
     }
     # Check if directory is empty

     if {! [catch { glob [file join $DEST_PATH *]} DIRS_LIST] } {
	
       # Directory is non-empty
       #
       # Find if the directory contains and sub directory which precludes
       # a full installation in fear of overwriting user's data
       # (examples: share, sys, etc.)
       #
	set PROTECTED_SUBDIRS {}
	set DIR_HAS_PROTECTED_SUBDIRS  0
	foreach DIR_PATH $DIRS_LIST {
	   set DIR_NAME [file tail $DIR_PATH]
	   if { [lsearch $APP_GEN_SUB_DIRS_PROTECTED $DIR_NAME] >= 0 } {
	      set DIR_HAS_PROTECTED_SUBDIRS 1
	      lappend PROTECTED_SUBDIRS $DIR_NAME
	   }
	}
	#
	# Find if the directory contains all the necessary directories
	# which are required for an update or fix installation
	# (Example : We warn if sich installation is done to a directory
	#            without sys or exx directories)
	#
	set REQUIRED_SUBDIRS {}
	set DIR_HAS_ALL_REQUIRED_SUBDIRS 1
	foreach REQUIRED_SUBDIR $APP_GEN_SUB_DIRS_REQUIRED {
	   set FILE_PATTERN [file join * $REQUIRED_SUBDIR]
	   if { [lsearch $DIRS_LIST $FILE_PATTERN] < 0 } {
	      set DIR_HAS_ALL_REQUIRED_SUBDIRS 0
	      lappend REQUIRED_SUBDIRS $REQUIRED_SUBDIR
	   }
	}
     } else {
        set DIR_IS_EMPTY 1
     }
  }
  set EDIR_LOCATION_PATH [get_edir_location $DEST_PATH 0]
  set STATUS [tclu_mkdir $APP_GEN_G(EDIR_LOCATION)]
  if { $STATUS != 0 } {
      return error
  }

  switch -- $IS_FIX {
     0 {        # Not a fix - a full version
	if { $DIR_IS_EMPTY } {
	   set APP_GEN_G(INSTALL_TYPE) full
	} elseif {$DIR_HAS_PROTECTED_SUBDIRS} {
	   set APP_GEN_G(INSTALL_TYPE) update
	}
	if {$APP_GEN_G(INSTALL_TYPE) == "update" &&
	    ! $DIR_HAS_ALL_REQUIRED_SUBDIRS } {
          set CHOICE [tku_popup_message warning yesno \
	     [format "You are trying to install inside a directory \
	            \nwhich is not empty but has no full version \
	            \nin it. Please check your destination directory.\
	          \n\nMissing sub-directories: %s\
	          \n\nAre you sure you wish to continue ?" $REQUIRED_SUBDIRS]]
	   if { $CHOICE == "no" } {
  	       return "cancel"	
           }
	}
     }
     1 {         # a fix version
	if { $DIR_HAS_ALL_REQUIRED_SUBDIRS } {
	   set APP_GEN_G(INSTALL_TYPE) fix
	} else {
          tku_popup_message error ok \
             [format "You are trying to install a 'fix version' (%s) \
                \ninside a directory without a full version.\
                \nPlease install the full version 'v%s' first.\
	      \n\nMissing sub-directories: %s" \
                 $VPIG(NAME_VERSION) $VER_NUM $REQUIRED_SUBDIRS]
  	  return error	
	}
	set STATUS [verify_previous_version]
	if { $STATUS != 0 } {
	   return error
	}
     }
     default {
       bgerror "Switch error app_gen.ins (0)"
     }
  }
	
  #
  #  Confirmation message - depending on the install type
  #
  switch -- $APP_GEN_G(INSTALL_TYPE) {
     "full" {
        set DO_E_SEPARATELY 1
	set TAR_DIRS "share fw hosts sys logs tmp"	
	if { $DEST_PATH == $EDIR_LOCATION_PATH } {
	   set TAR_DIRS "$TAR_DIRS e$VER_NUM"
           set DO_E_SEPARATELY 0
	}
	set RENAME_E_VER 0
	set CONFIRM_MESSAGE \
 	  "A full installation will be performed since \
         \nthe destination directory is empty."
     }
     "update" {
        set DO_E_SEPARATELY 1
	set TAR_DIRS "e$VER_NUM"	
	set RENAME_E_VER 1
	set ACTION "Rename"
	set CONFIRM_MESSAGE \
 	  "An update installation will be performed since \
         \nthe destination directory already contains some of the \
	 \nversion directories. \
       \n\nExisting version directories: $PROTECTED_SUBDIRS\n"
     }
     "fix" {
        set DO_E_SEPARATELY 1
	set TAR_DIRS "e$VER_NUM"
	set RENAME_E_VER 1
	set ACTION "Copy"
	set CONFIRM_MESSAGE \
 	  "A fix installation will be performed since \
         \nthe product selected contains a fix version only."
     }
     default {
       bgerror "Switch error app_gen.ins (1)"
     }
  }
  set CHOICE [tku_popup_message question yesno \
      [format "%s\n \
      \nDo you wish to continue ?" $CONFIRM_MESSAGE]]

⌨️ 快捷键说明

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