2008-04-07 08:31:27 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
setup_sysv_init() {
|
|
|
|
echo 'setting up sysv init'
|
|
|
|
|
|
|
|
rlvl=`cat /etc/inittab | grep initdefault | sed 's/^id://; s/:init.*$//'`
|
|
|
|
if [ $? != 0 -o -z "$rlvl" ]; then
|
|
|
|
echo 'default runlevel detection failed.'
|
|
|
|
rlvl=2
|
|
|
|
fi
|
|
|
|
echo "selected runlevel: $rlvl"
|
|
|
|
|
|
|
|
if [ "$2" = 'remove' ]; then
|
|
|
|
rm -f /etc/init.d/spacenavd
|
|
|
|
rm -f /etc/rc${rlvl}.d/S99spacenavd
|
|
|
|
else
|
|
|
|
install -m 755 init_script /etc/init.d/spacenavd
|
|
|
|
cd /etc/rc${rlvl}.d
|
|
|
|
rm -f S99spacenavd
|
|
|
|
ln -s ../init.d/spacenavd S99spacenavd
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
setup_bsd_init() {
|
|
|
|
echo 'setting up bsd init'
|
|
|
|
echo "BSD init setup not implemented yet, you'll have to do it manually."
|
|
|
|
}
|
|
|
|
|
2008-08-14 02:10:34 +00:00
|
|
|
|
|
|
|
if [ "$1" = '--no-install' ]; then
|
|
|
|
echo
|
|
|
|
echo --- Spacenavd installation complete ---
|
|
|
|
echo To have spacenavd start automatically at bootup, you must add an appropriate
|
|
|
|
echo "init script. Refer to your system's manual for details on how to do that."
|
|
|
|
echo An example init script is available in the spacenavd source directory.
|
|
|
|
echo If you wish to attempt and install an init script automatically, run ./setup_init
|
|
|
|
echo
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2008-04-07 08:31:27 +00:00
|
|
|
(stat /etc/init.d && stat /etc/rc0.d) >/dev/null 2>/dev/null
|
|
|
|
if [ $? = 0 ]; then
|
|
|
|
setup_sysv_init
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
(stat /etc/rc && stat /etc/rc.d) >/dev/null 2>/dev/null
|
2008-08-14 02:10:34 +00:00
|
|
|
if [ $? = 0 ]; then
|
2008-04-07 08:31:27 +00:00
|
|
|
setup_bsd_init
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "You're either using a non-standard init or this detection failed."
|
|
|
|
echo "You'll have to setup your init, to start spacenavd, manually."
|