Chinaunix首页 | 论坛 | 博客
  • 博客访问: 103232551
  • 博文数量: 19283
  • 博客积分: 9968
  • 博客等级: 上将
  • 技术积分: 196062
  • 用 户 组: 普通用户
  • 注册时间: 2007-02-07 14:28
文章分类

全部博文(19283)

文章存档

2011年(1)

2009年(125)

2008年(19094)

2007年(63)

分类:

2008-03-27 11:27:01

作者:silverwolf  
SCO UNIX 下Custom发布软件的制作方法(含CCS的使用)

  很早以前写好的帖子,根据“SCO UNIX高级宝典”修改而成,用完后丢在公司的论坛上,现重新发布出来。中间半角空格被我用全角替换,估计直接粘贴无法使用,有用到的替换一下。

  问题:
  很多软件产品完工之后,都会做成一个软件包,以便于用户用custom工具进行安装。哪位能详细描述一下,做软件包的过程?

  答:
  SCO OPENSERVER 下custom发布软件的制作方法
  在SCO OPENSERVER5.0.x下,软件都用cutsom管理用户通过该工具,可以很好地进行软件的安装、升级、删除;开发商通过该工具,可以很好地管理好开发的发布软件的版本。利用SCO OPENSERVER下的一个工具--Custom Distribution Master ToolKit,本文提供了custom发布软件的制作方法。

  CDMT生成的发布软件,根据其介质可为软盘、磁带或光盘版。其中光盘发布软件的生成比较困难,这是由于SCO OPENSERVER支持的光盘刻录机比较少,往往只好借助于windows或linux下的刻录工具。然而,现在软件大都通过光盘来安装,因此,光盘发布软件的制作显得尤为重要。下面将具体介绍CDMT生成发布软件的具体过程,包括软盘、磁带和光盘。
  
  一、确定你的产品结构
  
  SCO OPENSERVER下,custom按照如下层次组织系统上安装的软件:
  如产品SCO OpenServer 5.0.x被分成很多组件,如Xclient和Wserver,每一个组件又分成多个包,如man等。
  为了说明方便,我们所举的例中名称都取为一个,并且只有一个组件和一个包,名字全部为test。
  
  二、确定每个文件的属性
  
  属性有shared(/opt)和non-shared(/var/opt)之分,其中shared的文件为只读,non-shared的文件为可读可写。本处为说明方便,所举的例子中的文件全部为shared。

  To specify the shared and non-shared files when you create the distribution tree, put the shared files in the SHARED directory, and the non-shared files in CLIENT. Another way to accomplish this is to define the shared and non-shared files in the CDMT input files. Set the distTreeRootSHARED attribute to the directory containing the shared files and distTreeRootCLIENT to the directory containing the non-shared files. Set these attributes in the COMP record in *.cmpnt, or PKG record in *.pkg. See cdmtInput(CDMT) for details.

  For example, if you want custom(ADM) to place a non-shared file in the /var/opt/K/SCO/WServer/1.0.0/lib directory, either put the distribution file in the distTreeRoot/CLIENT/lib directory or set the COMP record distTreeRootCLIENT attribute to the directory containing the non-shared files.

  三、构件软件的目录结构
  
  所安装的test软件的目录结构为:
  /usr/test/.profile
       database/
       dblog/
       bin/
       tmp/
  
  四、设置CDMT的环境
  
  设置生成该Distribution的根目录CDMT_DIR环境变量,在命令行下键入:
  #CDMT_DIR=/usr/test ;export CDMT_DIR
  
  五、生成CDMT命令所需的输入文件
  
  包括三个文件,分别是:
  $CDMT_DIR/input/test.prd
  $CDMT_DIR/input/test.cmpnt
  $CDMT_DIR/input/test.pkg上述三个文件可以用vi生成,也可以用如下两条命令生成后用vi修改。

  在$CDMT_DIR目录下:
  find . -print>/tmp/test.files
  cdmtConvert /tmp/test.files

  在input目录下,生成了四个文件,其中一个是为生成cdmt.config文件的。
  转到$CDMT_DIR目录下,执行命令:
  #vi $CDMT_DIR/cdmt.config

  在该文件下输入:
  CONFIG:
  archiveMedia=CD

  CD_MEDIA:
  distCode=“CDDist”
  再把input目录下的test.config文件中的内容拷贝到cdmt.config中。
  以上的config文件是为生成光盘介质,生成其它介质的config也类似,可以参考随机手册。
  
  六、生成SSO树
  
  在CDMT_DIR宏已设定的条件下,在任何目录下(当然,一般都在$CDMT_DIR/下)先后执行以下三个命令:
  1?cdmtParse,该命令软件存储对象(SSO)数据库,它读取CDMT的input文件,并把生成的SSO放在$CDMT-DIR/sso下。
  2?cdmtCompress,该命令构件SSO的目录,并压缩它。
  3?cdmtArchive,该命令生成可custom安装的格式。
  
  七、从硬盘上移到指定介质上
  
  1?若是FLOPPY,可以用以下命令
  cdmtArchive -media FLOPPY -copy
  默认状态下,系统用cpio拷贝到软盘上,cpio有个缺点,不检查写得是否正确;用tar也一样。往往在多张软盘tar到硬盘上时,发现最后一张盘有问题,而不得不从头来。

  2?若是TAPE,可以用以下命令
  cdmtArchive -media TAPE -copy
  默认状态下,在磁带上生成一个文件系统。此步完成即完成整个制作过程。

  3?若是CD介质,比较复杂
  (1)#cd /usr/test/sso  #ls可在其下看见 /opt目录

  (2)用mkisofs工具生成ISO9660的文件系统
  mkisofs可从internet上downlad下来,编译后可以使用
  mkisofs -r -T -o cd_image.iso
  其中,表示对当前目录操作,不可改为opt。
  此时,在/usr/test目录下,生成文件cd_image.iso,该文件即是用来刻录的镜像文件。

  (3)把cd_image.iso移到windows操作系统下,在该操作系统下进行刻录。可以用ftp方式(windows和openserver不在同一计算机中),也可以用mount方式(windows和openserver在同一计算机中)。用windows下的刻录软件刻录该软件。

  BTW:
  +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  cdmtConvert 转换一个文件列表成为CDMT输入文件(*.prd, *.cmpnt and *.pkg)。
  cdmtConvert [-f] [-inputDir directory] [-defaultPerms] [-version version] [-exportMacro macroName]packageCode*.files 
  -f       在删除以前的目录和文件时,不提示用户
  -inputDir    指明存放转换后的文件的目录
  -defaultPerms  忽略实际文件的权限,使用*.cmpnt中的缺省定义
  -version    定义版本号
  -exportMacro  定义一个宏名

  +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

  cdmtParse 命令从CDMT输入文件(*.prd, *.cmpnt and *.pkg)中产生SSO数据库的文件。
  cdmtParse [-f] [-config filename] [-inputDir directory] [-prd *.prd files] [-cmpnt *.cmpnt files] [*.prd files]
  一般情况下,cdmtParse命令是读入$CDMT_DIR/input目录下所有的*.prd文件,*.prd文件中引用了*.cmpnt和*.pkg文件。
  -f           在删除以前的目录和文件时,不提示用户
  -inputDir        指明输入文件*.prd的目录
  -config         指明一个配置文件,而不用cdmt.config
  -prd *.prd files    指明只处理指定的prd文件。
  -cmpnt *.cmpnt files  指明只处理指定的*.cmpnt文件
  *.prd files       只读入指定的prd文件
  
  +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

  cdmtCompress 把所有SSO文件转换成分布程序文件形式,再压缩这些文件(如果指定要压缩的话)
  cdmtCompress [-config filename] [-cmpnt *.cmpnt files]
  -config filename    指明一个配置文件,而不用cdmt.config
  -cmpnt *.cmpnt files  只拷贝和压缩在cmpnt文件中指定的组件文件

  +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

  cdmtArchive 命令产生能够用custom安装的程序
  cdmtArchive [-f] [-config filename] [-media media_type] [-copy]
  缺省情况下,cdmtArchive命令从cdmt.config文件读入配置信息;生成的安装文件缺省的放在$CDMT_DIR/archives/TAPE目录下。
  -f           在删除以前的目录和文件时,不提示用户
  -config         指明一个配置文件,而不用cdmt.config
  -copy          拷贝档案到介质
  -f copy         与-copy一样,只是不提示。
  -media media_type    指定要拷贝的介质,可以是:TAPE, CD和FLOPPY

  cdmtArchive命令产生出以下的文件:
  VOL.volumeIndex.archiveIndex    CPIO文档,volumeIndex是介质的卷标,archiveIndex是文档号
  VOL.volumeIndex.archiveIndex.files 每个文档里面的文件列表,用来产生实际的文档。
  VOL.volumeIndex.archiveIndex.sum  一个用命令sum -r产生出来的档案的sum值列表。

  +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  cdmt.config -- specify default CDMT configuration
  在这个文件里面,可以定义以下的选项:
  MACROS 定义宏 
  格式:
  MACROS:
  macroname = macrovalue

  COMPONENT_ORDER 指明应用程序组件在发布中顺序
  格式:
  COMPONENT_ORDER:
  integer = componentID|componentCode
  integer = componentID|componentCode
  integer = componentID|componentCode
  
  EXAMPLE:
  COMPONENT_ORDER:
  1 = SCO:cdmt::1.0.1
  2 = SCO:WServer::4.0
  3 = SCO:XClients::1.0
  
  This example specifies that the CDMT component appears first, WServer appears second, and XClients appears third on the media.

  CONFIG 指明安装文件的一般配置信息
  格式:
  CONFIG:
  inputDir= pathname(default $CDMT_DIR/inputDir)
  ssoDir = pathname(default $CDMT_DIR/sso)
  removalPrompt = TRUE | FALSE (default TRUE)
  removeFiles = TRUE | FALSE (default TRUE)
  compress = TRUE | FALSE (default TRUE)
  archiveMedia = TAPE | CD | FLOPPY (default TAPE)

  FLOPPY_MEDIA 指明如果用软盘作为工具时的一些配置信息
  格式:
  FLOPPY_MEDIA:
  device = media device name (default /dev/rfd0135ds18)
  volumeSize = volume size in KB (default 1440)
  archivesDir = directory where cdmtArchive creates archives (default $CDMT_DIR/archives/FLOPPY)
  archiveFormat = format of the archive (default CPIO)
  freeSpace = amount of space to leave on filesystem (default 0)
  distCode = distribution code (default ``protoFloppyDist'')
  distVersion = distribution version (default ``1.0'')
  paperLabel = volume media label (default ``Floppy Volume %d'')

  TAPE_MEDIA 指明如果用磁带作为工具时的一些配置信息
  格式:
  TAPE_MEDIA:
  device = media device name (default /dev/nrct0)
  volumeSize = volume size in KB (default 9000000000)
  archivesDir = directory where cdmtArchive creates archives (default $CDMT_DIR/archives/TAPE)
  distCode = distribution code (default ``protoTapeDist'')
  distVersion = distribution version (default ``1.0'')
  paperLabel = volume media label (default ``Tape Volume %d'')

  CD_MEDIA 指明如果用光盘作为工具时的一些配置信息
  格式:
  CD_MEDIA:
  distCode = distribution code (default ``protoCDDist'')
  distVersion = distribution version (default ``1.0'')
  paperLabel = volume media label (default ``CD Volume %d'')

  在以上的定义的一些属性的意义:
  archivesDir   指定cdmtArchive命令产生的文件的存放目录,缺省放在$CDMT_DIR/archives/TAPE或者$CDMT_DIR/archives/FLOPPY
  archiveFormat  对于软盘,指定其文档格式为CPIO或者FILESYS;如果指定为FILESYS,则cdmtArchive 命令在软盘上创建一个文件系统,并把文档拷贝到上面,CUSTOM可以识别两种格式。缺省CPIO.
  freeSpace    指明在介质上保留的空间。对于软盘文件系统格式(FILESYS),预留空间可以后来拷贝文件到这个空间里面;缺省是零。
  inputDir    指定包含有CDMT文件的目录,cdmtParse命令在这个目录中搜索*.prd,*.cmpnt和*.pkg文件,缺省$CDMT_DIR/input
  ssoDir     指明cdmtParse命令产生的组件文件*.sso映象文件的存放目录。缺省是$CDMT_DIR/sso。
  archiveMedia  指明cdmtArchive命令要产生文档的存放介质类型,缺省是TAPE。
  removeFiles   指明命令cdmtParse时,是否移除原来的SSO文件和SSO数据库中的记录。如果不需要移除,则cdmtCompress命令要比较新产生的SSO文件与原来在目录下的SSO文件的修改时间,如果当前SSO文件新,则拷贝该文件。缺省是TRUE
  removalPrompt  在删除一个文件或者是目录时,是否提示,缺省是TRUE
  compress    是否压缩SSO文件,缺省是TRUE
  distCode    指定一个唯一的分布码.
  distVersion   指明发布软件的版本号,非产品的版本号。
  paperLabel   对每一个介质产生一个卷标,缺省是"Volume %d"
  macroName    指定一个宏名的替代值
  integer     指定一个组件的ID号
  device     指定档案文件的介质名称,缺省对于软盘,是/dev/rfd0135ds18;对于磁带,是/dev/nrct0

  +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

  mkisofs
  选项  功能
  -o   指定 ISO 映像的输出文件名
  -J   生成 Joliet 命名记录;对于将在 Windows 环境下使用的光盘有帮助
  -R   生成 Rock Ridge (RR) 命名记录来保留文件名长度和大小写,特别用于 UNIX/Linux 环境
  -A   设立一个应用程序 ID - 一个将会被写入到映像卷头的文本字串,它对于判定光盘上的应用程序有帮助
  -V   设立一个文件卷 ID - 当映像被刻录后,光盘被挂载到 Solaris 和 Windows 环境后被指派给它的一个名称
  -v   设置执行时的详细反馈,对于在映像被制作时查看 它的状态有帮助。
  -x   不包括任何紧跟在这个选项之后的目录; 这个选项可以被重复使用(譬如, ... -x /home/joe/trash -x /home/joe/delete ...)
  -r   使用长文件名,并开放全部文件的读取权限。
  -T   建立文件名的转换表,适用于不支持长文件名的系统上。

  +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  Example 12-1 Example product description file (WServer.prd)
  
  PROD:SCO:testProd:
    description   ="Widget Server"
  
    # $WServer_VER is a CDMT macro defined in the cdmt.config file.
    version     =$WServer_VER
    packages    =SCO:WServer
  
    # $WServer_DIR is defined in cdmt.config.
    cmpntFiles   =$WServer_DIR/input/WServer.cmpnt

  +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  Example 12-2 Example component description file (WServer.cmpnt)
  
  COMP:SCO:WServer:
    description    = "Widget Server"
    # $WServer_VER is a CDMT macro defined in the cdmt.config file.
    version      = $WServer_VER
    subpackages    = WSERVER,EXAMPLES
    # $WServer_DIR is defined in cdmt.config.
    distTreeRoot    = $WServer_DIR
    # distTreeRootSHARED specifies where the shared files are located
    distTreeRootSHARED = $WServer_DIR
    # distTreeRootCLIENT specifies where the non-shared files are located
    distTreeRootCLIENT = $WServer_DIR
    pkgFiles      = $WServer_DIR/input/WServer.pkg
  
  FILE_DEFAULT:
    perms       = 444
    owner       = bin
    group       = bin
  
  DIR_DEFAULT:
    perms       = 755
    owner       = bin
    group       = bin

  +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  Example 12-3 Example package description file (WServer.pkg)
  
  (This example describes only a few of the packages in the WServer component.)
  
  PKG:Control:
    description    = "WServer component definition files"
    # $WServer_DIR is defined in cdmt.config.
    distTreeRoot    = $WServer_DIR
    # distTreeRootSHARED specifies where the shared files are located
    distTreeRootSHARED = $WServer_DIR
    # distTreeRootCLIENT specifies where the non-shared files are located
    distTreeRootCLIENT = $WServer_DIR
  
  DIR:WSERVER:SHARED:./cntl:
    perms       = 0755
    owner       = bin
    group       = bin
  
  FILE:WSERVER:SHARED:./cntl/ccs:
    perms       = 0755
    owner       = bin
    group       = bin
  
  PKG:WSERVER:
    description    = "Widget Server"
    distTreeRoot    = $WServer_DIR
    distTreeRootSHARED = $WServer_DIR
    distTreeRootCLIENT = $WServer_DIR
  
  
  DIR:WSERVER:SHARED:./bin:
    perms       = 0755
    owner       = bin
    group       = bin
  
  FILE:WSERVER:SHARED:./bin/xm_wserver:
    perms       = 0755
    owner       = bin
    group       = bin
    exportPath     = /bin/xm_wserver
  
  DIR:WSERVER:CLIENT:./usr:
    perms       = 0755
    owner       = bin
    group       = bin
  
  DIR:WSERVER:CLIENT:./usr/lib:
    perms       = 0755
    owner       = bin
    group       = bin
  
  DIR:WSERVER:CLIENT:./usr/lib/X11:
    perms       = 0755
    owner       = bin
    group       = bin
  
  DIR:WSERVER:CLIENT:./usr/lib/X11/app-defaults:
    perms       = 0755
    owner       = bin
    group       = bin
  
  FILE:WSERVER:CLIENT:./usr/lib/X11/app-defaults/WServer:
    perms       = 0444
    owner       = bin
    group       = bin
    exportPath     = ./lib/X11/app-defaults/WServer
  .
  .
  .


  PS: CDMT的高级功能 (CCS 组件控制脚本)
  The Component Control Script (ccs) located in SSOroot/cntl/ccs, defines how custom(ADM) installs the component. For each component that you prepare for installation, create a ccs.

  The ccs takes three arguments:
  $1  step to perform
     The step name contains three items:
     + the name of the phase to perform (such as LOAD)
     + the prefix UN (if the step is a reverse operation)
     + the prefix PRE_ or POST_, indicating which step to perform
     For example, use PRE_LOAD to indicate the pre-load step during an installation; POST_UNATTACH indicates the post-attach step during a removal.
  $2  keyword_list
     The keyword specifies how the ccs behaves (during
     installation only):
     UPGRADE
        Upgrades an older version of an SSO-based component to the new version of an SSO-based component.
     OLD_CUSTOM_UPGRADE
        Upgrades a non-SSO component to an SSO component. See ``Creating software upgrades'' in Developer's Topics.
  $3
     package_list
     The package_list is a space-separated list of the fully-qualified package names in the component. Package names are in the form: vendorCode:componentCode:packageCode. See ``Component identifiers'' in Developer's Topics. To use the simpler packageCode, use the getPackageCode function in the ccsSetup(CDMT) library.

  1. 说明:在CDMT_DIR根目录下建立/cntl/ccs文件,文件格式可参考模板,一般只要修订do_postexport函数
  
  2. 设置CDMT的环境
  #CDMT_DIR=/usr/test ;export CDMT_DIR
  
  3. 生成.cmpnt, .prd, .pkg ,.config文件
  find . -print>/tmp/test.files
  cdmtConvert /tmp/test.files
  
  4. 打开$CDMT_DIR/input/目录下的.pkg文件, 修改/cntl/ccs文件的用户,属组为bin:bin,访问权限为744
  
  5. 拷贝.config到$CDMT_DIR目录,重命名为cdmt.config(偷懒步骤)
  
  6. 余下步骤同上

  PS:
  如果出现如下警告:
  Warning: distribution vendor not set
  Warning: distribution code not set
  Warning: distribution version not set

  请定义cdmt.config中介质相关参数(以软盘为例)
  CONFIG:
    archiveMedia=FLOPPY
  FLOPPY_MEDIA:
    distVendor=foo
    distCode=distribution code (default ``protoFloppyDist'')
    distVersion=distribution version (default ``1.0'')


