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

« back to all changes in this revision

Viewing changes to scripts/edgy

  • Committer: Bazaar Package Importer
  • Author(s): Colin Watson
  • Date: 2010-10-21 11:36:48 UTC
  • mfrom: (0.1.8 maverick)
  • Revision ID: james.westby@ubuntu.com-20101021113648-fac3y327xkwbmdte
Tags: 1.0.23ubuntu1~hardy1
Automated backport upload; no source changes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
case $ARCH in
 
2
  amd64|i386|powerpc|sparc)
 
3
    default_mirror http://archive.ubuntu.com/ubuntu
 
4
    ;;
 
5
  *)
 
6
    default_mirror http://ports.ubuntu.com/ubuntu-ports
 
7
    ;;
 
8
esac
 
9
mirror_style release
 
10
download_style apt
 
11
finddebs_style from-indices
 
12
variants - buildd fakechroot
 
13
 
 
14
if doing_variant fakechroot; then
 
15
    test "$FAKECHROOT" = "true" || error 1 FAKECHROOTREQ "This variant requires fakechroot environment to be started"
 
16
fi
 
17
 
 
18
case $ARCH in
 
19
  alpha|ia64) LIBC="libc6.1" ;;
 
20
  *)          LIBC="libc6" ;;
 
21
esac
 
22
 
 
23
work_out_debs () {
 
24
    required="$(get_debs Priority: required)"
 
25
 
 
26
    if doing_variant -; then
 
27
      #required="$required $(get_debs Priority: important)"
 
28
      #  ^^ should be getting debconf here somehow maybe
 
29
      base="$(get_debs Priority: important)"
 
30
    elif doing_variant buildd; then
 
31
      # TODO: add Build-Essential: yes extraoverrides
 
32
      #base="$(get_debs Build-Essential: yes)"
 
33
 
 
34
      add () { if [ "$ARCH" = "$1" ]; then eval "$2=\"\$$2 $3\""; fi; }
 
35
 
 
36
      base="apt binutils cpio cpp cpp-4.1 dpkg-dev g++ g++-4.1 gcc gcc-4.1 ${LIBC}-dev libdb4.4 libgdbm3 libstdc++6 libstdc++6-4.1-dev linux-libc-dev make patch perl perl-modules"
 
37
 
 
38
      add ia64 base "libunwind7-dev"
 
39
      add sparc base "lib64gcc1"
 
40
      add sparc base "libc6-dev-sparc64"
 
41
      add sparc base "libc6-sparc64"
 
42
    elif doing_variant fakechroot; 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="$(extract_deb_field "$TARGET/$deb" Version)"
 
70
 
 
71
        mkdir -p "$TARGET/var/lib/dpkg/info"
 
72
 
 
73
        echo \
 
74
"Package: $pkg
 
75
Version: $ver
 
76
Status: install ok installed" >> "$TARGET/var/lib/dpkg/status"
 
77
 
 
78
        touch "$TARGET/var/lib/dpkg/info/${pkg}.list"
 
79
    }
 
80
 
 
81
    x_feign_install dpkg
 
82
}
 
