From: Michael Prokop Date: Tue, 18 Sep 2007 19:23:19 +0000 (+0200) Subject: Support use of local mirror (like NFS) through mount bind X-Git-Tag: 0.0.1~13 X-Git-Url: http://git.grml.org/?p=grml-live.git;a=commitdiff_plain;h=1544e35bd7c2bc398f9fc96e2df05e168b24700a Support use of local mirror (like NFS) through mount bind --- diff --git a/etc/grml/grml-live.conf b/etc/grml/grml-live.conf index 1c776e6..4c67f87 100644 --- a/etc/grml/grml-live.conf +++ b/etc/grml/grml-live.conf @@ -3,7 +3,7 @@ # Authors: grml-team (grml.org), (c) Michael Prokop # Bug-Reports: see http://grml.org/bugs/ # License: This file is licensed under the GPL v2 or any later version. -# Latest change: Tue Sep 18 09:31:39 CEST 2007 [mika] +# Latest change: Tue Sep 18 20:32:37 CEST 2007 [mika] ################################################################################ # main output directory @@ -49,6 +49,12 @@ CLASSES="GRMLBASE,I386" # Usage: # FAI_DEBOOTSTRAP="etch http://ftp.de.debian.org/debian" +# Do you want to use a local mirror (like NFS) as well? +# If so specify the directory where debian/ is available: +# MIRROR_DIRECTORY="/mnt/mirror" +# ... and the sources.list entry for the directory: +# MIRROR_SOURCES="deb file:///mnt/mirror/debian sid main contrib non-free" + # directory of configuration files for grml-live's FAI: GRML_FAI_CONFIG=/etc/grml/fai diff --git a/grml-live b/grml-live index 91a929d..ec336c2 100755 --- a/grml-live +++ b/grml-live @@ -4,7 +4,7 @@ # Authors: grml-team (grml.org), (c) Michael Prokop # Bug-Reports: see http://grml.org/bugs/ # License: This file is licensed under the GPL v2 or any later version. -# Latest change: Tue Sep 18 19:29:33 CEST 2007 [mika] +# Latest change: Tue Sep 18 20:32:35 CEST 2007 [mika] ################################################################################ # read configuration files, set some misc variables {{{ @@ -36,6 +36,7 @@ PN=$(basename $0) # clean exit {{{ bailout() { # rm -f "$TMPFILE" + [ -n "$MIRROR_DIRECTORY" ] && umount "${CHROOT_TARGET}/${MIRROR_DIRECTORY}" [ -n "$1" ] && EXIT="$1" || EXIT="1" [ -n "$2" ] && echo "$2">&2 exit "$EXIT" @@ -129,7 +130,16 @@ fi # }}} # on-the-fly configuration {{{ -if [ -n "$GRML_LIVE_SOURCES" ] ; then +if [ -n "$MIRROR_DIRECTORY" ] ; then + if ! [ -d "$MIRROR_DIRECTORY/debian" ] ; then + echo "Sorry, $MIRROR_DIRECTORY/debian does not seem to exist. Exiting.">&2 + bailout 1 + fi + echo "$MIRROR_SOURCES" > /etc/grml/fai/apt/sources.list + if [ -n "$GRML_LIVE_SOURCES" ] ; then + echo "$GRML_LIVE_SOURCES" >> /etc/grml/fai/apt/sources.list + fi +elif [ -n "$GRML_LIVE_SOURCES" ] ; then echo "$GRML_LIVE_SOURCES" > /etc/grml/fai/apt/sources.list fi @@ -158,9 +168,14 @@ if [ -d "$CHROOT_TARGET" ] ; then echo " [x] $CHROOT_TARGET exists already, skipping the stage 'fai dirnstall'" else mkdir -p "$CHROOT_TARGET" || bailout 5 "Problem with creating $CHROOT_TARGET for FAI" + if [ -n "${MIRROR_DIRECTORY}" ] ; then + mkdir -p "${CHROOT_TARGET}/${MIRROR_DIRECTORY}" + mount --bind "${MIRROR_DIRECTORY}" "${CHROOT_TARGET}/${MIRROR_DIRECTORY}" + fi fai $VERBOSE -C "$GRML_FAI_CONFIG" -c"$CLASSES" dirinstall "$CHROOT_TARGET" $FAI_ARGS umount $CHROOT_TARGET/proc 2>/dev/null || /bin/true umount $CHROOT_TARGET/sys 2>/dev/null || /bin/true + [ -n "$MIRROR_DIRECTORY" ] && umount "${CHROOT_TARGET}/${MIRROR_DIRECTORY}" # notice: 'fai dirinstall' does not seem to exit appropriate -> # we need better error handling if [ -r "$CHROOT_TARGET"/etc/grml_cd ] ; then