[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

rc-update() 1.0



Hello

you might have read:
http://lists.debian.org/debian-user/2013/04/msg00644.html

In case you are interested i updated rc-update() to be able to handle several
services at once:
# rc-update enable|disable|show <service1> <service2> ... <serviceN>

The API has changed (not good), but i consider the feature addition significant
enough to be worthwhile this breakage.

Since i consider this new version now feature complete it is 1.0! ;)


-- 
Regards,
Thilo

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

_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


rc-update()
{
  case "${1}" in
    enable|add)
	insserv -d "${@:2}"
	;;

    disable|remove|del)
	insserv -r "${@:2}"
	for i in "${@:2}"; do insserv -f ${i},start=,stop=1; done
	;;

    show)
	for i in "${@:2}"; do insserv -s | \grep -i ${i} | sort -r | sed 's/^K:/K/;s/^S:/S/;s/:/\t/g'; 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
}

Reply to: