~udienz/+junk/debootstrap-blankon

« back to all changes in this revision

Viewing changes to scripts/ubuntu/warty.buildd

  • Committer: Andy Apdhani
  • Date: 2007-09-29 13:24:53 UTC
  • Revision ID: imtheface@ubuntu.com-20070929132453-r0ir93lt4fk29u7m
Impor awal

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
work_out_debs () {
 
6
 
 
7
    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 perl-base sed slang1a-utf8 sysv-rc sysvinit tar util-linux zlib1g"
 
8
 
 
9
    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"
 
10
 
 
11
    without_package () {
 
12
        echo "$2" | tr ' ' '\n' | grep -v "^$1$" | tr '\n' ' '
 
13
    }
 
14
    subst_package () {
 
15
        echo "$3" | tr ' ' '\n' | sed "s/^$1$/$2/" | tr '\n' ' '
 
16
    }
 
17
 
 
18
    LIBC6=libc6
 
19
 
 
20
    case $ARCH in
 
21
        "amd64")
 
22
            ;;
 
23
        "i386")
 
24
            ;;
 
25
        "powerpc")
 
26
            ;;
 
27
 
 
28
        # Unsupported architectures:
 
29
        "alpha")
 
30
            required="$(subst_package "libc6" "libc6.1" "$required")"
 
31
            base="$(subst_package "libc6-dev" "libc6.1-dev" "$base")"
 
32
            LIBC6="libc6.1"
 
33
            ;;
 
34
        "ia64")
 
35
            required="$(subst_package "libc6" "libc6.1" "$required")"
 
36
            base="$(subst_package "libc6-dev" "libc6.1-dev" "$base")"
 
37
            LIBC6="libc6.1"
 
38
            ;;
 
39
        *)
 
40
            # who knows?
 
41
            ;;
 
42
    esac
 
43
}
 
44
 
 
45
install_debs () {
 
46
    first_stage_install
 
47
    second_stage_install
 
48
}
 
49
 
 
50
first_stage_install () {
 
51
    extract $required
 
52
 
 
53
    mkdir -p "$TARGET/var/lib/dpkg"
 
54
    : >"$TARGET/var/lib/dpkg/status"
 
55
    echo >"$TARGET/var/lib/dpkg/available"
 
56
 
 
57
    setup_etc
 
58
    if [ ! -e "$TARGET/etc/fstab" ]; then
 
59
        echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab"
 
60
        chown 0.0 "$TARGET/etc/fstab"; chmod 644 "$TARGET/etc/fstab"
 
61
    fi
 
62
 
 
63
    setup_devices
 
64
 
 
65
    x_feign_install () {
 
66
        local pkg="$1"
 
67
        local deb="$(debfor $pkg)"
 
68
        local ver="$(
 
69
            ar -p "$TARGET/$deb" control.tar.gz | zcat |
 
70
                tar -O -xf - control ./control 2>/dev/null |
 
71
                sed -ne 's/^Version: *//Ip' | head -n 1
 
72
        )"
 
73
 
 
74
        mkdir -p "$TARGET/var/lib/dpkg/info"
 
75
 
 
76
        echo \
 
77
"Package: $pkg
 
78
Version: $ver
 
79
Status: install ok installed" >> "$TARGET/var/lib/dpkg/status"
 
80
 
 
81
        touch "$TARGET/var/lib/dpkg/info/${pkg}.list"
 
82
    }
 
83
 
 
84
    x_feign_install dpkg
 
85
}
 
86
 
 
87
second_stage_install () {
 
88
    x_core_install () {
 
89
        smallyes '' | in_target dpkg --force-depends --install $(debfor "$@")
 
90
    }
 
91
    p () {
 
92
        baseprog="$(($baseprog + ${1:-1}))"
 
93
    }
 
94
 
 
95
    DEBIAN_FRONTEND=noninteractive
 
96
    export DEBIAN_FRONTEND
 
97
 
 
98
    baseprog=0
 
99
    bases=40
 
100
 
 
101
    setup_proc
 
102
    in_target /sbin/ldconfig
 
103
 
 
104
    p; progress $baseprog $bases INSTCORE "Installing core packages" #1
 
105
    info INSTCORE "Installing core packages..."
 
106
 
 
107
    p; progress $baseprog $bases INSTCORE "Installing core packages" #2
 
108
    ln -sf mawk "$TARGET/usr/bin/awk"
 
109
    x_core_install base-files base-passwd
 
110
    p; progress $baseprog $bases INSTCORE "Installing core packages" #3
 
111
    x_core_install dpkg
 
112
 
 
113
    if [ ! -e "$TARGET/etc/localtime" ]; then
 
114
        ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime"
 
115
    fi
 
116
 
 
117
    p; progress $baseprog $bases INSTCORE "Installing core packages" #4
 
118
    x_core_install $LIBC6
 
119
 
 
120
    p; progress $baseprog $bases INSTCORE "Installing core packages" #5
 
121
    x_core_install perl-base
 
122
    p; progress $baseprog $bases INSTCORE "Installing core packages" #6
 
123
    rm "$TARGET/usr/bin/awk"
 
124
    x_core_install mawk
 
125
    p; progress $baseprog $bases INSTCORE "Installing core packages" #7
 
126
 
 
127
    info UNPACKREQ "Unpacking required packages..."
 
128
 
 
129
    p; progress $baseprog $bases INSTCORE "Installing core packages" #8
 
130
    smallyes '' | repeat 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)
 
131
    p 10; progress $baseprog $bases INSTCORE "Installing core packages" #18
 
132
 
 
133
    info CONFREQ "Configuring required packages..."
 
134
 
 
135
    mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL"
 
136
    echo \
 
137
"#!/bin/sh
 
138
echo
 
139
echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon"
 
140
    chmod 755 "$TARGET/sbin/start-stop-daemon"
 
141
 
 
142
    setup_dselect_method apt
 
143
    #on_exit "in_target_nofail umount /dev/pts"
 
144
 
 
145
    p; progress $baseprog $bases INSTCORE "Installing core packages" #19
 
146
    smallyes '' | in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" dpkg --configure --pending --force-configure-any --force-depends
 
147
    p 10; progress $baseprog $bases INSTCORE "Installing core packages" #29 
 
148
 
 
149
    info INSTCORE "Installing base packages..."
 
150
 
 
151
    p; progress $baseprog $bases INSTCORE "Installing core packages" #30
 
152
    smallyes '' | repeat 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)
 
153
 
 
154
    smallyes '' | repeat 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
 
155
 
 
156
    p 9; progress $baseprog $bases INSTCORE "Installing core packages" #39
 
157
 
 
158
    mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon"
 
159
 
 
160
    progress $bases $bases INSTCORE "Installing core packages" #40
 
161
    info BASESUCCESS "Base system installed successfully."
 
162
}