~ubuntu-branches/ubuntu/hardy/sbuild/hardy

« back to all changes in this revision

Viewing changes to chroot/buildd.chroot.pre-sarge

  • Committer: Bazaar Package Importer
  • Author(s): Roger Leigh
  • Date: 2006-10-21 21:23:16 UTC
  • mfrom: (2.1.6 edgy)
  • Revision ID: james.westby@ubuntu.com-20061021212316-nh89o5rnhyk1epnn
Tags: 0.52
* New upstream release.
* sbuild: Remove incorrect WannaBuild:: prefix from version_compare.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
mirror_style release
2
 
download_style apt
3
 
 
4
 
work_out_debs () {
5
 
 
6
 
    if [ "$SUITE" = stable ]
7
 
    then
8
 
        required="base-files base-passwd bash bsdutils debconf debianutils diff dpkg e2fsprogs fileutils findutils grep gzip hostname libcap1 libc6 libdb2 libdb3 libgdbmg1 libncurses5 libpam-modules libpam-runtime libpam0g libperl5.6 libreadline4 libstdc++2.10-glibc2.2 login mawk mount ncurses-base ncurses-bin passwd perl-base sed shellutils slang1 sysvinit tar textutils util-linux"
9
 
    elif [ "$SUITE" = testing ]; then
10
 
        required="base-files base-passwd bash bsdutils coreutils debconf debianutils diff dpkg dselect e2fsprogs fileutils findutils grep gzip hostname libcap1 libc6 libdb1-compat libdb2 libdb3 libdb4.0 libgdbmg1 libncurses5 libpam-modules libpam-runtime libpam0g libperl5.6 libreadline4 libstdc++2.10-glibc2.2 login mawk mount ncurses-base ncurses-bin passwd perl-base sed slang1 sysvinit tar util-linux"
11
 
    else
12
 
        required="base-files base-passwd bash bsdutils coreutils debianutils diff dpkg dselect e2fslibs e2fsprogs 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 makedev mawk mbr modutils mount ncurses-base ncurses-bin passwd perl-base procps sed slang1a-utf8 sysv-rc sysvinit tar util-linux zlib1g"
13
 
    fi
14
 
 
15
 
    base="apt binutils cpio cpp dpkg-dev gcc g++ make patch perl perl-modules ssmtp sudo"
16
 
 
17
 
    without_package () {
18
 
        echo "$2" | tr ' ' '\n' | grep -v "^$1$" | tr '\n' ' '
19
 
    }
20
 
 
21
 
    LIBC6=libc6
22
 
    
23
 
    if [ "$SUITE" = unstable ]; then
24
 
        case $ARCH in
25
 
            "alpha")
26
 
                required="$(without_package "libc6" "$required") libc6.1"
27
 
                base="$base gcc-3.2-base gcc-3.3-base gcc-3.2 gcc-3.3 g++-3.2 g++-3.3 cpp-3.2 cpp-3.3 libgcc1 libc6.1-dev libstdc++5-dev libstdc++5-3.3-dev fakeroot"
28
 
                LIBC6="libc6.1"
29
 
                ;;
30
 
            *)
31
 
                # default
32
 
                base="$base gcc-3.2-base gcc-3.3-base gcc-3.2 gcc-3.3 g++-3.2 g++-3.3 cpp-3.2 cpp-3.3 libgcc1 libc6-dev libstdc++5-dev libstdc++5-3.3-dev fakeroot"
33
 
                ;;
34
 
        esac
35
 
    else
36
 
        case $ARCH in
37
 
            "alpha")
38
 
                required="$(without_package "libc6" "$required") libc6.1"
39
 
                base="$base gcc-2.95 g++-2.95 cpp-2.95 libc6.1-dev libstdc++2.10-dev fakeroot"
40
 
                LIBC6="libc6.1"
41
 
                ;;
42
 
            "arm")
43
 
                base="$base gcc-2.95 g++-2.95 cpp-2.95 libc6-dev libstdc++2.10-dev fakeroot"
44
 
                ;;
