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 .
9 if [ "$1" != "" ] ; then
12 echo "Usage: " `basename $0` " <package name> [output file]"
16 if [ "$2" != "" ] ; then
22 if [ "$3" != "" ] ; then
28 if [ "$4" != "" ] ; then
31 srcdir=`basename $0`/../..
34 # Initialize our variables
36 prototype="$prepdir/Prototype"
37 stagedir=$srcdir/${pkg}.inst
39 # Create the Prototype file
40 cat > $prototype <<Fin
44 if [ ! -d $stagedir ] ; then
45 echo "Whoops! Staging directory $stagedir doesn't exist. Bailing."
49 find $stagedir/$prefix/* -print | \
50 pkgproto $stagedir/$prefix=$prefix | \
51 # Mimic file permissions under /usr
53 /bin/ { print $1, $2, $3, $4, "root bin"; next }; \
54 /lib/ { print $1, $2, $3, $4, "root bin"; next }; \
55 /man/ { print $1, $2, $3, $4, "root bin"; next }; \
56 { print $1, $2, $3, $4, "root sys" } \
60 # Make the package installation directory
61 pkgmk -o -r / -d /$srcdir -f $prototype
62 echo "Setting file permissions in $stagedir tree to 644."
63 find $stagedir -type f -print | xargs chmod a+r
64 find $stagedir -type f -print | xargs chmod u+w
65 echo "Setting directory permissions in $stagedir tree to 755."
66 find $stagedir -type d -print | xargs chmod 755
67 if [ -f $stagedir/install/preinstall ]; then
68 chmod 755 $stagedir/install/preinstall
70 if [ -f $stagedir/install/postinstall ]; then
71 chmod 755 $stagedir/install/postinstall
73 if [ -f $stagedir/install/preremove ]; then
74 chmod 755 $stagedir/install/preremove
76 if [ -f $stagedir/install/postremove ]; then
77 chmod 755 $stagedir/install/postremove
79 if [ -f $stagedir/install/request ]; then
80 chmod 755 $stagedir/install/request
82 if [ -f $stagedir/install/checkinstall ]; then
83 chmod 755 $stagedir/install/checkinstall
86 # Spool the install directory into its own self-contained file.
87 pkgtrans -s $srcdir $pkgfile $pkg
89 # echo "Compressing package file"
90 # gzip -9 $srcdir/$pkgfile