Remove unmaintained accessibility support
[grml-autoconfig.git] / autoconfig.functions
index 84fd976..a9c5043 100755 (executable)
@@ -98,10 +98,6 @@ checkgrmlsmall(){
   grep -q small /etc/grml_version 2>>$DEBUG && return 0 || return 1
 }
 
-# execute flite only if it's present
-flitewrapper() {
-   [ -x /usr/bin/flite ] && flite -o play -t "$*"
-}
 ### }}}
 
 # {{{ filesystems (proc, pts, sys) and fixes
@@ -667,18 +663,6 @@ fi
 }
 # }}}
 
-# {{{ hardware detection via hwinfo
-config_hwinfo(){
-if checkbootparam 'hwinfo' >>$DEBUG 2>&1; then
-  einfo "Discovering hardware via hwinfo:"
-  MODULES=$(su grml hwinfo | grep "Cmd: \"modprobe" | awk '{print $5}' | sed 's/"//')
-  echo -n "  Loading modules: "
-  for i in `echo $MODULES` ; do echo -n $i && modprobe $i ; done
-  eend 0
-fi
-}
-# }}}
-
 # {{{ blacklist specific module [ used in /etc/init.d/udev ]
 config_blacklist(){
 if checkbootparam 'blacklist' ; then
@@ -732,7 +716,7 @@ if [ -d /proc/acpi ]; then
     else
       ewarn "(none)" ; eend 1
     fi
-    if ! ps x | grep -q /usr/sbin/acpid ; then
+    if ! ps x 2>>$DEBUG | grep -q /usr/sbin/acpid ; then
       if ! [ -r /var/run/dbus/pid ] ; then
         einfo "Starting acpi daemon."
         /etc/init.d/acpid start >>$DEBUG 2>&1 ; eend $?
@@ -766,166 +750,6 @@ fi
 }
 # }}}
 
