set -e . /usr/share/debconf/confmodule
systemctl daemon-reload
systemctl enable robotcontrol
systemctl enable rc_battery_monitor
if [ ! "$DEBIAN_FRONTEND" = "noninteractive" ] ; then
set +e
db_get librobotcontrol/q_enable_dt
ENABLE_DT=$RET
db_get librobotcontrol/q_runonboot
PROG=$RET
if [ ! -d "/etc/robotcontrol" ]; then
echo "making /etc/robotcontrol"
mkdir /etc/robotcontrol
fi
if [ "$PROG" = "rc_blink" ]; then
echo "setting rc_blink to run on boot"
ln -s -f /usr/bin/rc_blink /etc/robotcontrol/link_to_startup_program
elif [ "$PROG" = "rc_balance" ]; then
ln -s -f /usr/bin/rc_balance /etc/robotcontrol/link_to_startup_program
echo "setting rc_balance to run on boot"
elif [ "$PROG" = "none" ]; then
echo "setting nothing to run on boot"
rm -f /etc/robotcontrol/link_to_startup_program
else
echo "leaving current robot control startup program alone"
fi
systemctl start rc_battery_monitor
systemctl start robotcontrol
if [ "$ENABLE_DT" = "true" ]; then
echo "Configuring Device Tree"
configure_robotics_dt
fi
echo "**********************************************"
echo "librobotcontrol package installation complete."
if [ "$ENABLE_DT" = "true" ]; then
echo "Please reboot now to load new device tree."
fi
echo "**********************************************"
set -e
fi
exit 0