X-Git-Url: http://git.grml.org/?p=grml-autoconfig.git;a=blobdiff_plain;f=autoconfig.functions;h=90bc6bd2a948566cf099f17f65a9634301d45f58;hp=dc3e045950354f1bcd29a623a368243f4c7c02e4;hb=2b4bfb74c4c727f74f03f53c142b983a07a7b949;hpb=79b3fa623f0f25e88a0bbdbea0bfa8de078f8f5d diff --git a/autoconfig.functions b/autoconfig.functions index dc3e045..90bc6bd 100755 --- a/autoconfig.functions +++ b/autoconfig.functions @@ -31,17 +31,22 @@ fi service_wrapper() { if [ "$#" -lt 2 ] ; then - echo "Usage: service_wrapper " >&2 + echo "Usage: service_wrapper [background]" >&2 return 1 fi local service="$1" local action="$2" + local background="$3" if $SYSTEMD ; then systemctl "$action" "$service" else - /etc/init.d/"$service" "$action" + if [ "${background:-}" = "background" ] ; then + /etc/init.d/"$service" "$action" & + else + /etc/init.d/"$service" "$action" + fi fi } @@ -512,6 +517,14 @@ config_kernel(){ # {{{ secure boot config_secureboot(){ + # systemd does this for us, but if we are not running under systemd then mokutil + # doesn't work as needed as it relies on /sys/firmware/efi/efivars (while + # /sys/firmware/efi/vars would exist) + if ! $SYSTEMD ; then + modprobe efivars + mount -t efivarfs efivarfs /sys/firmware/efi/efivars + fi + if [ -x /usr/bin/mokutil ] ; then local secstate=$(mokutil --sb-state 2>/dev/null) # "SecureBoot enabled" if [ -n "$secstate" ] ; then @@ -962,7 +975,7 @@ if checkbootparam 'ssh' ; then einfo "Starting secure shell server in background for root and user $localuser" service_wrapper rmnologin start >>$DEBUG 2>>$DEBUG - service_wrapper ssh start >>$DEBUG 2>>$DEBUG & + service_wrapper ssh start background >>$DEBUG 2>>$DEBUG eend $? fi @@ -1191,7 +1204,7 @@ config_syslog(){ ewarn "Not starting syslog daemon as requested on boot commandline." ; eend 0 else einfo "Starting rsyslog in background." - service_wrapper rsyslog start >>$DEBUG & + service_wrapper rsyslog start >>$DEBUG eend 0 fi } @@ -1206,8 +1219,7 @@ config_gpm(){ eerror "No mouse found - not starting GPM." ; eend 1 else einfo "Starting gpm in background." - service_wrapper gpm start >>$DEBUG & - # ( while [ ! -e /dev/psaux ]; do sleep 5; done; /etc/init.d/gpm start >>$DEBUG ) & + service_wrapper gpm start background >>$DEBUG eend 0 fi fi @@ -1228,7 +1240,7 @@ config_services(){ service_wrapper "${service}" start >>$DEBUG else einfo "Starting service ${service} in background." - service_wrapper "${service}" start >>$DEBUG & + service_wrapper "${service}" start background >>$DEBUG fi done eend $? @@ -1317,6 +1329,10 @@ 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 + if [ -n "$WINDOWMANAGER" ] ; then + mkdir -p /var/run/grml-x/ + echo "$WINDOWMANAGER" > /var/run/grml-x/window-manager + fi chvt 7 return fi @@ -1589,7 +1605,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 @@ -1599,7 +1615,7 @@ config_swraid(){ eindent IFSOLD=${IFS:-} IFS=$'\n' - for line in $(mdadm --assemble --scan --auto=yes --symlink=no 2>&1) ; do + for line in $(mdadm --assemble --scan 2>&1) ; do case $line in *'No arrays found'*) ewarn "$line" ; eend 0 @@ -1717,15 +1733,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