continue
fi
+ _ALREADY_DISABLED="false"
+
# service is already disabled
for _RUNLEVEL in /etc/rc*.d
do
- if [ ! -e "${_RUNLEVEL}/K*${_SERVICE}" ]
+ if ! ls ${_RUNLEVEL}/K*${_SERVICE} > /dev/null 2>&1
then
# disabled services have stop links in all runlevels
# if at least one runlevel does not have a stop link,
# then the service was not disabled and we need to continue
# with disabling the service later on
+ _ALREADY_DISABLED="false"
break
fi
# service is indeed already disabled
- continue
+ _ALREADY_DISABLED="true"
done
- if ls /etc/rc*.d/K*${_SERVICE} > /dev/null 2>&1 && \
- ! ls /etc/rc*.d/S*${_SERVICE} > /dev/null 2>&1
+ if [ "${_ALREADY_DISABLED}" = "false" ]
then
- # service has only stop links
- # therefore, using 'update-rc.d disable' does not work,
- # and using 'update-rc.d remove' is not upgrade safe
- # (on upgrades, the stop links would be re-added).
- for _SYMLINK in /etc/rc*.d/K*${_SERVICE}
- do
- rm -f ${_SYMLINK}
- ln -s /bin/live-initscripts-empty-stop ${_SYMLINK}
- done
- fi
+ if ls /etc/rc*.d/K*${_SERVICE} > /dev/null 2>&1 && \
+ ! ls /etc/rc*.d/S*${_SERVICE} > /dev/null 2>&1
+ then
+ # service has only stop links
+ # therefore, using 'update-rc.d disable' does not work,
+ # and using 'update-rc.d remove' is not upgrade safe
+ # (on upgrades, the stop links would be re-added).
+ for _SYMLINK in /etc/rc*.d/K*${_SERVICE}
+ do
+ rm -f ${_SYMLINK}
+ ln -s /bin/live-initscripts-empty-stop ${_SYMLINK}
+ done
+ fi
- # service is a normal service with both start and stop links
- update-rc.d -f ${_SERVICE} disable 2>&1 | \
- grep -v "update-rc.d: using dependency based boot sequencing" | \
- grep -v "update-rc.d: error: cannot find a LSB script for mountroot" || true
+ # service is a normal service with both start and stop links
+ update-rc.d -f ${_SERVICE} disable 2>&1 | \
+ grep -v "update-rc.d: using dependency based boot sequencing" | \
+ grep -v "update-rc.d: error: cannot find a LSB script for mountroot" || true
+ fi
done
;;