3
default_mirror http://archive.ubuntu.com/ubuntu
8
default_mirror http://archive.ubuntu.com/ubuntu
11
default_mirror http://ports.ubuntu.com/ubuntu-ports
16
default_mirror http://ports.ubuntu.com/ubuntu-ports
21
finddebs_style from-indices
22
variants - buildd fakechroot minbase
24
if doing_variant fakechroot; then
25
test "$FAKECHROOT" = "true" || error 1 FAKECHROOTREQ "This variant requires fakechroot environment to be started"
29
alpha|ia64) LIBC="libc6.1" ;;
34
required="$(get_debs Priority: required)"
36
if doing_variant -; then
37
#required="$required $(get_debs Priority: important)"
38
# ^^ should be getting debconf here somehow maybe
39
base="$(get_debs Priority: important)"
40
elif doing_variant buildd; then
41
base="$(get_debs Build-Essential: yes)"
42
elif doing_variant fakechroot || doing_variant minbase; 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/Etc/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"
160
mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL"
164
echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon"
165
chmod 755 "$TARGET/sbin/start-stop-daemon"
167
if [ -x "$TARGET/sbin/initctl" ]; then
168
mv "$TARGET/sbin/initctl" "$TARGET/sbin/initctl.REAL"
172
echo \"Warning: Fake initctl called, doing nothing\"" > "$TARGET/sbin/initctl"
173
chmod 755 "$TARGET/sbin/initctl"
176
setup_dselect_method apt
179
(in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" \
180
dpkg --status-fd 8 --configure --pending --force-configure-any --force-depends 8>&1 1>&7 |
181
dpkg_progress $baseprog $bases CONFREQ "Configuring required packages" CONFIGURING) 7>&1
184
bases="$(set -- $base; echo $#)"
186
info UNPACKBASE "Unpacking the base system..."
188
setup_available $required $base
190
while predep=$(get_next_predep); do
191
# We have to resolve dependencies of pre-dependencies manually because
192
# dpkg --predep-package doesn't handle this.
193
predep=$(without "$(without "$(resolve_deps $predep)" "$required")" "$done_predeps")
194
# XXX: progress is tricky due to how dpkg_progress works
195
# -- cjwatson 2009-07-29
196
p; smallyes '' | in_target dpkg --force-overwrite --force-confold --skip-same-version --install $(debfor $predep)
197
base=$(without "$base" "$predep")
198
done_predeps="$done_predeps $predep"
202
(repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" \
203
dpkg --status-fd 8 --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) 8>&1 1>&7 |
204
dpkg_progress $baseprog $bases UNPACKBASE "Unpacking base system" UNPACKING) 7>&1
206
info CONFBASE "Configuring the base system..."
209
(repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages. This will be attempted 5 times." "" \
210
dpkg --status-fd 8 --force-confold --skip-same-version --configure -a 8>&1 1>&7 |
211
dpkg_progress $baseprog $bases CONFBASE "Configuring base system" CONFIGURING) 7>&1
213
if [ -x "$TARGET/sbin/initctl.REAL" ]; then
214
mv "$TARGET/sbin/initctl.REAL" "$TARGET/sbin/initctl"
216
mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon"
218
progress $bases $bases CONFBASE "Configuring base system"
219
info BASESUCCESS "Base system installed successfully."