-#!/bin/sh
+#!/bin/bash
# Filename: grml-setservices
# Purpose: interface for basic configuration of system startup
# Authors: grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
# Bug-Reports: see http://grml.org/bugs/
# License: This file is licensed under the GPL v2.
-# Latest change: Mit Jul 18 02:16:12 CEST 2007 [mika]
################################################################################
-PN="$(basename $0)"
+PN="$(basename "$0")"
TMP=$(mktemp)
DIALOG=dialog
CONFFILE='/etc/runlevel.conf'
+# shellcheck disable=SC1091
+{
. /etc/grml/script-functions
. /etc/grml/lsb-functions
+}
check4root || exit 100
exit 0
}
-trap bailout 1 2 3 15
+trap bailout HUP INT QUIT TERM
is_value_set(){
[ -n "$1" ] || return 2
[ -r "$TMP" ] || return 3
- grep -q "$1" $TMP && return 0 || return 1
+ grep -q "$1" "$TMP" && return 0 || return 1
}
INFO="Which services would you like to have enabled on your system?
[ -r /etc/init.d/lvm2 ] && LVM='lvm!logical volume management!on'
[ -r /etc/init.d/mdadm ] && SRAID='mdadm!software-raid via mdadm!on'
[ -r /etc/init.d/dmraid ] && MRAID='dmraid!software-raid via dmraid!off'
-[ -r /etc/init.d/dbus -o -r /etc/init.d/dbus-1 ] && DBUS='dbus!hal/dbus (important for KDE e.g.)!off'
+[ -r /etc/init.d/dbus ] || [ -r /etc/init.d/dbus-1 ] && DBUS='dbus!hal/dbus (important for KDE e.g.)!off'
+[ -r /etc/init.d/hal ] && HAL='hal!Hardware Abstraction Layer daemon (important for KDE e.g.)!off'
[ -r /etc/init.d/nfs-common ] && NFS='nfs!Network File System (client setup)!off'
## adjust setup
fi
fi
+ if [ -n "$HAL" ] ; then
+ if is_value_set "hal" ; then
+ update-rc.d -f hal remove >/dev/null 2>&1
+ update-rc.d hal start 24 2 3 4 5. stop 16 0 1 6 . >/dev/null 2>&1
+ else
+ update-rc.d -f hal remove >/dev/null 2>&1
+ update-rc.d hal stop 20 0 1 6 . >/dev/null 2>&1
+ fi
+ fi
+
if [ -n "$NFS" ] ; then
if is_value_set "nfs" ; then
update-rc.d -f nfs-common remove >/dev/null 2>&1
# the interface itself
oifs="$IFS"
IFS='!'
-$DIALOG --title "$PN" --checklist "$INFO" 30 65 8 $LVM $SRAID $MRAID $DBUS $NFS 2>$TMP
+$DIALOG --title "$PN" --checklist "$INFO" 30 65 8 "$LVM" "$SRAID" "$MRAID" "$DBUS" "$HAL" "$NFS" 2>"$TMP"
retval="$?"
case $retval in
;;
esac
-rm -f $TMP
+rm -f "$TMP"
IFS="$oifs"
## END OF FILE #################################################################