-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdebuild
executable file
·41 lines (39 loc) · 1.29 KB
/
debuild
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
build () {
debuild -S -us -uc -d && \
#is modif by debuild but let always with changes
#git restore debian/files && \
#version is in ..base but i'm testing without ..base
name=`cat debian/changelog | head -1 | grep -o ^[^\ ]*` && \
version=`cat debian/changelog | head -1 | grep -Poe "[^\(]*(?=\))"` && \
partname=${name}_${version} && \
cd .. && \
mv ${partname}* tmp && \
cd tmp && \
zip ../last${1}.zip ./* && \
rm ./*
#at exit working dir will not remain in tmp
#DEB_BUILD_OPTIONS=nocheck debuild -us -uc
}
if [ -z "${dist}" ]; then
build
else
b=${dist:0:1}
p=`pwd` && \
distribution=`cat debian/changelog | head -1 | grep -Poe "[^ ]*(?=;)"` && \
sed -i "1s/${distribution}/${dist}/" debian/changelog && \
sed -i "1s/)/${b})/" debian/changelog && \
if [ -n "${arhs}" ]; then
astr="Architecture:"
architectures=`cat debian/control | grep -Poe "(?<=^Architecture: ).*" | head -1` && \
arhs=${arhs// /\\ }
architectures=${architectures// /\\ }
sed -i "0,/^${astr}/s/^${astr}\ ${architectures}/${astr}\ ${arhs}/" debian/control
fi && \
build ${b} && \
cd ${p} && \
sed -i "1s/${dist}/${distribution}/" debian/changelog && \
sed -i "1s/${b})/)/" debian/changelog && \
if [ -n "${arhs}" ]; then
sed -i "0,/^${astr}/s/^${astr}\ ${arhs}/${astr}\ ${architectures}/" debian/control
fi
fi