summaryrefslogtreecommitdiff
path: root/contrib/solaris/buildpkg.sh
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/solaris/buildpkg.sh')
-rwxr-xr-xcontrib/solaris/buildpkg.sh82
1 files changed, 82 insertions, 0 deletions
diff --git a/contrib/solaris/buildpkg.sh b/contrib/solaris/buildpkg.sh
new file mode 100755
index 000000000..a71417075
--- /dev/null
+++ b/contrib/solaris/buildpkg.sh
@@ -0,0 +1,82 @@
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#
9umask 022
10PKGNAME=OpenSSH
11
12## Extract common info requires for the 'info' part of the package.
13VERSION=`tail -1 ../../version.h | sed -e 's/.*_\([0-9]\)/\1/g' | sed 's/\"$//'`
14ARCH=`uname -p`
15
16## Start by faking root install
17echo "Faking root install..."
18START=`pwd`
19FAKE_ROOT=$START/package
20mkdir $FAKE_ROOT
21cd ../..
22make install-nokeys DESTDIR=$FAKE_ROOT
23
24## Fill in some details, like prefix and sysconfdir
25ETCDIR=`grep "^sysconfdir=" Makefile | sed 's/sysconfdir=//'`
26PREFIX=`grep "^prefix=" Makefile | cut -d = -f 2`
27cd $FAKE_ROOT
28
29## Setup our run level stuff while we are at it.
30mkdir -p $FAKE_ROOT/etc/init.d
31mkdir -p $FAKE_ROOT/etc/rcS.d
32mkdir -p $FAKE_ROOT/etc/rc0.d
33mkdir -p $FAKE_ROOT/etc/rc1.d
34mkdir -p $FAKE_ROOT/etc/rc2.d
35
36
37## setup our initscript correctly
38sed -e "s#%%configDir%%#$ETCDIR#g" \
39 -e "s#%%openSSHDir%%#$PREFIX#g" \
40 ../opensshd.in > $FAKE_ROOT/etc/init.d/opensshd
41chmod 711 $FAKE_ROOT/etc/init.d/opensshd
42
43ln -s $FAKE_ROOT/etc/init.d/opensshd $FAKE_ROOT/etc/rcS.d/K30opensshd
44ln -s $FAKE_ROOT/etc/init.d/opensshd $FAKE_ROOT/etc/rc1.d/K30opensshd
45ln -s $FAKE_ROOT/etc/init.d/opensshd $FAKE_ROOT/etc/rc2.d/S98opensshd
46
47
48## Ok, this is outright wrong, but it will work. I'm tired of pkgmk
49## whining.
50for i in *; do
51 PROTO_ARGS="$PROTO_ARGS $i=/$i";
52done
53
54## Build info file
55echo "Building pkginfo file..."
56cat > pkginfo << _EOF
57PKG=$PKGNAME
58NAME=OpenSSH Portable for Solaris
59DESC="Secure Shell remote access utility; replaces telnet and rlogin/rsh."
60VENDOR="OpenSSH Portable Team - http://www.openssh.com/portable.html"
61BASEDIR=$FAKE_ROOT
62ARCH=$ARCH
63VERSION=$VERSION
64CATEGORY=Security
65BASEDIR=/
66_EOF
67
68## Next Build our prototype
69echo "Building prototype file..."
70find . | egrep -v "prototype|pkginfo" | sort | pkgproto $PROTO_ARGS | \
71 awk '
72 BEGIN { print "i pkginfo" }
73 { $5="root"; $6="sys"; }
74 { print; }' > prototype
75
76## Step back a directory and now build the package.
77echo "Building package.."
78cd ..
79pkgmk -d . -f $FAKE_ROOT/prototype -o
80rm -rf $FAKE_ROOT
81echo | pkgtrans -os . $PKGNAME-$ARCH-$VERSION.pkg
82rm -rf $PKGNAME