[Lunar-commits] <moonbase-core> Merge pull request #12 from Ratler/systemd_fixes

Auke Kok sofar+github at foo-projects.org
Thu Jul 12 23:59:30 CEST 2012


commit 836ee6f85c88a59f2947053b4ce2f291e9c1b1da
Author: Auke Kok <sofar+github at foo-projects.org>
Date: Thu, 12 Jul 2012 14:59:30 -0700
URL: https://github.com/lunar-linux/moonbase-core/commit/836ee6f85c88a59f2947053b4ce2f291e9c1b1da

Merge pull request #12 from Ratler/systemd_fixes

Systemd fixes
---
  system/systemd/POST_INSTALL                                  +1/-1     
  system/systemd/PRE_BUILD                                     +8/-0     
  system/systemd/plugin.d/systemd.plugin                       +10/-30   
  3 files changed, 0 insertions (+), 0 deletions (-)

--- a/system/systemd/POST_INSTALL
+++ b/system/systemd/POST_INSTALL
@@ -42,7 +42,7 @@ if egrep -q '^(proc|none|devpts|usbfs|tmpfs)' /etc/fstab; then
 fi
 
 if [ -n "$SYSTEMD_ERROR" ]; then
-  message "\e[5;31mPress any key to continue..."
+  message "\e[5;31mPress any key to continue...${DEFAULT_COLOR}"
   read -n 1
 fi
 
--- a/system/systemd/PRE_BUILD
+++ b/system/systemd/PRE_BUILD
@@ -12,4 +12,12 @@ do
   fi
 done
 
+if mountpoint -q /usr; then
+  message "${PROBLEM_COLOR}WARNING: ${MESSAGE_COLOR}You appear to have an /usr partition mounted. If you continue this"
+  message "installation your computer will NOT be able to boot properly. This will be supported soon!${DEFAULT_COLOR}"
+  if ! query "Ignore this warning and continue installation?" n ; then
+    exit 1
+  fi
+fi
+
 default_pre_build
--- a/system/systemd/plugin.d/systemd.plugin
+++ b/system/systemd/plugin.d/systemd.plugin
@@ -13,7 +13,7 @@
 
 plugin_systemd_configure()
 {
-  local SERVICES SERVICE SYSTEMD_SERVICES SYSTEMD_SERVICE SYSTEMD_TEMP FOUND
+  local SERVICES SERVICE SYSTEMD_SERVICES
   debug_msg "plugin_systemd_configure ($@)"
   if [ -d $SCRIPT_DIRECTORY/systemd.d ]; then
     cd $SCRIPT_DIRECTORY/systemd.d
@@ -24,22 +24,9 @@ plugin_systemd_configure()
     for SERVICE in $SERVICES; do
       # don't ask for '@' services - these should always be installed but
       # never linked directly. Also ask for new or renamed services.
-      if echo $SERVICE | grep -q @ ; then
+      if echo $SERVICE | grep -q @ || echo $SYSTEMD_SERVICES | egrep -q "(^| )$SERVICE( |$)"; then
         continue
       fi
-
-      # Keep processing new or renamed services. This is a bit of a hack
-      # but the previous solution using grep was not possible even with
-      # word boundary flag due to possible chars in a servce like '-' and '.'.
-      FOUND=false
-      for SYSTEMD_SERVICE in $SYSTEMD_SERVICES; do
-        if [ "$SERVICE" == "$SYSTEMD_SERVICE" ]; then
-          FOUND=true
-          break
-        fi
-      done
-      [ "$FOUND" == "true" ] && continue
-
       message "${MESSAGE_COLOR}$SERVICE: $(grep Description= $SERVICE | cut -d= -f2-)${DEFAULT_COLOR}"
       if query "Invoke $SERVICE via systemd automatically at boot ?"  y
       then
@@ -55,22 +42,15 @@ plugin_systemd_configure()
     # Look for renamed or removed services and stop and disable them.
     # If we don't do it here it will be too late and there will be rogue
     # processes left behind after a successful install
-    for SYSTEMD_SERVICE in $SYSTEMD_SERVICES; do
-      FOUND=false
-      for SERVICE in $SERVICES; do
-        if [ "$SYSTEMD_SERVICE" == "$SERVICE" ]; then
-          FOUND=true
-          SYSTEMD_TEMP+=" $SERVICE"
-          break
-        fi
-      done
-      [ "$FOUND" == "true" ] && continue
-
-      verbose_msg "Stopping removed service ($SYSTEMD_SERVICE)"
-      systemctl stop $SYSTEMD_SERVICE &> /dev/null
-      systemctl disable $SYSTEMD_SERVICE &> /dev/null
+    for SERVICE in $SYSTEMD_SERVICES; do
+      if ! echo $SERVICES | egrep -q "(^| )$SERVICE( |$)"; then
+        verbose_msg "Stopping removed service ($SERVICE)"
+        systemctl stop $SERVICE &> /dev/null
+        systemctl disable $SERVICE &> /dev/null
+        SYSTEMD_SERVICES=$(echo $SYSTEMD_SERVICES | sed -r "s;(^| )$SERVICE( |$);\1;")
+      fi
     done
-    SYSTEMD_SERVICES=$SYSTEMD_TEMP
+
     set_module_config "SYSTEMD_SERVICES" "$SYSTEMD_SERVICES"
   fi
   return 2




More information about the Lunar-commits mailing list