3
finddebs_style from-indices
4
variants - buildd fakechroot minbase scratchbox
6
if doing_variant fakechroot; then
7
test "$FAKECHROOT" = "true" || error 1 FAKECHROOTREQ "This variant requires fakechroot environment to be started"
11
alpha|ia64) LIBC="libc6.1" ;;
12
kfreebsd-*) LIBC="libc0.1" ;;
13
hurd-*) LIBC="libc0.3" ;;
18
required="$(get_debs Priority: required)"
20
if doing_variant - || doing_variant fakechroot; then
21
#required="$required $(get_debs Priority: important)"
22
# ^^ should be getting debconf here somehow maybe
23
base="$(get_debs Priority: important)"
24
elif doing_variant buildd || doing_variant scratchbox; then
25
base="$(get_debs Build-Essential: yes)"
26
elif doing_variant minbase; then
30
if doing_variant fakechroot; then
31
# ldd.fake needs binutils
32
required="$required binutils"
36
first_stage_install () {
39
mkdir -p "$TARGET/var/lib/dpkg"
40
: >"$TARGET/var/lib/dpkg/status"
41
echo >"$TARGET/var/lib/dpkg/available"
44
if [ ! -e "$TARGET/etc/fstab" ]; then
45
echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab"
46
chown 0:0 "$TARGET/etc/fstab"; chmod 644 "$TARGET/etc/fstab"
49
if [ -x "$TARGET/usr/bin/md5sum.textutils" ] && [ \! -e "$TARGET/usr/bin/md5sum" ]; then
50
cp "$TARGET/usr/bin/md5sum.textutils" "$TARGET/usr/bin/md5sum"
53
if doing_variant fakechroot; then
54
setup_devices_fakechroot
61
local deb="$(debfor $pkg)"
63
ar -p "$TARGET/$deb" control.tar.gz | zcat |
64
tar -O -xf - control ./control 2>/dev/null |
65
grep -i ^Version: | sed -e 's/[^:]*: *//' | head -n 1
68
mkdir -p "$TARGET/var/lib/dpkg/info"
73
Status: install ok installed" >> "$TARGET/var/lib/dpkg/status"
75
touch "$TARGET/var/lib/dpkg/info/${pkg}.list"
81
second_stage_install () {
83
smallyes '' | in_target dpkg --force-depends --install $(debfor "$@")
87
baseprog="$(($baseprog + ${1:-1}))"
90
if doing_variant fakechroot; then
92
elif doing_variant scratchbox; then
96
in_target /sbin/ldconfig
99
DEBIAN_FRONTEND=noninteractive
100
DEBCONF_NONINTERACTIVE_SEEN=true
101
export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN
106
p; progress $baseprog $bases INSTCORE "Installing core packages" #1
107
info INSTCORE "Installing core packages..."
109
p; progress $baseprog $bases INSTCORE "Installing core packages" #2
110
ln -sf mawk "$TARGET/usr/bin/awk"
111
x_core_install base-files base-passwd
112
p; progress $baseprog $bases INSTCORE "Installing core packages" #3
115
if [ ! -e "$TARGET/etc/localtime" ]; then
116
ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime"
119
if doing_variant fakechroot; then
120
install_fakechroot_tools
123
p; progress $baseprog $bases INSTCORE "Installing core packages" #4
126
p; progress $baseprog $bases INSTCORE "Installing core packages" #5
127
x_core_install perl-base
129
p; progress $baseprog $bases INSTCORE "Installing core packages" #6
130
rm "$TARGET/usr/bin/awk"
133
p; progress $baseprog $bases INSTCORE "Installing core packages" #7
134
if doing_variant -; then
135
x_core_install debconf
139
bases=$(set -- $required; echo $#)
141
info UNPACKREQ "Unpacking required packages..."
146
(repeatn 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages. This will be attempted up to five times." "" \
147
dpkg --status-fd 8 --force-depends --unpack $(debfor $required) 8>&1 1>&7 || echo EXITCODE $?) |
148
dpkg_progress $baseprog $bases UNPACKREQ "Unpacking required packages" UNPACKING
150
info CONFREQ "Configuring required packages..."
152
mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL"
156
echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon"
157
chmod 755 "$TARGET/sbin/start-stop-daemon"
159
setup_dselect_method apt
162
(in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" \
163
dpkg --status-fd 8 --configure --pending --force-configure-any --force-depends 8>&1 1>&7 || echo EXITCODE $?) |
164
dpkg_progress $baseprog $bases CONFREQ "Configuring required packages" CONFIGURING
167
bases="$(set -- $base; echo $#)"
169
info UNPACKBASE "Unpacking the base system..."
171
setup_available $required $base
173
while predep=$(get_next_predep); do
174
# We have to resolve dependencies of pre-dependencies manually because
175
# dpkg --predep-package doesn't handle this.
176
predep=$(without "$(without "$(resolve_deps $predep)" "$required")" "$done_predeps")
177
# XXX: progress is tricky due to how dpkg_progress works
178
# -- cjwatson 2009-07-29
179
p; smallyes '' | in_target dpkg --force-overwrite --force-confold --skip-same-version --install $(debfor $predep)
180
base=$(without "$base" "$predep")
181
done_predeps="$done_predeps $predep"
185
(repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" \
186
dpkg --status-fd 8 --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) 8>&1 1>&7 || echo EXITCODE $?) |
187
dpkg_progress $baseprog $bases UNPACKBASE "Unpacking base system" UNPACKING
189
info CONFBASE "Configuring the base system..."
193
in_target_failmsg CONF_BASE_FAIL "Failure while configuring base packages." "" \
194
dpkg --status-fd 8 --force-confold --skip-same-version --configure -a 8>&1 1>&7 || echo EXITCODE $?) |
195
dpkg_progress $baseprog $bases CONFBASE "Configuring base system" CONFIGURING
197
mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon"
199
progress $bases $bases CONFBASE "Configuring base system"
200
info BASESUCCESS "Base system installed successfully."