[Fai-commit] r3815 - people/lazyboy/fai-distributions/sbin

fai-commit at lists.alioth.debian.org fai-commit at lists.alioth.debian.org
Sat Sep 2 15:04:08 UTC 2006


Author: lazyboy-guest
Date: 2006-09-02 15:04:07 +0000 (Sat, 02 Sep 2006)
New Revision: 3815

Added:
   people/lazyboy/fai-distributions/sbin/fai-make-base-tgz
Log:
creating a generic version of the base tgz helper script from the ubuntu script

Copied: people/lazyboy/fai-distributions/sbin/fai-make-base-tgz (from rev 3263, people/lazyboy/fai-distributions/dists/ubuntu_breezy/make-base-tgz)
===================================================================
--- people/lazyboy/fai-distributions/sbin/fai-make-base-tgz	                        (rev 0)
+++ people/lazyboy/fai-distributions/sbin/fai-make-base-tgz	2006-09-02 15:04:07 UTC (rev 3815)
@@ -0,0 +1,91 @@
+#!/bin/sh
+PATH=/usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin
+
+DISTRIBUTION="ubuntu_breezy"
+
+if [ `id -u` -ne 0 ]; then
+    echo "Run this program as root."
+    exit 9
+fi
+
+# option e currently does nothing
+while getopts vc:f: opt ; do
+    case "$opt" in
+        c) cfdir=$OPTARG ;;
+        v) verbose=1 ; v=-v ;;
+        f) cfg=$OPTARG ;;
+        ?) exit 5 ;; # error in option parsing
+    esac
+done
+
+set -e
+
+# source fai.conf and make-fai-nfsroot.conf
+[ -z "$cfdir" ] && cfdir=/etc/fai
+if [ ! -d "$cfdir" ]; then
+    echo "$cfdir is not a directory"
+    exit 6
+fi
+
+[ "$verbose" ] && echo "Using configuration files from directory $cfdir"
+if [ -n "$cfg" ]; then
+    . $cfdir/$cfg
+else
+    . $cfdir/fai.conf
+fi
+
+
+. /etc/fai-distributions/${DISTRIBUTION}.conf
+
+if [ -z "$NFSROOT" ]; then
+    echo "\$NFSROOT is not set. Please check your settings in $cfdir/fai.conf."
+    exit 4
+fi
+
+# call debootstrap as necesary - (how can this be done without having the
+# ubuntu debootstrap installed?)
+
+BOOTSTRAP_DIR=/var/fai/bootstrappers/$DISTRIBUTION
+mkdir -p $BOOTSTRAP_DIR
+cd $BOOTSTRAP_DIR
+wget $BOOTSTRAP_ARCHIVE/ubuntu_breezy/$BOOTSTRAP_PACKAGE
+
+
+# extact debootstrap archive
+dpkg-deb -x $BOOTSTRAP_PACKAGE .
+
+cd -
+
+# FIXME: can/should probably be defined somewhere in /etc/fai?
+TMP_CHROOT_DIR=`mktemp -d /tmp/fai/${DISTRIBUTION}_debootstrap.XXXXXX`
+echo "TMPDIT is $TMP_CHROOT_DIR"
+
+FAI_DEBOOTSTRAP_OPTIONS="--arch i386 \
+    --exclude=pcmcia-cs,pppoe,dhcp-client,exim4,exim4-base,exim4-config,exim4-daemon-light,modconf,libident,exim \
+    --include=lilo \
+    breezy \
+    $TMP_CHROOT_DIR \
+    $MIRROR_LOCATION"
+
+cd `dirname $0`
+
+export DEBOOTSTRAP_DIR=$BOOTSTRAP_DIR/usr/lib/debootstrap/
+
+echo run $BOOTSTRAP_DIR/usr/sbin/debootstrap $FAI_DEBOOTSTRAP_OPTIONS
+$BOOTSTRAP_DIR/usr/sbin/debootstrap $FAI_DEBOOTSTRAP_OPTIONS
+
+chroot $TMP_CHROOT_DIR apt-get clean
+       
+echo "Creating base-$DISTRIBUTION.tgz"
+
+cd $TMP_CHROOT_DIR
+tar cfz $NFSROOT/var/tmp/base-$DISTRIBUTION.tgz *
+
+chroot $TMP_CHROOT_DIR umount /dev
+chroot $TMP_CHROOT_DIR umount /.dev
+ 
+# cleanup
+echo "cleaning up TMP_CHROOT_DIR $TMP_CHROOT_DIR"
+rm -rf $TMP_CHROOT_DIR
+
+




More information about the Fai-commit mailing list