decide systemd/initd at runtime, add testing

This commit is contained in:
john30
2021-10-09 11:35:56 +02:00
parent cd689b8a25
commit 866daf9f1d
+18 -15
View File
@@ -78,6 +78,13 @@ else
fi fi
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 "*************" echo "*************"
echo " pack" echo " pack"
@@ -112,30 +119,26 @@ EOF
cat <<EOF > $RELEASE/DEBIAN/dirs cat <<EOF > $RELEASE/DEBIAN/dirs
/etc/ebusd /etc/ebusd
/etc/default /etc/default
/etc/init.d
/etc/logrotate.d /etc/logrotate.d
/lib/systemd/system
/usr/bin /usr/bin
EOF EOF
cat <<EOF > $RELEASE/DEBIAN/postinst
#!/bin/sh
if [ -d /run/systemd/system ]; then if [ -d /run/systemd/system ]; then
echo /lib/systemd/system >> $RELEASE/DEBIAN/dirs start='systemctl start ebusd'
cat <<EOF > $RELEASE/DEBIAN/postinst autostart='systemctl enable ebusd'
#!/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
else else
echo /etc/init.d >> $RELEASE/DEBIAN/dirs start='service ebusd start'
cat <<EOF > $RELEASE/DEBIAN/postinst autostart='update-rc.d ebusd defaults'
#!/bin/sh fi
echo "Instructions:" echo "Instructions:"
echo "1. Edit /etc/default/ebusd if necessary" echo "1. Edit /etc/default/ebusd if necessary"
echo " (especially if your device is not /dev/ttyUSB0)" 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 "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 EOF
fi fi
chmod 755 $RELEASE/DEBIAN/postinst chmod 755 $RELEASE/DEBIAN/postinst