Browse Source

Add daemon control script

slackware-14.2
Damien Goutte-Gattat 8 years ago
parent
commit
4b98158287
  1. 12
      l/pcsc-lite/doinst.sh
  2. 8
      l/pcsc-lite/pcsc-lite.SlackBuild
  3. 40
      l/pcsc-lite/rc.pcscd

12
l/pcsc-lite/doinst.sh

@ -0,0 +1,12 @@
#!/bin/sh
if ! grep ^scard /etc/group > /dev/null ; then
/usr/sbin/groupadd -g 280 scard
fi
if ! grep ^scard /etc/passwd > /dev/null ; then
/usr/sbin/useradd -u 280 -c "User for SmartCard" -d /var/run/pcscd -g scard scard
fi
mkdir -p var/run/pcscd
chown scard:scard var/run/pcscd

8
l/pcsc-lite/pcsc-lite.SlackBuild

@ -33,7 +33,7 @@ WGET=${WGET:-https://alioth.debian.org/frs/download.php/file/3862/$ARCHIVE}
# Build infos
NAMEPKG=${NAMEPKG:-pcsc-lite}
BUILD=${BUILD:-1GGD}
BUILD=${BUILD:-2GGD}
ARCH=${ARCH:-$(uname -m | sed 's/^i.86$/i486/;s/^arm.*/arm/')}
JOBS=${JOBS:-1}
EXT=${EXT:-txz}
@ -106,8 +106,12 @@ mkdir -p $PKG/usr/doc/$NAME
install -m 644 AUTHORS COPYING ChangeLog DRIVERS HELP NEWS README TODO \
SECURITY $PKG/usr/doc/$NAME
# Copy slack-desc file
# Install control script
install -D -m 644 $CWD/rc.pcscd $PKG/etc/rc.d/rc.pcscd
# Copy slack-desc and doinst.sh files
install -D -m 644 $CWD/slack-desc $PKG/install/slack-desc
install -m 755 $CWD/doinst.sh $PKG/install/doinst.sh
# Package the tree
cd $PKG

40
l/pcsc-lite/rc.pcscd

@ -0,0 +1,40 @@
#!/bin/sh
PIDFILE=/var/run/pcscd/pcscd.pid
case "$1" in
start)
su scard -c "/usr/sbin/pcscd"
;;
restart)
$0 stop
sleep 1
$0 start
;;
stop)
if [ -f $PIDFILE ] && kill -0 $(cat $PIDFILE) ; then
kill -TERM $(cat $PIDFILE)
fi
;;
status)
if [ -f $PIDFILE ] && kill -0 $(cat $PIDFILE) ; then
echo "pcscd is running."
else
echo "pcscd is not running."
fi
;;
reload)
/usr/sbin/pcscd --hotplug
;;
*)
echo "usage: $0 {start|stop|restart|status|reload}"
exit 1
;;
esac
exit 0
Loading…
Cancel
Save