chiark / gitweb /
Prep v220: Apply "Fixes to user and session saving"
[elogind.git] / src / systemctl / systemd-sysv-install.SKELETON
1 #!/bin/sh
2 # This script is called by "systemctl enable/disable" when the given unit is a
3 # SysV init.d script. It needs to call the distribution's mechanism for
4 # enabling/disabling those, such as chkconfig, update-rc.d, or similar. This
5 # can optionally take a --root argument for enabling a SysV init script
6 # in a chroot or similar.
7 set -e
8
9 usage() {
10     echo "Usage: $0 [--root=path] enable|disable|is-enabled <sysv script name>" >&2
11     exit 1
12 }
13
14 # parse options
15 eval set -- "$(getopt -o r: --long root: -- "$@")"
16 while true; do
17     case "$1" in
18         -r|--root)
19             ROOT="$2"
20             shift 2 ;;
21         --) shift ; break ;;
22         *) usage ;;
23     esac
24 done
25
26 NAME="$2"
27 [ -n "$NAME" ] || usage
28
29 case "$1" in
30     enable)
31         # call the command to enable SysV init script $NAME here
32         # (consider optional $ROOT)
33         echo "IMPLEMENT ME: enabling SysV init.d script $NAME"
34         ;;
35     disable)
36         # call the command to disable SysV init script $NAME here
37         # (consider optional $ROOT)
38         echo "IMPLEMENT ME: disabling SysV init.d script $NAME"
39         ;;
40     is-enabled)
41         # exit with 0 if $NAME is enabled, non-zero if it is disabled
42         # (consider optional $ROOT)
43         echo "IMPLEMENT ME: checking SysV init.d script $NAME"
44         ;;
45     *)
46         usage ;;
47 esac