added grml-setservices; removed todo note from manpage of grml-setkeyboard
authorMichael Prokop <mika@grml.org>
Fri, 16 Mar 2007 20:55:41 +0000 (21:55 +0100)
committerMichael Prokop <mika@grml.org>
Fri, 16 Mar 2007 20:55:41 +0000 (21:55 +0100)
debian/changelog
manpages/grml-setkeyboard.8
manpages/grml-setservices.8 [new file with mode: 0644]
usr_sbin/grml-setservices [new file with mode: 0755]

index 8ba3c3b..653716d 100644 (file)
@@ -1,3 +1,11 @@
+grml-scripts (0.9.23) unstable; urgency=low
+
+  * Added grml-setservices (interface for basic configuration of system
+    startup/shutdown via /etc/runlevel.conf)
+  * Removed todo note from manpage of grml-setkeyboard.
+
+ -- Michael Prokop <mika@grml.org>  Fri, 16 Mar 2007 21:54:31 +0100
+
 grml-scripts (0.9.22) unstable; urgency=low
 
   * dirvish-setup: support setting of tree (directory) that should
index 43e729d..038936e 100644 (file)
@@ -15,7 +15,7 @@ Use loadkeys on the console and setxkbmap on X to modify keyboard layout manuall
 .SH USAGE EXAMPLES
 .TP
 .B grml-setkeyboard
-TODO
+Invoke the interface.
 .SH SEE ALSO
 .BR grml-setlang (8).
 .SH AUTHOR
diff --git a/manpages/grml-setservices.8 b/manpages/grml-setservices.8
new file mode 100644 (file)
index 0000000..45b376f
--- /dev/null
@@ -0,0 +1,30 @@
+.TH grml-setservices 8
+.SH "NAME"
+grml-setservices \- interface for basic configuration of system startup
+.SH SYNOPSIS
+.B grml-setservices
+.SH DESCRIPTION
+This manual page documents briefly the
+.B grml-setservices
+command.
+.SH OPTIONS
+grml-setservices does not support any options.
+.SH NOTES
+grml-setservices is a simple script for configuring some core
+settings of system startup. The script uses the interface update-rc.d
+for adjusting the file /etc/runlevel.conf. /etc/runlevel.conf is the
+configuration file for startup (and shutdown) used by file-rc (which
+is the default init system on grml). You neither have to use grml-setservices
+nor update-rc.d to edit /etc/runlevel.conf, you can edit it manually
+(using your favourite editor) as well of course.
+.SH USAGE EXAMPLES
+.TP
+.B grml-setservices
+Invoke the interface.
+.SH SEE ALSO
+.BR runlevel.conf (5).
+.SH AUTHOR
+grml-setservices was written by Michael Prokop <mika@grml.org>.
+.PP
+This manual page was written by Michael Prokop
+<mika@grml.org> for the Debian project (but may be used by others).
diff --git a/usr_sbin/grml-setservices b/usr_sbin/grml-setservices
new file mode 100755 (executable)
index 0000000..be21363
--- /dev/null
@@ -0,0 +1,104 @@
+#!/bin/sh
+# 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: Fre Mär 16 21:54:10 CET 2007 [mika]
+################################################################################
+
+PN="$(basename $0)"
+TMP=$(mktemp)
+DIALOG=dialog
+CONFFILE='/etc/runlevel.conf'
+
+. /etc/grml/script-functions
+. /etc/grml/lsb-functions
+
+check4root || exit 100
+
+bailout(){
+  rm -f "$TMP"
+  exit 0
+}
+
+trap bailout 1 2 3 15
+
+is_value_set(){
+ [ -n "$1" ] || return 2
+ [ -r "$TMP" ] || return 3
+ grep -q "$1" $TMP && return 0 || return 1
+}
+
+INFO="Which services would you like to have enabled on your system?
+
+Notice: this script will adjust your ${CONFFILE}, the
+file which provides the startup configuration for your
+system. You can edit the file manually as well.
+
+If you do not know what to choose just take the defaults
+or choose cancel.
+"
+
+# enable checks only if the according init script is present
+[ -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'
+
+# adjust setup
+set_values(){
+  if is_value_set "mdadm"  ; then
+     update-rc.d -f mdadm remove >/dev/null 2>&1
+     update-rc.d mdadm-raid start 25 S . start 50 0 6 . >/dev/null 2>&1
+     update-rc.d mdadm defaults 25 >/dev/null 2>&1
+  else
+     update-rc.d -f mdadm remove >/dev/null 2>&1
+     update-rc.d mdadm stop 20 0 1 6 . >/dev/null 2>&1
+  fi
+
+  if is_value_set "dmraid" ; then
+     update-rc.d -f dmraid remove >/dev/null 2>&1
+     update-rc.d dmraid start 04 S . start 51 0 6 . >/dev/null
+  else
+     update-rc.d -f dmraid remove >/dev/null 2>&1
+     update-rc.d dmraid stop 20 0 1 6 . >/dev/null 2>&1
+  fi
+
+  if is_value_set "dbus" ; then
+     update-rc.d -f dbus remove >/dev/null 2>&1
+     update-rc.d dbus defaults >/dev/null 2>&1
+  else
+     update-rc.d -f dbus remove >/dev/null 2>&1
+     update-rc.d dbus stop 20 0 1 6 . >/dev/null 2>&1
+  fi
+}
+
+# the interface itself
+oifs="$IFS"
+IFS='!'
+$DIALOG --title "$PN" --checklist "$INFO" 30 65 8 $SRAID $MRAID $DBUS 2>$TMP
+
+retval="$?"
+case $retval in
+    (0)   set_values ;;
+    (1)   echo "Cancel pressed." ; exit 1 ;;
+    (255) echo "ESC pressed."    ; exit 1 ;;
+esac
+
+retval=$?
+case $retval in
+    (0)
+          $DIALOG --title "$PN" --stdout --msgbox "Adjusting system runlevel configuration via $CONFFILE was successful." 0 0
+          esyslog user.notice "$PN" "Writing language settings ($LANGUAGE) to $CONFFILE was successful."
+          ;;
+    *)
+          $DIALOG --title "$PN" --stdout --msgbox "Error writing settings to ${CONFFILE}." 0 0
+          esyslog user.notice "$PN" "Error writing settings to ${CONFFILE}."
+          ;;
+esac
+
+rm -f $TMP
+IFS="$oifs"
+
+## END OF FILE #################################################################
+# vim: ai tw=80 expandtab