|
@@ -58,8 +58,15 @@ install_file() {
|
|
|
return 0
|
|
return 0
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+# Units are skipped when their package isn't installed on this host -- the
|
|
|
|
|
+# package lists are per-host (tlp is jellyfish-only, for instance), so this
|
|
|
|
|
+# file is shared while the set of units that actually exist is not.
|
|
|
enable_unit() {
|
|
enable_unit() {
|
|
|
local unit="$1"
|
|
local unit="$1"
|
|
|
|
|
+ if ! systemctl cat "$unit" &>/dev/null; then
|
|
|
|
|
+ log_warn "Skipping $unit -- not installed on this host"
|
|
|
|
|
+ return 0
|
|
|
|
|
+ fi
|
|
|
if systemctl is-enabled --quiet "$unit" 2>/dev/null; then
|
|
if systemctl is-enabled --quiet "$unit" 2>/dev/null; then
|
|
|
return 0
|
|
return 0
|
|
|
fi
|
|
fi
|
|
@@ -72,6 +79,10 @@ enable_unit() {
|
|
|
|
|
|
|
|
enable_user_unit() {
|
|
enable_user_unit() {
|
|
|
local unit="$1"
|
|
local unit="$1"
|
|
|
|
|
+ if ! systemctl --user cat "$unit" &>/dev/null; then
|
|
|
|
|
+ log_warn "Skipping user unit $unit -- not installed on this host"
|
|
|
|
|
+ return 0
|
|
|
|
|
+ fi
|
|
|
if systemctl --user is-enabled --quiet "$unit" 2>/dev/null; then
|
|
if systemctl --user is-enabled --quiet "$unit" 2>/dev/null; then
|
|
|
return 0
|
|
return 0
|
|
|
fi
|
|
fi
|