diff --git a/pkg/debian/salt-api.postinst b/pkg/debian/salt-api.postinst index 9345d72bf2aa..f170f580939c 100644 --- a/pkg/debian/salt-api.postinst +++ b/pkg/debian/salt-api.postinst @@ -1,3 +1,23 @@ +#!/bin/sh +# postinst script for salt-api +# +# 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. + + case "$1" in configure) if [ ! -e "/var/log/salt/api" ]; then @@ -5,6 +25,19 @@ case "$1" in chmod 640 /var/log/salt/api fi chown salt:salt /var/log/salt/api - if command -v systemctl; then systemctl enable salt-api; 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-cloud.postinst b/pkg/debian/salt-cloud.postinst index a92551161da0..693e5c6a0e98 100644 --- a/pkg/debian/salt-cloud.postinst +++ b/pkg/debian/salt-cloud.postinst @@ -1,6 +1,40 @@ +#!/bin/sh +# postinst script for salt-cloud. +# +# 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. + + case "$1" in configure) PY_VER=$(/opt/saltstack/salt/bin/python3 -c "import sys; sys.stdout.write('{}.{}'.format(*sys.version_info)); sys.stdout.flush;") chown -R salt:salt /etc/salt/cloud.deploy.d /opt/saltstack/salt/lib/python${PY_VER}/site-packages/salt/cloud/deploy ;; + 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 4f7686d8ed9c..92238080397d 100644 --- a/pkg/debian/salt-master.postinst +++ b/pkg/debian/salt-master.postinst @@ -1,3 +1,22 @@ +#!/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 + case "$1" in configure) if [ ! -e "/var/log/salt/master" ]; then @@ -9,6 +28,19 @@ case "$1" in chmod 640 /var/log/salt/key fi chown -R salt:salt /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 systemctl enable salt-master; 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 f205423079c0..d02305156549 100644 --- a/pkg/debian/salt-master.preinst +++ b/pkg/debian/salt-master.preinst @@ -1,3 +1,19 @@ +#!/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. + + case "$1" in install|upgrade) [ -z "$SALT_HOME" ] && SALT_HOME=/opt/saltstack/salt @@ -15,4 +31,19 @@ case "$1" in test -d /etc/ufw/applications.d/salt-master && rm -rf /etc/ufw/applications.d/salt-master || /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