-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconvert-deb.sh
executable file
·71 lines (57 loc) · 1.45 KB
/
convert-deb.sh
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
#!/bin/bash
# add dist name to the version, cause reprepro (the .deb mirror mananger) do
# not want to add the same package for 2 different codename of the same linux distrib (e.g ubuntu 18.04 and 20.04).
set -xe
if [ $# -lt 1 ]; then
echo "usage: $0 package.deb code outdir"
echo "exiting"
exit 1
fi
DEB=$1
code=$2
outdir=$3
DEB2=`basename ${DEB}|sed "s|1_amd64|1${code}_amd64|g"`
# temporary dir
TMPDIR=$(mktemp -d /tmp/deb.XXXXXX)
if test "$?" != "0"
then
echo "mktemp failed. Exiting."
exit 1
fi
WORKDIR=$TMPDIR/workdir
mkdir -p $WORKDIR && cd $WORKDIR
# extract deb
dpkg -e $DEB
dpkg -x $DEB .
# modify ot version
OT_VERSION="1.24-1"
OT_MODVERSION="$OT_VERSION$code"
sed -i -e "s/$OT_VERSION/$OT_MODVERSION/" DEBIAN/control
if ! grep -q "Version: $OT_MODVERSION" DEBIAN/control
then
sed -i -e "s/^\(Version: .*\)$/\1$code/" DEBIAN/control
fi
# modify cuba control
if grep -q "cuba" <<< "$DEB"
then
CUBA_VERSION="4.2.2-1"
sed -i -e "s/= ${CUBA_VERSION}/= ${CUBA_VERSION}${code}/" DEBIAN/control
fi
# modify pagmo control
if grep -q "pagmo" <<< "$DEB"
then
PAGMO_VERSION="2.19.1-1"
sed -i -e "s/= ${PAGMO_VERSION}/= ${PAGMO_VERSION}${code}/" DEBIAN/control
fi
# modify mixmod control
if grep -q "mixmod" <<< "$DEB"
then
MIXMOD_VERSION="2.1.11-1"
sed -i -e "s/= ${MIXMOD_VERSION}/= ${MIXMOD_VERSION}${code}/" DEBIAN/control
fi
cat DEBIAN/control
# rebuild deb
# tree $WORKDIR
mkdir -p ${outdir}
dpkg-deb -b $WORKDIR ${outdir}/$DEB2
rm -rf $TMPDIR