summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Wicki <gandro@gmx.net>2014-02-02 18:32:14 +0100
committerJouke Witteveen <j.witteveen@gmail.com>2014-03-01 20:13:48 +0100
commit79ef3fb789375dfe4f191fd42d8cf7ff2dbb8cc5 (patch)
treeadad0a9c83ed6962deb4fdc0f71e815575c52721
parentde8c80f6748f1202d5b28594f4b8195417f4e219 (diff)
downloadnetctl-79ef3fb789375dfe4f191fd42d8cf7ff2dbb8cc5.tar.gz
netctl-79ef3fb789375dfe4f191fd42d8cf7ff2dbb8cc5.tar.xz
Prohibit user invocation of netctl-auto [start|stop]
Instead of using systemctl to manage the netctl-auto service, some users try to invoke the start/stop commands of netctl-auto directly. Although this behaviour is explicitly discouraged in the man page, this seems to be a source of confusion. The changes introduced in de8c80f will cause other netctl-auto commands to fail if the netctl-auto service was not spawned by systemd. Therefore, this change emits an error message if netctl-auto [start|stop] is invoked from an interactive terminal.
-rwxr-xr-xsrc/netctl-auto3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/netctl-auto b/src/netctl-auto
index 4f53f75..507b1fc 100755
--- a/src/netctl-auto
+++ b/src/netctl-auto
@@ -253,6 +253,9 @@ case $# in
switch-to)
switch_to "$2";;
start|stop)
+ if [[ -t 0 ]]; then
+ exit_error "Use 'systemctl $1 netctl-auto@$2' to $1 netctl-auto."
+ fi
ensure_root "$(basename "$0")"
"$1" "$2";;
*)