diff --git a/pkg/debian/control b/pkg/debian/control index c08d99d5e23a..df7483cb5539 100644 --- a/pkg/debian/control +++ b/pkg/debian/control @@ -162,6 +162,7 @@ Package: salt-cloud Architecture: amd64 arm64 Breaks: salt-common (<= 3006.4) Depends: salt-common (= ${source:Version}), + salt-master (= ${source:Version}), ${misc:Depends} Description: public cloud VM management system provision virtual machines on various public clouds via a cleanly diff --git a/pkg/debian/salt-api.postinst b/pkg/debian/salt-api.postinst index 3b78211922ad..88976f2f775b 100644 --- a/pkg/debian/salt-api.postinst +++ b/pkg/debian/salt-api.postinst @@ -1,37 +1,47 @@ #!/bin/sh +# postinst script for salt-api +# +# See: dh_installdeb(1). -. /usr/share/debconf/confmodule +set -e + +# Summary of how this script can be called: +# * 'configure' +# * 'abort-upgrade' +# * 'abort-remove' 'in-favour' +# +# * 'abort-remove' +# * 'abort-deconfigure' 'in-favour' +# 'removing' +# +# for details, see https://www.debian.org/doc/debian-policy/ or +# the debian-policy package. case "$1" in configure) - db_get salt-api/user - if [ "$RET" != "root" ]; then - if [ ! -e "/var/log/salt/api" ]; then - touch /var/log/salt/api - chmod 640 /var/log/salt/api - fi - chown $RET:$RET /var/log/salt/api - fi - if command -v systemctl; then - db_get salt-api/active - RESLT=$(echo "$RET" | cut -d ' ' -f 1) - if [ "$RESLT" != 10 ]; then - systemctl daemon-reload - if [ "$RESLT" = "active" ]; then - systemctl restart salt-api - fi - db_get salt-api/enabled - RESLT=$(echo "$RET" | cut -d ' ' -f 1) - if [ "$RESLT" = "disabled" ]; then - systemctl disable salt-api - else - systemctl enable salt-api - fi - else - systemctl daemon-reload - systemctl restart salt-api - systemctl enable salt-api + . /usr/share/debconf/confmodule + if db_get salt-api/user; then + if [ "$RET" != "root" ]; then + if [ ! -e "/var/log/salt/api" ]; then + touch /var/log/salt/api + chmod 640 /var/log/salt/api fi + chown $RET:$RET /var/log/salt/api + fi fi ;; + abort-upgrade|abort-remove|abort-deconfigure) + ;; + + *) + echo "postinst called with unknown argument '$1'" >&2 + exit 1 + ;; esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 diff --git a/pkg/debian/salt-api.preinst b/pkg/debian/salt-api.preinst index c063108ea55e..24cd75a7168d 100644 --- a/pkg/debian/salt-api.preinst +++ b/pkg/debian/salt-api.preinst @@ -1,9 +1,24 @@ #!/bin/sh +# preinst script for salt-api. +# +# See: dh_installdeb(1). -. /usr/share/debconf/confmodule +set -e + +# Summary of how this script can be called: +# * 'install' +# * 'install' +# * 'upgrade' +# * 'abort-upgrade' +# for details, see https://www.debian.org/doc/debian-policy/ or +# the debian-policy package. case "$1" in + install) + ;; + upgrade) + . /usr/share/debconf/confmodule [ -z "$SALT_HOME" ] && SALT_HOME=/opt/saltstack/salt [ -z "$SALT_USER" ] && SALT_USER=salt [ -z "$SALT_NAME" ] && SALT_NAME="Salt" @@ -14,14 +29,20 @@ case "$1" in CUR_GROUP=$(ls -dl /run/salt-api.pid | cut -d ' ' -f 4) db_set salt-api/user $CUR_USER chown -R $CUR_USER:$CUR_GROUP /var/log/salt/api - if command -v systemctl; then - SM_ENABLED=$(systemctl show -p UnitFileState salt-api | cut -d '=' -f 2) - db_set salt-api/enabled $SM_ENABLED - SM_ACTIVE=$(systemctl is-active salt-api) - db_set salt-api/active $SM_ACTIVE - else - db_set salt-api/enabled enabled - db_set salt-api/active active - fi - ;; + ;; + + abort-upgrade) + ;; + + *) + echo "preinst called with unknown argument '$1'" >&2 + exit 1 + ;; esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 diff --git a/pkg/debian/salt-api.templates b/pkg/debian/salt-api.templates index 88e4b0823c71..e24e496b719a 100644 --- a/pkg/debian/salt-api.templates +++ b/pkg/debian/salt-api.templates @@ -3,15 +3,3 @@ Type: string Default: salt Description: User for salt-api User to run the salt-api process as - -Template: salt-api/enabled -Type: string -Default: enabled -Description: Systemd enable state for salt-api - default enable state for salt-api systemd state - -Template: salt-api/active -Type: string -Default: active -Description: Systemd active state for salt-api - default active state for salt-api systemd state diff --git a/pkg/debian/salt-cloud.postinst b/pkg/debian/salt-cloud.postinst index a6c3c2119a9b..9dab433d4991 100644 --- a/pkg/debian/salt-cloud.postinst +++ b/pkg/debian/salt-cloud.postinst @@ -1,13 +1,45 @@ #!/bin/sh +# postinst script for salt-cloud. +# +# See: dh_installdeb(1). -. /usr/share/debconf/confmodule +set -e + +# Summary of how this script can be called: +# * 'configure' +# * 'abort-upgrade' +# * 'abort-remove' 'in-favour' +# +# * 'abort-remove' +# * 'abort-deconfigure' 'in-favour' +# 'removing' +# +# for details, see https://www.debian.org/doc/debian-policy/ or +# the debian-policy package. case "$1" in configure) - db_get salt-master/user - if [ "$RET" != "root" ]; then - PY_VER=$(/opt/saltstack/salt/bin/python3 -c "import sys; sys.stdout.write('{}.{}'.format(*sys.version_info)); sys.stdout.flush;") - chown -R $RET:$RET /etc/salt/cloud.deploy.d /opt/saltstack/salt/lib/python${PY_VER}/site-packages/salt/cloud/deploy + . /usr/share/debconf/confmodule + if db_get salt-master/user + then + if [ "$RET" != "root" ]; then + PY_VER=$(/opt/saltstack/salt/bin/python3 -c "import sys; sys.stdout.write('{}.{}'.format(*sys.version_info)); sys.stdout.flush;") + chown -R $RET:$RET /etc/salt/cloud.deploy.d /opt/saltstack/salt/lib/python${PY_VER}/site-packages/salt/cloud/deploy + fi fi ;; + abort-upgrade|abort-remove|abort-deconfigure) + ;; + + *) + echo "postinst called with unknown argument '$1'" >&2 + exit 1 + ;; esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 diff --git a/pkg/debian/salt-common.postinst b/pkg/debian/salt-common.postinst index c5a8d969b450..723e8d0f7894 100644 --- a/pkg/debian/salt-common.postinst +++ b/pkg/debian/salt-common.postinst @@ -1,4 +1,40 @@ #!/bin/sh +# postinst script for salt-common. +# +# See: dh_installdeb(1). + set -e -/opt/saltstack/salt/bin/python3 -m compileall -qq /opt/saltstack/salt/lib +# Summary of how this script can be called: +# * 'configure' +# * 'abort-upgrade' +# * 'abort-remove' 'in-favour' +# +# * 'abort-remove' +# * 'abort-deconfigure' 'in-favour' +# 'removing' +# +# for details, see https://www.debian.org/doc/debian-policy/ or +# the debian-policy package. + + +case "$1" in + configure) + /opt/saltstack/salt/bin/python3 -m compileall -qq /opt/saltstack/salt/lib + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + ;; + + *) + echo "postinst called with unknown argument '$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 diff --git a/pkg/debian/salt-common.preinst b/pkg/debian/salt-common.preinst index 0e45d2399f68..a0faa698f6a1 100644 --- a/pkg/debian/salt-common.preinst +++ b/pkg/debian/salt-common.preinst @@ -1,3 +1,19 @@ +#!/bin/sh +# preinst script for salt-common. +# +# See: dh_installdeb(1). + +set -e + +# Summary of how this script can be called: +# * 'install' +# * 'install' +# * 'upgrade' +# * 'abort-upgrade' +# for details, see https://www.debian.org/doc/debian-policy/ or +# the debian-policy package. + + case "$1" in install|upgrade) [ -z "$SALT_HOME" ] && SALT_HOME=/opt/saltstack/salt @@ -36,4 +52,19 @@ case "$1" in test -d /etc/logrotate.d/salt && rm -r /etc/logrotate.d/salt || /bin/true ;; + + abort-upgrade) + ;; + + *) + echo "preinst called with unknown argument '$1'" >&2 + exit 1 + ;; esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 diff --git a/pkg/debian/salt-common.prerm b/pkg/debian/salt-common.prerm index 236c2bd3d12d..47603f5a7ea9 100644 --- a/pkg/debian/salt-common.prerm +++ b/pkg/debian/salt-common.prerm @@ -1,5 +1,40 @@ #!/bin/sh +# prerm script for salt-common. +# +# See: dh_installdeb(1). + set -e -dpkg -L salt-common | perl -ne 's,/([^/]*)\.py$,/__pycache__/\1.*, or next; unlink $_ or die $! foreach glob($_)' -find /opt/saltstack/salt -type d -name __pycache__ -empty -print0 | xargs --null --no-run-if-empty rmdir +# Summary of how this script can be called: +# * 'remove' +# * 'upgrade' +# * 'failed-upgrade' +# * 'remove' 'in-favour' +# * 'deconfigure' 'in-favour' +# 'removing' +# +# for details, see https://www.debian.org/doc/debian-policy/ or +# the debian-policy package. + + +case "$1" in + remove|upgrade|deconfigure) + dpkg -L salt-common | perl -ne 's,/([^/]*)\.py$,/__pycache__/\1.*, or next; unlink $_ or die $! foreach glob($_)' + find /opt/saltstack/salt -type d -name __pycache__ -empty -print0 | xargs --null --no-run-if-empty rmdir + ;; + + failed-upgrade) + ;; + + *) + echo "prerm called with unknown argument '$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 diff --git a/pkg/debian/salt-master.postinst b/pkg/debian/salt-master.postinst index be7064f9bad2..ab12587e88e9 100644 --- a/pkg/debian/salt-master.postinst +++ b/pkg/debian/salt-master.postinst @@ -1,41 +1,52 @@ #!/bin/sh +# postinst script for salt-master. +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `configure' +# * `abort-upgrade' +# * `abort-remove' `in-favour' +# +# * `abort-remove' +# * `abort-deconfigure' `in-favour' +# `removing' +# +# for details, see https://www.debian.org/doc/debian-policy/ or +# the debian-policy package -. /usr/share/debconf/confmodule case "$1" in configure) - db_get salt-master/user - if [ "$RET" != "root" ]; then - if [ ! -e "/var/log/salt/master" ]; then - touch /var/log/salt/master - chmod 640 /var/log/salt/master - fi - if [ ! -e "/var/log/salt/key" ]; then - touch /var/log/salt/key - chmod 640 /var/log/salt/key - fi - chown -R $RET:$RET /etc/salt/pki/master /etc/salt/master.d /var/log/salt/master /var/log/salt/key /var/cache/salt/master /var/run/salt/master - fi - if command -v systemctl; then - db_get salt-master/active - RESLT=$(echo "$RET" | cut -d ' ' -f 1) - if [ "$RESLT" != 10 ]; then - systemctl daemon-reload - if [ "$RESLT" = "active" ]; then - systemctl restart salt-master - fi - db_get salt-master/enabled - RESLT=$(echo "$RET" | cut -d ' ' -f 1) - if [ "$RESLT" = "disabled" ]; then - systemctl disable salt-master - else - systemctl enable salt-master - fi - else - systemctl daemon-reload - systemctl restart salt-master - systemctl enable salt-master + . /usr/share/debconf/confmodule + if db_get salt-master/user; then + if [ "$RET" != "root" ]; then + if [ ! -e "/var/log/salt/master" ]; then + touch /var/log/salt/master + chmod 640 /var/log/salt/master + fi + if [ ! -e "/var/log/salt/key" ]; then + touch /var/log/salt/key + chmod 640 /var/log/salt/key fi + chown -R $RET:$RET /etc/salt/pki/master /etc/salt/master.d /var/log/salt/master /var/log/salt/key /var/cache/salt/master /var/run/salt/master + fi fi ;; + abort-upgrade|abort-remove|abort-deconfigure) + ;; + + *) + echo "postinst called with unknown argument '$1'" >&2 + exit 1 + ;; esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 diff --git a/pkg/debian/salt-master.preinst b/pkg/debian/salt-master.preinst index a96f9dd67678..2fc9acbd1112 100644 --- a/pkg/debian/salt-master.preinst +++ b/pkg/debian/salt-master.preinst @@ -1,6 +1,18 @@ #!/bin/sh +# preinst script for salt-master. +# +# See: dh_installdeb(1). + +set -e + +# Summary of how this script can be called: +# * 'install' +# * 'install' +# * 'upgrade' +# * 'abort-upgrade' +# for details, see https://www.debian.org/doc/debian-policy/ or +# the debian-policy package. -. /usr/share/debconf/confmodule case "$1" in install) @@ -11,7 +23,12 @@ case "$1" in PY_VER=$(/opt/saltstack/salt/bin/python3 -c "import sys; sys.stdout.write('{}.{}'.format(*sys.version_info)); sys.stdout.flush();") # Reset permissions to fix previous installs - find ${SALT_HOME} /etc/salt /var/log/salt /var/cache/salt /var/run/salt \ + SALT_DIRS="" + for salt_dir in ${SALT_HOME} /etc/salt /var/log/salt /var/cache/salt /var/run/salt + do + [ -d "${salt_dir}" ] && SALT_DIRS="${SALT_DIRS:+${SALT_DIRS} }${salt_dir}" + done + find ${SALT_DIRS} \ \! \( -path /etc/salt/cloud.deploy.d\* -o -path /var/log/salt/cloud -o -path \ /opt/saltstack/salt/lib/python${PY_VER}/site-packages/salt/cloud/deploy\* \) -a \( -user ${SALT_USER} \ -o -group ${SALT_GROUP} \) -exec chown ${SALT_USER}:${SALT_GROUP} \{\} \; @@ -19,29 +36,30 @@ case "$1" in ;; upgrade) - [ -z "$SALT_HOME" ] && SALT_HOME=/opt/saltstack/salt - [ -z "$SALT_USER" ] && SALT_USER=salt - [ -z "$SALT_NAME" ] && SALT_NAME="Salt" - [ -z "$SALT_GROUP" ] && SALT_GROUP=salt - PY_VER=$(/opt/saltstack/salt/bin/python3 -c "import sys; sys.stdout.write('{}.{}'.format(*sys.version_info)); sys.stdout.flush();") - - # Reset permissions to fix previous installs + . /usr/share/debconf/confmodule CUR_USER=$(ls -dl /run/salt/master | cut -d ' ' -f 3) CUR_GROUP=$(ls -dl /run/salt/master | cut -d ' ' -f 4) db_set salt-master/user $CUR_USER chown -R $CUR_USER:$CUR_GROUP /etc/salt/pki/master /etc/salt/master.d /var/log/salt/master \ /var/log/salt/key /var/cache/salt/master /var/run/salt/master - if command -v systemctl; then - SM_ENABLED=$(systemctl show -p UnitFileState salt-master | cut -d '=' -f 2) - db_set salt-master/enabled $SM_ENABLED - SM_ACTIVE=$(systemctl is-active salt-master) - db_set salt-master/active $SM_ACTIVE - else - db_set salt-master/enabled enabled - db_set salt-master/active active - fi - ;; + + ;; + + abort-upgrade) + ;; + + *) + echo "preinst called with unknown argument '$1'" >&2 + exit 1 + ;; esac # remove incorrectly installed ufw salt-master directory - issue 57712 test -d /etc/ufw/applications.d/salt-master && rm -rf /etc/ufw/applications.d/salt-master || /bin/true + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 diff --git a/pkg/debian/salt-master.templates b/pkg/debian/salt-master.templates index c0ea8cfd69be..70a1141e33b1 100644 --- a/pkg/debian/salt-master.templates +++ b/pkg/debian/salt-master.templates @@ -3,15 +3,3 @@ Type: string Default: salt Description: User for salt-master User to run the salt-master process as - -Template: salt-master/enabled -Type: string -Default: enabled -Description: Systemd enable state for salt-master - default enable state for salt-master systemd state - -Template: salt-master/active -Type: string -Default: active -Description: Systemd active state for salt-master - default active state for salt-master systemd state diff --git a/pkg/debian/salt-minion.postinst b/pkg/debian/salt-minion.postinst index 13d1cf509016..ad506e367a3f 100644 --- a/pkg/debian/salt-minion.postinst +++ b/pkg/debian/salt-minion.postinst @@ -1,41 +1,54 @@ #!/bin/sh +# postinst script for salt-minion. +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `configure' +# * `abort-upgrade' +# * `abort-remove' `in-favour' +# +# * `abort-remove' +# * `abort-deconfigure' `in-favour' +# `removing' +# +# for details, see https://www.debian.org/doc/debian-policy/ or +# the debian-policy package -. /usr/share/debconf/confmodule case "$1" in configure) - db_get salt-minion/user - if [ "$RET" != "root" ]; then - if [ ! -e "/var/log/salt/minion" ]; then - touch /var/log/salt/minion - chmod 640 /var/log/salt/minion - fi - if [ ! -e "/var/log/salt/key" ]; then - touch /var/log/salt/key - chmod 640 /var/log/salt/key - fi - chown -R $RET:$RET /etc/salt/pki/minion /etc/salt/minion.d /var/log/salt/minion /var/cache/salt/minion /var/run/salt/minion - fi - if command -v systemctl; then - db_get salt-minion/active - RESLT=$(echo "$RET" | cut -d ' ' -f 1) - if [ "$RESLT" != 10 ]; then - systemctl daemon-reload - if [ "$RESLT" = "active" ]; then - systemctl restart salt-minion - fi - db_get salt-minion/enabled - RESLT=$(echo "$RET" | cut -d ' ' -f 1) - if [ "$RESLT" = "disabled" ]; then - systemctl disable salt-minion - else - systemctl enable salt-minion - fi - else - systemctl daemon-reload - systemctl restart salt-minion - systemctl enable salt-minion + . /usr/share/debconf/confmodule + if db_get salt-minion/user + then + if [ "$RET" != "root" ]; then + if [ ! -e "/var/log/salt/minion" ]; then + touch /var/log/salt/minion + chmod 640 /var/log/salt/minion + fi + if [ ! -e "/var/log/salt/key" ]; then + touch /var/log/salt/key + chmod 640 /var/log/salt/key fi + chown -R $RET:$RET /etc/salt/pki/minion /etc/salt/minion.d /var/log/salt/minion /var/cache/salt/minion /var/run/salt/minion + fi fi ;; + + abort-upgrade|abort-remove|abort-deconfigure) + ;; + + *) + echo "postinst called with unknown argument '$1'" >&2 + exit 1 + ;; esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 diff --git a/pkg/debian/salt-minion.preinst b/pkg/debian/salt-minion.preinst index 51be48e0677f..4773cd38b769 100644 --- a/pkg/debian/salt-minion.preinst +++ b/pkg/debian/salt-minion.preinst @@ -1,9 +1,25 @@ #!/bin/sh +# preinst script for salt-minion. +# +# See: dh_installdeb(1). + +set -e + +# Summary of how this script can be called: +# * 'install' +# * 'install' +# * 'upgrade' +# * 'abort-upgrade' +# for details, see https://www.debian.org/doc/debian-policy/ or +# the debian-policy package. -. /usr/share/debconf/confmodule case "$1" in + install) + ;; + upgrade) + . /usr/share/debconf/confmodule [ -z "$SALT_HOME" ] && SALT_HOME=/opt/saltstack/salt [ -z "$SALT_USER" ] && SALT_USER=salt [ -z "$SALT_NAME" ] && SALT_NAME="Salt" @@ -16,14 +32,20 @@ case "$1" in db_set salt-minion/user $CUR_USER chown -R $CUR_USER:$CUR_GROUP /etc/salt/pki/minion /etc/salt/minion.d /var/log/salt/minion \ /var/cache/salt/minion /var/run/salt/minion - if command -v systemctl; then - SM_ENABLED=$(systemctl show -p UnitFileState salt-minion | cut -d '=' -f 2) - db_set salt-minion/enabled $SM_ENABLED - SM_ACTIVE=$(systemctl is-active salt-minion) - db_set salt-minion/active $SM_ACTIVE - else - db_set salt-minion/enabled enabled - db_set salt-minion/active active - fi - ;; + ;; + + abort-upgrade) + ;; + + *) + echo "preinst called with unknown argument '$1'" >&2 + exit 1 + ;; esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 diff --git a/pkg/debian/salt-minion.templates b/pkg/debian/salt-minion.templates index 583e027d5d7c..d08bb06da1d9 100644 --- a/pkg/debian/salt-minion.templates +++ b/pkg/debian/salt-minion.templates @@ -3,15 +3,3 @@ Type: string Default: root Description: User for salt-minion User to run the salt-minion process as - -Template: salt-minion/enabled -Type: string -Default: enabled -Description: Systemd enable state for salt-minion - default enable state for salt-minion systemd state - -Template: salt-minion/active -Type: string -Default: active -Description: Systemd active state for salt-minion - default active state for salt-minion systemd state diff --git a/pkg/debian/salt-syndic.postinst b/pkg/debian/salt-syndic.postinst index 071ba38e1859..61412ea077ae 100644 --- a/pkg/debian/salt-syndic.postinst +++ b/pkg/debian/salt-syndic.postinst @@ -1,37 +1,49 @@ #!/bin/sh +# postinst script for salt-syndic. +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `configure' +# * `abort-upgrade' +# * `abort-remove' `in-favour' +# +# * `abort-remove' +# * `abort-deconfigure' `in-favour' +# `removing' +# +# for details, see https://www.debian.org/doc/debian-policy/ or +# the debian-policy package -. /usr/share/debconf/confmodule case "$1" in configure) - db_get salt-syndic/user - if [ "$RET" != "root" ]; then - if [ ! -e "/var/log/salt/syndic" ]; then - touch /var/log/salt/syndic - chmod 640 /var/log/salt/syndic - fi - chown $RET:$RET /var/log/salt/syndic - fi - if command -v systemctl; then - db_get salt-syndic/active - RESLT=$(echo "$RET" | cut -d ' ' -f 1) - if [ "$RESLT" != 10 ]; then - systemctl daemon-reload - if [ "$RESLT" = "active" ]; then - systemctl restart salt-syndic - fi - db_get salt-syndic/enabled - RESLT=$(echo "$RET" | cut -d ' ' -f 1) - if [ "$RESLT" = "disabled" ]; then - systemctl disable salt-syndic - else - systemctl enable salt-syndic - fi - else - systemctl daemon-reload - systemctl restart salt-syndic - systemctl enable salt-syndic + . /usr/share/debconf/confmodule + if db_get salt-syndic/user; then + if [ "$RET" != "root" ]; then + if [ ! -e "/var/log/salt/syndic" ]; then + touch /var/log/salt/syndic + chmod 640 /var/log/salt/syndic fi + chown $RET:$RET /var/log/salt/syndic + fi fi ;; + + abort-upgrade|abort-remove|abort-deconfigure) + ;; + + *) + echo "postinst called with unknown argument '$1'" >&2 + exit 1 + ;; esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 diff --git a/pkg/debian/salt-syndic.preinst b/pkg/debian/salt-syndic.preinst index da43d779163c..82129f2af09a 100644 --- a/pkg/debian/salt-syndic.preinst +++ b/pkg/debian/salt-syndic.preinst @@ -1,9 +1,25 @@ #!/bin/sh +# preinst script for salt-syndic. +# +# See: dh_installdeb(1). + +set -e + +# Summary of how this script can be called: +# * 'install' +# * 'install' +# * 'upgrade' +# * 'abort-upgrade' +# for details, see https://www.debian.org/doc/debian-policy/ or +# the debian-policy package. -. /usr/share/debconf/confmodule case "$1" in + install) + ;; + upgrade) + . /usr/share/debconf/confmodule [ -z "$SALT_HOME" ] && SALT_HOME=/opt/saltstack/salt [ -z "$SALT_USER" ] && SALT_USER=salt [ -z "$SALT_NAME" ] && SALT_NAME="Salt" @@ -14,14 +30,20 @@ case "$1" in CUR_GROUP=$(ls -dl /run/salt-syndic.pid | cut -d ' ' -f 4) db_set salt-syndic/user $CUR_USER chown -R $CUR_USER:$CUR_GROUP /var/log/salt/syndic - if command -v systemctl; then - SM_ENABLED=$(systemctl show -p UnitFileState salt-syndic | cut -d '=' -f 2) - db_set salt-syndic/enabled $SM_ENABLED - SM_ACTIVE=$(systemctl is-active salt-syndic) - db_set salt-syndic/active $SM_ACTIVE - else - db_set salt-syndic/enabled enabled - db_set salt-syndic/active active - fi - ;; + ;; + + abort-upgrade) + ;; + + *) + echo "preinst called with unknown argument '$1'" >&2 + exit 1 + ;; esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 diff --git a/pkg/debian/salt-syndic.templates b/pkg/debian/salt-syndic.templates index c27859e0a24f..64edb70385f6 100644 --- a/pkg/debian/salt-syndic.templates +++ b/pkg/debian/salt-syndic.templates @@ -3,15 +3,3 @@ Type: string Default: salt Description: User for salt-syndic User to run the salt-syndic process as - -Template: salt-syndic/enabled -Type: string -Default: enabled -Description: Systemd enable state for salt-syndic - default enable state for salt-syndic systemd state - -Template: salt-syndic/active -Type: string -Default: active -Description: Systemd active state for salt-syndic - default active state for salt-syndic systemd state