~ubuntu-branches/ubuntu/hardy/debootstrap/hardy-backports

« back to all changes in this revision

Viewing changes to scripts/ubuntu/gutsy

  • Committer: Bazaar Package Importer
  • Author(s): Otavio Salvador, Otavio Salvador, Guillem Jover, Frans Pop, Joey Hess
  • Date: 2010-02-21 23:11:06 UTC
  • mto: (0.1.7 maverick)
  • mto: This revision was merged to the branch mainline in revision 33.
  • Revision ID: james.westby@ubuntu.com-20100221231106-leq9wi54r2kbxyjk
Tags: 1.0.21
[ Otavio Salvador ]
* Apply patch from Clint Adams <schizo@debian.org> to add support for
  gz/bz2/xz data.tar (closes: #458663).

[ Guillem Jover ]
* Refactor deb extractors into two new functions.
* Use dpkg-deb if available instead of ar (closes: #557296).
* Add an --extractor option to override the automatic extractor selection.

[ Otavio Salvador ]
* Document new --extractor option in manpage.
* Apply patch from Vagrant Cascadian <vagrant+bugs@freegeek.org> not
  fail if resolv.conf is a broken symlink (closes: #390647).

[ Frans Pop ]
* Use tab indentation in scripts/debian/sid to reduce its size (relevant
  for Debian Installer).
* Add apt to base packages for the buildd variant as it is no longer marked
  Build-Essential.

[ Otavio Salvador ]
* Apply patch from Andres Salomon <dilinger@collabora.co.uk> to honor
  --components when using mirror_style 'main' (closes: #561283).
* Apply patch from Andres Salomon <dilinger@collabora.co.uk> to fix
  iteration through components in download_main (closes: #561298).

[ Joey Hess ]
* Allow the suite to be stable, testing, or unstable when debootstrapping
  Debian. Closes: #288109
* Make scripts directory in source tree look like installed directory,
  and add a section to README explaining an easy way to run
  debootstrap w/o installing it. Closes: #345762
* Convert rules file to use dh with overrides.
* Remove binary-basedebs target from debian/rules.
  This target has been broken in multiple ways since 2007. While I
  accidentially partially fixed it with the above changes, this is evidence
  it's dead code that can be safely removed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
case $ARCH in
2
 
  amd64|i386)
3
 
    default_mirror http://archive.ubuntu.com/ubuntu
4
 
    ;;
5
 
  sparc)
6
 
    case $SUITE in
7
 
      gutsy)
8
 
        default_mirror http://archive.ubuntu.com/ubuntu
9
 
        ;;
10
 
      *)
11
 
        default_mirror http://ports.ubuntu.com/ubuntu-ports
12
 
        ;;
13
 
    esac
14
 
    ;;
15
 
  *)
16
 
    default_mirror http://ports.ubuntu.com/ubuntu-ports
17
 
    ;;
18
 
esac
19
 
mirror_style release
20
 
download_style apt
21
 
finddebs_style from-indices
22
 
variants - buildd fakechroot minbase
23
 
 
24
 
if doing_variant fakechroot; then
25
 
    test "$FAKECHROOT" = "true" || error 1 FAKECHROOTREQ "This variant requires fakechroot environment to be started"
26
 
fi
27
 
 
28
 
case $ARCH in
29
 
  alpha|ia64) LIBC="libc6.1" ;;
30
 
  *)          LIBC="libc6" ;;
31
 
esac
32
 
 
33
 
work_out_debs () {
34
 
    required="$(get_debs Priority: required)"
35
 
 
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
43
 
      base="apt"
44
 
    fi
45
 
}
46
 
 
47
 
first_stage_install () {
48
 
    extract $required
49
 
 
50
 
    mkdir -p "$TARGET/var/lib/dpkg"
51
 
    : >"$TARGET/var/lib/dpkg/status"
52
 
    : >"$TARGET/var/lib/dpkg/available"
53
 
 
54
 
    setup_etc
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"
58
 
    fi
59
 
 
60
 
    if doing_variant fakechroot; then
61
 
        setup_devices_fakechroot
62
 
    else
63
 
        setup_devices
64
 
    fi
65
 
 
66
 
    x_feign_install () {
67
 
        local pkg="$1"
68
 
        local deb="$(debfor $pkg)"
69
 
        local ver="$(
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
73
 
        )"
74
 
 
75
 
        mkdir -p "$TARGET/var/lib/dpkg/info"
76
 
 
77
 
        echo \
78
 
"Package: $pkg
79
 
Version: $ver
80
 
Status: install ok installed" >> "$TARGET/var/lib/dpkg/status"
81
 
 
82
 
        touch "$TARGET/var/lib/dpkg/info/${pkg}.list"
83
 
    }
