Add service install for systemd

This commit is contained in:
David Schmenk 2017-05-20 14:43:29 -07:00
parent e0b6886a67
commit c1371f42b9
4 changed files with 10 additions and 51 deletions

4
debian/a2pi.default vendored
View File

@ -8,5 +8,5 @@
# Additional options that are passed to the Daemon.
# If you are not using the default serial port /dev/ttyAMA0, enter it here.
# DAEMON_OPTS="/dev/ttyUSB0"
DAEMON_OPTS=""
# A2PID_OPTS="/dev/ttyUSB0"
A2PID_OPTS=""

2
debian/init.d vendored
View File

@ -49,7 +49,7 @@ do_start()
#start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null || return 1
#start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \ $DAEMON_ARGS \ || return 2
killall -HUP $NAMED
$DAEMON $DAEMON_ARGS $DAEMON_OPTS || return 2
$DAEMON $DAEMON_ARGS $A2PID_OPTS || return 2
# Add code here, if necessary, that waits for the process to be ready
# to handle requests from services started subsequently which depend
# on this one. As a last resort, sleep for some time.

50
debian/postinst vendored
View File

@ -81,54 +81,12 @@ case "$1" in
echo "deb http://schmenk.is-a-geek.com/raspbian jessie contrib" >> /etc/apt/sources.list
fi
#
# Remove old install
# Add a2pi service to systemd
#
if [ -f /usr/local/bin/a2pid ] ; then
rm /usr/local/bin/a2pid
fi
if [ -f /usr/local/bin/a2serclk ] ; then
rm /usr/local/bin/a2serclk
fi
if [ -f /usr/local/bin/a2mon ] ; then
rm /usr/local/bin/a2mon
fi
if [ -f /usr/local/bin/dskread ] ; then
rm /usr/local/bin/dskread
fi
if [ -f /usr/local/bin/dskwrite ] ; then
rm /usr/local/bin/dskwrite
fi
if [ -f /usr/local/bin/a2term ] ; then
rm /usr/local/bin/a2term
fi
if [ -f /usr/local/bin/fusea2pi ] ; then
rm /usr/local/bin/fusea2pi
fi
if [ -f /usr/local/bin/a2joy ] ; then
rm /usr/local/bin/a2joy
fi
if [ -f /usr/local/bin/a2joymou ] ; then
rm /usr/local/bin/a2joymou
fi
if [ -f /usr/local/bin/a2joypad ] ; then
rm /usr/local/bin/a2joypad
fi
if [ -f /usr/local/bin/a2mount ] ; then
rm /usr/local/bin/a2mount
fi
if [ -f /usr/local/bin/bload ] ; then
rm /usr/local/bin/bload
fi
if [ -f /usr/local/bin/brun ] ; then
rm /usr/local/bin/brun
fi
if [ -f /usr/local/sbin/a2pid ] ; then
rm /usr/local/sbin/a2pid
fi
if [ "$(grep a2pid /etc/rc.local)" != "" ] ; then
mv /etc/rc.local /etc/rc.local.old
sed -e '/^# Start Apple II Pi/d' -e '/a2pid/d' -e '/^wait 1/d' -e '/a2joy/'d /etc/rc.local.old > /etc/rc.local
rm /etc/rc.local.old
cp /usr/share/a2pi/a2pi.service /lib/systemd/
systemctl enable a2pi
systemctl reload a2pi
fi
;;

View File

@ -5,7 +5,8 @@ After=network.target
[Service]
Type=idle
Environment="HOME=/root"
ExecStart=/sbin/a2pid
EnvironmentFile=-/etc/default/a2pi
ExecStart=/sbin/a2pid $A2PID_OPTS
Restart=on-failure
RestartSec=60