#! /bin/sh # # sysv-rc prerm # set -e revert_to_legacy_ordering() { # First, check that we have all the needed actions recorded present="" missing="" for script in /etc/init.d/* ; do name=$(basename $script) case $name in *.dpkg*) continue; ;; esac enabled="" for f in $(ls /etc/rc?.d/[KS][0-9][0-9]$name 2> /dev/null) ; do if [ -e $f ] ; then if [ ! -f /var/lib/update-rc.d/$name ] ; then missing="$missing $script" else present="$present $name" fi break; fi done done if [ "$missing" ] ; then # Not using debconf, as might not be available when the # package is removed. cat < /dev/null done # Remove files generated by insserv to disable concurrent booting rm -f /etc/init.d/.depend.boot rm -f /etc/init.d/.depend.start rm -f /etc/init.d/.depend.stop return 0 } case "$1" in remove) # Refuse to be uninstalled unless all the needed # update-rc.d calls are recorded already. if [ ! -f /etc/init.d/.legacy-bootordering ] ; then revert_to_legacy_ordering exit $? fi ;; *) : ;; esac exit 0