-# {{{ PCMCIA Check/Setup
-# This needs to be done before other modules are being loaded (by hwsetup)
-config_pcmcia(){
-if checkbootparam 'nopcmcia'; then
-  ewarn "Skipping PCMCIA detection as requested on boot commandline." ; eend 0
-else
-  if /usr/sbin/laptop-detect ; then
-    einfo "Detected Laptop - checking for PCMCIA." && eend 0
-    modprobe pcmcia_core >>$DEBUG 2>&1
-    # Try Cardbus or normal PCMCIA socket drivers
-    modprobe yenta_socket >>$DEBUG 2>&1 || modprobe i82365 >>$DEBUG 2>&1 || modprobe pd6729 >>$DEBUG 2>&1 || modprobe tcic >>$DEBUG 2>&1
-    if [ "$?" = "0" ]; then
-      modprobe ds >>$DEBUG 2>&1
-      if [ -d /proc/bus/pccard ] ; then
-       if [ -x /sbin/cardmgr ] ; then
-        einfo "PCMCIA found, starting cardmgr."
-        cardmgr >>$DEBUG 2>&1 && sleep 6 && eend 0
-       else
-        eerror "No cardmgr found. Make sure package pcmciautils is installed, it should handle it instead." ; eend 1
-       fi
-      fi
-    fi
-  fi
-fi
-}
-# }}}
-
-# {{{ run software synthesizer via speakup
-config_swspeak(){
-   if checkbootparam 'swspeak' ; then
-      einfo "Bootoption swspeak found."
-
-      if [ ! -d /proc/speakup/ ] && ! grep -q speakup_soft /proc/modules ; then
-         ewarn "Kernel does not support software speakup - trying to load kernel module:" ; eend 0
-         eindent
-         einfo "Loading speakup_soft"
-         if modprobe speakup_soft ; then
-            eend 0
-         else
-            flitewrapper "Fatal error setting up software speakup"
-            eend 1
-            return 1
-         fi
-         eoutdent
-      fi
-
-      if [ -d /proc/speakup/ ] || grep -q speakup_soft /proc/modules ; then
-         einfo "Kernel supports speakup." ; eend 0
-         eindent
-            einfo "Just run swspeak if you want to use software synthesizer via speakup."
-            flitewrapper "Finished activating software speakup. Just run swspeak when booting finished."
-         eoutdent
-      else
-         eerror "Kernel does not seem to support speakup. Skipping swspeak." ; eend 1
-         flitewrapper "Kernel does not seem to support speakup. Sorry."
-      fi
-   fi
-}
-# }}}
-
-# {{{ support hardware synthesizer via speakup
-config_hwspeak(){
-   if checkbootparam 'speakup.synth' ; then
-      einfo "Bootoption speakup.synth found."
-      eindent
-
-      module="$(getbootparam 'speakup.synth' 2>>$DEBUG)"
-      if [ -z "$module" ] ; then
-         eerror "Sorry, no speakup module specified for bootoption speakup.synth."
-         flitewrapper "Sorry, no speakup module specified for bootoption speakup.synth."
-      else
-         einfo "Trying to load $module"
-         modprobe "speakup_${module}"
-         eend $?
-      fi
-
-      if [ -d /proc/speakup/ ] || grep -q speakup /proc/modules ; then
-         einfo "Kernel should support speakup now." ; eend 0
-         flitewrapper "Kernel should support speakup now."
-      else
-         eerror "Kernel or hardware do not seem to support speakup. Skipping hwspeak." ; eend 1
-         flitewrapper "Kernel or hardware do not seem to support speakup. Sorry."
-      fi
-
-      eoutdent
-
-   # hwspeak:
-   elif checkbootparam 'hwspeak' ; then
-      einfo "Bootoption hwspeak found."
-
-      if [ ! -d /proc/speakup/ ] && ! grep -q speakup /proc/modules ; then
-         ewarn "Kernel does not support hardware speakup - trying to load kernel modules:" ; eend 0
-         eindent
-         if ! [ -d "/lib/modules/${KERNEL}/extra/speakup/" ] ; then
-            eerror "Kernel does not provide speakup modules, sorry." ; eend 1
-         else
-           for module in $(find "/lib/modules/${KERNEL}/extra/speakup/" -name \*.ko | \
-                           sed 's#.*speakup/##g ; s#.ko$##g' | \
-                           grep -ve speakup_soft -ve speakup_dummy | sort -u) ; do
-              einfo "Trying to load $module"
-              modprobe $module
-              eend $?
-           done
-         fi
-         eoutdent
-      fi
-
-      if [ -d /proc/speakup/ ] || grep -q speakup /proc/modules ; then
-         einfo "Kernel should support speakup now." ; eend 0
-         flitewrapper "Kernel should support speakup now."
-      else
-         eerror "Kernel or hardware do not seem to support speakup. Skipping hwspeak." ; eend 1
-         flitewrapper "Kernel or hardware do not seem to support speakup. Sorry."
-      fi
-   fi
-}
-# }}}
-
-# {{{ Check for blind option or brltty
-config_blind(){
-BLIND=""
-checkbootparam 'blind' && BLIND="yes"
-BRLTTY="$(getbootparam 'brltty' 2>>$DEBUG)"
-
-if [ -n "$BLIND" -o -n "$BRLTTY" ]; then
-  if [ -x /sbin/brltty ]; then
-    # Blind option detected, start brltty now.
-    # modprobe serial_core parport_serial generic_serial && echo "done"
-    CMD=brltty
-    BRLTYPE=""
-    BRLDEV=""
-    BRLTEXT=""
-    if [ -n "$BRLTTY" ]; then
-      # Extra options
-      BRLTYPE="${BRLTTY%%,*}"
-      R="${BRLTTY#*,}"
-      if [ -n "$R" -a "$R" != "$BRLTTY" ]; then
-        BRLTTY="$R"
-        BRLDEV="${BRLTTY%%,*}"
-        R="${BRLTTY#*,}"
-        if [ -n "$R" -a "$R" != "$BRLTTY" ]; then
-          BRLTTY="$R"
-          BRLTEXT="${BRLTTY%%,*}"
-          R="${BRLTTY#*,}"
-        fi
-      fi
-    fi
-    [ -n "$BRLTYPE" ] && CMD="$CMD -b $BRLTYPE"
-    [ -n "$BRLDEV"  ] && CMD="$CMD -d $BRLDEV"
-    [ -n "$BRLTEXT" ] && CMD="$CMD -t $BRLTEXT"
-    einfo "Starting braille-display manager."
-#    ( exec $CMD & )
-    ( sh -c "$CMD" & )
-    sleep 2 && BLINDSOUND="yes"
-    eend 0
-  fi
-fi
-}
-# }}}
-
 # {{{ AGP
 config_agp(){
 if checkbootparam 'forceagp' ; then
@@ -935,59 +759,6 @@ fi
 }
 # }}}
 
