aboutsummaryrefslogtreecommitdiff
path: root/system/amanda/amanda.SlackBuild
blob: bb6af9177ad0716fc5dc7f0850461a8b63e4c365 (plain)
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#!/bin/sh

# Slackware build script for amanda
# Written by Christopher Walker <kris240376@gmail.com>

PRGNAM=amanda
VERSION=${VERSION:-2.5.2p1}
ARCH=${ARCH:-i486}
BUILD=${BUILD:-1}
TAG=${TAB:-_SBo}

CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}

AMANDAUSR=${AMANDAUSR:-amanda}
AMANDAGRP=${AMANDAGRP:-amanda}
AMANDAUID=${AMANDAUID:-211}
AMANDAGID=${AMANDAGID:-211}

if [ "$ARCH" = "i486" ]; then
  SLKCFLAGS="-O2 -march=i486 -mtune=i686"
elif [ "$ARCH" = "x86_64" ]; then
  SLKCFLAGS="-O2 -fPIC"
fi

do_exit() {
  echo ; echo "You must have the ${AMANDAUSR} user and ${AMANDAGRP} group in"
  echo "order to build amanda.  Sample lines to do so are below:"
  echo "# groupadd -g ${AMANDAGID} ${AMANDAGRP}"
  echo "# useradd -u ${AMANDAUID} -d /var/lib/amanda -s /bin/false -g ${AMANDAGRP} ${AMANDAUSR}"
  echo "Exiting..." ; echo ; exit 1
}

# Check for Amanada user and group availability
if ! grep -q ^${AMANDAGRP}: /etc/group 2>/dev/null ; then
  do_exit ; 
elif ! grep -q ^${AMANDAUSR}: /etc/passwd 2>/dev/null ; then
  do_exit ; 
fi

rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
tar xvf $CWD/$PRGNAM-$VERSION.tar.gz || exit 1
cd $PRGNAM-$VERSION
chown -R root:root .
chmod -R a-s,u+w,go+r-w .

CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
./configure \
  --prefix=/usr \
  --mandir=/usr/man \
  --sysconfdir=/etc \
  --localstatedir=/var/lib \
  --with-user=$AMANDAUSR \
  --with-group=$AMANDAGRP\
  --with-owner=root \
  --with-bsdudp-security \
  --with-ssh-security \
  --with-bsdtcp-security \
  --disable-static

make || exit 1
make install DESTDIR=$PKG || exit 1

( cd $PKG
  find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
)

chown -R root:root $PKG/usr/man
find $PKG/usr/man -type f -exec gzip -9 {} \;

mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a AUTHORS COPYRIGHT COPYRIGHT-APACHE COPYRIGHT-REGEX ChangeLog INSTALL \
  NEWS README ReleaseNotes $CWD/README-SLACKWARE $PKG/usr/doc/$PRGNAM-$VERSION
# Move documentation to Slackware'esque location
mv $PKG/usr/share/amanda/* $PKG/usr/doc/$PRGNAM-$VERSION
rm -rf $PKG/usr/share
chown -R root:root $PKG/usr/doc/$PRGNAM-$VERSION
chmod 644 $PKG/usr/doc/$PRGNAM-$VERSION/*

mkdir -p $PKG/etc/$PRGNAM
for i in 3hole.ps 8.5x11.ps DIN-A4.ps DLT.ps EXB-8500.ps \
  HP-DAT.ps amanda-client.conf amanda.conf chg-mcutil.conf \
  chg-multi.conf chg-scsi.conf disklist ; do
    cp -a example/$i $PKG/etc/$PRGNAM/$i.new;
done

chown -R root.root $PKG/etc/$PRGNAM
chmod 644 $PKG/etc/$PRGNAM/*

mkdir -p $PKG/var/lib/amanda
chown -R $AMANDAUSR:$AMANDAGRP $PKG/var/lib/amanda

mkdir $PKG/install
cp $CWD/doinst.sh $CWD/slack-desc $PKG/install

cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.tgz