summaryrefslogtreecommitdiff
path: root/misc/zaptel/zaptel.SlackBuild
blob: 6649e1e99c97f6f37b1550945acef1265c7ea768 (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
#!/bin/bash
# Copyright 2006, Alan Hicks, Lizella, GA
# 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.

# Modified by Robby Workman <rworkman@slackbuilds.org> with a few things 
# related to udev rules and such

set -e

PRGNAM="zaptel"
VERSION="1.4.12.1"
ARCH=${ARCH:-i486}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}

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

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

# There's no ./configure script here.  "make" has to be run once to
# configure the system and even when everything is ok, make will
# exit with a non-zero status the first time.  We have to kludge this
# so the script doesn't bail when called with "set -e".
make || true
make
make install DESTDIR=$PKG

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

mkdir -p $PKG/install $PKG/usr/doc/$PRGNAM-$VERSION $PKG/etc/rc.d
cp -a ChangeLog LICENSE README* $PKG/usr/doc/$PRGNAM-$VERSION/
cat $CWD/zaptel.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/zaptel.SlackBuild
find $PKG/usr/doc -type f -exec chmod 0644 {} \;
chown -R root:root $PKG/usr/doc

# Fix up the manpages
mv $PKG/usr/share/man $PKG/usr/man
gzip -9 $PKG/usr/man/man?/*.?

# Add this directory.  zaptel/asterisk will complain if it
# is not present
mkdir -p $PKG/var/lock/subsys

# Don't clobber config file and init script
mv $PKG/etc/zaptel.conf $PKG/etc/zaptel.conf.new
install -m 0755 $CWD/rc.zaptel $PKG/etc/rc.d/rc.zaptel.new

# udev handles device node creation
rm -fr $PKG/dev
# hotplug is dead
rm -rf $PKG/etc/hotplug
# rename udev rules file
mv $PKG/etc/udev/rules.d/xpp.rules $PKG/etc/udev/rules.d/96-xpp.rules

cat $CWD/slack-desc > $PKG/install/slack-desc
cat $CWD/doinst.sh > $PKG/install/doinst.sh

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