-
Notifications
You must be signed in to change notification settings - Fork 2
/
packagingscript.sh
executable file
·60 lines (46 loc) · 1.34 KB
/
packagingscript.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
#!/usr/bin/env bash
# Based on scripts by azlux.fr
pkgname=lp-ddns
repo="wioxjk/lp-ddns"
current=$(reprepro -b /srv/repos/ list stable lp-ddns | head -n1 | awk '{print $3}')
if [[ ! -d /tmp/${pkgname} ]]; then
git clone https://github.com/$repo /tmp/lp-ddns
else
cd /tmp/${pkgname}
git fetch
tp=$(git pull)
fi
cd /tmp/${pkgname}
new=$(grep 'declare version=' ${pkgname} | cut -d '"' -f 2)
if [ "$current" == "$new" ]; then
exit
fi
echo "New LP-DDNS version $current -> $new"
STARTDIR="/tmp/${pkgname}/build"
DESTDIR="$STARTDIR/pkg"
OUTDIR="$STARTDIR/deb"
rm -rf "$STARTDIR"
mkdir "$STARTDIR"
install -Dm 755 "/tmp/${pkgname}/${pkgname}" "$DESTDIR/usr/local/bin/${pkgname}"
mkdir -p "$DESTDIR/DEBIAN"
cat >"$DESTDIR/DEBIAN/control"<<EOL
Source: lp-ddns
Section: custom
Priority: optional
Maintainer: Jonathan Sélea <[email protected]>
Package: ${pkgname}
Version: $new
Standard-Version: 0.2a
Architecture: all
Essential: no
Depends-On: curl bash
Homepage: https://linux.pizza
Vcs-Git: https://github.com/wioxjk/lp-ddns
Bugs: https://github.com/wioxjk/lp-ddns/issues
Description: Tool for managing Dynamic DNS toghether with FreeDNS.linux.pizza
EOL
mkdir "$OUTDIR"
dpkg-deb --build "$DESTDIR" "$OUTDIR"
reprepro -b /srv/repos includedeb buster "$OUTDIR"/*.deb
reprepro -b /srv/repos includedeb stretch "$OUTDIR"/*.deb
rm -rf "$STARTDIR"