📄 mkpkg
字号:
#!/bin/sh## mkpkg - Builds a pkgadd-installable package from a listing of the contents in# a staging directory.## This is a modified version of a script written by mark@metalab.unc.edu .# The original is at http://metalab.unc.edu/pub/packages/solaris/sparc/html/creating.solaris.packages.html .if [ "$1" != "" ] ; then pkg=$1else echo "Usage: " `basename $0` " <package name> [output file]" exit 1fiif [ "$2" != "" ] ; then pkgfile=$2else pkgfile=$pkgfiif [ "$3" != "" ] ; then prefix=$3else prefix=/usr/localfiif [ "$4" != "" ] ; then srcdir=$4else srcdir=`basename $0`/../..fi# Initialize our variablesprepdir=`dirname $0`prototype="$prepdir/Prototype"stagedir=$srcdir/${pkg}.stage# Create the Prototype filecat > $prototype <<Fini pkginfoi checkinstallFinif [ ! -d $stagedir ] ; then echo "Whoops! Staging directory $stagedir doesn't exist. Bailing." exit 1fifind $stagedir/$prefix/* -print | \ pkgproto $stagedir/$prefix=$prefix >> $prototype# Make the package installation directorypkgmk -o -r / -d /$srcdir -f $prototypeecho "Setting file permissions in $stagedir tree to 644."find $stagedir -type f -print | xargs chmod a+rfind $stagedir -type f -print | xargs chmod u+wecho "Setting directory permissions in $stagedir tree to 755."find $stagedir -type d -print | xargs chmod 755if [ -f $stagedir/install/preinstall ]; then chmod 755 $stagedir/install/preinstallfiif [ -f $stagedir/install/postinstall ]; then chmod 755 $stagedir/install/postinstallfiif [ -f $stagedir/install/preremove ]; then chmod 755 $stagedir/install/preremovefiif [ -f $stagedir/install/postremove ]; then chmod 755 $stagedir/install/postremovefiif [ -f $stagedir/install/request ]; then chmod 755 $stagedir/install/requestfiif [ -f $stagedir/install/checkinstall ]; then chmod 755 $stagedir/install/checkinstallfi# Spool the install directory into its own self-contained file.pkgtrans -s $srcdir $pkgfile $pkg# echo "Compressing package file"# gzip -9 $srcdir/$pkgfile
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -