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

« back to all changes in this revision

Viewing changes to scripts/ubuntu/feisty

  • 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="$(
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/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
 
 
159
 
        # kill libdevmapper postinst; it tries to create /dev/mapper/
160
 
        rm "$TARGET/var/lib/dpkg/info/libdevmapper1"*.postinst
161
 
    fi
162
 
 
163
 
    mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL"
164
 
    echo \
165
 
"#!/bin/sh
166
 
echo
167
 
echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon"
168
 
    chmod 755 "$TARGET/sbin/start-stop-daemon"
169
 
 
170
 
    setup_dselect_method apt
171
 
 
172
 
    smallyes '' | 
173
 
      (in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" \
174
 
      dpkg --status-fd 8 --configure --pending --force-configure-any --force-depends 8>&1 1>&7 |
175
 
      dpkg_progress $baseprog $bases CONFREQ "Configuring required packages" CONFIGURING) 7>&1
176
 
 
177
 
    baseprog=0
178
 
    bases="$(set -- $base; echo $#)"
179
 
 
180
 
    info UNPACKBASE "Unpacking the base system..."
181
 
 
182
 
    smallyes '' | 
183
 
      (repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages.  This will be re-attempted up to five times." "" \
184
 
      dpkg --status-fd 8 --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) 8>&1 1>&7 |
185
 
      dpkg_progress $baseprog $bases UNPACKBASE "Unpacking base system" UNPACKING) 7>&1
186
 
 
187
 
    info CONFBASE "Configuring the base system..."
188
 
 
189
 
    smallyes '' |
190
 
      (repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages.  This will be attempted 5 times." "" \
191
 
      dpkg --status-fd 8 --force-confold --skip-same-version --configure -a 8>&1 1>&7 |
192
 
      dpkg_progress $baseprog $bases CONFBASE "Configuring base system" CONFIGURING) 7>&1
193
 
 
194
 
    mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon"
195
 
 
196
 
    progress $bases $bases CONFBASE "Configuring base system"
197
 
    info BASESUCCESS "Base system installed successfully."
198
 
}