From 378d921afcbe43fc0acf7d79881fe5cf194572d4 Mon Sep 17 00:00:00 2001 From: David Woodfall Date: Fri, 15 Oct 2010 22:39:52 -0500 Subject: [PATCH] network/smstools3: Added (SMS Server Tools) Signed-off-by: Robby Workman --- network/smstools3/README | 17 ++++ network/smstools3/doinst.sh | 28 +++++++ network/smstools3/fixups.diff | 110 +++++++++++++++++++++++++ network/smstools3/slack-desc | 19 +++++ network/smstools3/smstools3.SlackBuild | 103 +++++++++++++++++++++++ network/smstools3/smstools3.info | 10 +++ 6 files changed, 287 insertions(+) create mode 100644 network/smstools3/README create mode 100644 network/smstools3/doinst.sh create mode 100644 network/smstools3/fixups.diff create mode 100644 network/smstools3/slack-desc create mode 100644 network/smstools3/smstools3.SlackBuild create mode 100644 network/smstools3/smstools3.info diff --git a/network/smstools3/README b/network/smstools3/README new file mode 100644 index 0000000000..9236a14861 --- /dev/null +++ b/network/smstools3/README @@ -0,0 +1,17 @@ +The SMS Server Tools 3 is a SMS Gateway software which can send and +receive short messages through GSM modems and mobile phones. + +You can send short messages by simply storing text files into a +special spool directory. The program monitors this directory and +sends new files automatically. It also stores received short messages +into another directory as text files. Binary messages (including +Unicode text) are also supported, for example ring tone messages. +It's also possible to send a WAP Push message to the WAP / MMS +capable mobile phone. + +The program can be run as a SMS daemon which can be started +automatically when the operating system starts. High availability +can be ensured by using multiple GSM devices (currently up to 64, +but this limit is easily changeable). + +Note: users should be added to dialout group to send/receive messages. diff --git a/network/smstools3/doinst.sh b/network/smstools3/doinst.sh new file mode 100644 index 0000000000..35e58cf2ff --- /dev/null +++ b/network/smstools3/doinst.sh @@ -0,0 +1,28 @@ +config() { + NEW="$1" + OLD="$(dirname $NEW)/$(basename $NEW .new)" + # If there's no config file by that name, mv it over: + if [ ! -r $OLD ]; then + mv $NEW $OLD + elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then + # toss the redundant copy + rm $NEW + fi + # Otherwise, we leave the .new copy for the admin to consider... +} + +preserve_perms() { + NEW="$1" + OLD="$(dirname $NEW)/$(basename $NEW .new)" + if [ -e $OLD ]; then + cp -a $OLD ${NEW}.incoming + cat $NEW > ${NEW}.incoming + mv ${NEW}.incoming $NEW + fi + config $NEW +} + +preserve_perms /etc/rc.d/rc.sms3.new +#chgrp -R dialout /var/spool/sms +#chmod -R g+rw /var/spool/sms + diff --git a/network/smstools3/fixups.diff b/network/smstools3/fixups.diff new file mode 100644 index 0000000000..7630a6d046 --- /dev/null +++ b/network/smstools3/fixups.diff @@ -0,0 +1,110 @@ +diff -Nur smstools3.orig//Makefile smstools3/Makefile +--- smstools3.orig//Makefile 2007-04-22 06:42:22.000000000 -0500 ++++ smstools3/Makefile 2010-10-15 22:34:14.971037552 -0500 +@@ -2,7 +2,7 @@ + + # If you change destination of executables, remember to change + # startup script (init.d/sms3) too. +-BINDIR=/usr/local/bin ++BINDIR=/usr/bin + + VERSION=$(shell grep package_version src/version.h | cut -f2) + +@@ -10,7 +10,7 @@ + cd src && $(MAKE) -$(MAKEFLAGS) + + install: compile +- ./install.sh $(BINDIR) ++ ./install.sh $(DESTDIR)$(BINDIR) + + uninstall: + ./uninstall.sh $(BINDIR) +diff -Nur smstools3.orig//install.sh smstools3/install.sh +--- smstools3.orig//install.sh 2007-04-22 06:43:17.000000000 -0500 ++++ smstools3/install.sh 2010-10-15 22:34:14.971037552 -0500 +@@ -5,6 +5,7 @@ + if [ -z "$BINDIR" ]; then + BINDIR=/usr/local/bin + fi ++SBINDIR=$DESTDIR/usr/sbin + + makepath() + { +@@ -64,7 +65,7 @@ + echo " Skipped $1, directory already exists" + else + echo " Creating directory $1" +- mkdir $1 ++ mkdir -p $1 + fi + } + +@@ -76,10 +77,11 @@ + + echo "Installing binary program files" + makepath $BINDIR ++makepath $SBINDIR + if [ -f src/smsd.exe ]; then + forcecopy src/smsd.exe $BINDIR/smsd.exe + else +- forcecopy src/smsd $BINDIR/smsd ++ forcecopy src/smsd $SBINDIR/smsd + fi + delete $BINDIR/getsms + delete $BINDIR/putsms +@@ -90,32 +92,18 @@ + copy scripts/sms2unicode $BINDIR/sms2unicode + copy scripts/unicode2sms $BINDIR/unicode2sms + +-echo "Installing config file" +-copy examples/smsd.conf.easy /etc/smsd.conf +- + echo "Creating minimum spool directories" +-makedir /var/spool +-makedir /var/spool/sms +-makedir /var/spool/sms/incoming +-makedir /var/spool/sms/outgoing +-makedir /var/spool/sms/checked ++makedir $DESTDIR/var/spool ++makedir $DESTDIR/var/spool/sms ++makedir $DESTDIR/var/spool/sms/incoming ++makedir $DESTDIR/var/spool/sms/outgoing ++makedir $DESTDIR/var/spool/sms/checked + + echo "Installing start-script" +-SMS3SCRIPT=scripts/sms3 +-if [ -d /etc/init.d ]; then +- copy scripts/sms3 /etc/init.d/sms3 +- SMS3SCRIPT=/etc/init.d/sms3 +-elif [ -d /sbin/init.d ]; then +- copy scripts/sms3 /sbin/init.d/sms3 +- SMS3SCRIPT=/sbin/init.d/sms3 +-else +- echo " I do not know where to copy scripts/sms3. Please find out yourself." +-fi ++makedir $DESTDIR/etc/rc.d ++copy scripts/sms3 $DESTDIR/etc/rc.d/rc.sms3.new ++SMS3SCRIPT=/etc/rc.d/rc.sms3 + + echo "" + echo "Example script files are not installed automatically." + echo 'Please dont forget to edit /etc/smsd.conf.' +-if [ "$BINDIR" != "/usr/local/bin" ]; then +- echo "You have installed executables to $BINDIR," +- echo "you should manually edit $SMS3SCRIPT script." +-fi +diff -Nur smstools3.orig//scripts/sms3 smstools3/scripts/sms3 +--- smstools3.orig//scripts/sms3 2010-05-04 04:21:44.000000000 -0500 ++++ smstools3/scripts/sms3 2010-10-15 22:34:14.971037552 -0500 +@@ -24,9 +24,9 @@ + # Logfile can also be defined in here: + LOGFILE="/var/log/smsd.log" + +-DAEMON=/usr/local/bin/smsd ++DAEMON=/usr/sbin/smsd + # A program which turns power off for couple of seconds: +-RESETMODEMS=/usr/local/bin/smsd_resetmodems ++RESETMODEMS=/usr/bin/smsd_resetmodems + NAME=smsd + PSOPT="-e" + ECHO=echo diff --git a/network/smstools3/slack-desc b/network/smstools3/slack-desc new file mode 100644 index 0000000000..f5df68ebcb --- /dev/null +++ b/network/smstools3/slack-desc @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. Line +# up the first '|' above the ':' following the base package name, and the '|' +# on the right side marks the last column you can put a character in. You must +# make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':'. + + |-----handy-ruler------------------------------------------------------| +smstools3: smstools3 (SMS Server Tools) +smstools3: +smstools3: The SMS Server Tools 3 is a SMS Gateway software which can send and +smstools3: receive short messages through GSM modems and mobile phones. +smstools3: +smstools3: Homepage: http://smstools3.kekekasvi.com +smstools3: +smstools3: +smstools3: +smstools3: +smstools3: diff --git a/network/smstools3/smstools3.SlackBuild b/network/smstools3/smstools3.SlackBuild new file mode 100644 index 0000000000..165e5347ec --- /dev/null +++ b/network/smstools3/smstools3.SlackBuild @@ -0,0 +1,103 @@ +#!/bin/sh + +# Slackware build script for smstools3 +# Copyright 2010 David Woodfall +# 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. + +PRGNAM=smstools3 +VERSION=${VERSION:-3.1.14} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} + +# Maximum number of supported modems +NUM_MODEMS=${NUM_MODEMS:-64} + +if [ -z "$ARCH" ]; then + case "$( uname -m )" in + i?86) ARCH=i486 ;; + arm*) ARCH=arm ;; + *) ARCH=$( uname -m ) ;; + esac +fi + +CWD=$(pwd) +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +if [ "$ARCH" = "i486" ]; then + SLKCFLAGS="-O2 -march=i486 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIRSUFFIX="64" +else + SLKCFLAGS="-O2" + LIBDIRSUFFIX="" +fi + +set -e + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP +rm -rf $PRGNAM +tar xvf $CWD/$PRGNAM-$VERSION.tar.gz +cd $PRGNAM +chown -R root:root . +find . \ + \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \ + -exec chmod 755 {} \; -o \ + \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \ + -exec chmod 644 {} \; + +patch --verbose -p1 < $CWD/fixups.diff + +DESTDIR=$PKG make install + +find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \ + | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true + +# Add sample config files +cat examples/smsd.conf.easy > $PKG/etc/smsd.conf.easy +cat examples/smsd.conf.full > $PKG/etc/smsd.conf.full +cat examples/smsd.conf.net > $PKG/etc/smsd.conf.net +cat examples/smsd.conf.non-root > $PKG/etc/smsd.conf.non-root + +# Fix some ownership/permissions +chown -R root:dialout $PKG/var/spool/sms +chmod -R g+rw $PKG/var/spool/sms + +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +cp -a \ + LICENSE README scripts examples doc/* \ + $PKG/usr/doc/$PRGNAM-$VERSION +cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild +find $PKG/usr/doc -type f -exec chmod 0644 {} \; + +mkdir -p $PKG/install +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.${PKGTYPE:-tgz} diff --git a/network/smstools3/smstools3.info b/network/smstools3/smstools3.info new file mode 100644 index 0000000000..69f061aed7 --- /dev/null +++ b/network/smstools3/smstools3.info @@ -0,0 +1,10 @@ +PRGNAM="smstools3" +VERSION="3.1.14" +HOMEPAGE="http://smstools3.kekekasvi.com" +DOWNLOAD="http://smstools3.kekekasvi.com/packages/smstools3-3.1.14.tar.gz" +MD5SUM="e0f9f84240f0db9a286aa3a5fa3bd8fb" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +MAINTAINER="David Woodfall" +EMAIL="dave@dawoodfall.net" +APPROVED="rworkman"