case "$MODE" in
    finalization)
        rc_cleanup() {
            LEVEL=$1; shift
        
            echo "Cleaning up startup links in $LEVEL ..."
        
            RC_DIR=$(cd $ROOT/etc/runlevels/$LEVEL/; ls)
        
            for match in $@; do
                RC_DIR=$(echo "$RC_DIR"|sed "s/^$match$//g")
            done
        
            for name in $RC_DIR; do
                if [ -f $ROOT/etc/init.d/$name ] ; then
                    rc-update del $name 2>&1 >/dev/null
                    $ROOT/etc/init.d/$name stop 2>&1 >/dev/null
                fi
            done
        }
        if [ -n "$RCS_WHITELIST" ]; then
            rc_cleanup boot $RCS_WHITELIST
        fi
        if [ -n "$RC2_WHITELIST" ]; then
            rc_cleanup default $RC2_WHITELIST
        fi
        ;;
esac
