aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorColin Guthrie <colin@mageia.org>2014-10-09 09:22:23 +0100
committerColin Guthrie <colin@mageia.org>2014-10-09 09:24:45 +0100
commita875fe4c7af9e1f2375b8543314fae794dcffb43 (patch)
treebb8d0bfc72c49a80435e2f2efd79b789d7570151
parentb7b0cc9d4f3dc6747848317e721eb21b6eba561e (diff)
downloadrpm-helper-a875fe4c7af9e1f2375b8543314fae794dcffb43.tar
rpm-helper-a875fe4c7af9e1f2375b8543314fae794dcffb43.tar.gz
rpm-helper-a875fe4c7af9e1f2375b8543314fae794dcffb43.tar.bz2
rpm-helper-a875fe4c7af9e1f2375b8543314fae794dcffb43.tar.xz
rpm-helper-a875fe4c7af9e1f2375b8543314fae794dcffb43.zip
Be quieter when enabling services, but tell the user when it goes wrong
-rw-r--r--NEWS2
-rwxr-xr-xadd-service7
2 files changed, 8 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index 17d9e97..45e37af 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,5 @@
+ * be quieter when enabling services, but tell the user when it goes wrong
+
2014-10-08 Colin Guthrie <colin@mageia.org> 0.24.13
* use systemctl enable if preset fails (which it will for sysvinit)
diff --git a/add-service b/add-service
index 880bd2e..f30b81e 100755
--- a/add-service
+++ b/add-service
@@ -129,7 +129,12 @@ add_service() {
# Actually do enable/disable foo
if [ -n "$units_to_enable" ]; then
# Prefer preset (for native systemd units), but fall back to enable (for sysvinit units)
- /bin/systemctl --quiet preset $units_to_enable >/dev/null || /bin/systemctl --quiet enable $units_to_enable >/dev/null
+ /bin/systemctl --quiet preset $units_to_enable >/dev/null 2>&1 || /bin/systemctl --quiet enable $units_to_enable >/dev/null 2>&1
+ if [ $? -ne 0 ]; then
+ echo "Warning: Problems encountered when activating services." >&2
+ echo " Please check and enable manually if necessary." >&2
+ echo " Service units affected: $units_to_enable" >&2
+ fi
if [ -n "$srv" -a ! -f "${systemd_migration_dir}/$srv" ]; then
touch "${systemd_migration_dir}/$srv"
fi