FIXUP: give names to sec_vt_command's
[wireshark-wip.git] / packaging / svr4 / mkpkg
blobecd908ee799d81f3ce2e81c05050875721bb8d03
1 #!/bin/sh
3 # mkpkg - Builds a pkgadd-installable package from a listing of the contents in
4 # a staging directory.
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 # $Id$
11 if [ "$1" != "" ] ; then
12 pkg=$1
13 else
14 echo "Usage: " `basename $0` " <package name> [output file]"
15 exit 1
18 if [ "$2" != "" ] ; then
19 pkgfile=$2
20 else
21 pkgfile=$pkg
24 if [ "$3" != "" ] ; then
25 prefix=$3
26 else
27 prefix=/usr/local
30 if [ "$4" != "" ] ; then
31 srcdir=$4
32 else
33 srcdir=`basename $0`/../..
36 # Initialize our variables
37 prepdir=`dirname $0`
38 prototype="$prepdir/Prototype"
39 stagedir=$srcdir/${pkg}.inst
41 # Create the Prototype file
42 cat > $prototype <<Fin
43 i pkginfo
44 i checkinstall
45 Fin
46 if [ ! -d $stagedir ] ; then
47 echo "Whoops! Staging directory $stagedir doesn't exist. Bailing."
48 exit 1
51 find $stagedir/$prefix/* -print | \
52 pkgproto $stagedir/$prefix=$prefix | \
53 # Mimic file permissions under /usr
54 awk ' \
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" } \
59 ' \
60 >> $prototype
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