以下是CCS的内容

#!/ibin/sh
#       %Z% %M% %I% %E% %Q%
#
#   Copyright (C) 2001 The Santa Cruz Operation, Inc.
#      All Rights Reserved.
#   The information in this file is provided for the exclusive use of
#   the licensees of The Santa Cruz Operation, Inc.  Such users have the
#   right to use, modify, and incorporate this code into other products
#   for purposes authorized by the license agreement provided they include
#   this notice and the associated copyright notice with any such product.
#   The information in this file is provided "AS IS" without warranty.
#
#******************************************************************************
#                      Generic CCS script -- CHANGE THIS!!!
#-----------------------------------------------------------------------------
#  COMMENTS/DESCRIPTION
#-----------------------------------------------------------------------------
#
#       input:
#           $1 is the name of the step
#           $2 is the keyword list (e.g., INSTALL, UPGRADE, REMOVE)
#           $3 is the package list
#============================================================================

#====================================================================== INT ===
#  cleanup --
#  
#    cleanup exits the package script with the passed argument
#
#------------------------------------------------------------------------------
cleanup()
{
   exit $1
}

#====================================================================== INT ===
#  do_save --
#  
#    do_save uses ccsUpgradeTool to save the RTS config files
#
#------------------------------------------------------------------------------
do_save()
{
   return # don't do anything here for now
}