84
 
 
85
 
    x_feign_install dpkg
86
 
}
87
 
 
88
 
second_stage_install () {
89
 
    x_core_install () {
90
 
        smallyes '' | in_target dpkg --force-depends --install $(debfor "$@")
91
 
    }
92
 
 
93
 
    p () {
94
 
        baseprog="$(($baseprog + ${1:-1}))"
95
 
    }
96
 
 
97
 
    if doing_variant fakechroot; then
98
 
        setup_proc_fakechroot
99
 
    else
100
 
        setup_proc
101
 
        in_target /sbin/ldconfig
102
 
    fi
103
 
 
104
 
    DEBIAN_FRONTEND=noninteractive
105
 
    DEBCONF_NONINTERACTIVE_SEEN=true
106
 
    export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN
107
 
 
108
 
    baseprog=0
109
 
    bases=7
110
 
 
111
 
    p; progress $baseprog $bases INSTCORE "Installing core packages" #1
112
 
    info INSTCORE "Installing core packages..."
113
 
 
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
118
 
    x_core_install dpkg
119
 
 
120
 
    if [ ! -e "$TARGET/etc/localtime" ]; then
121
 
        ln -sf /usr/share/zoneinfo/Etc/UTC "$TARGET/etc/localtime"
122
 
    fi
123
 
 
124
 
    if doing_variant fakechroot; then 
125
 
        install_fakechroot_tools
126
 
    fi
127
 
 
128
 
    p; progress $baseprog $bases INSTCORE "Installing core packages" #4
129
 
    x_core_install $LIBC
130
 
 
131
 
    p; progress $baseprog $bases INSTCORE "Installing core packages" #5
132
 
    x_core_install perl-base
133
 
 
134
 
    p; progress $baseprog $bases INSTCORE "Installing core packages" #6
135
 
    rm "$TARGET/usr/bin/awk"
136
 
    x_core_install mawk
137
 
 
138
 
    p; progress $baseprog $bases INSTCORE "Installing core packages" #7
139
 
    if doing_variant -; then
140
 
      x_core_install debconf
141
 
    fi
142
 
 
143
 
    baseprog=0
144
 
    bases=$(set -- $required; echo $#)
145
 
 
146
 
    info UNPACKREQ "Unpacking required packages..."
147
 
 
148
 
    smallyes '' | 
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
152
 
 
153
 
    info CONFREQ "Configuring required packages..."
154
 
 
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"
158
 
    fi
159
 
 
160
 
    mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL"
161
 
    echo \
162
 
"#!/bin/sh
163
 
echo
164
 
echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon"
165
 
    chmod 755 "$TARGET/sbin/start-stop-daemon"
166
 
 
167
 
    if [ -x "$TARGET/sbin/initctl" ]; then
168
 
      mv "$TARGET/sbin/initctl" "$TARGET/sbin/initctl.REAL"
169
 
      echo \
170
 
"#!/bin/sh
171
 
echo
172
 
echo \"Warning: Fake initctl called, doing nothing\"" > "$TARGET/sbin/initctl"
173
 
      chmod 755 "$TARGET/sbin/initctl"
174
 
    fi
175
 
 
176
 
    setup_dselect_method apt
177
 
 
178
 
    smallyes '' | 
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
182
 
 
183
 
    baseprog=0
184
 
    bases="$(set -- $base; echo $#)"
185
 
 
186
 
    info UNPACKBASE "Unpacking the base system..."
187
 
 
188
 
    setup_available $required $base
189
 
    done_predeps=
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"
199
 
    done
200
 
 
201
 
    smallyes '' | 
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
205
 
 
206
 
    info CONFBASE "Configuring the base system..."
207
 
 
208
 
    smallyes '' |
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
212
 
 
213
 
    if [ -x "$TARGET/sbin/initctl.REAL" ]; then
214
 
      mv "$TARGET/sbin/initctl.REAL" "$TARGET/sbin/initctl"
215
 
    fi
216
 
    mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon"
217
 
 
218
 
    progress $bases $bases CONFBASE "Configuring base system"
219
 
    info BASESUCCESS "Base system installed successfully."
220
 
}