-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
28 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,25 +10,21 @@ maintainer="The Ehrenamtskarte Team <[email protected]>" | |
description="Backend server for the Ehrenamtskarte app" | ||
|
||
# read input | ||
while getopts v:r:a:n:t:h flag | ||
while getopts v:r:a:n:t:s:h flag | ||
do | ||
case "${flag}" in | ||
v) version=${OPTARG};; | ||
r) revision=${OPTARG};; | ||
a) architecture=${OPTARG};; | ||
n) name=${OPTARG};; | ||
t) tarfile=${OPTARG};; | ||
s) servicefile=${OPTARG};; | ||
h) | ||
echo "$0 [-v version] [-r revision] [-a architecture] [-n name] -t backend_tar" | ||
echo "$0 [-v version] [-r revision] [-a architecture] [-n name] [-t backend_tar] [-s service_file]" | ||
exit 0;; | ||
esac | ||
done | ||
|
||
if [[ -z "$tarfile" ]]; then | ||
echo "Must provide input tar file using -t file" 1>&2 | ||
exit 1 | ||
fi | ||
|
||
debworkdir=$(mktemp -d) | ||
fullname=${name}_${version}-${revision}_${architecture} | ||
debfile=${fullname}.deb | ||
|
@@ -45,9 +41,17 @@ echo "Maintainer: $maintainer" >> $ctrlfile | |
echo "Description: $description" >> $ctrlfile | ||
|
||
# copy files to deb workdir | ||
echo "Copying $tarfile …" | ||
mkdir -p ${debworkdir}/var/ehrenamtskarte/backend | ||
tar -xf $tarfile -C ${debworkdir}/var/ehrenamtskarte | ||
if [[ -n "$tarfile" ]]; then | ||
echo "Copying $tarfile …" | ||
mkdir -p ${debworkdir}/opt/ehrenamtskarte/backend | ||
tar -xf $tarfile -C ${debworkdir}/opt/ehrenamtskarte | ||
fi | ||
if [[ -n "$servicefile" ]]; then | ||
echo "Copying $servicefile …" | ||
mkdir -p ${debworkdir}/etc/systemd/system | ||
cp $servicefile ${debworkdir}/etc/systemd/system/${name}.service | ||
fi | ||
|
||
|
||
# build the deb | ||
dpkg-deb --build --root-owner-group $debworkdir $debfile | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[Unit] | ||
Description=Backend for the ehrenamtskarte app | ||
After=postgresql.service network-online.target | ||
Wants=network-online.target systemd-networkd-wait-online.service | ||
|
||
StartLimitIntervalSec=500 | ||
StartLimitBurst=5 | ||
|
||
[Service] | ||
Type=simple | ||
ExecStart=/opt/ehrenamtskarte/backend/bin/backend | ||
Restart=on-failure | ||
RestartSec=5s |