forked from lcarsde/application-starter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy-deb.sh
executable file
·47 lines (32 loc) · 1.08 KB
/
deploy-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
#!/bin/bash
export LC_ALL=en_US.UTF-8
TIME="$(date '+%a, %d %b %Y %T %z')"
YEAR="$(date '+%Y')"
echo "preparing debian package build for $1-${CIRCLE_TAG}"
# create debian package construction directory
mkdir -p "build/deb/$1-${CIRCLE_TAG}"
# copy software resources
cp -r src "build/deb/$1-${CIRCLE_TAG}/src"
cp -r resources "build/deb/$1-${CIRCLE_TAG}/resources"
cp CHANGELOG "build/deb/$1-${CIRCLE_TAG}/"
cp LICENSE "build/deb/$1-${CIRCLE_TAG}/"
cp readme.md "build/deb/$1-${CIRCLE_TAG}/"
cd "build/deb"
echo "create tarball"
tar -czf "$1_${CIRCLE_TAG}.orig.tar.gz" "$1-${CIRCLE_TAG}"
tar -ztf "$1_${CIRCLE_TAG}.orig.tar.gz"
cd ../..
# copy debian packaging files
cp -r "debian" "build/deb/$1-${CIRCLE_TAG}/debian"
echo "building debian package of $1-${CIRCLE_TAG}"
cd "build/deb/$1-${CIRCLE_TAG}"
sed -i "s/%version%/${CIRCLE_TAG}/" "debian/changelog"
sed -i "s/%time%/${TIME}/" "debian/changelog"
sed -i "s/%year%/${YEAR}/g" "debian/copyright"
debuild -us -uc
cd ..
ls -l
mkdir "deploy"
mv "$1_${CIRCLE_TAG}_amd64.deb" deploy/
cd ../..
echo "deb and tar.gz files are in build/deb/deploy"