#=================CUSTOM INSTALLATION STEP FUNCTIONS=================== INT ===
#
#====================================================================== INT ===
#  do_preload --
#  
#   If the keyword "UPGRADE" is specified, but the old version being
#   upgraded is not an SSO component, special action may be required
#   at this point. See guidelines 4.6.2 "How to Handle In-Place Upgrade".
#
#   Note that only the files in the "SharedControl" package of the
#   component have been loaded onto the target at this point.
#
#------------------------------------------------------------------------------
do_preload()
{
   # calls do_save to save config files for upgrade
   #

   do_save
}

#====================================================================== INT ===
#  do_postload --
#  
#   No work is defined
#
#------------------------------------------------------------------------------
do_postload()
{
   do_save
   # no work currently defined for here
}

#====================================================================== INT ===
#  do_preattach --
#
#   In this step, the ccs should make any necessary version-compatibility
#   checks. If, for some reason it is not valid to install the component
#   on the given client -- perhaps an inappropriate version of the
#   operating system is installed, for instance -- the ccs shoudl return
#   an exit code of $FAIL, causing teh installation to fail.
#
#   If the keyword "UPGRADE" is specified, but the old version being
#   upgraded is not an SSO component, special action is required at this
#   point. See guidelines 4.6.2 "How to Handle In-Place Upgrade".
#  
#------------------------------------------------------------------------------
do_preattach()
{
   #
   #   < FILL IN HERE >
   #
   # perform necessary version-compatibility checks. perform a
   #   cleanup $FAIL
   # if something is not right after loggin the reasons.
   #

   # calls do_save to save config files for network client upgrade
   #

   do_save
}

