X-Git-Url: https://git.grml.org/?p=grml-autoconfig.git;a=blobdiff_plain;f=autoconfig.functions;h=a7c31510b484080c9d037dd1c9227458314e7ba7;hp=bf5fa9261712071d29e41fc4286513169f659a0d;hb=b1359ba47c70cf7b774568dd57e16e5f8f58e988;hpb=348b546fca905e5c591faeb1fb0d636918f9b0f1 diff --git a/autoconfig.functions b/autoconfig.functions index bf5fa92..a7c3151 100755 --- a/autoconfig.functions +++ b/autoconfig.functions @@ -23,7 +23,7 @@ umask 022 # Ignore these signals in non-interactive mode: INT, TERM, SEGV [ -z "$PS1" ] && trap "" 2 3 11 -if [[ "$(realpath "$(cat /proc/1/cmdline)")" == "/lib/systemd/systemd" ]] ; then +if [ "$(cat /proc/1/comm 2>/dev/null)" = "systemd" ] ; then SYSTEMD=true else SYSTEMD=false @@ -194,12 +194,10 @@ fi # {{{ source lsb-functions , color handling if checkbootparam 'nocolor'; then - RC_NOCOLOR=yes . /etc/grml/lsb-functions einfo "Disabling colors in bootsequence as requested on commandline." ; eend 0 else . /etc/grml/lsb-functions - . /etc/grml_colors fi # }}} @@ -542,6 +540,27 @@ config_kernel(){ } # }}} +# {{{ secure boot +config_secureboot(){ + if [ -x /usr/bin/mokutil ] ; then + local secstate=$(mokutil --sb-state 2>/dev/null) # "SecureBoot enabled" + if [ -n "$secstate" ] ; then + einfo "SecureBoot is enabled" ; eend 0 + else + ewarn "SecureBoot not detected" ; eend 0 + fi + else + if modprobe efivars &>/dev/null ; then + if od -An -t u1 /sys/firmware/efi/vars/SecureBoot-*/data 2>/dev/null | grep -q 1 ; then + einfo "SecureBoot is enabled" ; eend 0 + else + ewarn "SecureBoot not detected" ; eend 0 + fi + fi + fi +} +# }}} + # {{{ timezone config_timezone(){ # don't touch the files if running from harddisk: @@ -699,21 +718,26 @@ fi # {{{ ACPI config_acpi(){ -if checkbootparam 'noacpi'; then - ewarn "ACPI: Not loading modules as requested by boot option \"noacpi\"." ; eend 0 -elif checkbootparam 'nogrmlacpi' ; then - ewarn "ACPI: Not loading modules as requested by boot option \"nogrmlacpi\"." ; eend 0 -elif [ ! -d /proc/acpi ] ; then - ewarn "ACPI: Kernel support not present." ; eend 0 -else - einfo "ACPI: Loading modules (disable with boot option noacpi / nogrmlacpi): " - eindent - found="" - for a in /lib/modules/$KERNEL/kernel/drivers/acpi/*; do - basename="${a##*/}" - basename="${basename%%.*}" - case "$basename" in *_acpi) - egrep -qi "${basename%%_acpi}" /proc/acpi/dsdt 2>>$DEBUG || continue ;; + if $SYSTEMD ; then + echo "systemd detected, no acpi(d) stuff needed." >>"$DEBUG" + return + fi + + if checkbootparam 'noacpi'; then + ewarn "ACPI: Not loading modules as requested by boot option \"noacpi\"." ; eend 0 + elif checkbootparam 'nogrmlacpi' ; then + ewarn "ACPI: Not loading modules as requested by boot option \"nogrmlacpi\"." ; eend 0 + elif [ ! -d /proc/acpi ] ; then + ewarn "ACPI: Kernel support not present." ; eend 0 + else + einfo "ACPI: Loading modules (disable with boot option noacpi / nogrmlacpi): " + eindent + found="" + for a in /lib/modules/$KERNEL/kernel/drivers/acpi/*; do + basename="${a##*/}" + basename="${basename%%.*}" + case "$basename" in *_acpi) + egrep -qi "${basename%%_acpi}" /proc/acpi/dsdt 2>>$DEBUG || continue ;; esac modprobe $basename >>$DEBUG 2>&1 && found="yes" local BASE="$BASE $basename" @@ -1202,18 +1226,18 @@ config_syslog(){ # {{{ gpm config_gpm(){ - if checkbootparam 'nogpm'; then - ewarn "Not starting GPM as requested on boot commandline." ; eend 0 - else - if ! [ -r /dev/input/mice ] ; then + if checkbootparam 'nogpm'; then + ewarn "Not starting GPM as requested on boot commandline." ; eend 0 + else + if ! [ -r /dev/input/mice ] ; then eerror "No mouse found - not starting GPM." ; eend 1 - else + 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 ) & eend 0 - fi - fi + fi + fi } # }}} @@ -1334,10 +1358,6 @@ config_stats() { # {{{ start X window system via grml-x config_x_startup(){ - if $SYSTEMD ; then - ewarn "The startx boot option isn't yet supported via systemd, sorry." ; eend 0 - return - fi # make sure we start X only if startx is used *before* a nostartx option # so it's possible to disable automatic X startup using nostart @@ -1352,17 +1372,28 @@ if checkbootparam 'startx' && ! echo "$CMDLINE" | grep -q 'startx.*nostartx' ; t fi einfo "Setting up and invoking grml-x ${WINDOWMANAGER}. Just exit X windows system to get full featured consoles." config_userlocal - cat>|/etc/init.d/xstartup<|/etc/init.d/startx<|/etc/init.d/startx</dev/tty6 2>\&1 /dev/tty6 2>\&1 /dev/tty6 2>&1 < /dev/tty6' >> /etc/inittab + echo '6:2345:respawn:/bin/zsh --login -c "/etc/init.d/startx ; /usr/share/grml-scripts/run-welcome" >/dev/tty6 2>&1 < /dev/tty6' >> /etc/inittab fi /sbin/telinit q ; eend $? @@ -1620,7 +1651,11 @@ config_swraid(){ if ! checkbootparam 'swraid' ; then eindent - einfo "Just run 'Start mdadm-raid' to assemble md arrays or boot using 'swraid' as bootoption for autostart." + if $SYSTEMD ; then + einfo "Just run 'Start mdmonitor' 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 eoutdent else einfo "Bootoption swraid found. Searching for software RAID arrays:" @@ -1747,11 +1782,19 @@ config_lvm(){ if lvdisplay 2>&1 | grep -v 'No volume groups found' >/dev/null 2>&1 ; then einfo "You seem to have logical volumes (LVM) on your system." eindent - einfo "Just run 'Start lvm2' to activate them or boot using 'lvm' as bootoption for autostart." + if $SYSTEMD ; then + einfo "Just run 'Start lvm2-lvmetad' to activate them 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:" - service_wrapper lvm2 start ; eend $? + if $SYSTEMD ; then + service_wrapper lvm2-lvmetad start ; eend $? + else + service_wrapper lvm2 start ; eend $? + fi fi eoutdent fi