Update to go-sbot systemctl system service
This commit is contained in:
parent
0907c07c97
commit
336fc9536a
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
# create user which go-sbot runs as (if doesnt exist)
|
# create user which go-sbot runs as
|
||||||
id -u peach &>/dev/null || adduser --quiet peach
|
id -u peach &>/dev/null || adduser --quiet peach
|
||||||
|
|
||||||
# set permissions
|
# set permissions
|
||||||
|
@ -11,33 +11,30 @@ chown peach /usr/bin/sbotcli
|
||||||
# Automatically added by cargo-deb
|
# Automatically added by cargo-deb
|
||||||
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
|
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
|
||||||
# This will only remove masks created by d-s-h on package removal.
|
# This will only remove masks created by d-s-h on package removal.
|
||||||
deb-systemd-helper --user unmask go-sbot.service >/dev/null || true
|
deb-systemd-helper unmask go-sbot.service >/dev/null || true
|
||||||
|
|
||||||
# was-enabled defaults to true, so new installations run enable.
|
# was-enabled defaults to true, so new installations run enable.
|
||||||
if deb-systemd-helper --user --quiet was-enabled go-sbot.service; then
|
if deb-systemd-helper --quiet was-enabled go-sbot.service; then
|
||||||
# Enables the unit on first installation, creates new
|
# Enables the unit on first installation, creates new
|
||||||
# symlinks on upgrades if the unit file has changed.
|
# symlinks on upgrades if the unit file has changed.
|
||||||
deb-systemd-helper --user enable go-sbot.service >/dev/null || true
|
deb-systemd-helper enable go-sbot.service >/dev/null || true
|
||||||
else
|
else
|
||||||
# Update the statefile to add new symlinks (if any), which need to be
|
# Update the statefile to add new symlinks (if any), which need to be
|
||||||
# cleaned up on purge. Also remove old symlinks.
|
# cleaned up on purge. Also remove old symlinks.
|
||||||
deb-systemd-helper --user update-state go-sbot.service >/dev/null || true
|
deb-systemd-helper update-state go-sbot.service >/dev/null || true
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# End automatically added section
|
# End automatically added section
|
||||||
# Automatically added by cargo-deb
|
# Automatically added by cargo-deb
|
||||||
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
|
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
|
||||||
if [ -d /run/systemd/system ]; then
|
if [ -d /run/systemd/system ]; then
|
||||||
# USER="$(who | head -1 | awk '{print $1;}')"
|
systemctl --system daemon-reload >/dev/null || true
|
||||||
USER="peach"
|
|
||||||
runuser -l $USER -c "XDG_RUNTIME_DIR=/run/user/$(id -u $USER) systemctl --user daemon-reload >/dev/null || true"
|
|
||||||
if [ -n "$2" ]; then
|
if [ -n "$2" ]; then
|
||||||
_dh_action=restart
|
_dh_action=restart
|
||||||
else
|
else
|
||||||
_dh_action=start
|
_dh_action=start
|
||||||
fi
|
fi
|
||||||
runuser -l $USER -c "XDG_RUNTIME_DIR=/run/user/$(id -u $USER) deb-systemd-invoke --user $_dh_action go-sbot.service >/dev/null || true"
|
deb-systemd-invoke $_dh_action go-sbot.service >/dev/null || true
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
# End automatically added section
|
# End automatically added section
|
|
@ -1,21 +1,21 @@
|
||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
# Automatically added by cargo-deb
|
# Automatically added by cargo-deb
|
||||||
if [ -d /run/systemd/system ]; then
|
if [ -d /run/systemd/system ]; then
|
||||||
# USER="$(who | head -1 | awk '{print $1;}')"
|
systemctl --system daemon-reload >/dev/null || true
|
||||||
USER="peach"
|
|
||||||
runuser -l $USER -c "XDG_RUNTIME_DIR=/run/user/$(id -u $USER) systemctl --user daemon-reload >/dev/null || true"
|
|
||||||
fi
|
fi
|
||||||
# End automatically added section
|
# End automatically added section
|
||||||
# Automatically added by cargo-deb
|
# Automatically added by cargo-deb
|
||||||
if [ "$1" = "remove" ]; then
|
if [ "$1" = "remove" ]; then
|
||||||
if [ -x "/usr/bin/deb-systemd-helper" ]; then
|
if [ -x "/usr/bin/deb-systemd-helper" ]; then
|
||||||
deb-systemd-helper --user mask service >/dev/null || true
|
deb-systemd-helper mask go-sbot.service >/dev/null || true
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$1" = "purge" ]; then
|
if [ "$1" = "purge" ]; then
|
||||||
if [ -x "/usr/bin/deb-systemd-helper" ]; then
|
if [ -x "/usr/bin/deb-systemd-helper" ]; then
|
||||||
deb-systemd-helper --user purge service >/dev/null || true
|
deb-systemd-helper purge go-sbot.service >/dev/null || true
|
||||||
deb-systemd-helper --user unmask service >/dev/null || true
|
deb-systemd-helper unmask go-sbot.service >/dev/null || true
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
# End automatically added section
|
# End automatically added section
|
|
@ -1,7 +1,7 @@
|
||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
# Automatically added by cargo-deb
|
# Automatically added by cargo-deb
|
||||||
if [ -d /run/systemd/system ] && [ "$1" = remove ]; then
|
if [ -d /run/systemd/system ] && [ "$1" = remove ]; then
|
||||||
# USER="$(who | head -1 | awk '{print $1;}')"
|
deb-systemd-invoke stop go-sbot.service >/dev/null || true
|
||||||
USER="peach"
|
|
||||||
runuser -l $USER -c "XDG_RUNTIME_DIR=/run/user/$(id -u $USER) deb-systemd-invoke --user stop service >/dev/null || true"
|
|
||||||
fi
|
fi
|
||||||
# End automatically added section
|
# End automatically added section
|
|
@ -1,5 +1,5 @@
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=peachs go-sbot
|
Description=peachcloud go-sbot
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=simple
|
Type=simple
|
||||||
|
|
|
@ -14,7 +14,7 @@ from peach_package_builder.constants import *
|
||||||
from peach_package_builder.utils import render_template, add_deb_to_freight, update_freight_cache
|
from peach_package_builder.utils import render_template, add_deb_to_freight, update_freight_cache
|
||||||
|
|
||||||
# manually update this version when we want to build a new peach-go-sbot package
|
# manually update this version when we want to build a new peach-go-sbot package
|
||||||
GO_SBOT_VERSION = '0.1.21'
|
GO_SBOT_VERSION = '0.1.24'
|
||||||
|
|
||||||
# constants
|
# constants
|
||||||
DEB_CONF_DIR = os.path.join(PROJECT_PATH, 'conf/templates/go_sbot')
|
DEB_CONF_DIR = os.path.join(PROJECT_PATH, 'conf/templates/go_sbot')
|
||||||
|
@ -48,8 +48,7 @@ def package_go_sbot(version):
|
||||||
render_template(src=src, dest=dest, template_vars={"version": version})
|
render_template(src=src, dest=dest, template_vars={"version": version})
|
||||||
|
|
||||||
# copy systemd service file
|
# copy systemd service file
|
||||||
SERVICE_DIR = os.path.join(DEB_BUILD_DIR, 'home/peach/.config/systemd')
|
SERVICE_DIR = os.path.join(DEB_BUILD_DIR, 'lib/systemd/system')
|
||||||
# SERVICE_DIR = os.path.join(DEB_BUILD_DIR, 'lib/systemd/system')
|
|
||||||
os.makedirs(SERVICE_DIR)
|
os.makedirs(SERVICE_DIR)
|
||||||
shutil.copyfile(
|
shutil.copyfile(
|
||||||
os.path.join(DEB_CONF_DIR, 'go-sbot.service'),
|
os.path.join(DEB_CONF_DIR, 'go-sbot.service'),
|
||||||
|
|
Loading…
Reference in New Issue