#====================================================================== INT ===
#  do_postattach --
#
#   If the keyword "UPGRADE" is specified, this is the step in which the
#   ccs should merge the old configuration data into the appropriate files.
#
#   If the old version being upgraded was not an SSO component, the old
#   configuration data will have been saved in the CCS_PERSISTENT_STORAGE by
#   an earlier script phase.
#
#   After the saved data has been restored, any "query" parameters that
#   necessitate further self-configuration should be applied. Only files
#   wholly owned by this component -- i.e., those in the /var/opt area
#   -- can be modified.
#  
#------------------------------------------------------------------------------
do_postattach()
{
   case "$upgrade" in
       nonSSOupgrade)
      # preserve any needed data from a 3.2v4 installation
      ;;
       SSOupgrade)
      # preserve any needed data from an OSr5 installation
               ;;
   esac
}

#====================================================================== INT ===
#  do_preregister --
#  
#   Here is where ScoAdmin OSAs that need to be available to other
#   components during those component's "configure" phase should be
#   installed. This implies some stringent restrictions on the
#   implementation of such OSA's: they must operate completely within
#   the boundries of their own component provided tools and data,
#   possibly relying as well on tools available in /ibin.
#
#------------------------------------------------------------------------------
do_preregister()
{
   :
   # No work defined yet
}

