Parcourir la source

Sync: 2026-08-01 12:30:41

Gabriel Capella il y a 1 jour
Parent
commit
6344f7c8d0
1 fichiers modifiés avec 11 ajouts et 0 suppressions
  1. 11 0
      bootstrap

+ 11 - 0
bootstrap

@@ -58,8 +58,15 @@ install_file() {
     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() {
     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
         return 0
     fi
@@ -72,6 +79,10 @@ enable_unit() {
 
 enable_user_unit() {
     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
         return 0
     fi