3 # mkpkg - Builds a pkgadd-installable package from a listing of the contents in
6 # This is a modified version of a script written by mark@metalab.unc.edu .
7 # The original is at http://metalab.unc.edu/pub/packages/solaris/sparc/html/creating.solaris.packages.html .
11 if [ "$1" != "" ] ; then
14 echo "Usage: " `basename $0` " <package name> [output file]"
18 if [ "$2" != "" ] ; then
24 if [ "$3" != "" ] ; then
30 if [ "$4" != "" ] ; then
33 srcdir
=`basename $0`/..
/..
36 # Initialize our variables
38 prototype
="$prepdir/Prototype"
39 stagedir
=$srcdir/${pkg}.inst
41 # Create the Prototype file
42 cat > $prototype <<Fin
46 if [ ! -d $stagedir ] ; then
47 echo "Whoops! Staging directory $stagedir doesn't exist. Bailing."
51 find $stagedir/$prefix/* -print | \
52 pkgproto
$stagedir/$prefix=$prefix | \
53 # Mimic file permissions under /usr
55 /bin/ { print $1, $2, $3, $4, "root bin"; next }; \
56 /lib/ { print $1, $2, $3, $4, "root bin"; next }; \
57 /man/ { print $1, $2, $3, $4, "root bin"; next }; \
58 { print $1, $2, $3, $4, "root sys" } \
62 # Make the package installation directory
63 pkgmk
-o -r / -d /$srcdir -f $prototype
64 echo "Setting file permissions in $stagedir tree to 644."
65 find $stagedir -type f
-print |
xargs chmod a
+r
66 find $stagedir -type f
-print |
xargs chmod u
+w
67 echo "Setting directory permissions in $stagedir tree to 755."
68 find $stagedir -type d
-print |
xargs chmod 755
69 if [ -f $stagedir/install
/preinstall
]; then
70 chmod 755 $stagedir/install
/preinstall
72 if [ -f $stagedir/install
/postinstall
]; then
73 chmod 755 $stagedir/install
/postinstall
75 if [ -f $stagedir/install
/preremove
]; then
76 chmod 755 $stagedir/install
/preremove
78 if [ -f $stagedir/install
/postremove
]; then
79 chmod 755 $stagedir/install
/postremove
81 if [ -f $stagedir/install
/request
]; then
82 chmod 755 $stagedir/install
/request
84 if [ -f $stagedir/install
/checkinstall
]; then
85 chmod 755 $stagedir/install
/checkinstall
88 # Spool the install directory into its own self-contained file.
89 pkgtrans
-s $srcdir $pkgfile $pkg
91 # echo "Compressing package file"
92 # gzip -9 $srcdir/$pkgfile