#====================================================================== INT ===
#  do_postregister --
#
#   No work is defined
#
#------------------------------------------------------------------------------
do_postregister()
{
   :
   # No work defined yet
}

#====================================================================== INT ===
#  do_preconfigure --
#  
#   The component should configure itself into any system service of which
#   it is a consumer. For instance, calls to "idinstall" should be made
#   here to add a drive into (or, in the case of a removal, to pull a
#   driver out of) the link kit.
#
#------------------------------------------------------------------------------
do_preconfigure()
{
   :
   #
   #   < FILL IN HERE >
   #
   # This is where things that need to register with OSA's should call
   # those OSAs.
}

#====================================================================== INT ===
#  do_postconfigure --
#
#   Any remaining configuration that relied on steps taken in the pre-
#   configurure and system steps should be completed here
#
#------------------------------------------------------------------------------
do_postconfigure()
{
   :
   #
   #   < FILL IN HERE >
   #
   # Continue anything started in do_preconfigure that needs finishing
   # up.
   #
}

#====================================================================== INT ===
#  do_preexport --
#  
#   No work defined here
#
#------------------------------------------------------------------------------
do_preexport()
{
   :
   # no work defined yet
}

#====================================================================== INT ===
#  do_postexport --
#  
#   In the final phase, all the remaining public interfaces are exported
#   to the system's public name space.
#
#------------------------------------------------------------------------------
do_postexport()
{
   :
   # ln -s /opt/K/SCO/manager/1.0/bin/monitor /usr/bin/monitor
}

