]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/systemctl/systemd-sysv-install.SKELETON
pid1: drop unit caches only based on mtime
[thirdparty/systemd.git] / src / systemctl / systemd-sysv-install.SKELETON
CommitLineData
0f0467e6
MP
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.
7set -e
8
9usage() {
10 echo "Usage: $0 [--root=path] enable|disable|is-enabled <sysv script name>" >&2
11 exit 1
12}
13
fa7bc1d1 14unset ROOT
3153ded0 15
0f0467e6
MP
16# parse options
17eval set -- "$(getopt -o r: --long root: -- "$@")"
18while true; do
19 case "$1" in
20 -r|--root)
21 ROOT="$2"
22 shift 2 ;;
23 --) shift ; break ;;
24 *) usage ;;
25 esac
26done
27
28NAME="$2"
29[ -n "$NAME" ] || usage
30
31case "$1" in
32 enable)
33 # call the command to enable SysV init script $NAME here
34 # (consider optional $ROOT)
35 echo "IMPLEMENT ME: enabling SysV init.d script $NAME"
36 ;;
37 disable)
38 # call the command to disable SysV init script $NAME here
39 # (consider optional $ROOT)
40 echo "IMPLEMENT ME: disabling SysV init.d script $NAME"
41 ;;
42 is-enabled)
43 # exit with 0 if $NAME is enabled, non-zero if it is disabled
44 # (consider optional $ROOT)
45 echo "IMPLEMENT ME: checking SysV init.d script $NAME"
46 ;;
47 *)
48 usage ;;
49esac