summary refs log tree commit diff
diff options
context:
space:
mode:
authorGerrit Pape <pape@smarden.org>2008-02-18 22:32:33 +0000
committerGerrit Pape <pape@smarden.org>2008-02-18 22:32:33 +0000
commitaf1ae83ac540df3257809bffa5bdd96585c72205 (patch)
tree0d73878b3360968aacb6ebee9f9cf299a1bc3bd4
parent8f7d11f1c9c1dc95186f3ca63b1633f5ba7eee61 (diff)
downloadrunit-af1ae83ac540df3257809bffa5bdd96585c72205.tar.gz
runit-af1ae83ac540df3257809bffa5bdd96585c72205.tar.xz
runit-af1ae83ac540df3257809bffa5bdd96585c72205.zip
* debian/update-service: prefix fatal and warn message with progname;
    only warn on --remove if service is not registered, still fatal if it
    is not a symlink.
-rw-r--r--debian/changelog5
-rwxr-xr-xdebian/update-service7
2 files changed, 9 insertions, 3 deletions
diff --git a/debian/changelog b/debian/changelog
index 3138783..983c897 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,8 +2,11 @@ runit (1.8.0-3) unstable; urgency=low
 
   * debian/update-service: enforce argument; enforce <service-name> must
     not start with a dot and must not contain a slash.
+  * debian/update-service: prefix fatal and warn message with progname;
+    only warn on --remove if service is not registered, still fatal if it
+    is not a symlink.
 
- -- Gerrit Pape <pape@smarden.org>  Wed, 13 Feb 2008 19:50:23 +0000
+ -- Gerrit Pape <pape@smarden.org>  Mon, 18 Feb 2008 22:32:19 +0000
 
 runit (1.8.0-2) unstable; urgency=low
 
diff --git a/debian/update-service b/debian/update-service
index 49bd721..484c157 100755
--- a/debian/update-service
+++ b/debian/update-service
@@ -5,7 +5,8 @@ servicedir=$SVDIR
 test -n "$servicedir" || servicedir=/var/service
 
 err() { >&2 printf '%s\n\n' "$*"; exit 1; }
-fatal() { err "fatal: $*"; }
+fatal() { err "${0##*/}: fatal: $*"; }
+warn() { err "${0##*/}: warning: $*"; }
 usage() {
   err "Usage: ${0##*/} --add|--remove <service-directory> [<service-name>]
        ${0##*/} --list|--check [<service-name>]"
@@ -67,8 +68,10 @@ case "$opt" in
   ;;
   -r|--remove)
     test "$(id -u)" = 0 || fatal "${0##*/} -r must be run by root."
+    test -e "$servicedir"/"$sv" ||
+      warn "$servicedir/$sv does not exist."
     test -h "$servicedir"/"$sv" ||
-      fatal "$servicedir/$sv does not exist, or is not a symbolic link."
+      fatal "$servicedir/$sv is not a symbolic link."
     test "$svdir" = "$(readlink "$servicedir"/"$sv")" ||
       fatal "$servicedir/$sv does not point to $svdir."
     rm -f "$servicedir"/"$sv"