-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.sh
executable file
·63 lines (41 loc) · 1.46 KB
/
build.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
#!/bin/bash
DEBFULLNAME="Alexandre DELAUNAY"
DEBMAIL="[email protected]"
gpg_key=C584C02F
export DEBMAIL DEBFULLNAME
api_latest_release="https://api.github.com/repos/glpi-project/glpi/releases/latest"
glpi_release_url=$(curl -s $api_latest_release | grep -Po '(?<="browser_download_url": ")[^"]*')
glpi_version=$(curl -s $api_latest_release | grep -Po '(?<="tag_name": ")[^"]*')
glpi_orig_filename="glpi_$glpi_version.orig.tar.gz"
cliupdate_file_url="https://raw.githubusercontent.com/glpi-project/glpi/$glpi_version/tools/cliupdate.php"
echo "url: $glpi_release_url"
echo "version: $glpi_version"
echo "filename: $glpi_orig_filename"
# prepare folders
mkdir -p sources
mkdir -p packages
# download release
wget --no-check-certificate -O sources/$glpi_orig_filename $glpi_release_url
# download update script
wget --no-check-certificate -O sources/cliupdate.php $cliupdate_file_url
# extract
cd sources
tar xf $glpi_orig_filename
mv glpi glpi-$glpi_version
# bootstrap debian package
mkdir -p glpi-$glpi_version/debian
cd glpi-$glpi_version/debian
# insert cliupdate
mv ../../cliupdate.php .
# copy and fill templates
cp -R ../../../templates/* .
find . -type f -exec sed -i -e "s/__FULLNAME__/$DEBFULLNAME/" -e "s/__MAIL__/$DEBMAIL/" {} \;
#generate deb
cd ..
debuild -k0x$gpg_key -S -sa --lintian-opts -i
cd ..
sudo pbuilder build *.dsc
# move deb files
sudo mv /var/cache/pbuilder/result/* ../packages
# clean (removed untracked files and folders)
#git clean -f -d