#kate: syntax bash; description "Handle custom screensavers" version "$Id$" # Start late so we can recover if it goes wrong... start on starting framework stop on (stopped framework or ota-update) export LANG LC_ALL pre-start script [ -f "/etc/upstart/functions" ] && source /etc/upstart/functions LINKSS_BASEDIR="/mnt/us/linkss" LINKSS_BINDIR="${LINKSS_BASEDIR}/bin" LINKSS_EMERGENCY="${LINKSS_BINDIR}/emergency.sh" LINKSS_ENABLE="${LINKSS_BASEDIR}/auto" LINKSS_SCRIPT="${LINKSS_BINDIR}/linkss" # First things first, check for an emergency script if [ -f ${LINKSS_EMERGENCY} ] ; then # We got one, make it executable and use it [ -x ${LINKSS_EMERGENCY} ] || chmod +x ${LINKSS_EMERGENCY} # Run it... f_log I linkss start "" "starting linkss emergency script" ${LINKSS_EMERGENCY} # And GET OUT! NOW! return 0 fi # Everything's fine, yeepee. if [ -f ${LINKSS_ENABLE} -a -f ${LINKSS_SCRIPT} ] ; then # We got our script, and we want to use it, so, make it executable [ -x ${LINKSS_SCRIPT} ] || chmod +x ${LINKSS_SCRIPT} # And run it! f_log I linkss start "" "starting linkss" ${LINKSS_SCRIPT} else f_log I linkss start "" "linkss is disabled" fi # Just in case... I hate upstart, and I don't want to hang the boot process... return 0 end script post-stop script [ -f "/etc/upstart/functions" ] && source /etc/upstart/functions LINKSS_BASEDIR="/mnt/us/linkss" LINKSS_BINDIR="${LINKSS_BASEDIR}/bin" LINKSS_SCRIPT_STOP="${LINKSS_BINDIR}/unlinkss" # Don't check for the enable trigger, we may have just removed it, so we'll still have to cleanup behind us. if [ -f ${LINKSS_SCRIPT_STOP} ] ; then # We got our script, and we want to use it, so, make it executable [ -x ${LINKSS_SCRIPT_STOP} ] || chmod +x ${LINKSS_SCRIPT_STOP} # And run it! f_log I linkss stop "" "stopping linkss" ${LINKSS_SCRIPT_STOP} else f_log I linkss stop "" "couldn't stop linkss" fi return 0 end script