X-Git-Url: http://git.grml.org/?p=grml-live.git;a=blobdiff_plain;f=scripts%2Fgrml-live;h=d085932472e333dc98430f1c3808ff0c606879a6;hp=ee7fbdd06388534eaf3e9aa732ff83bfb91a8fe5;hb=46e3a2d278bc75b91f6a5eae3fbdedae02441d64;hpb=9dc51d74f26d10d61130c86a0f3369c3f65970b7 diff --git a/scripts/grml-live b/scripts/grml-live index ee7fbdd..d085932 100755 --- a/scripts/grml-live +++ b/scripts/grml-live @@ -4,26 +4,80 @@ # Authors: grml-team (grml.org), (c) Michael Prokop # Bug-Reports: see http://grml.org/bugs/ # License: This file is licensed under the GPL v2. -# Latest change: Thu Feb 08 22:35:43 CET 2007 +# Latest change: Tue Feb 13 00:16:11 CET 2007 ################################################################################ -LANG=C -LC_ALL=C - -DEBUG=1 # be more verbose on stdout? -DEBUG_SYSLOG=1 # log actions to syslog? +LANG=C ; LC_ALL=C +set -e # fail on any error # functions -FUNCTIONSFILE='functions.sh' - +FUNCTIONSFILE='functions.sh' # TODO: fix location 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 } + [ -r "$file" ] && source "$file" || { print "Reading $file failed. Fatal error, exiting." ; exit 1 } done +# Clean exit trap bailout 1 2 3 15 -# main execution -debug "executing cmdline_options" ; cmdline_options +# We need root permissions to execute all the chroot stuff +check4root || bailout 1 + +# default variables +[ -n "$DEBOOTSTRAP" ] || DEBOOTSTRAP='debootstrap' +[ -n "$ARCH" ] || ARCH="$(dpkg --print-architecture)" +[ -n "$RELEASE" ] || RELEASE='sid' +[ -n "$MIRROR" ] || MIRROR='ftp://ftp.tugraz.at/mirror/debian' +[ -n "$TARGET" ] || TARGET="$(pwd)/grml-live/chroot/" + +# cmdline parsing, allow overwriting of variables +while true ; do + case "${1}" in + (-c|--config) CONFIG="${2}" + shift 2 ;; + (-r|--root) TARGET="${2}" + shift 2 ;; + (-h|--hook) HOOK="${2}" + shift 2 ;; + (-v|--version) usage + exit 1 ;; + (--) shift + break ;; + (*) break ;; + esac +done + +# configuration file +if [ -n "$CONFIG" ] ; then + [ -r "$CONFIG" ] || bailout 1 "Sorry, configuration file $CONFIG could not be read. Fatal error, exiting" + debug "sourcing $CONFIG" + source "$CONFIG" +else + source ../config/grml-live.conf # TODO: fix location +fi + +# make sure we have some variables, directories,... available before main execution +[ -d "$TARGET" ] || mkdir "$TARGET" +[ -n "$ARCH" ] && ARCH="$DEB_HOST_ARCH" || bailout 1 "\$ARCH not set, exiting." + +# TODO: fix location +source 01_bootstrap.sh +source 02_chroot.sh + +if [ -n "$HOOK" ] ; then + debug "executing given hook $HOOK" + $HOOK + exit 0 +fi + +## main execution + +# 01_bootstrap.sh +bootstrap + +# 02_chroot.sh +patch_chroot apply +chroot_shell +patch_chroot deapply ## END OF FILE ################################################################# # vim: ai tw=80 ft=zsh expandtab