|
1 | 1 | #!/bin/sh |
| 2 | +# postinst script for salt-api |
| 3 | +# |
| 4 | +# See: dh_installdeb(1). |
2 | 5 |
|
3 | | -. /usr/share/debconf/confmodule |
| 6 | +set -e |
| 7 | + |
| 8 | +# Summary of how this script can be called: |
| 9 | +# * <postinst> 'configure' <most-recently-configured-version> |
| 10 | +# * <old-postinst> 'abort-upgrade' <new version> |
| 11 | +# * <conflictor's-postinst> 'abort-remove' 'in-favour' <package> |
| 12 | +# <new-version> |
| 13 | +# * <postinst> 'abort-remove' |
| 14 | +# * <deconfigured's-postinst> 'abort-deconfigure' 'in-favour' |
| 15 | +# <failed-install-package> <version> 'removing' |
| 16 | +# <conflicting-package> <version> |
| 17 | +# for details, see https://www.debian.org/doc/debian-policy/ or |
| 18 | +# the debian-policy package. |
4 | 19 |
|
5 | 20 | case "$1" in |
6 | 21 | configure) |
7 | | - db_get salt-api/user |
8 | | - if [ "$RET" != "root" ]; then |
9 | | - if [ ! -e "/var/log/salt/api" ]; then |
10 | | - touch /var/log/salt/api |
11 | | - chmod 640 /var/log/salt/api |
12 | | - fi |
13 | | - chown $RET:$RET /var/log/salt/api |
14 | | - fi |
15 | | - if command -v systemctl; then |
16 | | - db_get salt-api/active |
17 | | - RESLT=$(echo "$RET" | cut -d ' ' -f 1) |
18 | | - if [ "$RESLT" != 10 ]; then |
19 | | - systemctl daemon-reload |
20 | | - if [ "$RESLT" = "active" ]; then |
21 | | - systemctl restart salt-api |
22 | | - fi |
23 | | - db_get salt-api/enabled |
24 | | - RESLT=$(echo "$RET" | cut -d ' ' -f 1) |
25 | | - if [ "$RESLT" = "disabled" ]; then |
26 | | - systemctl disable salt-api |
27 | | - else |
28 | | - systemctl enable salt-api |
29 | | - fi |
30 | | - else |
31 | | - systemctl daemon-reload |
32 | | - systemctl restart salt-api |
33 | | - systemctl enable salt-api |
| 22 | + . /usr/share/debconf/confmodule |
| 23 | + if db_get salt-api/user; then |
| 24 | + if [ "$RET" != "root" ]; then |
| 25 | + if [ ! -e "/var/log/salt/api" ]; then |
| 26 | + touch /var/log/salt/api |
| 27 | + chmod 640 /var/log/salt/api |
34 | 28 | fi |
| 29 | + chown $RET:$RET /var/log/salt/api |
| 30 | + fi |
35 | 31 | fi |
36 | 32 | ;; |
| 33 | + abort-upgrade|abort-remove|abort-deconfigure) |
| 34 | + ;; |
| 35 | + |
| 36 | + *) |
| 37 | + echo "postinst called with unknown argument '$1'" >&2 |
| 38 | + exit 1 |
| 39 | + ;; |
37 | 40 | esac |
| 41 | + |
| 42 | +# dh_installdeb will replace this with shell code automatically |
| 43 | +# generated by other debhelper scripts. |
| 44 | + |
| 45 | +#DEBHELPER# |
| 46 | + |
| 47 | +exit 0 |
0 commit comments