From b94f44cf1458983b798426f6e9d038b6768eae9f Mon Sep 17 00:00:00 2001 From: Colin Guthrie Date: Wed, 8 Oct 2014 20:22:40 +0100 Subject: Use systemctl enable if preset fails (which it will for sysvinit) --- NEWS | 2 ++ add-service | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 55f3b6c..d21b331 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,5 @@ + * use systemctl enable if preset fails (which it will for sysvinit) + 2014-07-27 Colin Guthrie 0.24.12 * use systemctl preset rather than enable to respect preset configuration * drop hacky workaround for systemd reload on sysv initscript package removal diff --git a/add-service b/add-service index 04eb865..880bd2e 100755 --- a/add-service +++ b/add-service @@ -128,7 +128,8 @@ add_service() { # Actually do enable/disable foo if [ -n "$units_to_enable" ]; then - /bin/systemctl --quiet preset $units_to_enable >/dev/null + # 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 if [ -n "$srv" -a ! -f "${systemd_migration_dir}/$srv" ]; then touch "${systemd_migration_dir}/$srv" fi -- cgit v1.2.1