45
 
            "i386")
46
 
                required="$(without_package "libperl5.6" "$required")"
47
 
                base="$base gcc-2.95 g++-2.95 cpp-2.95 libc6-dev libstdc++2.10-dev fakeroot"
48
 
                    ;;
49
 
            "ia64")
50
 
                required="$(without_package "libc6" "$required") libc6.1"
51
 
                base="$base gcc-2.96 gcc-2.96-base g++-2.96 cpp-2.96 libc6.1-dev libstdc++2.10-dev fakeroot"
52
 
                LIBC6="libc6.1"
53
 
                ;;
54
 
            "m68k")
55
 
                base="$base gcc-2.95 g++-2.95 cpp-2.95 libc6-dev libstdc++2.10-dev fakeroot"
56
 
                ;;
57
 
            "powerpc")
58
 
                base="$base gcc-2.95 g++-2.95 cpp-2.95 libc6-dev libstdc++2.10-dev fakeroot"
59
 
                ;;
60
 
            "sparc")
61
 
                base="$base gcc-2.95 g++-2.95 cpp-2.95 libc6-dev libstdc++2.10-dev fakeroot sparc-utils makedev"
62
 
                ;;
63
 
            "mips")
64
 
                base="$base gcc-2.95 g++-2.95 cpp-2.95 libc6-dev libstdc++2.10-dev"
65
 
                ;;
66
 
            "mipsel")
67
 
                base="$base gcc-2.95 g++-2.95 cpp-2.95 libc6-dev libstdc++2.10-dev"
68
 
                ;;
69
 
            "hppa")
70
 
                base="$base libstdc++3 gcc-3.0-base gcc-3.0 g++-3.0 cpp-3.0 libc6-dev libstdc++3-dev fakeroot libgcc1"
71
 
                required="$(without_package "libstdc++2.10-glibc2.2" "$required")"
72
 
                ;;
73
 
            *)
74
 
                # who knows?
75
 
                ;;
76
 
        esac
77
 
    fi
78
 
 
79
 
    all_debs="$required $base"
80
 
}
81
 
 
82
 
