X-Git-Url: http://git.grml.org/?p=grml-live.git;a=blobdiff_plain;f=scripts%2Fgrml-live;h=1d693cdae5966e32b9eff4ddaca2827335a87030;hp=eca49d9ec71da5b8f4c3eb2b3e8769cf46622757;hb=f6a4ba1f7632698941c898a7ae305f351a78fcda;hpb=f3a39c0e8073ead55cdcec7fba806249c8140b75 diff --git a/scripts/grml-live b/scripts/grml-live index eca49d9..1d693cd 100755 --- a/scripts/grml-live +++ b/scripts/grml-live @@ -1,12 +1,85 @@ #!/bin/zsh # Filename: grml-live -# Purpose: +# Purpose: build script for creating grml live-cd # 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 21:06:07 CET 2007 +# Latest change: Tue Feb 13 00:16:11 CET 2007 ################################################################################ -echo TODO +LANG=C ; LC_ALL=C +set -e # fail on any error + +# functions +FUNCTIONSFILE='functions.sh' # TODO: fix location +for file in $FUNCTIONSFILE /etc/grml/lsb-functions /etc/grml/script-functions ; do + [ -r "$file" ] && source "$file" || { print "Reading $file failed. Fatal error, exiting." ; exit 1 } +done + +# Clean exit +trap bailout 1 2 3 15 + +# 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_live_prepare +chroot_live_execute +chroot_shell +patch_chroot deapply ## END OF FILE ################################################################# +# vim: ai tw=80 ft=zsh expandtab