-
Notifications
You must be signed in to change notification settings - Fork 6
/
debian-build.sh
68 lines (54 loc) · 1.81 KB
/
debian-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
64
65
66
67
68
packageName=`jq -r '.name' project.json`
packageVersion=`jq -r '.version' project.json`
packagePlatform="amd64"
packageBinName=`jq -r '.binaryname' project.json`
packageDisc=`jq -r '.description' project.json`
##################################################################
# Creating the .deb package for Debian and Debian based distros###
##################################################################
dir="./tmp/"$packageName"_"$packageVersion"_"$packagePlatform
mkdir -p $dir
# create required sub directories
cd $dir
mkdir DEBIAN
mkdir -p usr/local/bin
# copy files
cp ../../build/cpuRoller ./usr/local/bin/cpuRoller
cp ../../appicon.png ./cpuRoller.png
# create the .desktop file
echo "[Desktop Entry]
Encoding=UTF-8
Name=$packageName
Comment=$packageDisc
Exec=/usr/local/bin/cpuRoller
Terminal=false
Type=Application
Icon=/usr/share/pixmaps/cpuRoller.png" > cpuRoller.desktop
# Create debian related files
cd DEBIAN
# debian control file
echo "Package: $packageName
Version: $packageVersion
Architecture: $packagePlatform
Maintainer: Sarthak Pranesh <[email protected]>
Description: $packageDisc" > control
# will run after install - creates desktop icon in gnome
echo "sudo chmod +x /usr/local/bin/cpuRoller
sudo cp ../cpuRoller.png /usr/share/pixmaps/cpuRoller.png
sudo cp ../cpuRoller.desktop /usr/share/applications/cpuRoller.desktop
" > postinst
# will run before uninstall - will remove icon and desktop file
echo "sudo rm -r /usr/share/pixmaps/cpuRoller.png
sudo rm -r /usr/share/applications/cpuRoller.desktop
" > prerm
# change permission for postinst and prerm
chmod -R 0775 postinst
chmod -R 0775 prerm
cd ../../
# start packaging .deb file
dpkg-deb --build --root-owner-group "$packageName"_"$packageVersion"_"$packagePlatform"
# copy .deb package to build
cp ./*.deb ../build/
# clean up
cd ../
rm -rf ./tmp