-
Notifications
You must be signed in to change notification settings - Fork 2
/
makedeb.sh
92 lines (75 loc) · 1.96 KB
/
makedeb.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/bin/bash
# Crear un paquete para Debian/Ubuntu a partir de los funtes
#
# Install Dependencias
# sudo apt-get install build-essential dh-make devscripts fakeroot pbuilder
# No Errors
set -e
VERSION_FILE="./get-version.sh"
chmod +x "$VERSION_FILE"
# Basic vars
TMPDIR=$(mktemp -d)
VERSION=$($VERSION_FILE)
PWD=$(pwd)
CWD="$PWD"
NAME="picta-dl-gui"
SRCDIR="$TMPDIR/$NAME-$VERSION"
# dhmake and pkg vars
MAINTAINER="Oleksis Fraga"
MAINT=$MAINTAINER
EMAIL="oleksis.fraga@gmail.com"
LIC="mit"
HOMEPAGE="https://github.com/oleksis/picta-dl-gui"
VCS="https://github.com/oleksis/picta-dl-gui.git"
DEPS="qtbase5-dev"
RECOM="ffmpeg (>=3.0.0)"
DATE=$(date +"%a, %d %b 20%y %H:%M:%S %z")
# var listing for dynamic substitution
VARS="VERSION NAME MAINTAINER EMAIL HOMEPAGE VCS DEPS RECOM DATE"
# cleanup
echo "Cleaning ..."
rm -f *qmake.stash *.pro.user* object_script.* *_wrapper.sh
find $PWD \( -name "moc_*" -or -name "*.o" -or -name "qrc_*" \
-or -name "ui_*.h" -or -name "Makefile*" -or -name "*.a" \) -exec rm {} \;
rm -f *.deb
mkdir "$SRCDIR"
echo "Copying source code to $SRCDIR ..."
cp -r "$CWD"/* "$SRCDIR"/
echo "Change to $SRCDIR"
cd "$SRCDIR"
echo "Copy debian folder"
mv deployment/linux/debian .
rm -rdf deployment
rm -rdf debug/
rm -rdf release/
# With Erros
set +e
# make it happen
echo "Running dh_make ..."
dh_make -c $LIC -e $EMAIL -s -p $NAME -y --createorig
# provision the debian folder
for v in $(echo $VARS | xargs) ; do
# Get the var content: Indirect Expansion
CONT=${!v}
# Note
echo "Replace $v by \"$CONT\""
find "debian/" -type f -exec \
sed -i "s|\_\_$v\_\_|${CONT}|g" {} \;
done
# No Errors
set -e
# make the debian archive
echo "Building package ..."
dpkg-buildpackage -us -uc
#debuild -us -uc -b
cd ..
echo "Change to: $(pwd)"
ls -la *.deb
echo "Copying Debian package ..."
cp picta-dl-gui*.deb $CWD
echo "Deleting $TMPDIR"
rm -rdf "$TMPDIR"
echo "Change to: $CWD"
cd $CWD
ls -la *.deb
echo "Finished build the Debian package!"