summaryrefslogtreecommitdiff
path: root/run-bootstrap-in-chroot
diff options
context:
space:
mode:
authorRichard Maw <richard.maw@codethink.co.uk>2012-01-27 16:03:31 +0000
committerRichard Maw <richard.maw@codethink.co.uk>2012-01-27 16:03:31 +0000
commitde57e2844ef7d0f67cbfe96f328d9182d1131d5f (patch)
treec9d83dc075c1202a9d208bec730b43ae3b479cab /run-bootstrap-in-chroot
parentbf105d61f24edb260ce9cf41180ab5a0cedb0dfe (diff)
downloadmorph-de57e2844ef7d0f67cbfe96f328d9182d1131d5f.tar.gz
run-bootstrap-in-chroot: Take mirrors from environment variables
Diffstat (limited to 'run-bootstrap-in-chroot')
-rwxr-xr-xrun-bootstrap-in-chroot25
1 files changed, 20 insertions, 5 deletions
diff --git a/run-bootstrap-in-chroot b/run-bootstrap-in-chroot
index dad53c4f..ad7b5168 100755
--- a/run-bootstrap-in-chroot
+++ b/run-bootstrap-in-chroot
@@ -26,8 +26,16 @@ else
snapshot=true
snapshotdir="$1"
fi
-mirror="http://192.168.1.185/debian"
-
+if ([ "x$DEBIAN_MIRROR" = x ] && echo DEBIAN_MIRROR 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"
@@ -41,7 +49,7 @@ else
--include=build-essential,\
gawk,bison,python,autoconf,autopoint,automake,gettext,libtool,\
help2man,texinfo,sudo,qemu-utils,parted,kpartx,mbr,extlinux \
-squeeze "$dir" "$mirror"
+squeeze "$dir" "$DEBIAN_MIRROR"
if "$snapshot"
then
@@ -55,6 +63,15 @@ cat <<EOF > "$dir/etc/hosts"
127.0.1.1 `hostname`
EOF
+cp baserock-bootstrap "$dir/."
+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
@@ -83,8 +100,6 @@ cp -rl "$HOME/baserock/gits" "$dir/tree/baserock/gits"
# Run pass2 of bootstrap. This actually runs pass1 too, but quickly, since
# it's already built.
-cp baserock-bootstrap "$dir/."
-sed 's,^.*/,http://192.168.1.185/lfs/,' wget-list > "$dir/wget-list"
if mount_virtual "$dir" &&
chroot "$dir" bash -x baserock-bootstrap false &&
unmount_virtual "$dir"