From a5adac93145eb7262caac0c04a3d1343c20bbd20 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Thu, 23 May 2024 02:46:38 +0200 Subject: [PATCH] [#319] Added /etc and /var/lib dirs to Debian package. --- .drone/update-deb-packages.sh | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/.drone/update-deb-packages.sh b/.drone/update-deb-packages.sh index 8c2e250d98..74cdd625ee 100755 --- a/.drone/update-deb-packages.sh +++ b/.drone/update-deb-packages.sh @@ -29,6 +29,23 @@ find "$GIT_BUILD_DIR" -name "site-packages" | while read dir; do mv "$dir" "$base/dist-packages" done +install -m755 -d "${GIT_BUILD_DIR}/usr/lib/systemd/system" +install -m755 -d "${GIT_BUILD_DIR}/usr/lib/systemd/user" +install -m750 -d "${GIT_BUILD_DIR}/var/lib/platypush" +install -m750 -d "${GIT_BUILD_DIR}/etc/platypush/scripts" + +install -m644 "${SRCDIR}/platypush/config/config.yaml" "${GIT_BUILD_DIR}/etc/platypush/config.yaml" +install -m644 "${SRCDIR}/platypush/config/systemd/platypush.service" "${GIT_BUILD_DIR}/usr/lib/systemd/user/platypush.service" +install -m644 "${SRCDIR}/platypush/config/systemd/platypush.service" "${GIT_BUILD_DIR}/usr/lib/systemd/system/platypush.service" +sed -i "${GIT_BUILD_DIR}/usr/lib/systemd/system/platypush.service" -r \ + -e 's/^#\s*Requires=(.*)/Requires=\1/' \ + -e 's/^\[Service\]$/\[Service\]\ +User=platypush\ +Group=platypush\ +WorkingDirectory=\/var\/lib\/platypush\ +Environment="PLATYPUSH_CONFIG=\/etc\/platypush\/config.yaml"\ +Environment="PLATYPUSH_WORKDIR=\/var\/lib\/platypush"/' + mkdir -p "$GIT_BUILD_DIR/DEBIAN" cat < "$GIT_BUILD_DIR/DEBIAN/control" @@ -41,6 +58,19 @@ Homepage: https://platypush.tech Description: Universal command executor and automation hub. EOF +cat < "$GIT_BUILD_DIR/DEBIAN/postinst" && chmod +x "$GIT_BUILD_DIR/DEBIAN/postinst" +#!/bin/sh + +set -e + +if [ "\$1" = "configure" ]; then + grep -e '^platypush:' /etc/passwd 2>/dev/null || useradd -r -s /bin/false -d /var/lib/platypush platypush + mkdir -p /var/lib/platypush + chown platypush:platypush /var/lib/platypush + if which systemctl; then systemctl daemon-reload; fi +fi +EOF + mkdir -p "$POOL_PATH" rm -f "$POOL_PATH/"*.deb dpkg --build "$GIT_BUILD_DIR"