diff options
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/aix/README | 36 | ||||
-rwxr-xr-x | contrib/aix/buildbff.sh | 187 | ||||
-rwxr-xr-x | contrib/aix/inventory.sh | 61 |
3 files changed, 284 insertions, 0 deletions
diff --git a/contrib/aix/README b/contrib/aix/README new file mode 100644 index 000000000..a08c08441 --- /dev/null +++ b/contrib/aix/README | |||
@@ -0,0 +1,36 @@ | |||
1 | Overview: | ||
2 | |||
3 | This directory contains files to build an AIX native (installp or SMIT | ||
4 | installable) openssh package. | ||
5 | |||
6 | |||
7 | Directions: | ||
8 | |||
9 | ./configure [options] | ||
10 | cd contrib/aix; ./buildbff.sh | ||
11 | |||
12 | |||
13 | Acknowledgements: | ||
14 | |||
15 | The contents of this directory are based on Ben Lindstrom's Solaris | ||
16 | buildpkg.sh. Ben also supplied inventory.sh. | ||
17 | |||
18 | Jim Abbey's (GPL'ed) lppbuild-2.1 was used to learn how to build .bff's | ||
19 | and for comparison with the output from this script, however no code | ||
20 | from lppbuild is included and it is not required for operation. | ||
21 | |||
22 | |||
23 | Other notes: | ||
24 | |||
25 | The script treats all packages as USR packages (not ROOT+USR when | ||
26 | appropriate). It seems to work, though...... | ||
27 | |||
28 | |||
29 | Disclaimer: | ||
30 | |||
31 | It is hoped that it is useful but there is no warranty. If it breaks | ||
32 | you get to keep both pieces. | ||
33 | |||
34 | |||
35 | - Darren Tucker (dtucker at zip dot com dot au) | ||
36 | 2002/03/01 | ||
diff --git a/contrib/aix/buildbff.sh b/contrib/aix/buildbff.sh new file mode 100755 index 000000000..6c7aaf454 --- /dev/null +++ b/contrib/aix/buildbff.sh | |||
@@ -0,0 +1,187 @@ | |||
1 | #!/bin/sh | ||
2 | # | ||
3 | # buildbff.sh: Create AIX SMIT-installable OpenSSH packages | ||
4 | # | ||
5 | # Author: Darren Tucker (dtucker at zip dot com dot au) | ||
6 | # This file is placed in the public domain and comes with absolutely | ||
7 | # no warranty. | ||
8 | # | ||
9 | # Based originally on Ben Lindstrom's buildpkg.sh for Solaris | ||
10 | # | ||
11 | |||
12 | umask 022 | ||
13 | PKGNAME=openssh | ||
14 | |||
15 | PATH=$PATH:`pwd` # set path for external tools | ||
16 | export PATH | ||
17 | |||
18 | ## Extract common info requires for the 'info' part of the package. | ||
19 | VERSION=`tail -1 ../../version.h | sed -e 's/.*_\([0-9]\)/\1/g' | sed 's/\"$//'` | ||
20 | BFFVERSION=`echo $VERSION | sed 's/p/./g'` | ||
21 | |||
22 | echo "Building BFF for $PKGNAME $VERSION (package version $BFFVERSION)" | ||
23 | PKGDIR=package | ||
24 | |||
25 | # Clean build directory and package file | ||
26 | rm -rf $PKGDIR | ||
27 | mkdir $PKGDIR | ||
28 | rm -f $PKGNAME-$VERSION.bff | ||
29 | |||
30 | if [ ! -f ../../Makefile ] | ||
31 | then | ||
32 | echo "Top-level Makefile not found (did you run ./configure?)" | ||
33 | exit 1 | ||
34 | fi | ||
35 | |||
36 | ## Start by faking root install | ||
37 | echo "Faking root install..." | ||
38 | START=`pwd` | ||
39 | FAKE_ROOT=$START/$PKGDIR | ||
40 | cd ../.. | ||
41 | make install-nokeys DESTDIR=$FAKE_ROOT | ||
42 | |||
43 | # | ||
44 | # Fill in some details, like prefix and sysconfdir | ||
45 | # the eval also expands variables like sysconfdir=${prefix}/etc | ||
46 | # provided they are eval'ed in the correct order | ||
47 | # | ||
48 | for confvar in prefix exec_prefix bindir sbindir libexecdir datadir mandir mansubdir sysconfdir piddir | ||
49 | do | ||
50 | eval $confvar=`grep "^$confvar=" Makefile | cut -d = -f 2` | ||
51 | done | ||
52 | |||
53 | # Rename config files; postinstall script will copy them if necessary | ||
54 | for cfgfile in ssh_config sshd_config ssh_prng_cmds | ||
55 | do | ||
56 | mv $FAKE_ROOT/$sysconfdir/$cfgfile $FAKE_ROOT/$sysconfdir/$cfgfile.default | ||
57 | done | ||
58 | |||
59 | # | ||
60 | # Generate lpp control files. | ||
61 | # working dir is $FAKE_ROOT but files are generated in contrib/aix | ||
62 | # and moved into place just before creation of .bff | ||
63 | # | ||
64 | cd $FAKE_ROOT | ||
65 | echo Generating LPP control files | ||
66 | find . ! -name . -print >../openssh.al | ||
67 | inventory.sh >../openssh.inventory | ||
68 | cp ../../../LICENCE ../openssh.copyright | ||
69 | |||
70 | # | ||
71 | # Create postinstall script | ||
72 | # | ||
73 | cat <<EOF >>../openssh.post_i | ||
74 | #!/bin/sh | ||
75 | |||
76 | # Create configs from defaults if necessary | ||
77 | for cfgfile in ssh_config sshd_config ssh_prng_cmds | ||
78 | do | ||
79 | if [ ! -f $sysconfdir/\$cfgfile ] | ||
80 | then | ||
81 | echo "Creating \$cfgfile from default" | ||
82 | cp $sysconfdir/\$cfgfile.default $sysconfdir/\$cfgfile | ||
83 | else | ||
84 | echo "\$cfgfile already exists." | ||
85 | fi | ||
86 | done | ||
87 | |||
88 | # Generate keys unless they already exist | ||
89 | if [ -f "$sysconfdir/ssh_host_key" ] ; then | ||
90 | echo "$sysconfdir/ssh_host_key already exists, skipping." | ||
91 | else | ||
92 | $bindir/ssh-keygen -t rsa1 -f $sysconfdir/ssh_host_key -N "" | ||
93 | fi | ||
94 | if [ -f $sysconfdir/ssh_host_dsa_key ] ; then | ||
95 | echo "$sysconfdir/ssh_host_dsa_key already exists, skipping." | ||
96 | else | ||
97 | $bindir/ssh-keygen -t dsa -f $sysconfdir/ssh_host_dsa_key -N "" | ||
98 | fi | ||
99 | if [ -f $sysconfdir/ssh_host_rsa_key ] ; then | ||
100 | echo "$sysconfdir/ssh_host_rsa_key already exists, skipping." | ||
101 | else | ||
102 | $bindir/ssh-keygen -t rsa -f $sysconfdir/ssh_host_rsa_key -N "" | ||
103 | fi | ||
104 | |||
105 | # Add to system startup if required | ||
106 | if grep $sbindir/sshd /etc/rc.tcpip >/dev/null | ||
107 | then | ||
108 | echo "sshd found in rc.tcpip, not adding." | ||
109 | else | ||
110 | echo >>/etc/rc.tcpip | ||
111 | echo "echo Starting sshd" >>/etc/rc.tcpip | ||
112 | echo "$sbindir/sshd" >>/etc/rc.tcpip | ||
113 | fi | ||
114 | EOF | ||
115 | |||
116 | # | ||
117 | # Create liblpp.a and move control files into it | ||
118 | # | ||
119 | echo Creating liblpp.a | ||
120 | ( | ||
121 | cd .. | ||
122 | for i in al copyright inventory post_i | ||
123 | do | ||
124 | ar -r liblpp.a openssh.$i | ||
125 | rm openssh.$i | ||
126 | done | ||
127 | ) | ||
128 | |||
129 | # | ||
130 | # Create lpp_name | ||
131 | # | ||
132 | # This will end up looking something like: | ||
133 | # 4 R I OpenSSH { | ||
134 | # OpenSSH 3.0.2.1 1 N U en_US OpenSSH 3.0.2p1 Portable for AIX | ||
135 | # [ | ||
136 | # % | ||
137 | # /usr/local/bin 8073 | ||
138 | # /usr/local/etc 189 | ||
139 | # /usr/local/libexec 185 | ||
140 | # /usr/local/man/man1 145 | ||
141 | # /usr/local/man/man8 83 | ||
142 | # /usr/local/sbin 2105 | ||
143 | # /usr/local/share 3 | ||
144 | # % | ||
145 | # ] | ||
146 | echo Creating lpp_name | ||
147 | cat <<EOF >../lpp_name | ||
148 | 4 R I $PKGNAME { | ||
149 | $PKGNAME $BFFVERSION 1 N U en_US OpenSSH $VERSION Portable for AIX | ||
150 | [ | ||
151 | % | ||
152 | EOF | ||
153 | |||
154 | for i in $bindir $sysconfdir $libexecdir $mandir/man1 $mandir/man8 $sbindir $datadir | ||
155 | do | ||
156 | # get size in 512 byte blocks | ||
157 | size=`du $FAKE_ROOT/$i | awk '{print $1}'` | ||
158 | echo "$i $size" >>../lpp_name | ||
159 | done | ||
160 | |||
161 | echo '%' >>../lpp_name | ||
162 | echo ']' >>../lpp_name | ||
163 | echo '}' >>../lpp_name | ||
164 | |||
165 | # | ||
166 | # Move pieces into place | ||
167 | # | ||
168 | mkdir -p usr/lpp/openssh | ||
169 | mv ../liblpp.a usr/lpp/openssh | ||
170 | mv ../lpp_name . | ||
171 | |||
172 | # | ||
173 | # Now invoke backup to create .bff file | ||
174 | # note: lpp_name needs to be the first file do we generate the | ||
175 | # file list on the fly and feed it to backup using -i | ||
176 | # | ||
177 | echo Creating $PKGNAME-$VERSION.bff with backup... | ||
178 | ( | ||
179 | echo "./lpp_name" | ||
180 | find . ! -name lpp_name -a ! -name . -print | ||
181 | ) | backup -i -q -f ../$PKGNAME-$VERSION.bff $filelist | ||
182 | |||
183 | cd .. | ||
184 | |||
185 | rm -rf $PKGDIR | ||
186 | echo $0: done. | ||
187 | |||
diff --git a/contrib/aix/inventory.sh b/contrib/aix/inventory.sh new file mode 100755 index 000000000..aa44ab9d4 --- /dev/null +++ b/contrib/aix/inventory.sh | |||
@@ -0,0 +1,61 @@ | |||
1 | #!/bin/sh | ||
2 | # | ||
3 | # inventory.sh | ||
4 | # | ||
5 | # Originall written by Ben Lindstrom, modified by Darren Tucker to use perl | ||
6 | # | ||
7 | # This will produced and AIX package inventory file, which looks like: | ||
8 | # | ||
9 | # /usr/local/bin: | ||
10 | # class=apply,inventory,openssh | ||
11 | # owner=root | ||
12 | # group=system | ||
13 | # mode=755 | ||
14 | # type=DIRECTORY | ||
15 | # /usr/local/bin/slogin: | ||
16 | # class=apply,inventory,openssh | ||
17 | # owner=root | ||
18 | # group=system | ||
19 | # mode=777 | ||
20 | # type=SYMLINK | ||
21 | # target=ssh | ||
22 | # /usr/local/share/Ssh.bin: | ||
23 | # class=apply,inventory,openssh | ||
24 | # owner=root | ||
25 | # group=system | ||
26 | # mode=644 | ||
27 | # type=FILE | ||
28 | # size=VOLATILE | ||
29 | # checksum=VOLATILE | ||
30 | |||
31 | find . ! -name . -print | perl -ne '{ | ||
32 | chomp; | ||
33 | if ( -l $_ ) { | ||
34 | ($dev,$ino,$mod,$nl,$uid,$gid,$rdev,$sz,$at,$mt,$ct,$bsz,$blk)=lstat; | ||
35 | } else { | ||
36 | ($dev,$ino,$mod,$nl,$uid,$gid,$rdev,$sz,$at,$mt,$ct,$bsz,$blk)=stat; | ||
37 | } | ||
38 | |||
39 | # Start to display inventory information | ||
40 | $name = $_; | ||
41 | $name =~ s|^.||; # Strip leading dot from path | ||
42 | print "$name:\n"; | ||
43 | print "\tclass=apply,inventory,openssh\n"; | ||
44 | print "\towner=root\n"; | ||
45 | print "\tgroup=system\n"; | ||
46 | printf "\tmode=%lo\n", $mod & 07777; # Mask perm bits | ||
47 | |||
48 | if ( -l $_ ) { | ||
49 | # Entry is SymLink | ||
50 | print "\ttype=SYMLINK\n"; | ||
51 | printf "\ttarget=%s\n", readlink($_); | ||
52 | } elsif ( -f $_ ) { | ||
53 | # Entry is File | ||
54 | print "\ttype=FILE\n"; | ||
55 | print "\tsize=VOLATILE\n"; | ||
56 | print "\tchecksum=VOLATILE\n"; | ||
57 | } elsif ( -d $_ ) { | ||
58 | # Entry is Directory | ||
59 | print "\ttype=DIRECTORY\n"; | ||
60 | } | ||
61 | }' | ||