add functions.sh
authorMichael Prokop <mika@grml.org>
Thu, 8 Feb 2007 21:36:01 +0000 (22:36 +0100)
committerMichael Prokop <mika@grml.org>
Thu, 8 Feb 2007 21:36:01 +0000 (22:36 +0100)
scripts/functions.sh [new file with mode: 0644]
scripts/grml-live

diff --git a/scripts/functions.sh b/scripts/functions.sh
new file mode 100644 (file)
index 0000000..1f1dd2b
--- /dev/null
@@ -0,0 +1,48 @@
+# Filename:      functions.sh
+# Purpose:       helper functions for use within grml-live
+# 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: Thu Feb 08 22:35:46 CET 2007
+################################################################################
+
+bailout(){
+  [ -n "$1" ] && EXIT="$1" || EXIT="1"
+  exit "$EXIT"
+}
+
+usage() {
+  print "
+  $0 ....
+"
+}
+
+debug() {
+  if [[ -n "$DEBUG" ]] ; then
+     print "grml-live: $*"
+     [[ -n "$DEBUG_SYSLOG" ]] && [ -x /usr/bin/logger ] && logger -t grml-live "$*"
+  else
+     return 0 # do nothing
+  fi
+}
+
+cmdline_options () {
+        while true
+        do
+                case "${1}" in
+                        (-r|--root) LIVE_ROOT="${2}"
+                                shift 2 ;;
+                        (-v|--version) usage
+                                exit 1 ;;
+                        (--) shift
+                                break ;;
+                        (*) exit 0 ;;
+                esac
+        done
+}
+chroot_exec()
+{
+;
+}
+
+## END OF FILE #################################################################
index eca49d9..ee7fbdd 100755 (executable)
@@ -1,12 +1,29 @@
 #!/bin/zsh
 # Filename:      grml-live
-# Purpose:       
+# Purpose:       build script for creating grml live-cd
 # 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: Thu Feb 08 21:06:07 CET 2007
+# Latest change: Thu Feb 08 22:35:43 CET 2007
 ################################################################################
 
-echo TODO
+LANG=C
+LC_ALL=C
+
+DEBUG=1        # be more verbose on stdout?
+DEBUG_SYSLOG=1 # log actions to syslog?
+
+# functions
+FUNCTIONSFILE='functions.sh'
+
+for file in $FUNCTIONSFILE /etc/grml/lsb-functions  /etc/grml/script-functions ; do
+    [[ -r $FUNCTIONSFILE ]] && source $file || { print "Reading $file failed, fatal error, exiting." ; exit 1 }
+done
+
+trap bailout 1 2 3 15
+
+# main execution
+debug "executing cmdline_options" ; cmdline_options
 
 ## END OF FILE #################################################################
+# vim: ai tw=80 ft=zsh expandtab