JavaScript is required to for searching.
跳过导航链接
退出打印视图
应用程序包开发者指南     Oracle Solaris 10 1/13 Information Library (简体中文)
search filter icon
search icon

文档信息

前言

1.  设计软件包

2.  生成软件包

3.  增强软件包的功能(任务)

4.  验证和转换软件包

5.  软件包创建案例研究

请求来自管理员的输入

技术

方法

案例研究文件

pkginfo 文件

prototype 文件

request 脚本

在安装时创建文件并在删除期间保存文件

技术

方法

案例研究文件

pkginfo 文件

prototype 文件

space 文件

i.admin 类操作脚本

r.cfgdata 删除脚本

定义软件包兼容性和相关性

技术

方法

案例研究文件

pkginfo 文件

copyright 文件

compver 文件

depend 文件

使用标准类和类操作脚本修改文件

技术

方法

案例研究文件

pkginfo 文件

prototype 文件

i.inittab 安装类操作脚本

r.inittab 删除类操作脚本

inittab 文件

使用 sed 类和 postinstall 脚本修改文件

技术

方法

案例研究文件

pkginfo 文件

prototype 文件

sed 类操作脚本 (/etc/inittab)

postinstall 脚本

使用 build 类修改文件

技术

方法

案例研究文件

pkginfo 文件

prototype 文件

生成文件

在安装期间修改 crontab 文件

技术

方法

案例研究文件

pkginfo 命令

prototype 文件

i.cron 安装类操作脚本

r.cron 删除类操作脚本

crontab 文件 #1

crontab 文件 #2

使用过程脚本安装和删除驱动程序

技术

方法

案例研究文件

pkginfo 文件

prototype 文件

request 脚本

postinstall 脚本

preremove 脚本

使用 sed 类和过程脚本安装驱动程序

技术

方法

案例研究文件

pkginfo 文件

prototype 文件

sed 类操作脚本 (/etc/devlink.tab)

postinstall 安装脚本

preremove 删除脚本

copyright 文件

6.  创建软件包的高级技术

词汇表

索引

在安装时创建文件并在删除期间保存文件

在此案例研究中,将在安装时创建一个数据库文件,并在删除软件包时保存数据库副本。

技术

此案例研究展示以下技术:

方法

要为此案例研究在安装时创建一个数据库文件,并在删除时保存副本,您必须完成以下任务:

案例研究文件

pkginfo 文件

PKG=krazy
NAME=KrAzY Applications
CATEGORY=applications
BASEDIR=/opt
ARCH=SPARC
VERSION=Version 1
CLASSES=none cfgdata admin

prototype 文件

i pkginfo
i request
i i.admin
i r.cfgdata
d none bin 555 root sys
f none bin/process1 555 root other
f none bin/process2 555 root other
f none bin/process3 555 root other
f admin bin/config 500 root sys
d admin cfg 555 root sys
f admin cfg/datafile1 444 root sys
f admin cfg/datafile2 444 root sys
f admin cfg/datafile3 444 root sys
f admin cfg/datafile4 444 root sys
d cfgdata data 555 root sys

space 文件

# extra space required by config data which is
# dynamically loaded onto the system
data 500 1

i.admin 类操作脚本

# PKGINST parameter provided by installation service
# BASEDIR parameter provided by installation service
while read src dest
do
   cp $src $dest || exit 2
done
# if this is the last time this script will be executed
# during the installation, do additional processing here.
if [ "$1" = ENDOFCLASS ]
then
# our config process will create a data file based on any changes
# made by installing files in this class; make sure the data file
# is in class `cfgdata' so special rules can apply to it during
# package removal.
   installf -c cfgdata $PKGINST $BASEDIR/data/config.data f 444 root
   sys || exit 2
   $BASEDIR/bin/config > $BASEDIR/data/config.data || exit 2
   installf -f -c cfgdata $PKGINST || exit 2
fi
exit 0

这里举例说明了一个很少见的实例,其中 installf 适用于类操作脚本。由于 space 文件用于在特定文件系统上保留空间,因此即使该新文件没有包括在 pkgmap 文件中也可以被安全地添加。

r.cfgdata 删除脚本

# the product manager for this package has suggested that
# the configuration data is so valuable that it should be
# backed up to $PKGSAV before it is removed!
while read path
do
# path names appear in reverse lexical order.
   mv $path $PKGSAV || exit 2
   rm -f $path || exit 2
done
exit 0