1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
#!/bin/sh
# Copyright 2008, 2009 Patrick J. Volkerding, Sebeka, Minnesota, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
VERSION=0.4.0
ARCH=${ARCH:-x86_64}
BUILD=${BUILD:-1}
CWD=$(pwd)
TMP=${TMP:-/tmp}
PKG=$TMP/package-ash
rm -rf $PKG
mkdir -p $TMP $PKG
cd $TMP
tar xzvf $CWD/ash-$VERSION.tar.gz
cd ash-$VERSION
chown -R root:root .
( cd $CWD/patches
for file in ash-builtin.patch.gz ash-echo.patch.gz ash-getcwd.patch.gz ash-getopt.patch.gz ash-glob.patch.gz ash-jobs.patch.gz ash-kill.patch.gz ash-makefile.patch.gz ash-manpage.patch.gz ash-hetio.patch.gz ash-memout.patch.gz ash-misc.patch.gz ash-redir.patch.gz ash-setmode.patch.gz ash-syntax.patch.gz ash-test.patch.gz ash-times.patch.gz ash-debian.patch.gz ash-ppid.patch.gz ash-freebsd.patch.gz ash-sighup.patch.gz ; do
zcat $file
done ) | patch -p1 --verbose
sed -i -e 's#= {#{#' arith.y || exit 1 # prevent "syntax error, unexpected ="
sed -i -e '/yyerrok;/d' arith.y || exit 1 # "error: 'yyerrstatus' undeclared"
# Fred Emmott found this on the LFS mailing list:
sed -i -e 's#extern int hetio_inter#static int hetio_inter#' hetio.h || exit 1
make || exit 1
strip sh
mkdir -p $PKG/bin
cat sh > $PKG/bin/ash
chmod 755 $PKG/bin/ash
mkdir -p $PKG/usr/man/man1
cat sh.1 | gzip -9c > $PKG/usr/man/man1/ash.1.gz
mkdir -p $PKG/usr/doc/ash-$VERSION
chmod 644 TOUR
cp -a TOUR $PKG/usr/doc/ash-$VERSION
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cat << EOF > $PKG/install/doinst.sh
if grep "bin/ash" etc/shells 1> /dev/null 2> /dev/null; then
true
else
echo "/bin/ash" >> etc/shells
fi
EOF
# Build the package:
cd $PKG
makepkg -l y -c n $TMP/ash-$VERSION-$ARCH-$BUILD.txz
# Clean up the extra stuff:
if [ "$1" = "--cleanup" ]; then
rm -rf $TMP/ash-$VERSION
rm -rf $PKG
fi
|