install_debs () {
83
 
    extract $required
84
 
 
85
 
    mkdir -p $TARGET/var/lib/dpkg
86
 
    echo -n >$TARGET/var/lib/dpkg/status
87
 
    echo -n >$TARGET/var/lib/dpkg/available
88
 
 
89
 
    setup_etc
90
 
    if [ ! -e $TARGET/etc/fstab ]; then
91
 
        echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' >$TARGET/etc/fstab
92
 
        chown 0.0 $TARGET/etc/fstab; chmod 644 $TARGET/etc/fstab
93
 
    fi
94
 
 
95
 
    setup_proc
96
 
    setup_devices
97
 
 
98
 
    if [ ! -e $TARGET/etc/ld.so.conf ]; then
99
 
        #warning "Creating empty ld.so.conf"
100
 
        info "(WARNING) Creating empty ld.so.conf"
101
 
        touch $TARGET/etc/ld.so.conf
102
 
        chown 0.0 $TARGET/etc/ld.so.conf
103
 
    fi
104
 
    in_target /sbin/ldconfig
105
 
 
106
 
    x_feign_install () {
107
 
        local pkg=$1
108
 
        local deb=$(debfor $pkg)
109
 
        local ver=$(
110
 
            ar -p $TARGET/$deb control.tar.gz | zcat |
111
 
                tar -O -xf - control ./control 2>/dev/null |
112
 
                sed -ne 's/^Version: *//Ip' | head -n 1
113
 
        )
114
 
 
115
 
        mkdir -p $TARGET/var/lib/dpkg/info
116
 
 
117
 
        cat >>$TARGET/var/lib/dpkg/status << EOF
118
 
Package: $pkg
119
 
Version: $ver
120
 
Status: install ok installed
121
 
 
122
 
EOF
123
 
        touch $TARGET/var/lib/dpkg/info/${pkg}.list
124
 
    }
125
 
 
126
 
    x_core_install () {
127
 
        in_target dpkg --force-depends --install $(debfor "$@")
128
 
    }
129
 
 
130
 
    x_feign_install dpkg
131
 
 
132
 
    export DEBIAN_FRONTEND=noninteractive
133
 
 
134
 
    info "Installing essential packages"
135
 
 
136
 
    x_core_install base-files base-passwd ldso
137
 
    x_core_install dpkg
138
 
 
139
 
    if [ ! -e $TARGET/etc/localtime ]; then
140
 
        ln -s /usr/share/zoneinfo/UTC $TARGET/etc/localtime
141
 
    fi
142
 
 
143
 
    if [ ! -e $TARGET/etc/hosts ]; then
144
 
        cp /etc/hosts $TARGET/etc
145
 
    fi
146
 
 
147
 
    x_core_install $LIBC6
148
 
 
149
 
    x_core_install perl-base
150
 
    x_core_install mawk
151
 
    x_core_install debconf
152
 
 
153
 
    repeat 5 in_target dpkg --force-depends --unpack $(debfor $required)
154
 
    # for p in $required; do
155
 
    #   repeat 20 in_target dpkg --force-depends --unpack $(debfor $p)
156
 
    # done
157
 
 
158
 
    mv $TARGET/sbin/start-stop-daemon $TARGET/sbin/start-stop-daemon.REAL
159
 
    cp $TARGET/bin/true $TARGET/sbin/start-stop-daemon
160
 
 
161
 
    setup_dselect_method apt
162
 
    on_exit "in_target_nofail umount /dev/pts"
163
 
 
164
 
    in_target dpkg --configure --pending --force-configure-any --force-depends
165
 
 
166
 
    info "Installing base packages"
167
 
 
168
 
    repeat 5 in_target dpkg --force-auto-select --force-overwrite \
169
 
        --force-confold --skip-same-version --install $(debfor $base)
170
 
 
171
 
    mv $TARGET/sbin/start-stop-daemon.REAL $TARGET/sbin/start-stop-daemon
172
 
 
173
 
    cp /etc/resolv.conf $TARGET/etc
174
 
 
175
 
    echo "# $SUITE" > $TARGET/etc/apt/sources.list
176
 
    echo "deb http://http.us.debian.org/debian/ $SUITE main non-free contrib" >> $TARGET/etc/apt/sources.list
177
 
    echo "deb-src http://http.us.debian.org/debian/ $SUITE main non-free contrib" >> $TARGET/etc/apt/sources.list
178
 
    echo "" >> $TARGET/etc/apt/sources.list
179
 
    echo "# $SUITE non-us" >> $TARGET/etc/apt/sources.list
180
 
    echo "deb http://non-us.debian.org/debian-non-US $SUITE/non-US main contrib non-free" >> $TARGET/etc/apt/sources.list
181
 
    echo "deb-src http://non-us.debian.org/debian-non-US $SUITE/non-US main contrib non-free" >> $TARGET/etc/apt/sources.list
182
 
 
183
 
    USER=root; GROUP=sbuild
184
 
    mkdir -p $TARGET/var/lib/sbuild/srcdep-lock $TARGET/build
185
 
    chown -R $USER:$GROUP $TARGET/var/lib/sbuild $TARGET/build
186
 
    chmod -R 02775 $TARGET/var/lib/sbuild
187
 
 
188
 
    info "Successfully set up chroot: $SUITE"
189
 
 
190
 
cat << EOF
191
 
 
192
 
-------------------------------------------------------------------------
193
 
Please add this line to /etc/fstab:
194
 
 
195
 
  none $TARGET/proc proc  defaults 0 0
196
 
 
197
 
and mount it:
198
 
 
199
 
  sudo mount $TARGET/proc
200
 
 
201
 
The add_sbuild_user script sets up the new chroot for a user:
202
 
 
203
 
  sudo /usr/lib/sbuild/add_sbuild_user $TARGET $SUITE <user>
204
 
 
205
 
-------------------------------------------------------------------------
206
 
EOF
207
 
exit 0
208
 
}
209