slackbuilds_ponce/misc/zaptel/zaptel.SlackBuild
2010-05-11 22:24:35 +02:00

88 lines
3 KiB
Bash

#!/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.11"
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