6
required="base-files base-passwd bash bsdutils build-essential coreutils debianutils diff dpkg dselect e2fslibs e2fsprogs fakeroot findutils gcc-3.3-base grep gzip hostname initscripts libacl1 libattr1 libblkid1 libc6 libcap1 libcomerr2 libdb1-compat libdb3 libgcc1 libncurses5 libpam-modules libpam-runtime libpam0g libss2 libstdc++5 libuuid1 login lsb-base mawk mount ncurses-base ncurses-bin perl-base sed slang1a-utf8 sysv-rc sysvinit tar util-linux zlib1g"
8
base="apt binutils cpio cpp cpp-3.3 dpkg-dev g++ g++-3.3 gcc gcc-3.3 libc6-dev libdb4.2 libgdbm3 libstdc++5-3.3-dev linux-kernel-headers make patch perl perl-modules $additional"
11
echo "$2" | tr ' ' '\n' | grep -v "^$1$" | tr '\n' ' '
14
echo "$3" | tr ' ' '\n' | sed "s/^$1$/$2/" | tr '\n' ' '
27
# Unsupported architectures:
29
required="$(subst_package "libc6" "libc6.1" "$required")"
30
base="$(subst_package "libc6-dev" "libc6.1-dev" "$base")"
34
required="$(subst_package "libc6" "libc6.1" "$required")"
35
base="$(subst_package "libc6-dev" "libc6.1-dev" "$base")"
43
all_debs="$required $base"
46
all_debs="$(without_package "$x" "$all_debs")"
56
first_stage_install () {
59
mkdir -p "$TARGET/var/lib/dpkg"
60
: >"$TARGET/var/lib/dpkg/status"
61
: >"$TARGET/var/lib/dpkg/available"
64
if [ ! -e "$TARGET/etc/fstab" ]; then
65
echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab"
66
chown 0.0 "$TARGET/etc/fstab"; chmod 644 "$TARGET/etc/fstab"
72
in_target /sbin/ldconfig
75
baseprog="$(($baseprog + ${1:-1}))"
80
local deb="$(debfor $pkg)"
82
ar -p "$TARGET/$deb" control.tar.gz | zcat |
83
tar -O -xf - control ./control 2>/dev/null |
84
sed -ne 's/^Version: *//Ip' | head -n 1
87
mkdir -p "$TARGET/var/lib/dpkg/info"
92
Status: install ok installed" >> "$TARGET/var/lib/dpkg/status"
94
touch "$TARGET/var/lib/dpkg/info/${pkg}.list"
100
second_stage_install () {
102
smallyes '' | in_target dpkg --force-depends --install $(debfor "$@")
105
DEBIAN_FRONTEND=noninteractive
106
export DEBIAN_FRONTEND
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
p; progress $baseprog $bases INSTCORE "Installing core packages" #4
125
x_core_install $LIBC6
127
p; progress $baseprog $bases INSTCORE "Installing core packages" #5
128
x_core_install perl-base
129
p; progress $baseprog $bases INSTCORE "Installing core packages" #6
130
rm $TARGET/usr/bin/awk
132
p; progress $baseprog $bases INSTCORE "Installing core packages" #7
134
info UNPACKREQ "Unpacking required packages..."
136
p; progress $baseprog $bases INSTCORE "Installing core packages" #8
137
smallyes '' | repeat 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages. This will be attempted up to five times." "" dpkg --force-depends --unpack $(debfor $required)
138
p 10; progress $baseprog $bases INSTCORE "Installing core packages" #18
140
info CONFREQ "Configuring required packages..."
142
mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL"
146
echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon"
147
chmod 755 "$TARGET/sbin/start-stop-daemon"
149
setup_dselect_method apt
150
#on_exit "in_target_nofail umount /dev/pts"
152
p; progress $baseprog $bases INSTCORE "Installing core packages" #19
153
smallyes '' | in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" dpkg --configure --pending --force-configure-any --force-depends
154
p 10; progress $baseprog $bases INSTCORE "Installing core packages" #29
156
info INSTCORE "Installing base packages..."
158
p; progress $baseprog $bases INSTCORE "Installing core packages" #30
159
smallyes '' | repeat 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" dpkg --force-auto-select --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base)
161
smallyes '' | repeat 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages. This will be attempted 5 times." "" dpkg --force-confold --skip-same-version --configure -a
163
p 9; progress $baseprog $bases INSTCORE "Installing core packages" #39
165
mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon"
167
progress $bases $bases INSTCORE "Installing core packages" #40
168
info BASESUCCESS "Base system installed successfully."