forked from pool/systemd
2133bfb31e
- Fix is-enabled check in systemd-sysv-install (bsc#997268) - Fix is-enabled check in systemd-sysv-install (bsc#997268) OBS-URL: https://build.opensuse.org/request/show/424922 OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=948
27 lines
503 B
Bash
27 lines
503 B
Bash
#!/bin/sh
|
|
set -e
|
|
|
|
usage() {
|
|
echo "Usage: $0 [--root=path] enable|disable|is-enabled <sysv script name>" >&2
|
|
exit 1
|
|
}
|
|
eval set -- "$(getopt -o r: --long root: -- "$@")"
|
|
while true; do
|
|
case "$1" in
|
|
-r|--root)
|
|
ROOT="$2"
|
|
shift 2 ;;
|
|
--) shift ; break ;;
|
|
*) usage ;;
|
|
esac
|
|
done
|
|
NAME="$2"
|
|
ROOT="${ROOT:+--root=$ROOT}"
|
|
[ -n "$NAME" ] || usage
|
|
case "$1" in
|
|
enable) chkconfig $ROOT -a "$NAME" ;;
|
|
disable) chkconfig $ROOT -d "$NAME" ;;
|
|
is-enabled) chkconfig $ROOT -c "$NAME" ;;
|
|
*) usage ;;
|
|
esac
|