]> andersk Git - openssh.git/commitdiff
- (bal) Added contrib/aix/ to support BFF package generation provided
authormouring <mouring>
Tue, 5 Mar 2002 03:38:35 +0000 (03:38 +0000)
committermouring <mouring>
Tue, 5 Mar 2002 03:38:35 +0000 (03:38 +0000)
   by Darren Tucker <dtucker@zip.com.au>

CREDITS
ChangeLog
contrib/aix/README [new file with mode: 0644]
contrib/aix/buildbff.sh [new file with mode: 0755]
contrib/aix/inventory.sh [new file with mode: 0755]

diff --git a/CREDITS b/CREDITS
index 9e5262765f172c131d9c1ec56ea487336d659f35..bcc0359a10541603a981cf80a7af39cf096d0423 100644 (file)
--- a/CREDITS
+++ b/CREDITS
@@ -26,6 +26,7 @@ Chun-Chung Chen <cjj@u.washington.edu> - RPM fixes
 Corinna Vinschen <vinschen@cygnus.com> - Cygwin support
 Dan Brosemer <odin@linuxfreak.com> - Autoconf support, build fixes
 Darren Hall <dhall@virage.org> - AIX patches
+Darren Tucker <dtucker@zip.com.au> - AIX BFF package scripts
 David Agraz <dagraz@jahoopa.com> - Build fixes
 David Del Piero <David.DelPiero@qed.qld.gov.au> - bug fixes
 David Hesprich <darkgrue@gue-tech.org> - Configure fixes
index d8740845281dccb62a3ff51ee75a7a2e3fb6142c..64151322dd7778f92c9d230838a6f030b5be106b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -61,7 +61,8 @@
    - markus@cvs.openbsd.org 2002/03/04 19:37:58
      [channels.c]
      off by one; thanks to joost@pine.nl
-
+ - (bal) Added contrib/aix/ to support BFF package generation provided
+   by Darren Tucker <dtucker@zip.com.au>
 20020226
  - (tim) Bug 12 [configure.ac] add sys/bitypes.h to int64_t tests
    based on patch by mooney@dogbert.cc.ndsu.nodak.edu (Tim Mooney)
diff --git a/contrib/aix/README b/contrib/aix/README
new file mode 100644 (file)
index 0000000..a08c084
--- /dev/null
@@ -0,0 +1,36 @@
+Overview:
+
+This directory contains files to build an AIX native (installp or SMIT
+installable) openssh package.
+
+
+Directions:
+
+./configure [options]
+cd contrib/aix; ./buildbff.sh
+
+
+Acknowledgements:
+
+The contents of this directory are based on Ben Lindstrom's Solaris
+buildpkg.sh. Ben also supplied inventory.sh.
+
+Jim Abbey's (GPL'ed) lppbuild-2.1 was used to learn how to build .bff's
+and for comparison with the output from this script, however no code
+from lppbuild is included and it is not required for operation.
+
+
+Other notes:
+
+The script treats all packages as USR packages (not ROOT+USR when
+appropriate).  It seems to work, though......
+
+
+Disclaimer:
+
+It is hoped that it is useful but there is no warranty. If it breaks
+you get to keep both pieces.
+
+
+       - Darren Tucker (dtucker at zip dot com dot au)
+         2002/03/01
diff --git a/contrib/aix/buildbff.sh b/contrib/aix/buildbff.sh
new file mode 100755 (executable)
index 0000000..6c7aaf4
--- /dev/null
@@ -0,0 +1,187 @@
+#!/bin/sh
+#
+# buildbff.sh: Create AIX SMIT-installable OpenSSH packages
+#
+# Author: Darren Tucker (dtucker at zip dot com dot au)
+# This file is placed in the public domain and comes with absolutely
+# no warranty.
+# 
+# Based originally on Ben Lindstrom's buildpkg.sh for Solaris
+#
+
+umask 022
+PKGNAME=openssh
+
+PATH=$PATH:`pwd`               # set path for external tools
+export PATH
+
+## Extract common info requires for the 'info' part of the package.
+VERSION=`tail -1 ../../version.h | sed -e 's/.*_\([0-9]\)/\1/g' | sed 's/\"$//'`
+BFFVERSION=`echo $VERSION | sed 's/p/./g'`
+
+echo "Building BFF for $PKGNAME $VERSION (package version $BFFVERSION)"
+PKGDIR=package
+
+# Clean build directory and package file
+rm -rf $PKGDIR
+mkdir $PKGDIR
+rm -f $PKGNAME-$VERSION.bff
+
+if [ ! -f ../../Makefile ]
+then
+       echo "Top-level Makefile not found (did you run ./configure?)"
+       exit 1
+fi
+
+## Start by faking root install 
+echo "Faking root install..."
+START=`pwd`
+FAKE_ROOT=$START/$PKGDIR
+cd ../.. 
+make install-nokeys DESTDIR=$FAKE_ROOT
+
+#
+# Fill in some details, like prefix and sysconfdir
+#      the eval also expands variables like sysconfdir=${prefix}/etc
+#      provided they are eval'ed in the correct order
+#
+for confvar in prefix exec_prefix bindir sbindir libexecdir datadir mandir mansubdir sysconfdir piddir
+do
+       eval $confvar=`grep "^$confvar=" Makefile | cut -d = -f 2`
+done
+
+# Rename config files; postinstall script will copy them if necessary
+for cfgfile in ssh_config sshd_config ssh_prng_cmds
+do
+       mv $FAKE_ROOT/$sysconfdir/$cfgfile $FAKE_ROOT/$sysconfdir/$cfgfile.default
+done
+
+#
+# Generate lpp control files.
+#      working dir is $FAKE_ROOT but files are generated in contrib/aix
+#      and moved into place just before creation of .bff
+#
+cd $FAKE_ROOT
+echo Generating LPP control files
+find . ! -name . -print >../openssh.al
+inventory.sh >../openssh.inventory
+cp ../../../LICENCE ../openssh.copyright
+
+#
+# Create postinstall script
+#
+cat <<EOF >>../openssh.post_i
+#!/bin/sh
+
+# Create configs from defaults if necessary
+for cfgfile in ssh_config sshd_config ssh_prng_cmds
+do
+        if [ ! -f $sysconfdir/\$cfgfile ]
+        then
+                echo "Creating \$cfgfile from default"
+                cp $sysconfdir/\$cfgfile.default $sysconfdir/\$cfgfile
+        else
+                echo "\$cfgfile already exists."
+        fi
+done
+
+# Generate keys unless they already exist
+if [ -f "$sysconfdir/ssh_host_key" ] ; then
+        echo "$sysconfdir/ssh_host_key already exists, skipping."
+else
+        $bindir/ssh-keygen -t rsa1 -f $sysconfdir/ssh_host_key -N ""
+fi
+if [ -f $sysconfdir/ssh_host_dsa_key ] ; then
+        echo "$sysconfdir/ssh_host_dsa_key already exists, skipping."
+else
+        $bindir/ssh-keygen -t dsa -f $sysconfdir/ssh_host_dsa_key -N ""
+fi
+if [ -f $sysconfdir/ssh_host_rsa_key ] ; then
+        echo "$sysconfdir/ssh_host_rsa_key already exists, skipping."
+else 
+        $bindir/ssh-keygen -t rsa -f $sysconfdir/ssh_host_rsa_key -N ""
+fi
+
+# Add to system startup if required
+if grep $sbindir/sshd /etc/rc.tcpip >/dev/null
+then
+        echo "sshd found in rc.tcpip, not adding."
+else
+        echo >>/etc/rc.tcpip
+        echo "echo Starting sshd" >>/etc/rc.tcpip
+        echo "$sbindir/sshd" >>/etc/rc.tcpip
+fi
+EOF
+
+#
+# Create liblpp.a and move control files into it
+#
+echo Creating liblpp.a
+(
+       cd ..
+       for i in al copyright inventory post_i
+       do
+               ar -r liblpp.a openssh.$i
+               rm openssh.$i
+       done
+)
+
+#
+# Create lpp_name
+#
+# This will end up looking something like:
+# 4 R I OpenSSH {
+# OpenSSH 3.0.2.1 1 N U en_US OpenSSH 3.0.2p1 Portable for AIX
+# [
+# %
+# /usr/local/bin 8073
+# /usr/local/etc 189
+# /usr/local/libexec 185
+# /usr/local/man/man1 145
+# /usr/local/man/man8 83
+# /usr/local/sbin 2105
+# /usr/local/share 3
+# %
+# ]
+echo Creating lpp_name
+cat <<EOF >../lpp_name
+4 R I $PKGNAME {
+$PKGNAME $BFFVERSION 1 N U en_US OpenSSH $VERSION Portable for AIX
+[
+%
+EOF
+
+for i in $bindir $sysconfdir $libexecdir $mandir/man1 $mandir/man8 $sbindir $datadir
+do
+       # get size in 512 byte blocks
+       size=`du $FAKE_ROOT/$i | awk '{print $1}'`
+       echo "$i $size" >>../lpp_name
+done
+
+echo '%' >>../lpp_name
+echo ']' >>../lpp_name
+echo '}' >>../lpp_name
+
+#
+# Move pieces into place
+#
+mkdir -p usr/lpp/openssh
+mv ../liblpp.a usr/lpp/openssh
+mv ../lpp_name .
+
+#
+# Now invoke backup to create .bff file
+#      note: lpp_name needs to be the first file do we generate the
+#      file list on the fly and feed it to backup using -i
+#
+echo Creating $PKGNAME-$VERSION.bff with backup...
+(
+       echo "./lpp_name"
+       find . ! -name lpp_name -a ! -name . -print 
+) | backup  -i -q -f ../$PKGNAME-$VERSION.bff $filelist
+
+cd ..
+
+rm -rf $PKGDIR
+echo $0: done.
+
diff --git a/contrib/aix/inventory.sh b/contrib/aix/inventory.sh
new file mode 100755 (executable)
index 0000000..aa44ab9
--- /dev/null
@@ -0,0 +1,61 @@
+#!/bin/sh
+#
+# inventory.sh
+#
+# Originall written by Ben Lindstrom, modified by Darren Tucker to use perl
+#
+# This will produced and AIX package inventory file, which looks like:
+#
+# /usr/local/bin:
+#          class=apply,inventory,openssh
+#          owner=root
+#          group=system
+#          mode=755
+#          type=DIRECTORY
+# /usr/local/bin/slogin:
+#          class=apply,inventory,openssh
+#          owner=root
+#          group=system
+#          mode=777
+#          type=SYMLINK
+#          target=ssh
+# /usr/local/share/Ssh.bin:
+#          class=apply,inventory,openssh
+#          owner=root
+#          group=system
+#          mode=644
+#          type=FILE
+#          size=VOLATILE
+#          checksum=VOLATILE
+
+find . ! -name . -print | perl -ne '{
+       chomp;
+       if ( -l $_ ) {
+               ($dev,$ino,$mod,$nl,$uid,$gid,$rdev,$sz,$at,$mt,$ct,$bsz,$blk)=lstat;
+       } else {
+               ($dev,$ino,$mod,$nl,$uid,$gid,$rdev,$sz,$at,$mt,$ct,$bsz,$blk)=stat;
+       }
+
+       # Start to display inventory information
+       $name = $_;
+       $name =~ s|^.||;        # Strip leading dot from path
+       print "$name:\n";
+       print "\tclass=apply,inventory,openssh\n";
+       print "\towner=root\n";
+       print "\tgroup=system\n";
+       printf "\tmode=%lo\n", $mod & 07777;    # Mask perm bits
+       
+       if ( -l $_ ) {
+               # Entry is SymLink
+               print "\ttype=SYMLINK\n";
+               printf "\ttarget=%s\n", readlink($_);
+       } elsif ( -f $_ ) {
+               # Entry is File
+               print "\ttype=FILE\n";
+               print "\tsize=VOLATILE\n";
+               print "\tchecksum=VOLATILE\n";
+       } elsif ( -d $_ ) {
+               # Entry is Directory
+               print "\ttype=DIRECTORY\n";
+       } 
+}'
This page took 0.094166 seconds and 5 git commands to generate.