Skip to content

Commit

Permalink
decide systemd/initd at runtime, add testing
Browse files Browse the repository at this point in the history
  • Loading branch information
john30 committed Oct 9, 2021
1 parent cd689b8 commit 866daf9
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions make_debian.sh
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,13 @@ else
fi
fi

echo
echo "*************"
echo " test"
echo "*************"
echo
(cd src/lib/ebus/test && make >/dev/null && ./test_filereader && ./test_data && ./test_message && ./test_symbol) || (echo "test failed"; exit 1)

echo
echo "*************"
echo " pack"
Expand Down Expand Up @@ -112,30 +119,26 @@ EOF
cat <<EOF > $RELEASE/DEBIAN/dirs
/etc/ebusd
/etc/default
/etc/init.d
/etc/logrotate.d
/lib/systemd/system
/usr/bin
EOF
if [ -d /run/systemd/system ]; then
echo /lib/systemd/system >> $RELEASE/DEBIAN/dirs
cat <<EOF > $RELEASE/DEBIAN/postinst
cat <<EOF > $RELEASE/DEBIAN/postinst
#!/bin/sh
echo "Instructions:"
echo "1. Edit /etc/default/ebusd if necessary"
echo " (especially if your device is not /dev/ttyUSB0)"
echo "2. Start the daemon with 'systemctl start ebusd'"
echo "3. Check the log file /var/log/ebusd.log"
echo "4. Make the daemon autostart with 'systemctl enable ebusd'"
EOF
if [ -d /run/systemd/system ]; then
start='systemctl start ebusd'
autostart='systemctl enable ebusd'
else
echo /etc/init.d >> $RELEASE/DEBIAN/dirs
cat <<EOF > $RELEASE/DEBIAN/postinst
#!/bin/sh
start='service ebusd start'
autostart='update-rc.d ebusd defaults'
fi
echo "Instructions:"
echo "1. Edit /etc/default/ebusd if necessary"
echo " (especially if your device is not /dev/ttyUSB0)"
echo "2. Start the daemon with 'service ebusd start'"
echo "2. Start the daemon with '$start'"
echo "3. Check the log file /var/log/ebusd.log"
echo "4. Make the daemon autostart with 'update-rc.d ebusd defaults'"
echo "4. Make the daemon autostart with '$autostart'"
EOF
fi
chmod 755 $RELEASE/DEBIAN/postinst
Expand Down

0 comments on commit 866daf9

Please sign in to comment.