#=================CUSTOM REMOVAL STEP FUNCTIONS-----=================== INT ===
#
#====================================================================== INT ===
#  do_preunexport --
#  
#   In the first phase, all the extra public interfaces are unexported
#   from the system's public name space.
#
#------------------------------------------------------------------------------
do_preunexport()
{
   :
   #
   #   < FILL IN HERE >
   #
   # This is the place that would be filled by all the other misc
   # functions performed by the removal script that were not covered by
   # the previous steps. Things like flushing buffers and the like.

}

#====================================================================== INT ===
#  do_postunexport --
#  
#   No work defined here
#
#------------------------------------------------------------------------------
do_postunexport()
{
   :
   # no work defined yet
}

#====================================================================== INT ===
#  do_preunconfigure --
#  
#   The component should unconfigure itself from any system service it is
#   a consumer of, using calls to the appropriate service interface. For
#   instance, kernel drivers should be removed by a call to the "idinstall"
#   utility.
#
#------------------------------------------------------------------------------
do_preunconfigure()
{
   :
   #
   #   < FILL IN HERE >
   #
   # This is where things that needed to register with OSA's should
   # remove themselves from those OSAs.
}

#====================================================================== INT ===
#  do_postunconfigure --
#
#   No work is defined
#
#------------------------------------------------------------------------------
do_postunconfigure()
{
   :
   # No work defined yet
}

