2
amd64|i386|powerpc|sparc)
3
default_mirror http://archive.ubuntu.com/ubuntu
6
default_mirror http://ports.ubuntu.com/ubuntu-ports
11
finddebs_style from-indices
12
variants - buildd fakechroot
14
if doing_variant fakechroot; then
15
test "$FAKECHROOT" = "true" || error 1 FAKECHROOTREQ "This variant requires fakechroot environment to be started"
19
alpha|ia64) LIBC="libc6.1" ;;
24
required="$(get_debs Priority: required)"
26
if doing_variant -; then
27
#required="$required $(get_debs Priority: important)"
28
# ^^ should be getting debconf here somehow maybe
29
base="$(get_debs Priority: important)"
30
elif doing_variant buildd; then
31
# TODO: add Build-Essential: yes extraoverrides
32
#base="$(get_debs Build-Essential: yes)"
34
add () { if [ "$ARCH" = "$1" ]; then eval "$2=\"\$$2 $3\""; fi; }
36
base="apt binutils cpio cpp cpp-4.1 dpkg-dev g++ g++-4.1 gcc gcc-4.1 ${LIBC}-dev libdb4.4 libgdbm3 libstdc++6 libstdc++6-4.1-dev linux-libc-dev make patch perl perl-modules"
38
add ia64 base "libunwind7-dev"
39
add sparc base "lib64gcc1"
40
add sparc base "libc6-dev-sparc64"
41
add sparc base "libc6-sparc64"
42
elif doing_variant fakechroot; then
47
first_stage_install () {
50
mkdir -p "$TARGET/var/lib/dpkg"
51
: >"$TARGET/var/lib/dpkg/status"
52
: >"$TARGET/var/lib/dpkg/available"
55
if [ ! -e "$TARGET/etc/fstab" ]; then
56
echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab"
57
chown 0:0 "$TARGET/etc/fstab"; chmod 644 "$TARGET/etc/fstab"
60
if doing_variant fakechroot; then
61
setup_devices_fakechroot
68
local deb="$(debfor $pkg)"
70
ar -p "$TARGET/$deb" control.tar.gz | zcat |
71
tar -O -xf - control ./control 2>/dev/null |
72
grep -i ^Version: | sed -e 's/[^:]*: *//' | head -n 1
75
mkdir -p "$TARGET/var/lib/dpkg/info"
80
Status: install ok installed" >> "$TARGET/var/lib/dpkg/status"
82
touch "$TARGET/var/lib/dpkg/info/${pkg}.list"
88
second_stage_install () {
90
smallyes '' | in_target dpkg --force-depends --install $(debfor "$@")
94
baseprog="$(($baseprog + ${1:-1}))"
97
if doing_variant fakechroot; then
101
in_target /sbin/ldconfig
104
DEBIAN_FRONTEND=noninteractive
105
DEBCONF_NONINTERACTIVE_SEEN=true
106
export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN
111
p; progress $baseprog $bases INSTCORE "Installing core packages" #1
112
info INSTCORE "Installing core packages..."
114
p; progress $baseprog $bases INSTCORE "Installing core packages" #2
115
ln -sf mawk "$TARGET/usr/bin/awk"
116
x_core_install base-files base-passwd
117
p; progress $baseprog $bases INSTCORE "Installing core packages" #3
120
if [ ! -e "$TARGET/etc/localtime" ]; then
121
ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime"
124
if doing_variant fakechroot; then
125
install_fakechroot_tools
128
p; progress $baseprog $bases INSTCORE "Installing core packages" #4
131
p; progress $baseprog $bases INSTCORE "Installing core packages" #5
132
x_core_install perl-base
134
p; progress $baseprog $bases INSTCORE "Installing core packages" #6
135
rm "$TARGET/usr/bin/awk"
138
p; progress $baseprog $bases INSTCORE "Installing core packages" #7
139
if doing_variant -; then
140
x_core_install debconf
144
bases=$(set -- $required; echo $#)
146
info UNPACKREQ "Unpacking required packages..."
149
(repeatn 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages. This will be attempted up to five times." "" \
150
dpkg --status-fd 8 --force-depends --unpack $(debfor $required) 8>&1 1>&7 |
151
dpkg_progress $baseprog $bases UNPACKREQ "Unpacking required packages" UNPACKING) 7>&1
153
info CONFREQ "Configuring required packages..."
155
if doing_variant fakechroot; then
156
# fix initscripts postinst (no mounting possible, and wrong if condition)
157
sed -i '/dpkg.*--compare-versions/ s/\<lt\>/lt-nl/' "$TARGET/var/lib/dpkg/info/initscripts.postinst"
159
# kill libdevmapper postinst; it tries to create /dev/mapper/
160
rm "$TARGET/var/lib/dpkg/info/libdevmapper1"*.postinst
163
mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL"
167
echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon"
168
chmod 755 "$TARGET/sbin/start-stop-daemon"
170
setup_dselect_method apt
173
(in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" \
174
dpkg --status-fd 8 --configure --pending --force-configure-any --force-depends 8>&1 1>&7 |
175
dpkg_progress $baseprog $bases CONFREQ "Configuring required packages" CONFIGURING) 7>&1
178
bases="$(set -- $base; echo $#)"
180
info UNPACKBASE "Unpacking the base system..."
183
(repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" \
184
dpkg --status-fd 8 --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) 8>&1 1>&7 |
185
dpkg_progress $baseprog $bases UNPACKBASE "Unpacking base system" UNPACKING) 7>&1
187
info CONFBASE "Configuring the base system..."
190
(repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages. This will be attempted 5 times." "" \
191
dpkg --status-fd 8 --force-confold --skip-same-version --configure -a 8>&1 1>&7 |
192
dpkg_progress $baseprog $bases CONFBASE "Configuring base system" CONFIGURING) 7>&1
194
mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon"
196
progress $bases $bases CONFBASE "Configuring base system"
197
info BASESUCCESS "Base system installed successfully."