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

« back to all changes in this revision

Viewing changes to scripts/hoary.buildd

  • 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
default_mirror http://old-releases.ubuntu.com/ubuntu
 
2
mirror_style release
 
3
download_style apt
 
4
 
 
5
LIBC=libc6
 
6
if [ "$ARCH" = "alpha" ] || [ "$ARCH" = "ia64" ]; then
 
7
  LIBC="libc6.1"
 
8
fi
 
9
 
 
10
work_out_debs () {
 
11
    required="base-files base-passwd bash bsdutils build-essential coreutils debianutils diff dpkg dselect e2fslibs e2fsprogs fakeroot findutils gcc-3.3-base grep gzip hostname initscripts libacl1 libattr1 libblkid1 libc6 libcap1 libcomerr2 libdb1-compat libdb3 libgcc1 libncurses5 libpam-modules libpam-runtime libpam0g libss2 libstdc++5 libuuid1 login lsb-base mawk mount ncurses-base ncurses-bin passwd perl-base pkgstriptranslations python-minimal python2.4-minimal sed slang1a-utf8 sysv-rc sysvinit tar util-linux zlib1g"
 
12
 
 
13
    base="apt binutils cpio cpp cpp-3.3 dpkg-dev g++ g++-3.3 gcc gcc-3.3 libc6-dev libdb4.2 libgdbm3 libstdc++5-3.3-dev linux-kernel-headers make patch perl perl-modules"
 
14
 
 
15
    without_package () {
 
16
        echo "$2" | tr ' ' '\n' | grep -v "^$1$" | tr '\n' ' '
 
17
    }
 
18
    subst_package () {
 
19
        echo "$3" | tr ' ' '\n' | sed "s/^$1$/$2/" | tr '\n' ' '
 
20
    }
 
21
 
 
22
    case $ARCH in
 
23
        "amd64")
 
24
            ;;
 
25
        "i386")
 
26
            ;;
 
27
        "powerpc")
 
28
            ;;
 
29
        "ia64")
 
30
            required="$(subst_package "libc6" "libc6.1" "$required")"
 
31
            base="$(subst_package "libc6-dev" "libc6.1-dev" "$base")"
 
32
            base="$base libunwind7 libunwind7-dev"
 
33
            ;;
 
34
 
 
35
        # Unsupported architectures:
 
36
        "alpha")
 
37
            required="$(subst_package "libc6" "libc6.1" "$required")"
 
38
            base="$(subst_package "libc6-dev" "libc6.1-dev" "$base")"
 
39
            ;;
 
40
        *)
 
41
            # who knows?
 
42
            ;;
 
43
    esac
 
44
}
 
45
 
 
46
install_debs () {
 
47
    first_stage_install
 
48
    second_stage_install
 
49
}
 
50
 
 
51
first_stage_install () {
 
52
    extract $required
 
53
 
 
54
    mkdir -p "$TARGET/var/lib/dpkg"
 
55
    : >"$TARGET/var/lib/dpkg/status"
 
56
    echo >"$TARGET/var/lib/dpkg/available"
 
57
 
 
58
    setup_etc
 
59
    if [ ! -e "$TARGET/etc/fstab" ]; then
 
60
        echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab"
 
61
        chown 0:0 "$TARGET/etc/fstab"; chmod 644 "$TARGET/etc/fstab"
 
62
    fi
 
63
 
 
64
    setup_devices
 
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
    p () {
 
89
        baseprog="$(($baseprog + ${1:-1}))"
 
90
    }
 
91
 
 
92
    DEBIAN_FRONTEND=noninteractive
 
93
    export DEBIAN_FRONTEND
 
94
 
 
95
    baseprog=0
 
96
    bases=40
 
97
 
 
98
    setup_proc
 
99
    in_target /sbin/ldconfig
 
100
 
 
101
    p; progress $baseprog $bases INSTCORE "Installing core packages" #1
 
102
    info INSTCORE "Installing core packages..."
 
103
 
 
104
    p; progress $baseprog $bases INSTCORE "Installing core packages" #2
 
105
    ln -sf mawk "$TARGET/usr/bin/awk"
 
106
    x_core_install base-files base-passwd
 
107
    p; progress $baseprog $bases INSTCORE "Installing core packages" #3
 
108
    x_core_install dpkg
 
109
 
 
110
    if [ ! -e "$TARGET/etc/localtime" ]; then
 
111
        ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime"
 
112
    fi
 
113
 
 
114
    p; progress $baseprog $bases INSTCORE "Installing core packages" #4
 
115
    x_core_install $LIBC
 
116
 
 
117
    p; progress $baseprog $bases INSTCORE "Installing core packages" #5
 
118
    x_core_install perl-base
 
119
    p; progress $baseprog $bases INSTCORE "Installing core packages" #6
 
120
    rm "$TARGET/usr/bin/awk"
 
121
    x_core_install mawk
 
122
    p; progress $baseprog $bases INSTCORE "Installing core packages" #7
 
123
 
 
124
    info UNPACKREQ "Unpacking required packages..."
 
125
 
 
126
    p; progress $baseprog $bases INSTCORE "Installing core packages" #8
 
127
    smallyes '' | repeatn 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages.  This will be attempted up to five times." "" dpkg --force-depends --unpack $(debfor $required)
 
128
    p 10; progress $baseprog $bases INSTCORE "Installing core packages" #18
 
129
 
 
130
    info CONFREQ "Configuring required packages..."
 
131
 
 
132
    mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL"
 
133
    echo \
 
134
"#!/bin/sh
 
135
echo
 
136
echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon"
 
137
    chmod 755 "$TARGET/sbin/start-stop-daemon"
 
138
 
 
139
    setup_dselect_method apt
 
140
    #on_exit "in_target_nofail umount /dev/pts"
 
141
 
 
142
    p; progress $baseprog $bases INSTCORE "Installing core packages" #19
 
143
    smallyes '' | in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" dpkg --configure --pending --force-configure-any --force-depends
 
144
    p 10; progress $baseprog $bases INSTCORE "Installing core packages" #29
 
145
 
 
146
    info INSTCORE "Installing base packages..."
 
147
 
 
148
    p; progress $baseprog $bases INSTCORE "Installing core packages" #30
 
149
    smallyes '' | repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages.  This will be re-attempted up to five times." "" dpkg --force-auto-select --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base)
 
150
 
 
151
    smallyes '' | repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages.  This will be attempted 5 times." "" dpkg  --force-confold --skip-same-version  --configure -a
 
152
 
 
153
    p 9; progress $baseprog $bases INSTCORE "Installing core packages" #39
 
154
 
 
155
    mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon"
 
156
 
 
157
    progress $bases $bases INSTCORE "Installing core packages" #40
 
158
    info BASESUCCESS "Base system installed successfully."
 
159
}