annotate sources/native-builds/gentoo-stage1.sh @ 1230:50015325b804

Teach gentoo-stage1.sh that /dev/null means don't create an hdc.
author Rob Landley <rob@landley.net>
date Tue, 31 Aug 2010 18:22:57 -0500
parents db3b0244a49e
children b84cf2f3ef53
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1057
949617f5287f First chunk of porting Gentoo From Scratch to an hdc build. (Much more to go.)
Rob Landley <rob@landley.net>
parents:
diff changeset
1 #!/bin/bash
949617f5287f First chunk of porting Gentoo From Scratch to an hdc build. (Much more to go.)
Rob Landley <rob@landley.net>
parents:
diff changeset
2
949617f5287f First chunk of porting Gentoo From Scratch to an hdc build. (Much more to go.)
Rob Landley <rob@landley.net>
parents:
diff changeset
3 # Script to extend minimal native build environment into a Gentoo stage 1.
949617f5287f First chunk of porting Gentoo From Scratch to an hdc build. (Much more to go.)
Rob Landley <rob@landley.net>
parents:
diff changeset
4
949617f5287f First chunk of porting Gentoo From Scratch to an hdc build. (Much more to go.)
Rob Landley <rob@landley.net>
parents:
diff changeset
5 # We take some liberties with this stage 1: use busybox instead of gnu tools,
949617f5287f First chunk of porting Gentoo From Scratch to an hdc build. (Much more to go.)
Rob Landley <rob@landley.net>
parents:
diff changeset
6 # uClibc-based instead of glibc-based, and using our existing toolchain
949617f5287f First chunk of porting Gentoo From Scratch to an hdc build. (Much more to go.)
Rob Landley <rob@landley.net>
parents:
diff changeset
7 # (with distcc acceleration).
949617f5287f First chunk of porting Gentoo From Scratch to an hdc build. (Much more to go.)
Rob Landley <rob@landley.net>
parents:
diff changeset
8
1095
891bb7ec58f2 Redo download logic to work with FORK=1 (spotted by Milton Miller).
Rob Landley <rob@landley.net>
parents: 1080
diff changeset
9 # GFS used:
891bb7ec58f2 Redo download logic to work with FORK=1 (spotted by Milton Miller).
Rob Landley <rob@landley.net>
parents: 1080
diff changeset
10 # setup-base-packages.sh
891bb7ec58f2 Redo download logic to work with FORK=1 (spotted by Milton Miller).
Rob Landley <rob@landley.net>
parents: 1080
diff changeset
11 # strace, Python, ncurses, bash, tar, patch, findutils, file, pax-utils,
891bb7ec58f2 Redo download logic to work with FORK=1 (spotted by Milton Miller).
Rob Landley <rob@landley.net>
parents: 1080
diff changeset
12 # shadow
891bb7ec58f2 Redo download logic to work with FORK=1 (spotted by Milton Miller).
Rob Landley <rob@landley.net>
parents: 1080
diff changeset
13 # setup-portage.sh
891bb7ec58f2 Redo download logic to work with FORK=1 (spotted by Milton Miller).
Rob Landley <rob@landley.net>
parents: 1080
diff changeset
14 # /etc/passwd (root and portage), /etc/group (root and portage)
891bb7ec58f2 Redo download logic to work with FORK=1 (spotted by Milton Miller).
Rob Landley <rob@landley.net>
parents: 1080
diff changeset
15 # portage
891bb7ec58f2 Redo download logic to work with FORK=1 (spotted by Milton Miller).
Rob Landley <rob@landley.net>
parents: 1080
diff changeset
16
1057
949617f5287f First chunk of porting Gentoo From Scratch to an hdc build. (Much more to go.)
Rob Landley <rob@landley.net>
parents:
diff changeset
17 # Download all the source tarballs we haven't got up-to-date copies of.
949617f5287f First chunk of porting Gentoo From Scratch to an hdc build. (Much more to go.)
Rob Landley <rob@landley.net>
parents:
diff changeset
18
949617f5287f First chunk of porting Gentoo From Scratch to an hdc build. (Much more to go.)
Rob Landley <rob@landley.net>
parents:
diff changeset
19 # The tarballs are downloaded into the "packages" directory, which is
949617f5287f First chunk of porting Gentoo From Scratch to an hdc build. (Much more to go.)
Rob Landley <rob@landley.net>
parents:
diff changeset
20 # created as needed.
949617f5287f First chunk of porting Gentoo From Scratch to an hdc build. (Much more to go.)
Rob Landley <rob@landley.net>
parents:
diff changeset
21
949617f5287f First chunk of porting Gentoo From Scratch to an hdc build. (Much more to go.)
Rob Landley <rob@landley.net>
parents:
diff changeset
22 source sources/include.sh || exit 1
949617f5287f First chunk of porting Gentoo From Scratch to an hdc build. (Much more to go.)
Rob Landley <rob@landley.net>
parents:
diff changeset
23
949617f5287f First chunk of porting Gentoo From Scratch to an hdc build. (Much more to go.)
Rob Landley <rob@landley.net>
parents:
diff changeset
24 [ $# -ne 1 ] && echo "usage: $0 FILENAME" >&2 && exit 1
1230
50015325b804 Teach gentoo-stage1.sh that /dev/null means don't create an hdc.
Rob Landley <rob@landley.net>
parents: 1223
diff changeset
25 [ "$1" != "/dev/null" ] && [ -e "$1" ] && echo "$1" exists && exit 0
1057
949617f5287f First chunk of porting Gentoo From Scratch to an hdc build. (Much more to go.)
Rob Landley <rob@landley.net>
parents:
diff changeset
26
1188
13c22a46b1c9 Now that extract_packages is separate from setupfor, EXTRACT_ALL=1 should be less brittle. (If not, needs to be fixed, so remove workarounds.)
Rob Landley <rob@landley.net>
parents: 1112
diff changeset
27 # We use a lot of our own directories because we may have the same packages
13c22a46b1c9 Now that extract_packages is separate from setupfor, EXTRACT_ALL=1 should be less brittle. (If not, needs to be fixed, so remove workarounds.)
Rob Landley <rob@landley.net>
parents: 1112
diff changeset
28 # as the aboriginal build, but use different versions. So keep things separate
13c22a46b1c9 Now that extract_packages is separate from setupfor, EXTRACT_ALL=1 should be less brittle. (If not, needs to be fixed, so remove workarounds.)
Rob Landley <rob@landley.net>
parents: 1112
diff changeset
29 # so they don't interfere.
13c22a46b1c9 Now that extract_packages is separate from setupfor, EXTRACT_ALL=1 should be less brittle. (If not, needs to be fixed, so remove workarounds.)
Rob Landley <rob@landley.net>
parents: 1112
diff changeset
30
1112
25607cc50c8f Update gentoo-stage1 build to actually build portage. (Doesn't install a tree yet.)
Rob Landley <rob@landley.net>
parents: 1095
diff changeset
31 NATIVE_BUILDS="$SOURCES/native-builds"
25607cc50c8f Update gentoo-stage1 build to actually build portage. (Doesn't install a tree yet.)
Rob Landley <rob@landley.net>
parents: 1095
diff changeset
32 PATCHDIR="$NATIVE_BUILDS/gentoo-stage1-patches"
1057
949617f5287f First chunk of porting Gentoo From Scratch to an hdc build. (Much more to go.)
Rob Landley <rob@landley.net>
parents:
diff changeset
33 SRCDIR="$SRCDIR/gentoo-stage1" && mkdir -p "$SRCDIR" || dienow
1112
25607cc50c8f Update gentoo-stage1 build to actually build portage. (Doesn't install a tree yet.)
Rob Landley <rob@landley.net>
parents: 1095
diff changeset
34 WORK="$WORK"/gentoo-stage1 && blank_tempdir "$WORK"
1188
13c22a46b1c9 Now that extract_packages is separate from setupfor, EXTRACT_ALL=1 should be less brittle. (If not, needs to be fixed, so remove workarounds.)
Rob Landley <rob@landley.net>
parents: 1112
diff changeset
35 SRCTREE="$WORK"
13c22a46b1c9 Now that extract_packages is separate from setupfor, EXTRACT_ALL=1 should be less brittle. (If not, needs to be fixed, so remove workarounds.)
Rob Landley <rob@landley.net>
parents: 1112
diff changeset
36
13c22a46b1c9 Now that extract_packages is separate from setupfor, EXTRACT_ALL=1 should be less brittle. (If not, needs to be fixed, so remove workarounds.)
Rob Landley <rob@landley.net>
parents: 1112
diff changeset
37 EXTRACT_ALL=1
1057
949617f5287f First chunk of porting Gentoo From Scratch to an hdc build. (Much more to go.)
Rob Landley <rob@landley.net>
parents:
diff changeset
38
949617f5287f First chunk of porting Gentoo From Scratch to an hdc build. (Much more to go.)
Rob Landley <rob@landley.net>
parents:
diff changeset
39 echo "=== Download source code."
949617f5287f First chunk of porting Gentoo From Scratch to an hdc build. (Much more to go.)
Rob Landley <rob@landley.net>
parents:
diff changeset
40
949617f5287f First chunk of porting Gentoo From Scratch to an hdc build. (Much more to go.)
Rob Landley <rob@landley.net>
parents:
diff changeset
41 # Note: set SHA1= blank to skip checksum validation.
949617f5287f First chunk of porting Gentoo From Scratch to an hdc build. (Much more to go.)
Rob Landley <rob@landley.net>
parents:
diff changeset
42
949617f5287f First chunk of porting Gentoo From Scratch to an hdc build. (Much more to go.)
Rob Landley <rob@landley.net>
parents:
diff changeset
43 URL=http://zlib.net/zlib-1.2.5.tar.bz2 \
949617f5287f First chunk of porting Gentoo From Scratch to an hdc build. (Much more to go.)
Rob Landley <rob@landley.net>
parents:
diff changeset
44 SHA1=543fa9abff0442edca308772d6cef85557677e02 \
949617f5287f First chunk of porting Gentoo From Scratch to an hdc build. (Much more to go.)
Rob Landley <rob@landley.net>
parents:
diff changeset
45 maybe_fork "download || dienow"
949617f5287f First chunk of porting Gentoo From Scratch to an hdc build. (Much more to go.)
Rob Landley <rob@landley.net>
parents:
diff changeset
46
949617f5287f First chunk of porting Gentoo From Scratch to an hdc build. (Much more to go.)
Rob Landley <rob@landley.net>
parents:
diff changeset
47 URL=http://ftp.gnu.org/pub/gnu/ncurses/ncurses-5.7.tar.gz \
949617f5287f First chunk of porting Gentoo From Scratch to an hdc build. (Much more to go.)
Rob Landley <rob@landley.net>
parents:
diff changeset
48 SHA1=8233ee56ed84ae05421e4e6d6db6c1fe72ee6797 \
1223
db3b0244a49e Break down and build separate patch package on target for gentoo stage 1.
Rob Landley <rob@landley.net>
parents: 1202
diff changeset
49 maybe_fork "download || dienow"
1057
949617f5287f First chunk of porting Gentoo From Scratch to an hdc build. (Much more to go.)
Rob Landley <rob@landley.net>
parents:
diff changeset
50
949617f5287f First chunk of porting Gentoo From Scratch to an hdc build. (Much more to go.)
Rob Landley <rob@landley.net>
parents:
diff changeset
51 URL=http://python.org/ftp/python/2.6.5/Python-2.6.5.tar.bz2 \
949617f5287f First chunk of porting Gentoo From Scratch to an hdc build. (Much more to go.)
Rob Landley <rob@landley.net>
parents:
diff changeset
52 SHA1=24c94f5428a8c94c9d0b316e3019fee721fdb5d1 \
1223
db3b0244a49e Break down and build separate patch package on target for gentoo stage 1.
Rob Landley <rob@landley.net>
parents: 1202
diff changeset
53 maybe_fork "download || dienow"
1057
949617f5287f First chunk of porting Gentoo From Scratch to an hdc build. (Much more to go.)
Rob Landley <rob@landley.net>
parents:
diff changeset
54
1080
119367910fcd More work on gentoo from scratch conversion.
Rob Landley <rob@landley.net>
parents: 1057
diff changeset
55 URL=http://ftp.gnu.org/gnu/bash/bash-3.2.tar.gz \
119367910fcd More work on gentoo from scratch conversion.
Rob Landley <rob@landley.net>
parents: 1057
diff changeset
56 SHA1=fe6466c7ee98061e044dae0347ca5d1a8eab4a0d \
1223
db3b0244a49e Break down and build separate patch package on target for gentoo stage 1.
Rob Landley <rob@landley.net>
parents: 1202
diff changeset
57 maybe_fork "download || dienow"
1202
75d179a52475 Bootstrapping gentoo portage tree. Download tarball, extract it, and emerge --sync. (Build rsync so emerge --sync works.)
Rob Landley <rob@landley.net>
parents: 1188
diff changeset
58
75d179a52475 Bootstrapping gentoo portage tree. Download tarball, extract it, and emerge --sync. (Build rsync so emerge --sync works.)
Rob Landley <rob@landley.net>
parents: 1188
diff changeset
59 URL=http://www.samba.org/ftp/rsync/src/rsync-3.0.7.tar.gz \
75d179a52475 Bootstrapping gentoo portage tree. Download tarball, extract it, and emerge --sync. (Build rsync so emerge --sync works.)
Rob Landley <rob@landley.net>
parents: 1188
diff changeset
60 SHA1=63426a1bc71991d93159cd522521fbacdafb7a61 \
1223
db3b0244a49e Break down and build separate patch package on target for gentoo stage 1.
Rob Landley <rob@landley.net>
parents: 1202
diff changeset
61 maybe_fork "download || dienow"
db3b0244a49e Break down and build separate patch package on target for gentoo stage 1.
Rob Landley <rob@landley.net>
parents: 1202
diff changeset
62
db3b0244a49e Break down and build separate patch package on target for gentoo stage 1.
Rob Landley <rob@landley.net>
parents: 1202
diff changeset
63 URL=http://ftp.gnu.org/gnu/patch/patch-2.5.9.tar.gz \
db3b0244a49e Break down and build separate patch package on target for gentoo stage 1.
Rob Landley <rob@landley.net>
parents: 1202
diff changeset
64 SHA1=9a69f7191576549255f046487da420989d2834a6 \
db3b0244a49e Break down and build separate patch package on target for gentoo stage 1.
Rob Landley <rob@landley.net>
parents: 1202
diff changeset
65 maybe_fork "download || dienow"
1080
119367910fcd More work on gentoo from scratch conversion.
Rob Landley <rob@landley.net>
parents: 1057
diff changeset
66
1112
25607cc50c8f Update gentoo-stage1 build to actually build portage. (Doesn't install a tree yet.)
Rob Landley <rob@landley.net>
parents: 1095
diff changeset
67 URL=http://dev.gentoo.org/~zmedico/portage/archives/portage-2.1.8.tar.bz2 \
25607cc50c8f Update gentoo-stage1 build to actually build portage. (Doesn't install a tree yet.)
Rob Landley <rob@landley.net>
parents: 1095
diff changeset
68 SHA1=390c97f3783af2d9e52482747ead3681655ea9c3 \
1223
db3b0244a49e Break down and build separate patch package on target for gentoo stage 1.
Rob Landley <rob@landley.net>
parents: 1202
diff changeset
69 maybe_fork "download || dienow"
1112
25607cc50c8f Update gentoo-stage1 build to actually build portage. (Doesn't install a tree yet.)
Rob Landley <rob@landley.net>
parents: 1095
diff changeset
70
1057
949617f5287f First chunk of porting Gentoo From Scratch to an hdc build. (Much more to go.)
Rob Landley <rob@landley.net>
parents:
diff changeset
71 echo === Got all source.
949617f5287f First chunk of porting Gentoo From Scratch to an hdc build. (Much more to go.)
Rob Landley <rob@landley.net>
parents:
diff changeset
72
949617f5287f First chunk of porting Gentoo From Scratch to an hdc build. (Much more to go.)
Rob Landley <rob@landley.net>
parents:
diff changeset
73 cleanup_oldfiles
949617f5287f First chunk of porting Gentoo From Scratch to an hdc build. (Much more to go.)
Rob Landley <rob@landley.net>
parents:
diff changeset
74
1230
50015325b804 Teach gentoo-stage1.sh that /dev/null means don't create an hdc.
Rob Landley <rob@landley.net>
parents: 1223
diff changeset
75 cp -a "$NATIVE_BUILDS/gentoo-stage1-files/." "$WORK" || exit 1
50015325b804 Teach gentoo-stage1.sh that /dev/null means don't create an hdc.
Rob Landley <rob@landley.net>
parents: 1223
diff changeset
76
50015325b804 Teach gentoo-stage1.sh that /dev/null means don't create an hdc.
Rob Landley <rob@landley.net>
parents: 1223
diff changeset
77 if [ "$1" != "/dev/null" ]
50015325b804 Teach gentoo-stage1.sh that /dev/null means don't create an hdc.
Rob Landley <rob@landley.net>
parents: 1223
diff changeset
78 then
50015325b804 Teach gentoo-stage1.sh that /dev/null means don't create an hdc.
Rob Landley <rob@landley.net>
parents: 1223
diff changeset
79 cd "$TOP" &&
50015325b804 Teach gentoo-stage1.sh that /dev/null means don't create an hdc.
Rob Landley <rob@landley.net>
parents: 1223
diff changeset
80 mksquashfs "$WORK" "$1" -noappend -all-root || dienow
50015325b804 Teach gentoo-stage1.sh that /dev/null means don't create an hdc.
Rob Landley <rob@landley.net>
parents: 1223
diff changeset
81 fi