1 | #! /bin/sh
|
---|
2 |
|
---|
3 | # XXX - this needs to run under fakeroot...
|
---|
4 |
|
---|
5 | exec 3>&1 1>&2
|
---|
6 |
|
---|
7 | real_dpkg_checkbuilddeps () {
|
---|
8 | SBOX_REDIRECT_IGNORE=/usr/bin/perl /usr/bin/perl /usr/bin/dpkg-checkbuilddeps "$@"
|
---|
9 | }
|
---|
10 |
|
---|
11 | finish () {
|
---|
12 | if ! real_dpkg_checkbuilddeps; then
|
---|
13 | echo "This package does not use any devkits."
|
---|
14 | echo "Please install all build dependencies as real packages."
|
---|
15 | echo >&3 FAIL
|
---|
16 | fi
|
---|
17 | exit 0
|
---|
18 | }
|
---|
19 |
|
---|
20 | # The stamp file can not be in the source tree because then it would
|
---|
21 | # end up in the source package, which is not what we want. We put it
|
---|
22 | # into /var/tmp so that it gets deleted when a new rootstrap is
|
---|
23 | # extracted.
|
---|
24 |
|
---|
25 | STAMP=/var/tmp/SANITIZED.$(head debian/changelog | md5sum | cut -d' ' -f1)
|
---|
26 |
|
---|
27 | if [ -e $STAMP ]; then
|
---|
28 | exit 0;
|
---|
29 | fi
|
---|
30 |
|
---|
31 | # Only do permanent changes if this is BIFH
|
---|
32 |
|
---|
33 | echo "$USER" | grep -q 'bifh[0-9]' || finish
|
---|
34 |
|
---|
35 | # prevent bash from killing the system
|
---|
36 | rm -f /var/lib/bash/provide-sh
|
---|
37 |
|
---|
38 | # clean ~/.texmf-var to avoid trouble with stale things hiding there.
|
---|
39 | rm -rf ~/.texmf-var/
|
---|
40 |
|
---|
41 | pfx="dpkg-checkbuilddeps: Unmet build dependencies:"
|
---|
42 | deps=`real_dpkg_checkbuilddeps 2>&1 | grep "^$pfx" | \
|
---|
43 | sed -e "s/$pfx//" -e s'/([^)]*)//g' -e 's/|//'`
|
---|
44 | deps="$deps build-essential automake autoconf libtool ed gawk diff dpkg-dev"
|
---|
45 | for d in $deps; do
|
---|
46 | echo apt-get "$@" install $d
|
---|
47 | apt-get -o DPkg::Options::=--force-confold -q --force-yes --yes install $d
|
---|
48 | done
|
---|
49 | apt-get -o DPkg::Options::=--force-confold -q --force-yes --yes dist-upgrade
|
---|
50 |
|
---|
51 | # Make sure we get a fresh fakeroot installation
|
---|
52 |
|
---|
53 | # We can't seem to control the value of LD_PRELOAD well enough, so we
|
---|
54 | # just copy the good version of libfakeroot over the bad one that
|
---|
55 | # Scratchbox uses. This will result in a good version of libfakeroot
|
---|
56 | # talking to a bad version of faked, but that seems to work well
|
---|
57 | # enough. The protocol between the two is really simple and unlikely
|
---|
58 | # to change even when new syscalls are wrapped. And this is a
|
---|
59 | # desperate hack anyway, so it's OK if there is blood all over the
|
---|
60 | # floor from time to time.
|
---|
61 | #
|
---|
62 | # After we have overwritten libfakeroot, it no longer works with any
|
---|
63 | # host binaries, such as the ones in /scratchbox/compilers/bin or
|
---|
64 | # /scratchbox/tools/bin. Thus, we must avoid running those when
|
---|
65 | # fakerooted.
|
---|
66 | #
|
---|
67 | # We use "cp -l" here to avoid overwriting a library that is in use.
|
---|
68 | #
|
---|
69 | if [ "$(fakeroot -v)" = "fakeroot version 1.4.2" ]; then
|
---|
70 | apt-get -q --force-yes --yes --reinstall install fakeroot
|
---|
71 | cp -fl /usr/lib/libfakeroot/libfakeroot-sysv.so /usr/lib/libfakeroot-sysv/libfakeroot.so.0
|
---|
72 | cp -fl /usr/lib/libfakeroot/libfakeroot-tcp.so /usr/lib/libfakeroot-tcp/libfakeroot.so.0
|
---|
73 | else
|
---|
74 | echo "We have $(fakeroot -v), hurray!"
|
---|
75 | fi
|
---|
76 |
|
---|
77 | touch $STAMP
|
---|
78 |
|
---|
79 | finish
|
---|