diff --git a/conf/templates/go_sbot/DEBIAN/postinst b/conf/templates/go_sbot/DEBIAN/postinst old mode 100755 new mode 100644 index 0425b4e..0cd3db9 --- a/conf/templates/go_sbot/DEBIAN/postinst +++ b/conf/templates/go_sbot/DEBIAN/postinst @@ -1,7 +1,7 @@ #!/bin/sh 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 # set permissions @@ -11,33 +11,30 @@ chown peach /usr/bin/sbotcli # Automatically added by cargo-deb 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. - 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. - 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 # 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 # Update the statefile to add new symlinks (if any), which need to be # 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 - # End automatically added section # Automatically added by cargo-deb if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then if [ -d /run/systemd/system ]; then -# USER="$(who | head -1 | awk '{print $1;}')" - USER="peach" - runuser -l $USER -c "XDG_RUNTIME_DIR=/run/user/$(id -u $USER) systemctl --user daemon-reload >/dev/null || true" + systemctl --system daemon-reload >/dev/null || true if [ -n "$2" ]; then _dh_action=restart else _dh_action=start 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 # End automatically added section \ No newline at end of file diff --git a/conf/templates/go_sbot/DEBIAN/postrm b/conf/templates/go_sbot/DEBIAN/postrm old mode 100755 new mode 100644 index cbe5c72..9e0955f --- a/conf/templates/go_sbot/DEBIAN/postrm +++ b/conf/templates/go_sbot/DEBIAN/postrm @@ -1,21 +1,21 @@ +#!/bin/sh +set -e # Automatically added by cargo-deb if [ -d /run/systemd/system ]; then - # USER="$(who | head -1 | awk '{print $1;}')" - USER="peach" - runuser -l $USER -c "XDG_RUNTIME_DIR=/run/user/$(id -u $USER) systemctl --user daemon-reload >/dev/null || true" + systemctl --system daemon-reload >/dev/null || true fi # End automatically added section # Automatically added by cargo-deb if [ "$1" = "remove" ]; 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 if [ "$1" = "purge" ]; then if [ -x "/usr/bin/deb-systemd-helper" ]; then - deb-systemd-helper --user purge service >/dev/null || true - deb-systemd-helper --user unmask service >/dev/null || true + deb-systemd-helper purge go-sbot.service >/dev/null || true + deb-systemd-helper unmask go-sbot.service >/dev/null || true fi fi # End automatically added section \ No newline at end of file diff --git a/conf/templates/go_sbot/DEBIAN/prerm b/conf/templates/go_sbot/DEBIAN/prerm old mode 100755 new mode 100644 index e4f421d..017b8b8 --- a/conf/templates/go_sbot/DEBIAN/prerm +++ b/conf/templates/go_sbot/DEBIAN/prerm @@ -1,7 +1,7 @@ +#!/bin/sh +set -e # Automatically added by cargo-deb if [ -d /run/systemd/system ] && [ "$1" = remove ]; then -# USER="$(who | head -1 | awk '{print $1;}')" - USER="peach" - runuser -l $USER -c "XDG_RUNTIME_DIR=/run/user/$(id -u $USER) deb-systemd-invoke --user stop service >/dev/null || true" + deb-systemd-invoke stop go-sbot.service >/dev/null || true fi # End automatically added section \ No newline at end of file diff --git a/conf/templates/go_sbot/go-sbot.service b/conf/templates/go_sbot/go-sbot.service index 061db13..9f3484b 100644 --- a/conf/templates/go_sbot/go-sbot.service +++ b/conf/templates/go_sbot/go-sbot.service @@ -1,5 +1,5 @@ [Unit] -Description=peachs go-sbot +Description=peachcloud go-sbot [Service] Type=simple diff --git a/peach_package_builder/build_go_sbot.py b/peach_package_builder/build_go_sbot.py index e0be04d..2b29efb 100644 --- a/peach_package_builder/build_go_sbot.py +++ b/peach_package_builder/build_go_sbot.py @@ -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 # 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 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}) # 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) shutil.copyfile( os.path.join(DEB_CONF_DIR, 'go-sbot.service'),