6
required="base-files base-passwd bash bsdutils coreutils libacl1 libattr1 debconf debconf-i18n liblocale-gettext-perl libtext-iconv-perl libtext-wrapi18n-perl libtext-charwidth-perl debianutils diff dpkg dselect libblkid1 e2fsprogs e2fslibs libcomerr2 libss2 libuuid1 findutils grep gzip hostname libcap1 libc6 libdb1-compat libdb3 libncurses5 libnewt0.51 libpam-modules libpam-runtime libpam0g libpopt0 login makedev mawk modutils mount ncurses-base ncurses-bin passwd perl-base procps sed slang1a-utf8 lsb-base initscripts sysvinit sysv-rc tar util-linux zlib1g whiptail libgcc1 gcc-3.3-base libstdc++5"
8
base="adduser alsa-base alsa-utils apt apt-utils aptitude at base-config bind9-host bsdmainutils bzip2 console-common console-data console-tools cpio cramfsprogs cron dash dbus-1 dhcp3-client dhcp3-common discover1 discover1-data dmsetup dnsutils dosfstools ed eject evms evms-ncurses fdutils file ftp gettext-base gnupg groff-base hdparm hotplug ifrename ifupdown info initrd-tools iproute iptables iputils-arping iputils-ping iputils-tracepath jfsutils klogd less libasound2 libatm1 libbz2-1.0 libconsole libdb4.2 libdevmapper1.00 libdiscover1 libdns16 libevms-2.3 libexpat1 libfribidi0 libgc1 libgcrypt7 libgdbm3 libgnutls10 libgpg-error0 libgpmg1 libidn11 libisc7 libiw27 libldap2 liblockfile1 liblwres1 liblzo1 libmagic1 libncursesw5 libopencdk8 libparted1.6-0 libpcap0.7 libpcap0.8 libreiserfs0.3-0 libsasl2 libsigc++-1.2-5c102 libssl0.9.7 libtasn1-2 libusb-0.1-4 libwrap0 locales logrotate lshw lsof ltrace lvm-common lvm10 lvm2 mailx man-db manpages mdadm mii-diag mime-support module-init-tools mtr-tiny mutt nano net-tools netbase netcat netkit-inetd ntp ntpdate openssh-client parted pciutils popularity-contest postfix postfix-tls ppp pppconfig pppoeconf psmisc python python2.3 reiser4progs reiserfsprogs reportbug rsync strace sudo sysklogd tcpd tcpdump telnet time ubuntu-base udev usbutils vim vim-common w3m wget wireless-tools xfsprogs $additional"
11
echo "$2" | tr ' ' '\n' | grep -v "^$1$" | tr '\n' ' '
14
echo "$3" | tr ' ' '\n' | sed "s/^$1$/$2/" | tr '\n' ' '
21
required="$required libc6-i686"
22
base="$base dmidecode memtest86+ libreadline4"
25
required="$required libreadline4"
26
base="$base hfsplus hfsutils libhfsp0 mac-fdisk pmac-fdisk powerpc-utils"
29
base="$base dmidecode libreadline4"
36
all_debs="$required $base"
39
all_debs="$(without_package "$x" "$all_debs")"
49
first_stage_install () {
52
mkdir -p "$TARGET/var/lib/dpkg"
53
: >"$TARGET/var/lib/dpkg/status"
54
: >"$TARGET/var/lib/dpkg/available"
57
if [ ! -e "$TARGET/etc/fstab" ]; then
58
echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab"
59
chown 0.0 "$TARGET/etc/fstab"; chmod 644 "$TARGET/etc/fstab"
65
in_target /sbin/ldconfig
68
baseprog="$(($baseprog + ${1:-1}))"
73
local deb="$(debfor $pkg)"
75
ar -p "$TARGET/$deb" control.tar.gz | zcat |
76
tar -O -xf - control ./control 2>/dev/null |
77
sed -ne 's/^Version: *//Ip' | head -n 1
80
mkdir -p "$TARGET/var/lib/dpkg/info"
85
Status: install ok installed" >> "$TARGET/var/lib/dpkg/status"
87
touch "$TARGET/var/lib/dpkg/info/${pkg}.list"
93
second_stage_install () {
95
smallyes '' | in_target dpkg --force-depends --install $(debfor "$@")
98
DEBIAN_FRONTEND=noninteractive
99
DEBCONF_NONINTERACTIVE_SEEN=true
100
export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN
105
p; progress $baseprog $bases INSTCORE "Installing core packages" #1
106
info INSTCORE "Installing core packages..."
108
p; progress $baseprog $bases INSTCORE "Installing core packages" #2
109
ln -s mawk $TARGET/usr/bin/awk
110
x_core_install base-files base-passwd
111
p; progress $baseprog $bases INSTCORE "Installing core packages" #3
114
if [ ! -e "$TARGET/etc/localtime" ]; then
115
ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime"
118
p; progress $baseprog $bases INSTCORE "Installing core packages" #4
119
x_core_install $LIBC6
121
p; progress $baseprog $bases INSTCORE "Installing core packages" #5
122
x_core_install perl-base
123
p; progress $baseprog $bases INSTCORE "Installing core packages" #6
124
rm $TARGET/usr/bin/awk
126
p; progress $baseprog $bases INSTCORE "Installing core packages" #7
127
x_core_install debconf
130
bases="$(set -- $required; echo $#)"
132
info UNPACKREQ "Unpacking required packages..."
134
smallyes '' | (repeat 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages. This will be attempted up to five times." "" dpkg --status-fd 8 --force-depends --unpack $(debfor $required) 8>&1 1>&7 | dpkg_progress $baseprog $bases UNPACKREQ "Unpacking required packages" UNPACKING) 7>&1
138
info CONFREQ "Configuring required packages..."
140
mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL"
144
echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon"
145
chmod 755 "$TARGET/sbin/start-stop-daemon"
147
setup_dselect_method apt
148
#on_exit "(in_target_nofail umount /dev/pts) || true"
150
smallyes '' | (in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" dpkg --status-fd 8 --configure --pending --force-configure-any --force-depends 8>&1 1>&7 | dpkg_progress $baseprog $bases CONFREQ "Configuring required packages" CONFIGURING) 7>&1
153
bases="$(set -- $base; echo $#)"
155
info UNPACKBASE "Unpacking the base system..."
157
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 --status-fd 8 --force-auto-select --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) 8>&1 1>&7 | dpkg_progress $baseprog $bases UNPACKBASE "Unpacking base system" UNPACKING) 7>&1
161
info CONFBASE "Configuring the base system..."
163
mv "$TARGET/usr/sbin/sendmail" "$TARGET/usr/sbin/sendmail.REAL"
164
ln -s /bin/true "$TARGET/usr/sbin/sendmail"
166
smallyes '' | (repeat 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages. This will be attempted 5 times." "" dpkg --status-fd 8 --force-confold --skip-same-version --configure -a 8>&1 1>&7 | dpkg_progress $baseprog $bases CONFBASE "Configuring base system" CONFIGURING) 7>&1
168
rm -f "$TARGET/usr/sbin/sendmail"
169
mv "$TARGET/usr/sbin/sendmail.REAL" "$TARGET/usr/sbin/sendmail"
171
mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon"
173
progress $bases $bases CONFBASE "Configuring base system"
174
info BASESUCCESS "Base system installed successfully."