]> git.pld-linux.org Git - packages/debootstrap.git/blob - debootstrap-etch
*** empty log message ***
[packages/debootstrap.git] / debootstrap-etch
1 mirror_style release
2 download_style apt
3 finddebs_style from-indices
4 variants - buildd fakechroot
5
6 if doing_variant fakechroot; then
7     test "$FAKECHROOT" = "true" || error 1 FAKECHROOTREQ "This variant requires fakechroot environment to be started"
8 fi
9
10 work_out_debs () {
11     LIBC6=libc6
12     if [ "$ARCH" = "alpha" -o "$ARCH" = "ia64" ]; then LIBC6="libc6.1"; fi
13
14     required="$(get_debs Priority: required)"
15
16     if doing_variant - || doing_variant fakechroot; then 
17       #required="$required $(get_debs Priority: important)"
18       #  ^^ should be getting debconf here somehow maybe
19       base="$(get_debs Priority: important)"
20     elif doing_variant buildd; then
21       base="$(get_debs Build-Essential: yes)"
22     fi
23
24     if doing_variant fakechroot; then 
25       # ldd.fake needs binutils
26       required="$required binutils"
27     fi
28 }
29
30 first_stage_install () {
31     extract $required
32
33     mkdir -p "$TARGET/var/lib/dpkg"
34     : >"$TARGET/var/lib/dpkg/status"
35     echo >"$TARGET/var/lib/dpkg/available"
36
37     setup_etc
38     if [ ! -e "$TARGET/etc/fstab" ]; then
39         echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab"
40         chown 0.0 "$TARGET/etc/fstab"; chmod 644 "$TARGET/etc/fstab"
41     fi
42
43     if [ -x $TARGET/usr/bin/md5sum.textutils -a \! -e $TARGET/usr/bin/md5sum ]; then
44         cp $TARGET/usr/bin/md5sum.textutils $TARGET/usr/bin/md5sum
45     fi
46
47     if doing_variant fakechroot; then 
48         setup_devices_fakechroot
49     else
50         setup_devices
51     fi
52
53     x_feign_install () {
54         local pkg="$1"
55         local deb="$(debfor $pkg)"
56         local ver="$(
57             ar -p "$TARGET/$deb" control.tar.gz | zcat |
58                 tar -O -xf - control ./control 2>/dev/null |
59                 sed -ne 's/^Version: *//Ip' | head -n 1
60         )"
61
62         mkdir -p "$TARGET/var/lib/dpkg/info"
63
64         echo \
65 "Package: $pkg
66 Version: $ver
67 Status: install ok installed" >> "$TARGET/var/lib/dpkg/status"
68
69         touch "$TARGET/var/lib/dpkg/info/${pkg}.list"
70     }
71
72     x_feign_install dpkg
73 }
74
75 second_stage_install () {
76     x_core_install () {
77         smallyes '' | in_target dpkg --force-depends --install $(debfor "$@")
78     }
79
80     p () {
81         baseprog="$(($baseprog + ${1:-1}))"
82     }
83
84     if doing_variant fakechroot; then 
85         setup_proc_fakechroot
86     else
87         setup_proc
88         in_target /sbin/ldconfig
89     fi
90
91     DEBIAN_FRONTEND=noninteractive
92     DEBCONF_NONINTERACTIVE_SEEN=true
93     export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN
94
95     baseprog=0
96     bases=7
97
98     p; progress $baseprog $bases INSTCORE "Installing core packages" #1
99     info INSTCORE "Installing core packages..."
100
101     p; progress $baseprog $bases INSTCORE "Installing core packages" #2
102     ln -sf mawk $TARGET/usr/bin/awk
103     x_core_install base-files base-passwd
104     p; progress $baseprog $bases INSTCORE "Installing core packages" #3
105     x_core_install dpkg
106
107     if [ ! -e "$TARGET/etc/localtime" ]; then
108         ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime"
109     fi
110
111     if doing_variant fakechroot; then 
112         install_fakechroot_tools
113     fi
114
115     p; progress $baseprog $bases INSTCORE "Installing core packages" #4
116     x_core_install $LIBC6
117
118     p; progress $baseprog $bases INSTCORE "Installing core packages" #5
119     x_core_install perl-base
120
121     p; progress $baseprog $bases INSTCORE "Installing core packages" #6
122     rm $TARGET/usr/bin/awk
123     x_core_install mawk
124
125     p; progress $baseprog $bases INSTCORE "Installing core packages" #7
126     if doing_variant -; then
127       x_core_install debconf
128     fi
129
130     baseprog=0
131     bases=$(set -- $required; echo $#)
132
133     info UNPACKREQ "Unpacking required packages..."
134
135     exec 7>&1
136
137     smallyes '' | 
138      (repeat 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages.  This will be attempted up to five times." "" \
139         dpkg --status-fd 8 --force-depends --unpack $(debfor $required) 8>&1 1>&7 || echo EXITCODE $?) |
140      dpkg_progress $baseprog $bases UNPACKREQ "Unpacking required packages" UNPACKING
141
142     info CONFREQ "Configuring required packages..."
143
144     mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL"
145     echo \
146 "#!/bin/sh
147 echo
148 echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon"
149     chmod 755 "$TARGET/sbin/start-stop-daemon"
150
151     setup_dselect_method apt
152
153     smallyes '' | 
154      (in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" \
155        dpkg --status-fd 8 --configure --pending --force-configure-any --force-depends 8>&1 1>&7 || echo EXITCODE $?) |
156      dpkg_progress $baseprog $bases CONFREQ "Configuring required packages" CONFIGURING
157
158     baseprog=0
159     bases="$(set -- $base; echo $#)"
160
161     info UNPACKBASE "Unpacking the base system..."
162
163     smallyes '' | 
164      (repeat 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages.  This will be re-attempted up to five times." "" \
165        dpkg --status-fd 8 --force-auto-select --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) 8>&1 1>&7 || echo EXITCODE $?) |
166      dpkg_progress $baseprog $bases UNPACKBASE "Unpacking base system" UNPACKING
167
168     info CONFBASE "Configuring the base system..."
169
170     smallyes '' |
171      (repeat 5 \
172       in_target_failmsg CONF_BASE_FAIL "Failure while configuring base packages." "" \
173       dpkg --status-fd 8 --force-confold --skip-same-version --configure -a 8>&1 1>&7 || echo EXITCODE $?) |
174      dpkg_progress $baseprog $bases CONFBASE "Configuring base system" CONFIGURING
175   
176     mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon"
177
178     progress $bases $bases CONFBASE "Configuring base system"
179     info BASESUCCESS "Base system installed successfully."
180 }
This page took 0.088596 seconds and 3 git commands to generate.