-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcowbuilder-dist
executable file
·102 lines (91 loc) · 2.93 KB
/
cowbuilder-dist
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#!/bin/sh -e
if [ -z "$dists" ]; then
dists="bookworm trixie sid"
fi
if [ -z "$archs" ]; then
archs="i386 amd64"
fi
if [ -z "$KEY_ID" ]; then
KEY_ID="4F23A0260F19DAC5"
fi
case "$1" in
install )
sudo apt-get install -y ubuntu-dev-tools cowbuilder debhelper dput
mkdir -p ~/pbuilder/hooks ~/pbuilder/local
cat >~/.pbuilderrc <<EOF
HOOKDIR="$HOME/pbuilder/hooks"
BINDMOUNTS="$HOME/pbuilder/local"
EOF
exit 0
;;
create | update)
for dist in $dists; do
for arch in $archs; do
echo ""
echo ""
echo "*******************************************************************************"
echo "Doing $1 for distribution $dist arch $arch"
echo "*******************************************************************************"
echo ""
cowbuilder-dist "$dist" "$arch" "$@" || {
echo ""
echo "****************************************"
echo " FAILED $1"
echo "****************************************"
echo ""
exit 2
}
done
done
exit 0
;;
esac
for file in $@; do
case "$file" in
*_source.changes )
dist=$(grep '^Distribution: ' -- "$file" | awk '{print $2}')
if [ -z "$dist" ]; then
echo "No distribution found in $file"
exit 1
fi
file=$(basename -- "$file" _source.changes).dsc
if [ ! -r "$file" ]; then
echo "File $file does not exists"
exit 1
fi
tarch=$(grep '^Architecture: ' -- "$file" | cut -d ' ' -f 2-)
tarchs="$archs"
case "$tarch" in
all )
tarchs="amd64"
;;
any )
;;
* )
tarchs="$tarch"
;;
esac
for arch in $tarchs; do
echo ""
echo ""
echo "*******************************************************************************"
echo "Building $file for distribution $dist on $arch arch"
echo "*******************************************************************************"
echo ""
cowbuilder-dist "$dist" "$arch" build "$file" || {
echo ""
echo "****************************************"
echo " FAILED build"
echo "****************************************"
echo ""
exit 2
}
done
;;
* )
echo "Unknown file $file"
exit 1
;;
esac
done
echo "ok"