]> andersk Git - gssapi-openssh.git/blob - openssh/contrib/solaris/buildpkg.sh
Initial revision
[gssapi-openssh.git] / openssh / contrib / solaris / buildpkg.sh
1 #!/bin/sh
2 #
3 # Fake Root Solaris Build System - Prototype
4 #
5 # The following code has been provide under Public Domain License.  I really
6 # don't care what you use it for.  Just as long as you don't complain to me
7 # nor my employer if you break it. - Ben Lindstrom (mouring@eviladmin.org)
8
9 umask 022
10 PKGNAME=OpenSSH
11
12 ## Extract common info requires for the 'info' part of the package.
13 VERSION=`tail -1 ../../version.h | sed -e 's/.*_\([0-9]\)/\1/g' | sed 's/\"$//'`
14 ARCH=`uname -p`
15
16 ## Start by faking root install 
17 echo "Faking root install..."
18 START=`pwd`
19 FAKE_ROOT=$START/package
20 mkdir $FAKE_ROOT
21 cd ../..
22 make install-nokeys DESTDIR=$FAKE_ROOT
23
24 ## Fill in some details, like prefix and sysconfdir
25 ETCDIR=`grep "^sysconfdir=" Makefile | sed 's/sysconfdir=//'`
26 PREFIX=`grep "^prefix=" Makefile | cut -d = -f 2`        
27 PIDDIR=`grep "^piddir=" Makefile | cut -d = -f 2`        
28 cd $FAKE_ROOT
29
30 ## Setup our run level stuff while we are at it.
31 mkdir -p $FAKE_ROOT/etc/init.d
32 mkdir -p $FAKE_ROOT/etc/rcS.d
33 mkdir -p $FAKE_ROOT/etc/rc0.d
34 mkdir -p $FAKE_ROOT/etc/rc1.d
35 mkdir -p $FAKE_ROOT/etc/rc2.d
36
37
38 ## setup our initscript correctly
39 sed -e "s#%%configDir%%#$ETCDIR#g"              \
40     -e "s#%%openSSHDir%%#$PREFIX#g"     \
41     -e "s#%%pidDir%%#$PIDDIR#g" \
42         ../opensshd.in  > $FAKE_ROOT/etc/init.d/opensshd
43 chmod 711 $FAKE_ROOT/etc/init.d/opensshd
44
45 ln -s ../init.d/opensshd $FAKE_ROOT/etc/rcS.d/K30opensshd
46 ln -s ../init.d/opensshd $FAKE_ROOT/etc/rc0.d/K30opensshd
47 ln -s ../init.d/opensshd $FAKE_ROOT/etc/rc1.d/K30opensshd
48 ln -s ../init.d/opensshd $FAKE_ROOT/etc/rc2.d/S98opensshd
49
50
51 ## Ok, this is outright wrong, but it will work.  I'm tired of pkgmk
52 ## whining.
53 for i in *; do
54   PROTO_ARGS="$PROTO_ARGS $i=/$i";
55 done
56
57 ## Build info file
58 echo "Building pkginfo file..."
59 cat > pkginfo << _EOF
60 PKG=$PKGNAME
61 NAME=OpenSSH Portable for Solaris
62 DESC="Secure Shell remote access utility; replaces telnet and rlogin/rsh."
63 VENDOR="OpenSSH Portable Team - http://www.openssh.com/portable.html"
64 BASEDIR=$FAKE_ROOT
65 ARCH=$ARCH
66 VERSION=$VERSION
67 CATEGORY=Security
68 BASEDIR=/
69 _EOF
70
71 ## Next Build our prototype
72 echo "Building prototype file..."
73 find . | egrep -v "prototype|pkginfo" | sort | pkgproto $PROTO_ARGS | \
74         awk '
75             BEGIN { print "i pkginfo" } 
76             { $5="root"; $6="sys"; }
77             { print; }' > prototype
78
79 ## Step back a directory and now build the package.
80 echo "Building package.."
81 cd ..
82 pkgmk -d . -f $FAKE_ROOT/prototype -o
83 rm -rf $FAKE_ROOT
84 echo | pkgtrans -os . $PKGNAME-$ARCH-$VERSION.pkg
85 rm -rf $PKGNAME
This page took 0.042406 seconds and 5 git commands to generate.