-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
integrate systemd unit file into Debian package
- Loading branch information
1 parent
914174c
commit b12bd33
Showing
8 changed files
with
121 additions
and
5 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 |
---|---|---|
@@ -1 +1 @@ | ||
9 | ||
10 |
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 |
---|---|---|
|
@@ -2,7 +2,7 @@ Source: smartmeter-datacollector | |
Maintainer: Supercomputing Systems AG <[email protected]> | ||
Section: python | ||
Priority: optional | ||
Build-Depends: python3-setuptools, python3-all, debhelper (>= 9) | ||
Build-Depends: python3-setuptools, python3-all, debhelper (>= 10), dh-systemd (>= 1.5) | ||
Standards-Version: 3.9.1 | ||
Homepage: https://github.com/scs/smartmeter-datacollector | ||
|
||
|
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,45 @@ | ||
#!/bin/sh | ||
# postinst script for python3-smartmeter-datacollector | ||
# | ||
# see: dh_installdeb(1) | ||
|
||
# exit on any error | ||
set -e | ||
|
||
USERNAME=smartmeter | ||
GROUP=dialout | ||
|
||
# make sure the dialout group already exists | ||
if ! getent group | grep -q "^${GROUP}:"; then | ||
>&2 echo "Expected group \"${GROUP}\" doesn't exist!" | ||
exit 1 | ||
fi | ||
|
||
# add new group "smartmeter" if it doesn't already exist | ||
if ! getent group | grep -q "^${USERNAME}:"; then | ||
echo -n "Adding group ${USERNAME}.." | ||
addgroup --quiet --system ${USERNAME} 2>/dev/null || true | ||
echo "..done" | ||
fi | ||
|
||
# add new user "smartmeter" if it doesn't already exist | ||
if ! getent passwd | grep -q "^${USERNAME}:"; then | ||
echo -n "Adding system user ${USERNAME}.." | ||
adduser --quiet \ | ||
--system \ | ||
--ingroup ${USERNAME} \ | ||
--no-create-home \ | ||
--disabled-login \ | ||
--disabled-password \ | ||
${USERNAME} 2>/dev/null || true | ||
echo "..done" | ||
fi | ||
|
||
# add the new user "smartmeter" to the dialout group | ||
if ! groups ${USERNAME} | cut -d: -f2 | grep -qw ${GROUP}; then | ||
adduser ${USERNAME} ${GROUP} > /dev/null 2>&1 | ||
fi | ||
|
||
#DEBHELPER# | ||
|
||
exit 0 |
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,11 @@ | ||
[Unit] | ||
Description=Smart Meter Data Collector Service | ||
|
||
[Service] | ||
Type=simple | ||
User=smartmeter | ||
Restart=on-failure | ||
ExecStart=smartmeter-datacollector -c /var/lib/smartmeter-datacollector/datacollector.ini | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
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
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