Hello

a bug has been identified which does make it necessary to update the above.


-- 
Regards,
Thilo

4096R/0xC70B1A8F
721B 1BA0 095C 1ABA 3FC6  7C18 89A4 A2A0 C70B 1A8F

_myservice()
{
    local cur prev words cword
    _init_completion || return

    if [[ $cword -ge 1 ]]; then
        _services
        [[ -e /etc/mandrake-release ]] && _xinetd_services
    fi
}

_rc-update()
{
    local cur prev words cword
    _init_completion || return

    if [[ $cword -eq 1 && $prev == ?(*/)rc-update ]]; then
        COMPREPLY=( $( compgen -W 'enable disable remove add del show' -- 
"$cur" ) )
    else
        _services
    fi
}
builtin complete -F _rc-update  rc-update
builtin complete -F _myservice  rc-add rc-del rc-show


rc-update()
{
case "${1}" in
    enable|add)
        # This action here shall enable a initsrcipt.
        # This is done by (re)enforcing the defaults described as LSB headers.
        #
        for i in "${@:2}";
        do
            find /etc/rc[S0-6].d/ -iname "*${i}" -type l -exec unlink {} +
            insserv -d ${i};
        done
        ;;

    disable|remove|del)
        # Here the the initscript gets disabled.
        # This is done by place a single stop link in /etc/rc1.d/
        # Due to this a package update wont change this settings.
        # It has be mentioned that not used stop-actions do not hit performance
        # read https://lists.debian.org/debian-user/2013/04/msg00829.html
        # You can modify the 'stop=1' here according if you like.
        #
        for i in "${@:2}";
        do
            find /etc/rc[S0-6].d/ -iname "*${i}" -type l -exec unlink {} +
            insserv -f ${i},start=,stop=1;
        done
        ;;

    show)
        # Display current state of <service>
        #
        printf "rlvl\tslot\tservive\n"
        for i in "${@:2}";
        do
            find /etc/rc[S0-6].d/ -iname "*${i}" -type l | sed 
's#^/etc/rc##;s#\.d/S#\tS#;s#\.d/K#\tK#;s#\([SK][0-9][0-9]\)#\1\t#' | sort -k2
        done
        ;;

    *)
        printf "usage:   rc-update enable|disable|show <service1> <service2> 
... <serviceN>\n\n"
        printf "enable:  Use default runlevels as defined in the scripts.\n"
        printf "disable: Remove the listed scripts from all runlevels.\n"
        printf "show:    Output runlevel and sequence information of service.\n"
        ;;

esac
}

alias rc-add="rc-update add"
alias rc-del="rc-update del"
alias rc-show="rc-update show"

Reply via email to