summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenis Yantarev2015-06-09 00:47:36 +0300
committerDenis Yantarev2015-06-09 00:47:36 +0300
commit8f9b416bdde1b7aaf08a874b52ccb94a23c5f517 (patch)
tree7f16c9149167c1d1b589d85a64c34f952fe8227c
downloadaur-8f9b416bdde1b7aaf08a874b52ccb94a23c5f517.tar.gz
Initial import
-rw-r--r--.SRCINFO39
-rw-r--r--PKGBUILD83
-rw-r--r--makefile.patch11
-rw-r--r--sendsms.patch38
-rw-r--r--smsd66
-rw-r--r--smsd.conf10
-rw-r--r--smsd.conf.d3
-rw-r--r--smsd.install33
-rw-r--r--smsd.logrotate7
-rw-r--r--smsd.service11
-rw-r--r--smsd.tmpfiles1
11 files changed, 302 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..7a4a8fd4debb
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,39 @@
+pkgbase = smstools3
+ pkgdesc = SMS gateway which can send and receive messages through GSM modems and mobile phones
+ pkgver = 3.1.15
+ pkgrel = 3
+ url = http://smstools3.kekekasvi.com/
+ install = smsd.install
+ arch = i686
+ arch = x86_64
+ license = GPL
+ makedepends = gcc
+ makedepends = make
+ makedepends = patch
+ depends = bash
+ backup = etc/smsd.conf
+ backup = etc/conf.d/smsd
+ backup = etc/logrotate.d/smsd
+ source = http://smstools3.kekekasvi.com/packages/smstools3-3.1.15.tar.gz
+ source = makefile.patch
+ source = sendsms.patch
+ source = smsd.install
+ source = smsd.conf
+ source = smsd.conf.d
+ source = smsd.tmpfiles
+ source = smsd.logrotate
+ source = smsd
+ source = smsd.service
+ md5sums = 0241ef60e646fac1a06254a848e61ed7
+ md5sums = 4cadb840b5604a73831ef53f8c24bb11
+ md5sums = eabdaf793ed2fb9883ea0923b31450d3
+ md5sums = d0489ac2ec24784eabf2e781afd86240
+ md5sums = ebc64ebc17f874fc0b1e6f0b4ce7fc79
+ md5sums = cb30274447a530ff2bd31ef7ac8a34b3
+ md5sums = 6209da5f6d2b53bb8814f6181aa42848
+ md5sums = 647c58aa56c6a29d6e68e73c239715f4
+ md5sums = f42d39eb2c21ebf9f2ff8549a4f893e5
+ md5sums = 7357a577480e95463112963f4244d2c1
+
+pkgname = smstools3
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..f6e6db027b87
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,83 @@
+# Maintainer: Denis Yantarev <denis dot yantarev at gmail dot com>
+
+pkgname=smstools3
+pkgver=3.1.15
+pkgrel=3
+pkgdesc="SMS gateway which can send and receive messages through GSM modems and mobile phones"
+arch=('i686' 'x86_64')
+url="http://smstools3.kekekasvi.com/"
+license=('GPL')
+backup=(etc/smsd.conf etc/conf.d/smsd etc/logrotate.d/smsd)
+install=smsd.install
+depends=('bash')
+makedepends=('gcc' 'make' 'patch')
+source=(http://smstools3.kekekasvi.com/packages/$pkgname-$pkgver.tar.gz
+ makefile.patch
+ sendsms.patch
+ smsd.install
+ smsd.conf
+ smsd.conf.d
+ smsd.tmpfiles
+ smsd.logrotate
+ smsd
+ smsd.service)
+md5sums=('0241ef60e646fac1a06254a848e61ed7'
+ '4cadb840b5604a73831ef53f8c24bb11'
+ 'eabdaf793ed2fb9883ea0923b31450d3'
+ 'd0489ac2ec24784eabf2e781afd86240'
+ 'ebc64ebc17f874fc0b1e6f0b4ce7fc79'
+ 'cb30274447a530ff2bd31ef7ac8a34b3'
+ '6209da5f6d2b53bb8814f6181aa42848'
+ '647c58aa56c6a29d6e68e73c239715f4'
+ 'f42d39eb2c21ebf9f2ff8549a4f893e5'
+ '7357a577480e95463112963f4244d2c1')
+
+build()
+{
+ cd $srcdir || return 1
+ patch -p0 <makefile.patch || return 1
+ patch -p0 <sendsms.patch || return 1
+
+ cd $pkgname || return 1
+ make || return 1
+}
+
+package()
+{
+ cd $srcdir/$pkgname || return 1
+
+ mkdir -p $pkgdir/usr/bin/ || return 1
+ install -m0755 $srcdir/$pkgname/src/smsd $pkgdir/usr/bin/smsd || return 1
+ install -m0755 $srcdir/$pkgname/scripts/sendsms $pkgdir/usr/bin/sendsms || return 1
+ install -m0755 $srcdir/$pkgname/scripts/sms2html $pkgdir/usr/bin/sms2html || return 1
+ install -m0755 $srcdir/$pkgname/scripts/sms2unicode $pkgdir/usr/bin/sms2unicode || return 1
+ install -m0755 $srcdir/$pkgname/scripts/unicode2sms $pkgdir/usr/bin/unicode2sms || return 1
+
+ mkdir -p $pkgdir/etc/ || return 1
+ install -m0644 $srcdir/smsd.conf $pkgdir/etc/smsd.conf || return 1
+
+ mkdir -p $pkgdir/etc/rc.d/ || return 1
+ install -m0755 $srcdir/smsd $pkgdir/etc/rc.d/smsd || return 1
+
+ mkdir -p $pkgdir/etc/conf.d/ || return 1
+ install -m0644 $srcdir/smsd.conf.d $pkgdir/etc/conf.d/smsd || return 1
+
+ mkdir -p $pkgdir/etc/logrotate.d/ || return 1
+ install -m0644 $srcdir/smsd.logrotate $pkgdir/etc/logrotate.d/smsd || return 1
+
+ mkdir -p $pkgdir/usr/lib/systemd/system/ || return 1
+ install -m0644 $srcdir/smsd.service $pkgdir/usr/lib/systemd/system/smsd.service || return 1
+
+ mkdir -p $pkgdir/usr/lib/tmpfiles.d/ || return 1
+ install -m0644 $srcdir/smsd.tmpfiles $pkgdir/usr/lib/tmpfiles.d/smsd.conf || return 1
+
+ mkdir -p $pkgdir/var/spool/sms/incoming || return 1
+ mkdir -p $pkgdir/var/spool/sms/outgoing || return 1
+ mkdir -p $pkgdir/var/spool/sms/checked || return 1
+ chmod 0750 $pkgdir/var/spool/sms || return 1
+ chmod 0770 $pkgdir/var/spool/sms/* || return 1
+
+ mkdir -p $pkgdir/var/log/smsd || return 1
+ chmod 0770 $pkgdir/var/log/smsd || return 1
+}
+
diff --git a/makefile.patch b/makefile.patch
new file mode 100644
index 000000000000..dc50fb0a6f8f
--- /dev/null
+++ b/makefile.patch
@@ -0,0 +1,11 @@
+--- ./smstools3/src/Makefile.old 2013-12-03 13:37:03.000000000 +0400
++++ ./smstools3/src/Makefile 2013-12-03 13:37:33.000000000 +0400
+@@ -43,7 +43,7 @@
+
+ ifneq (,$(findstring SOLARIS,$(CFLAGS)))
+ ifeq (,$(findstring DISABLE_INET_SOCKET,$(CFLAGS)))
+-override LFLAGS += -lsocket -lnsl
++ override LFLAGS += -lsocket -lnsl
+ endif
+ endif
+
diff --git a/sendsms.patch b/sendsms.patch
new file mode 100644
index 000000000000..2d697229ac26
--- /dev/null
+++ b/sendsms.patch
@@ -0,0 +1,38 @@
+--- ./smstools3/scripts/sendsms.old 2010-07-08 16:41:13.000000000 +0400
++++ ./smstools3/scripts/sendsms 2010-10-30 13:37:44.000000000 +0400
+@@ -18,7 +18,7 @@
+ # When creating keys, remember to use -n for echo:
+ # echo -n "key" | md5sum
+
+-smsd_user="smsd"
++smsd_group="smsd"
+
+ # Will need echo which accepts -n argument:
+ ECHO=echo
+@@ -85,10 +85,10 @@
+ fi
+ fi
+
+-owner=""
+-if [ -f /etc/passwd ]; then
+- if grep $smsd_user: /etc/passwd >/dev/null; then
+- owner=$smsd_user
++group=""
++if [ -f /etc/group ]; then
++ if grep $smsd_group: /etc/group >/dev/null; then
++ group=$smsd_group
+ fi
+ fi
+
+@@ -107,8 +107,9 @@
+ $ECHO -n "$TEXT" | iconv -t UNICODEBIG >> $TMPFILE
+ fi
+
+- if [ "x$owner" != x ]; then
+- chown $owner $TMPFILE
++ if [ "x$group" != x ]; then
++ chgrp $group $TMPFILE
++ chmod 0660 $TMPFILE
+ fi
+
+ FILE=`mktemp /var/spool/sms/outgoing/send_XXXXXX`
diff --git a/smsd b/smsd
new file mode 100644
index 000000000000..11a78d2c0398
--- /dev/null
+++ b/smsd
@@ -0,0 +1,66 @@
+#!/bin/bash
+
+if [ "$(whoami)" != "root" ]; then
+ echo "You must be root to start/restart/stop services."
+ exit 1
+fi
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+DESC="SMS Server Tools 3"
+
+PARAMS=""
+USER="smsd"
+GROUP="smsd"
+RUNDIR="/var/run/smsd"
+PIDFILE="$RUNDIR/smsd.pid"
+INFOFILE="$RUNDIR/smsd.working"
+LOGFILE="/var/log/smsd/smsd.log"
+
+[ -r "/etc/conf.d/smsd" ] && . /etc/conf.d/smsd
+
+PID=`cat $PIDFILE 2>/dev/null`
+
+case "$1" in
+ start)
+ stat_busy "Starting $DESC"
+ [ -n "$USER" ] && PARAMS="-u$USER $PARAMS"
+ [ -n "$GROUP" ] && PARAMS="-g$GROUP $PARAMS"
+ [ -n "$LOGFILE" ] && PARAMS="-l$LOGFILE $PARAMS"
+ if [ -z "$PID" ]; then
+ [ -d "$RUNDIR" ] || mkdir "$RUNDIR"
+ [ -n "$USER" ] && chown $USER "$RUNDIR"
+ [ -n "$GROUP" ] && chgrp $GROUP "$RUNDIR"
+ /usr/bin/smsd -n MAINPROCESS -p$PIDFILE -i$INFOFILE $PARAMS
+ sleep 1
+ PID=`cat $PIDFILE 2>/dev/null`
+ if [ -z "$PID" ]; then
+ stat_fail
+ exit 1
+ fi
+ add_daemon smsd
+ stat_done
+ else
+ echo -n "Already running!"
+ stat_fail
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping $DESC"
+ [ -n "$PID" ] && kill $PID &>/dev/null
+ if [ $? -gt 0 ]; then
+ echo -n "Not started!"
+ stat_fail
+ else
+ rm_daemon smsd
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
diff --git a/smsd.conf b/smsd.conf
new file mode 100644
index 000000000000..39c75c95c778
--- /dev/null
+++ b/smsd.conf
@@ -0,0 +1,10 @@
+# Example smsd.conf. Read the manual for a description
+
+devices = GSM1
+logfile = /var/log/smsd/smsd.log
+loglevel = 7
+
+[GSM1]
+device = /dev/ttyS0
+incoming = yes
+#pin = 1111
diff --git a/smsd.conf.d b/smsd.conf.d
new file mode 100644
index 000000000000..a4aeefab12b4
--- /dev/null
+++ b/smsd.conf.d
@@ -0,0 +1,3 @@
+USER="smsd"
+GROUP="smsd"
+
diff --git a/smsd.install b/smsd.install
new file mode 100644
index 000000000000..a4d5b74791f7
--- /dev/null
+++ b/smsd.install
@@ -0,0 +1,33 @@
+# arg 1: the new package version
+post_install() {
+ getent group smsd >/dev/null 2>&1 || groupadd smsd
+ if getent passwd smsd >/dev/null 2>&1; then
+ usermod -d /var/spool/sms -c 'SMS Gateway Daemon' \
+ -s /sbin/nologin smsd >/dev/null 2>&1
+ else
+ useradd -c 'SMS Gateway Daemon' -g smsd \
+ -d /var/spool/sms -s /sbin/nologin smsd >/dev/null 2>&1
+ fi
+ groupmems -g uucp -a smsd >/dev/null 2>&1
+ passwd -l smsd >/dev/null 2>&1
+ chown root:smsd $pkgdir/var/spool/sms
+ chmod -R 0750 $pkgdir/var/spool/sms
+ chown smsd:smsd $pkgdir/var/spool/sms/*
+ chmod -R 0770 $pkgdir/var/spool/sms/*
+ chown root:smsd $pkgdir/var/log/smsd
+ chmod -R 0770 $pkgdir/var/log/smsd
+ systemd-tmpfiles --create /usr/lib/tmpfiles.d/smsd.conf >/dev/null 2>&1
+}
+
+# arg 1: the new package version
+# arg 2: the old package version
+post_upgrade() {
+ post_install $1
+ systemctl --system daemon-reload >/dev/null 2>&1
+}
+
+# arg 1: the old package version
+pre_remove() {
+ getent passwd smsd >/dev/null 2>&1 && userdel smsd
+}
+
diff --git a/smsd.logrotate b/smsd.logrotate
new file mode 100644
index 000000000000..e8008f06b196
--- /dev/null
+++ b/smsd.logrotate
@@ -0,0 +1,7 @@
+/var/log/smsd/smsd.log {
+ notifempty
+ missingok
+ sharedscripts
+ copytruncate
+ su root smsd
+}
diff --git a/smsd.service b/smsd.service
new file mode 100644
index 000000000000..af75e79fb1e2
--- /dev/null
+++ b/smsd.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=SMS Server Tools 3
+
+[Service]
+User=smsd
+PIDFile=/run/smsd/smsd.pid
+ExecStart=/usr/bin/smsd -n MAINPROCESS -l/var/log/smsd/smsd.log \
+ -p/run/smsd/smsd.pid -i/run/smsd/smsd.working
+
+[Install]
+WantedBy=multi-user.target
diff --git a/smsd.tmpfiles b/smsd.tmpfiles
new file mode 100644
index 000000000000..4627bc7ea49a
--- /dev/null
+++ b/smsd.tmpfiles
@@ -0,0 +1 @@
+d /run/smsd 0755 smsd smsd -