1 | #!/bin/sh |
---|
2 | |
---|
3 | # Copyright 2008, 2009, 2010, 2011, 2013, 2016 Patrick J. Volkerding, Sebeka, MN, USA |
---|
4 | # All rights reserved. |
---|
5 | # |
---|
6 | # Redistribution and use of this script, with or without modification, is |
---|
7 | # permitted provided that the following conditions are met: |
---|
8 | # |
---|
9 | # 1. Redistributions of this script must retain the above copyright |
---|
10 | # notice, this list of conditions and the following disclaimer. |
---|
11 | # |
---|
12 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED |
---|
13 | # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
---|
14 | # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO |
---|
15 | # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
---|
16 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
---|
17 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; |
---|
18 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
---|
19 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
---|
20 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF |
---|
21 | # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
---|
22 | |
---|
23 | |
---|
24 | VERSION=1.3.3 |
---|
25 | BUILD=${BUILD:-2} |
---|
26 | |
---|
27 | # Automatically determine the architecture we're building on: |
---|
28 | if [ -z "$ARCH" ]; then |
---|
29 | case "$( uname -m )" in |
---|
30 | i?86) export ARCH=i586 ;; |
---|
31 | arm*) export ARCH=arm ;; |
---|
32 | # Unless $ARCH is already set, use uname -m for all other archs: |
---|
33 | *) export ARCH=$( uname -m ) ;; |
---|
34 | esac |
---|
35 | fi |
---|
36 | |
---|
37 | NUMJOBS=${NUMJOBS:-" -j7 "} |
---|
38 | |
---|
39 | if [ "$ARCH" = "i586" ]; then |
---|
40 | SLKCFLAGS="-O2 -march=i586 -mtune=i686" |
---|
41 | elif [ "$ARCH" = "s390" ]; then |
---|
42 | SLKCFLAGS="-O2" |
---|
43 | elif [ "$ARCH" = "x86_64" ]; then |
---|
44 | SLKCFLAGS="-O2 -fPIC" |
---|
45 | else |
---|
46 | SLKCFLAGS="-O2" |
---|
47 | fi |
---|
48 | |
---|
49 | CWD=$(pwd) |
---|
50 | TMP=${TMP:-/tmp} |
---|
51 | PKG=$TMP/package-nfs-utils |
---|
52 | |
---|
53 | rm -rf $PKG |
---|
54 | mkdir -p $TMP $PKG |
---|
55 | |
---|
56 | # Explode the package framework: |
---|
57 | cd $PKG |
---|
58 | explodepkg $CWD/_nfs-utils.tar.gz |
---|
59 | |
---|
60 | # Add startup script: |
---|
61 | cat $CWD/rc.nfsd > $PKG/etc/rc.d/rc.nfsd.new |
---|
62 | # Off by default, unless there's a previous version that's turned on: |
---|
63 | chmod 644 $PKG/etc/rc.d/rc.nfsd.new |
---|
64 | |
---|
65 | cd $TMP |
---|
66 | rm -rf nfs-utils-$VERSION |
---|
67 | tar xvf $CWD/nfs-utils-$VERSION.tar.xz || exit 1 |
---|
68 | cd nfs-utils-$VERSION || exit 1 |
---|
69 | |
---|
70 | zcat $CWD/nfs-utils.lwrap.needs.lnsl.diff.gz | patch -p1 --verbose || exit 1 |
---|
71 | # Fix problems on machines without IPv6: |
---|
72 | zcat $CWD/ignore_unsupported_address_types_in_nfssvc_setfds.diff.gz | patch -p1 -l --verbose || exit 1 |
---|
73 | |
---|
74 | chown -R root:root . |
---|
75 | find . \ |
---|
76 | \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \ |
---|
77 | -exec chmod 755 {} \; -o \ |
---|
78 | \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \ |
---|
79 | -exec chmod 644 {} \; |
---|
80 | |
---|
81 | |
---|
82 | CFLAGS="$SLKCFLAGS" \ |
---|
83 | ./configure \ |
---|
84 | --prefix=/usr \ |
---|
85 | --mandir=/usr/man \ |
---|
86 | --with-statedir=/var/lib/nfs \ |
---|
87 | --enable-mountconfig \ |
---|
88 | --enable-nfsv4=yes \ |
---|
89 | --enable-gss=no \ |
---|
90 | --with-krb5 \ |
---|
91 | --enable-tirpc=yes \ |
---|
92 | --disable-ipv6 \ |
---|
93 | --program-prefix= \ |
---|
94 | --program-suffix= \ |
---|
95 | --build=$ARCH-slackware-linux |
---|
96 | |
---|
97 | make $NUMJOBS || make || exit 1 |
---|
98 | make install DESTDIR=$PKG || exit 1 |
---|
99 | |
---|
100 | # Add nfsmount.conf and man page: |
---|
101 | cat ./utils/mount/nfsmount.conf > $PKG/etc/nfsmount.conf |
---|
102 | mkdir -p $PKG/usr/man/man5 |
---|
103 | cat ./utils/mount/nfsmount.conf.man > $PKG/usr/man/man5/nfsmount.conf.5 |
---|
104 | # Set default protocol version 3: |
---|
105 | #sed -i "s/# Defaultvers=4/Defaultvers=3/g" $PKG/etc/nfsmount.conf.new |
---|
106 | |
---|
107 | # These might be in use: |
---|
108 | ( cd $PKG/var/lib/nfs |
---|
109 | for config_file in etab rmtab state xtab ; do |
---|
110 | mv ${config_file} ${config_file}.new |
---|
111 | done |
---|
112 | ) |
---|
113 | |
---|
114 | # No NFSv4 yet, so remove these: |
---|
115 | #rm -f $PKG/sbin/*nfs4 |
---|
116 | |
---|
117 | # This should move to support /usr on NFS: |
---|
118 | mkdir -p $PKG/sbin |
---|
119 | mv $PKG/usr/sbin/rpc.statd $PKG/sbin |
---|
120 | ( cd $PKG/usr/sbin ; ln -sf ../../sbin/rpc.statd . ) |
---|
121 | |
---|
122 | # Chown /var/lib/nfs so that rpc.statd runs as rpc:rpc: |
---|
123 | chown -R rpc:rpc $PKG/var/lib/nfs |
---|
124 | |
---|
125 | find $PKG | xargs file | grep -e "executable" -e "shared object" \ |
---|
126 | | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null |
---|
127 | |
---|
128 | mkdir -p $PKG/usr/doc/nfs-utils-$VERSION |
---|
129 | cp -a \ |
---|
130 | COPYING* INSTALL NEWS README* \ |
---|
131 | $PKG/usr/doc/nfs-utils-$VERSION |
---|
132 | mkdir -p $PKG/usr/doc/nfs-utils-$VERSION/statd |
---|
133 | cp -a \ |
---|
134 | utils/statd/COPYING utils/statd/TODO \ |
---|
135 | $PKG/usr/doc/nfs-utils-$VERSION/statd |
---|
136 | |
---|
137 | # If there's a ChangeLog, installing at least part of the recent history |
---|
138 | # is useful, but don't let it get totally out of control: |
---|
139 | if [ -r ChangeLog ]; then |
---|
140 | DOCSDIR=$(echo $PKG/usr/doc/*-$VERSION) |
---|
141 | cat ChangeLog | head -n 1000 > $DOCSDIR/ChangeLog |
---|
142 | touch -r ChangeLog $DOCSDIR/ChangeLog |
---|
143 | fi |
---|
144 | |
---|
145 | # Compress and if needed symlink the man pages: |
---|
146 | if [ -d $PKG/usr/man ]; then |
---|
147 | ( cd $PKG/usr/man |
---|
148 | for manpagedir in $(find . -type d -name "man*") ; do |
---|
149 | ( cd $manpagedir |
---|
150 | for eachpage in $( find . -type l -maxdepth 1) ; do |
---|
151 | ln -s $( readlink $eachpage ).gz $eachpage.gz |
---|
152 | rm $eachpage |
---|
153 | done |
---|
154 | gzip -9 *.? |
---|
155 | ) |
---|
156 | done |
---|
157 | ) |
---|
158 | fi |
---|
159 | |
---|
160 | mkdir -p $PKG/install |
---|
161 | cat $CWD/slack-desc > $PKG/install/slack-desc |
---|
162 | zcat $CWD/doinst.sh.gz > $PKG/install/doinst.sh |
---|
163 | |
---|
164 | # Build the package: |
---|
165 | cd $PKG |
---|
166 | /sbin/makepkg -l y -c n $TMP/nfs-utils-$VERSION-$ARCH-$BUILD.txz |
---|
167 | |
---|