83
 
 
84
second_stage_install () {
 
85
    x_core_install () {
 
86
        smallyes '' | in_target dpkg --force-depends --install $(debfor "$@")
 
87
    }
 
88
 
 
89
    p () {
 
90
        baseprog="$(($baseprog + ${1:-1}))"
 
91
    }
 
92
 
 
93
    if doing_variant fakechroot; then
 
94
        setup_proc_fakechroot
 
95
    else
 
96
        setup_proc
 
97
        in_target /sbin/ldconfig
 
98
    fi
 
99
 
 
100
    DEBIAN_FRONTEND=noninteractive
 
101
    DEBCONF_NONINTERACTIVE_SEEN=true
 
102
    export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN
 
103
 
 
104
    baseprog=0
 
105
    bases=7
 
106
 
 
107
    p; progress $baseprog $bases INSTCORE "Installing core packages" #1
 
108
    info INSTCORE "Installing core packages..."
 
109
 
 
110
    p; progress $baseprog $bases INSTCORE "Installing core packages" #2
 
111
    ln -sf mawk "$TARGET/usr/bin/awk"
 
112
    x_core_install base-files base-passwd
 
113
    p; progress $baseprog $bases INSTCORE "Installing core packages" #3
 
114
    x_core_install dpkg
 
115
 
 
116
    if [ ! -e "$TARGET/etc/localtime" ]; then
 
117
        ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime"
 
118
    fi
 
119
 
 
120
    if doing_variant fakechroot; then
 
121
        install_fakechroot_tools
 
122
    fi
 
123
 
 
124
    p; progress $baseprog $bases INSTCORE "Installing core packages" #4
 
125
    x_core_install $LIBC
 
126
 
 
127
    p; progress $baseprog $bases INSTCORE "Installing core packages" #5
 
128
    x_core_install perl-base
 
129
 
 
130
    p; progress $baseprog $bases INSTCORE "Installing core packages" #6
 
131
    rm "$TARGET/usr/bin/awk"
 
132
    x_core_install mawk
 
133
 
 
134
    p; progress $baseprog $bases INSTCORE "Installing core packages" #7
 
135
    if doing_variant -; then
 
136
      x_core_install debconf
 
137
    fi
 
138
 
 
139
    baseprog=0
 
140
    bases=$(set -- $required; echo $#)
 
141
 
 
142
    info UNPACKREQ "Unpacking required packages..."
 
143
 
 
144
    smallyes '' |
 
145
      (repeatn 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages.  This will be attempted up to five times." "" \
 
146
      dpkg --status-fd 8 --force-depends --unpack $(debfor $required) 8>&1 1>&7 |
 
147
      dpkg_progress $baseprog $bases UNPACKREQ "Unpacking required packages" UNPACKING) 7>&1
 
148
 
 
149
    info CONFREQ "Configuring required packages..."
 
150
 
 
151
    if doing_variant fakechroot; then
 
152
        # fix initscripts postinst (no mounting possible, and wrong if condition)
 
153
        sed -i '/dpkg.*--compare-versions/ s/\<lt\>/lt-nl/' "$TARGET/var/lib/dpkg/info/initscripts.postinst"
 
154
    fi
 
155
 
 
156
    mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL"
 
157
    echo \
 
158
"#!/bin/sh
 
159
echo
 
160
echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon"
 
161
    chmod 755 "$TARGET/sbin/start-stop-daemon"
 
162
 
 
163
    setup_dselect_method apt
 
164
 
 
165
    smallyes '' |
 
166
      (in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" \
 
167
      dpkg --status-fd 8 --configure --pending --force-configure-any --force-depends 8>&1 1>&7 |
 
168
      dpkg_progress $baseprog $bases CONFREQ "Configuring required packages" CONFIGURING) 7>&1
 
169
 
 
170
    baseprog=0
 
171
    bases="$(set -- $base; echo $#)"
 
172
 
 
173
    info UNPACKBASE "Unpacking the base system..."
 
174
 
 
175
    smallyes '' |
 
176
      (repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages.  This will be re-attempted up to five times." "" \
 
177
      dpkg --status-fd 8 --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) 8>&1 1>&7 |
 
178
      dpkg_progress $baseprog $bases UNPACKBASE "Unpacking base system" UNPACKING) 7>&1
 
179
 
 
180
    info CONFBASE "Configuring the base system..."
 
181
 
 
182
    smallyes '' |
 
183
      (repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages.  This will be attempted 5 times." "" \
 
184
      dpkg --status-fd 8 --force-confold --skip-same-version --configure -a 8>&1 1>&7 |
 
185
      dpkg_progress $baseprog $bases CONFBASE "Configuring base system" CONFIGURING) 7>&1
 
186
 
 
187
    mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon"
 
188
 
 
189
    progress $bases $bases CONFBASE "Configuring base system"
 
190
    info BASESUCCESS "Base system installed successfully."
 
191
}