3 finddebs_style from-indices
4 variants - buildd fakechroot minbase scratchbox
5 keyring /usr/share/keyrings/debian-archive-keyring.gpg
7 if doing_variant fakechroot; then
8 test "$FAKECHROOT" = "true" || error 1 FAKECHROOTREQ "This variant requires fakechroot environment to be started"
12 alpha|ia64) LIBC="libc6.1" ;;
13 kfreebsd-*) LIBC="libc0.1" ;;
14 hurd-*) LIBC="libc0.3" ;;
19 required="$(get_debs Priority: required)"
21 if doing_variant - || doing_variant fakechroot; then
22 #required="$required $(get_debs Priority: important)"
23 # ^^ should be getting debconf here somehow maybe
24 base="$(get_debs Priority: important)"
25 elif doing_variant buildd || doing_variant scratchbox; then
26 base="apt build-essential"
27 elif doing_variant minbase; then
31 if doing_variant fakechroot; then
32 # ldd.fake needs binutils
33 required="$required binutils"
38 base="$base apt-transport-https ca-certificates"
43 first_stage_install () {
46 mkdir -p "$TARGET/var/lib/dpkg"
47 : >"$TARGET/var/lib/dpkg/status"
48 : >"$TARGET/var/lib/dpkg/available"
51 if [ ! -e "$TARGET/etc/fstab" ]; then
52 echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab"
53 chown 0:0 "$TARGET/etc/fstab"; chmod 644 "$TARGET/etc/fstab"
58 local deb="$(debfor $pkg)"
59 local ver="$(extract_deb_field "$TARGET/$deb" Version)"
61 mkdir -p "$TARGET/var/lib/dpkg/info"
67 Status: install ok installed" >> "$TARGET/var/lib/dpkg/status"
69 touch "$TARGET/var/lib/dpkg/info/${pkg}.list"
75 second_stage_install () {
79 smallyes '' | in_target dpkg --force-depends --install $(debfor "$@")
83 baseprog="$(($baseprog + ${1:-1}))"
86 if doing_variant fakechroot; then
88 elif doing_variant scratchbox; then
92 in_target /sbin/ldconfig
95 DEBIAN_FRONTEND=noninteractive
96 DEBCONF_NONINTERACTIVE_SEEN=true
97 export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN
102 p; progress $baseprog $bases INSTCORE "Installing core packages" #1
103 info INSTCORE "Installing core packages..."
105 p; progress $baseprog $bases INSTCORE "Installing core packages" #2
106 ln -sf mawk "$TARGET/usr/bin/awk"
107 x_core_install base-passwd
108 x_core_install base-files
109 p; progress $baseprog $bases INSTCORE "Installing core packages" #3
112 if [ ! -e "$TARGET/etc/localtime" ]; then
113 ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime"
116 if doing_variant fakechroot; then
117 install_fakechroot_tools
120 p; progress $baseprog $bases INSTCORE "Installing core packages" #4
123 p; progress $baseprog $bases INSTCORE "Installing core packages" #5
124 x_core_install perl-base
126 p; progress $baseprog $bases INSTCORE "Installing core packages" #6
127 rm "$TARGET/usr/bin/awk"
130 p; progress $baseprog $bases INSTCORE "Installing core packages" #7
131 if doing_variant -; then
132 x_core_install debconf
136 bases=$(set -- $required; echo $#)
138 info UNPACKREQ "Unpacking required packages..."
143 (repeatn 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages. This will be attempted up to five times." "" \
144 dpkg --status-fd 8 --force-depends --unpack $(debfor $required) 8>&1 1>&7 || echo EXITCODE $?) |
145 dpkg_progress $baseprog $bases UNPACKREQ "Unpacking required packages" UNPACKING
147 info CONFREQ "Configuring required packages..."
151 exit 101" > "$TARGET/usr/sbin/policy-rc.d"
152 chmod 755 "$TARGET/usr/sbin/policy-rc.d"
154 mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL"
158 echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon"
159 chmod 755 "$TARGET/sbin/start-stop-daemon"
161 setup_dselect_method apt
164 (in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" \
165 dpkg --status-fd 8 --configure --pending --force-configure-any --force-depends 8>&1 1>&7 || echo EXITCODE $?) |
166 dpkg_progress $baseprog $bases CONFREQ "Configuring required packages" CONFIGURING
169 bases="$(set -- $base; echo $#)"
171 info UNPACKBASE "Unpacking the base system..."
173 setup_available $required $base
175 while predep=$(get_next_predep); do
176 # We have to resolve dependencies of pre-dependencies manually because
177 # dpkg --predep-package doesn't handle this.
178 predep=$(without "$(without "$(resolve_deps $predep)" "$required")" "$done_predeps")
179 # XXX: progress is tricky due to how dpkg_progress works
180 # -- cjwatson 2009-07-29
182 in_target dpkg --force-overwrite --force-confold --skip-same-version --install $(debfor $predep)
183 base=$(without "$base" "$predep")
184 done_predeps="$done_predeps $predep"
188 (repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" \
189 dpkg --status-fd 8 --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) 8>&1 1>&7 || echo EXITCODE $?) |
190 dpkg_progress $baseprog $bases UNPACKBASE "Unpacking base system" UNPACKING
192 info CONFBASE "Configuring the base system..."
195 (repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages. This will be re-attempted up to five times." "" \
196 dpkg --status-fd 8 --force-confold --skip-same-version --configure -a 8>&1 1>&7 || echo EXITCODE $?) |
197 dpkg_progress $baseprog $bases CONFBASE "Configuring base system" CONFIGURING
199 mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon"
200 rm -f "$TARGET/usr/sbin/policy-rc.d"
202 progress $bases $bases CONFBASE "Configuring base system"
203 info BASESUCCESS "Base system installed successfully."