X-Git-Url: http://git.grml.org/?p=grml-autoconfig.git;a=blobdiff_plain;f=autoconfig.functions;h=b71e69d6294519dd090486b4be6dc226358094cf;hp=c6ed6f2e19e5166070ffa5dd7102e19e48a4f69c;hb=cc211e933848b3c1a958279399a5d740d85ac572;hpb=5e3222d2cff12b9297743bb6d4fccc470ccc9f83 diff --git a/autoconfig.functions b/autoconfig.functions index c6ed6f2..b71e69d 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 } @@ -183,11 +188,15 @@ VMWARE=false if vmware-detect &>/dev/null; then VIRTUAL=true; VMWARE=true; VIRTUAL_ENV='VMware' -elif [ "$(virt-what 2>/dev/null)" = "kvm" ] || \ - [ "$(imvirt 2>/dev/null)" = "KVM" ] ; then +fi + +if virt-what 2>/dev/null | grep -q 'kvm' || \ + [ "$(imvirt 2>/dev/null)" = "KVM" ] ; then VIRTUAL=true; KVM=true; VIRTUAL_ENV='KVM' -elif [ "$(virt-what 2>/dev/null)" = "virtualbox" ] || \ - [ "$(imvirt 2>/dev/null)" = "VirtualBox" ] ; then +fi + +if virt-what 2>/dev/null | grep -q 'virtualbox' || \ + [ "$(imvirt 2>/dev/null)" = "VirtualBox" ] ; then VIRTUAL=true; VIRTUALBOX=true; VIRTUAL_ENV='VirtualBox' fi # }}} @@ -309,20 +318,6 @@ config_language(){ [ -r /etc/sysconfig/keyboard ] && . /etc/sysconfig/keyboard - # activate unicode console if running within utf8 environment - if [ -r /etc/default/locale ] ; then - if grep -q "LANG=.*UTF" /etc/default/locale ; then - einfo "Setting up unicode environment." - unicode_start >>$DEBUG 2>&1 ; eend $? - fi - fi - - # Set default keyboard before interactive setup - if [ -n "$KEYTABLE" ] ; then - einfo "Running loadkeys for ${WHITE}${KEYTABLE}${NORMAL} in background" - loadkeys -q $KEYTABLE & - eend $? - fi # we have to set up all consoles, therefore loop it over all ttys: NUM_CONSOLES=$(fgconsole --next-available 2>/dev/null) @@ -378,6 +373,21 @@ config_language(){ fi fi + # Set default keyboard before interactive setup + if [ -n "$KEYTABLE" ] ; then + einfo "Running loadkeys for ${WHITE}${KEYTABLE}${NORMAL} in background" + loadkeys -q $KEYTABLE & + eend $? + fi + + # activate unicode console if running within utf8 environment + if [ -r /etc/default/locale ] ; then + if grep -q "LANG=.*UTF" /etc/default/locale ; then + einfo "Setting up unicode environment." + unicode_start ; eend $? + fi + fi + eoutdent } # }}} @@ -516,8 +526,9 @@ config_secureboot(){ # 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 + if modprobe efivars &>/dev/null ; then + mount -t efivarfs efivarfs /sys/firmware/efi/efivars + fi fi if [ -x /usr/bin/mokutil ] ; then @@ -970,7 +981,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 @@ -1199,7 +1210,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 } @@ -1214,8 +1225,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 @@ -1236,7 +1246,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 $?