#====================================================================== INT ===
#  do_preunregister --
#
#   For components which provide system services, any work which is
#   necessary prior to the removal of those services should be completed
#   in this step. Depending on the service, it may be appropriate to
#   inform all service consumers of the service's removal, using a
#   provider-defined interface. See the guidlines 3.4 "Responsibilies
#   involved with providing a system service."
#
#------------------------------------------------------------------------------
do_preunregister()
{
   :
   #
   #   < FILL IN HERE >
   #
   # This is where OSAs should call classconf & osaconf to remove
   # themselves from the osa registration database
   #
}

#====================================================================== INT ===
#  do_postunregister --
#
#   No work is defined
#
#------------------------------------------------------------------------------
do_postunregister()
{
   :
   # No work defined yet
}

#====================================================================== INT ===
#  do_preunattach --
#
#   No work is defined
#
#------------------------------------------------------------------------------
do_preunattach()
{
   :
   # No work defined yet
}

#====================================================================== INT ===
#  do_postunattach --
#
#   No work is defined
#
#------------------------------------------------------------------------------
do_postunattach()
{
   :
   # No work defined yet
}


#====================================================================== INT ===
#  do_preunload --
#
#   No work is defined
#
#------------------------------------------------------------------------------
do_preunload()
{
   :
   # No work defined yet
}

