startx: share selected window manager via /var/run/grml-x/window-manager
[grml-autoconfig.git] / autoconfig.functions
index 8a534e2..8ae71d1 100755 (executable)
@@ -201,36 +201,6 @@ else
 fi
 # }}}
 
-# {{{ debug
-config_debug(){
- checkbootparam 'debug'            && BOOTDEBUG="yes"
- checkbootparam "BOOT_IMAGE=debug" && BOOTDEBUG="yes"
-
- rundebugshell(){
-  if [ -n "$BOOTDEBUG" ]; then
-     einfo "Starting intermediate shell stage $stage as requested by \"debug\" option."
-     if [ grep -q "debug=noscreen" "$CMDLINE" ] ; then
-        einfo "Notice that the shell does not provide job handling: ctrl-z, bg and fg won't work!"
-        einfo "Just exit the shell to continue boot process..."
-        /bin/zsh
-     else
-        eindent
-        if [ -r /etc/grml/screenrc ] ; then
-           einfo "Starting GNU screen to be able to use a full featured shell environment."
-           einfo "Just exit the shells (and therefore screen) to continue boot process..."
-           /bin/zsh -c "screen -c /etc/grml/screenrc"
-        else
-           einfo "Notice that the shell does not provide job handling: ctrl-z, bg and fg won't work!"
-           einfo "Just exit the shell to continue boot process..."
-           /bin/zsh
-        fi
-        eoutdent
-     fi
-  fi
- }
-}
-# }}}
-
 # {{{ log
 config_log(){
 if checkbootparam 'log' || checkbootparam 'debug' ; then
@@ -922,8 +892,7 @@ else
       eindent
         SKIP_CPU_GOVERNOR=1
         oldIFS="$IFS"
-        IFS="
-"
+        IFS=$'\n'
          for line in $(grep FATAL "$LOADCPUFREQ" | sed 's/.*FATAL: //; s/ (.*)//') ; do
              eerror "$line" ; eend $RC
          done
@@ -1185,8 +1154,7 @@ config_mixer () {
 
       CONTROLS=$(amixer -c $card scontrols | awk -F"Simple mixer control " '{print $2}')
       IFSOLD=${IFS:-}
-      IFS='
-      '
+      IFS=$'\n'
       for CONTROL in ${=CONTROLS} ; do
         # such devices can not be controlled with amixer ... unmute
         [[ "$CONTROL" == *Console* ]] && continue
@@ -1349,14 +1317,11 @@ if checkbootparam 'startx' && ! echo "$CMDLINE" | grep -q 'startx.*nostartx' ; t
    einfo "Setting up and invoking grml-x ${WINDOWMANAGER}. Just exit X windows system to get full featured consoles."
    config_userlocal
    if $SYSTEMD ; then
-     cat>|/etc/init.d/startx<<EOF
-#!/bin/sh
-chgrp tty \${TTY}
-chmod g=rw \${TTY}
-sudo -u "${localuser}" /usr/bin/grml-x ${WINDOWMANAGER}
-EOF
-     chmod 755 /etc/init.d/startx
-     chvt 6
+     if [ -n "$WINDOWMANAGER" ] ; then
+       mkdir -p /var/run/grml-x/
+       echo "$WINDOWMANAGER" > /var/run/grml-x/window-manager
+     fi
+     chvt 7
      return
    fi
    cat>|/etc/init.d/startx<<EOF
@@ -1628,7 +1593,7 @@ config_swraid(){
        if ! checkbootparam 'swraid' ; then
           eindent
           if $SYSTEMD ; then
-            einfo "Just run 'Start mdmonitor' to assemble md arrays or boot using 'swraid' as bootoption for autostart."
+            einfo "Just run 'mdadm --assemble --scan' to assemble md arrays or boot using 'swraid' as bootoption for autostart."
           else
             einfo "Just run 'Start mdadm-raid' to assemble md arrays or boot using 'swraid' as bootoption for autostart."
           fi
@@ -1637,9 +1602,8 @@ config_swraid(){
           einfo "Bootoption swraid found. Searching for software RAID arrays:"
           eindent
            IFSOLD=${IFS:-}
-           IFS='
-'
-           for line in $(mdadm --assemble --scan --auto=yes --symlink=no 2>&1) ; do
+           IFS=$'\n'
+           for line in $(mdadm --assemble --scan 2>&1) ; do
                case $line in
                  *'No arrays found'*)
                    ewarn "$line" ; eend 0
@@ -1659,8 +1623,7 @@ config_swraid(){
                ewarn "No active arrays found" ; eend 0
             else
                IFSOLD=${IFS:-}
-               IFS='
-'
+               IFS=$'\n'
                for line in $(grep '^md[0-9]' /proc/mdstat) ; do
                    einfo "active arrays: $line" ; eend 0
                done
@@ -1694,8 +1657,7 @@ config_dmraid(){
     [ -n "$1" ] || return 1
 
     IFSOLD=${IFS:-}
-    IFS='
-'
+    IFS=$'\n'
     eindent
 
     for line in $(dmraid $1 ; echo errcode:$?); do
@@ -1759,15 +1721,17 @@ config_lvm(){
           einfo "You seem to have logical volumes (LVM) on your system."
           eindent
           if $SYSTEMD ; then
-            einfo "Just run 'Start lvm2-lvmetad' to activate them or boot using 'lvm' as bootoption for autostart."
+            einfo "Just run 'Start lvm2-pvscan@name' to activate LV or VG 'name' or boot using 'lvm' as bootoption for autostart."
           else
             einfo "Just run 'Start lvm2' to activate them or boot using 'lvm' as bootoption for autostart."
           fi
           eend 0
           if checkbootparam 'lvm' ; then
-             einfo "Bootoption LVM found. Searching for logical volumes:"
+             einfo "Bootoption LVM found. Searching for logical volumes and enabling them:"
              if $SYSTEMD ; then
-               service_wrapper lvm2-lvmetad start ; eend $?
+               service_wrapper lvm2-lvmetad start
+               vgchange -ay
+               eend $?
              else
                service_wrapper lvm2 start ; eend $?
              fi
@@ -1986,7 +1950,6 @@ config_distri(){
 if checkbootparam 'distri'; then
   DISTRI="$(getbootparam 'distri' 2>>$DEBUG)"
   if [ -r "${LIVECD_PATH}"/desktop/"$DISTRI".jpg ] ; then
-     [ -n "$BOOTDEBUG" ] && einfo "Debug: bootoption distri found and file ${LIVECD_PATH}/desktop/${DISTRI} present" && eend 0
      # make sure the desktop.jpg file is not a symlink, so copying does not file then
      [ -L /usr/share/grml/desktop.jpg ] && rm /usr/share/grml/desktop.jpg
      cp "${LIVECD_PATH}"/desktop/"$DISTRI".jpg /usr/share/grml/desktop.jpg