aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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