-# {{{ automount(er)
-config_automounter(){
-if checkbootparam 'automounter' ; then
-  RUNLEVEL="$(runlevel)"
-  AUTOMOUNTER=""
-  [ -x /etc/init.d/autofs ] && [ "$RUNLEVEL" != "N 1" ] && [ "$RUNLEVEL" != "N S" ] && AUTOMOUNTER="yes"
-
-addautomount(){
-# /dev/ice  options
-  d="${1##*/}"
-  if [ -n "$AUTOMOUNTER" ]; then
-    [ -d "/mnt/$d" -a ! -L "/mnt/$d" ] && rmdir /mnt/$d
-    [ -d "/mnt/auto/$d" ] || mkdir -p "/mnt/auto/$d"
-    [ -L "/mnt/$d" ]      || ln -s "/mnt/auto/$d" "/mnt/$d"
-    anew="$d        -fstype=auto,$2 :$i"
-    grep -q "$anew" "/etc/auto.mnt" || echo "$anew" >> /etc/auto.mnt
-    AUTOMOUNTS="$AUTOMOUNTS $d"
-    new="$1 /mnt/auto/$d  auto   users,noauto,exec,$2 0 0"
-  else
-    [ -d /mnt/$d ] && mkdir -p /mnt/$d
-    new="$1 /mnt/$d  auto   users,noauto,exec,$2 0 0"
-  fi
-  grep -q "$new" "/etc/fstab" || echo "$new" >> /etc/fstab
-}
-
-  AUTOMOUNTS="floppy cdrom"
-# Add new devices to /etc/fstab and /etc/auto.mnt
-  for i in /dev/cdrom?*; do
-    if [ -L $i ]; then
-      addautomount "$i" "ro"
-    fi
-  done
-fi
-
-if [ -n "$AUTOMOUNTER" ]; then
-# Check for floppy dir, reinstall with automounter
-  [ -d /mnt/floppy -a ! -L /mnt/floppy ] && rmdir /mnt/floppy
-  [ -d /mnt/auto/floppy ] || mkdir -p /mnt/auto/floppy
-  [ -L /mnt/floppy ] || ln -s /mnt/auto/floppy /mnt/floppy
-  [ -d /mnt/cdrom -a ! -L /mnt/cdrom ] && rmdir /mnt/cdrom
-  [ -d /mnt/auto/cdrom ] || mkdir -p /mnt/auto/cdrom
-  [ -L /mnt/cdrom ] || ln -s /mnt/auto/cdrom /mnt/cdrom
-  rm -f /etc/fstab.new
-# Replace paths from bootfloppy
-  sed 's|/mnt/cdrom|/mnt/auto/cdrom|g;s|/mnt/floppy|/mnt/auto/floppy|g' /etc/fstab > /etc/fstab.new
-  mv -f /etc/fstab.new /etc/fstab
-# Start automounter now
-  einfo "Starting automounter for ${AUTOMOUNTS}."
-  /etc/init.d/autofs start >>$DEBUG ; eend $?
-fi
-}
-# }}}
-
 # {{{ Collect partitions from /proc/partitions first for enabling DMA
 check_partitions(){
 partitions=""
@@ -1531,11 +1302,18 @@ config_services(){
     SERVICE="$(getbootparam 'services' 2>>$DEBUG)"
     SERVICELIST=$(echo "$SERVICE" | sed 's/,/\\n/g')
     SERVICENL=$(echo "$SERVICE" | sed 's/,/ /g')
-    einfo "Starting service(s) ${SERVICENL} in background."
     for service in $(echo -e $SERVICELIST) ; do
-       /etc/init.d/${service} start >>$DEBUG &
+      # support running (custom) init scripts in non-blocking mode
+      # if they contain the keyword "DO_NO_RUN_IN_BACKGROUND".
+      if grep -q 'DO_NO_RUN_IN_BACKGROUND' "/etc/init.d/${service}" 2>>$DEBUG ; then
+        einfo "Starting service ${service}."
+        /etc/init.d/${service} start >>$DEBUG
+      else
+        einfo "Starting service ${service} in background."
+        /etc/init.d/${service} start >>$DEBUG &
+      fi
     done
-    [ "$?" == "0" ] ; eend $?
+    eend $?
  fi
 }
 # }}}
@@ -1597,23 +1375,6 @@ config_netscript() {
 }
 # }}}
 
-# {{{ blindsound
-config_blindsound(){
- if checkbootparam 'blind' ; then
-    beep
-    flitewrapper "welcome to the gremel system"
- fi
-}
-# }}}
-
-# {{{ welcome sound
-config_welcome(){
- if checkbootparam 'welcome' ; then
-    flitewrapper "welcome to the gremel system"
- fi
-}
-# }}}
-
 # {{{ fix/workaround for unionfs
 fix_unionfs(){
   if [ -z "$INSTALLED" ]; then
@@ -2385,6 +2146,45 @@ fi # checkbootparam "BOOT_IMAGE=debian2hd
 }
 # }}}
 
+config_virtualbox_shared_folders() {
+if [ -r /proc/acpi/battery/BAT0/info ] && grep -q 'OEM info:.*innotek' /proc/acpi/battery/BAT0/info ; then
+  einfo "VirtualBox detected, trying to set up Shared Folders."
+  if ! modprobe -l | grep -q vboxsf.ko ; then
+    ewarn "vboxsf driver not present, not setting up VirtualBox Shared Folders."
+    eend 0
+  elif ! [ -x /usr/sbin/VBoxService ] ; then
+    ewarn "virtualbox-guest-utils not installed, not setting up VirtualBox Shared Folders."
+    eend 0
+  else
+    eindent
+
+      einfo "Loading vboxsf driver."
+      lsmod | grep -q vboxsf || modprobe vboxsf
+      eend $?
+
+      einfo "Adjusting /dev/vboxguest."
+      chown root:vboxsf /dev/vboxguest
+      chmod 660 /dev/vboxguest
+      eend $?
+
+      if [ -n "$CONFIG_FSTAB_USER" ] ; then
+        fstabuser="$CONFIG_FSTAB_USER"
+      else
+        fstabuser=$(getent passwd 1000 | cut -d: -f1)
+      fi
+      einfo "Adding $fstabuser to group vboxsf."
+      adduser grml vboxsf &>/dev/null
+      eend $?
+
+      einfo "Starting VBoxService."
+      VBoxService >/dev/null &
+      eend $?
+
+    eoutdent
+  fi
+fi
+}
+
 # {{{ Support customization
 config_distri(){
 if checkbootparam 'distri'; then