#!/bin/sh set -e unmount_virtual() { umount "$1/proc" || true umount "$1/sys" || true } export LC_ALL=C if [ "x$1" = x ] then dir="squeeze-chroot" snapshot=false else mkdir -p "$1" dir="$1/squeeze-chroot" snapshot=true snapshotdir="$1" fi if [ ! -x ./do-squeeze-chroot ]; then cat >"./do-squeeze-chroot" <&2) || ([ "x$GIT_BUNDLES" = x ] && echo GIT_BUNDLES is unspecified >&2) || ([ "x$LFS_MIRROR" = x ] && echo LFS_MIRROR is unspecified >&2) then echo It is recommended that mirrors are used if test -t 0 -o -p /dev/stdin; then #check for interactive stdin read -p "continue anyway? " || exit 1 fi fi #DEBIAN_MIRROR="http://192.168.1.185/debian" #LFS_MIRROR=http://192.168.1.185/lfs/ unmount_virtual "$dir" rm -rf "$dir" mkdir "$dir" if "$snapshot" && [ -e "$snapshotdir/squeeze.tar" ] then tar -C "$dir" -xf "$snapshotdir/squeeze.tar" else debootstrap \ --include=build-essential,\ gawk,bison,python,autoconf,autopoint,automake,gettext,libtool,\ help2man,texinfo,sudo,qemu-utils,parted,kpartx,mbr,extlinux \ squeeze "$dir" "$DEBIAN_MIRROR" if "$snapshot" then tar -caf "$snapshotdir/squeeze.tar" -C "$dir" . fi fi hostname > "$dir/etc/hostname" cat < "$dir/etc/hosts" 127.0.0.1 localhost 127.0.1.1 `hostname` EOF if [ "x$LFS_MIRROR" = x ]; then cp wget-list "$dir/wget-list" else perl -M'Env' -lpe 's|^.*/|$LFS_MIRROR|' wget-list >"$dir/wget-list" #gawk -v m="$LFS_MIRROR" '{gsub(/^.*\//, m)}; 1' wget-list >"$dir/wget-list" #sed "s,^.*/,$LFS_MIRROR," wget-list > "$dir/wget-list" fi # Unpack existing snapshot, or run pass1 of bootstrap and then make snapshot. if "$snapshot" && [ -e "$snapshotdir/pass1-snapshot.tar" ] then tar -C "$dir" -xf "$snapshotdir/pass1-snapshot.tar" cp baserock-bootstrap "$dir/." #update bootstrap script else cp baserock-bootstrap "$dir/." "./do-squeeze-chroot" bash -x baserock-bootstrap true || exit 1 if "$snapshot" then tar -C "$dir" -caf "$snapshotdir/pass1-snapshot.tar" . fi fi # Update the git repos. mkdir -p "$dir/tree/baserock" rm -rf "$dir/tree/baserock/gits" mkdir "$dir/tree/baserock/gits" mkdir "$dir/tree/baserock/gits/morph" cp -r . "$dir/tree/baserock/gits/morph/." # Run pass2 of bootstrap. This actually runs pass1 too, but quickly, since # it's already built. "./do-squeeze-chroot" bash -x baserock-bootstrap false || exit 1