#====================================================================== INT ===
#  do_postunload --
#
#   No work is defined
#
#------------------------------------------------------------------------------
do_postunload()
{
   :
   # No work defined yet
}

#====================================================================== INT ===
#  main --
#  
#    Based on step specified, perform actions of the general form:
#       Global initialization
#       Loop to call each package script for package-specific actions
#       Global cleanup
#
#    NOTE: Currently, a number of steps exist for which no action needs to
#    be specified in this product.  This will probably be true for most
#    products in the near future.
#------------------------------------------------------------------------------

# NOTE: Do not "cd" around the place as the SSO_CLIENT_ROOT and related
#       variables are of relative path and your use of them will be damaged
#   if you change your location.

# set a trap so if the user dels out, a WARN exit value is passed
# to the calling program
trap 'cleanup $WARN' 1 2 3 15

# Process the arguments to this script and perform action
# for the step being executed currently
pkg_step=$1
pkg_keywords=$2
pkg_list=$3

# Source in the standard functions library
. ccsSetup.sh

# determine action to perform, default is install
upgrade=
removal=
for word in $pkg_keywords
do
   case "$word" in
      OLD_CUSTOM_UPGRADE) upgrade=nonSSOupgrade
      ;;
      UPGRADE) upgrade=SSOupgrade
      ;;
   esac
done

# This first case details in which order an "installation" takes place in:
case "$pkg_step" in
   PRE_LOAD)
         do_preload
         ;;
   POST_LOAD)
         do_postload
         ;;
   PRE_ATTACH)
         do_preattach
         ;;
   POST_ATTACH)
         do_postattach
         ;;
   PRE_REGISTER)
         do_preregister
         ;;
   POST_REGISTER)
         do_postregister
         ;;
   PRE_CONFIGURE)
         do_preconfigure
         ;;
   POST_CONFIGURE)
         do_postconfigure
         ;;
   PRE_EXPORT)
         do_preexport
         ;;
   POST_EXPORT)
         do_postexport
         ;;
esac

# This first case details in which order an "removal" takes place in:
case "$pkg_step" in
   PRE_UNEXPORT)
         do_preunexport
         ;;
   POST_UNEXPORT)
         do_postunexport
         ;;
   PRE_UNCONFIGURE)
         do_preunconfigure
         ;;
   POST_UNCONFIGURE)
         do_postunconfigure
         ;;
   PRE_UNREGISTER)
         do_preunregister
         ;;
   POST_UNREGISTER)
         do_postunregister
         ;;
   PRE_UNATTACH)
         do_preunattach
         ;;
   POST_UNATTACH)
         do_postunattach
         ;;
   PRE_UNLOAD)
         do_preunload
         ;;
   POST_UNLOAD)
         do_postunload
         ;;
esac

cleanup $OK

阅读(459) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~