Restore systemd handling in preinst and postinst for Debina/Ubuntu

This commit is contained in:
David Murphy 2024-09-04 14:05:27 -06:00 committed by Daniel Wozniak
parent 974bad0054
commit 142b7ac258
5 changed files with 81 additions and 83 deletions

View file

@ -12,26 +12,26 @@ case "$1" in
fi
chown $RET:$RET /var/log/salt/api
fi
## DGM if command -v systemctl; then
## DGM db_get salt-api/active
## DGM RESLT=$(echo "$RET" | cut -d ' ' -f 1)
## DGM if [ "$RESLT" != 10 ]; then
## DGM systemctl daemon-reload
## DGM if [ "$RESLT" = "active" ]; then
## DGM systemctl restart salt-api
## DGM fi
## DGM db_get salt-api/enabled
## DGM RESLT=$(echo "$RET" | cut -d ' ' -f 1)
## DGM if [ "$RESLT" = "disabled" ]; then
## DGM systemctl disable salt-api
## DGM else
## DGM systemctl enable salt-api
## DGM fi
## DGM else
## DGM systemctl daemon-reload
## DGM systemctl restart salt-api
## DGM systemctl enable salt-api
## DGM fi
## DGM 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
fi
fi
;;
esac

View file

@ -16,26 +16,26 @@ case "$1" in
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
## DGM if command -v systemctl; then
## DGM db_get salt-master/active
## DGM RESLT=$(echo "$RET" | cut -d ' ' -f 1)
## DGM if [ "$RESLT" != 10 ]; then
## DGM systemctl daemon-reload
## DGM if [ "$RESLT" = "active" ]; then
## DGM systemctl restart salt-master
## DGM fi
## DGM db_get salt-master/enabled
## DGM RESLT=$(echo "$RET" | cut -d ' ' -f 1)
## DGM if [ "$RESLT" = "disabled" ]; then
## DGM systemctl disable salt-master
## DGM else
## DGM systemctl enable salt-master
## DGM fi
## DGM else
## DGM systemctl daemon-reload
## DGM systemctl restart salt-master
## DGM systemctl enable salt-master
## DGM fi
## DGM 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
fi
fi
;;
esac

View file

@ -31,16 +31,15 @@ case "$1" in
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
## DGM if command -v systemctl; then
## DGM SM_ENABLED=$(systemctl show -p UnitFileState salt-master | cut -d '=' -f 2)
## DGM db_set salt-master/enabled $SM_ENABLED
## DGM SM_ACTIVE=$(systemctl is-active salt-master)
## DGM db_set salt-master/active $SM_ACTIVE
## DGM else
## DGM db_set salt-master/enabled enabled
## DGM db_set salt-master/active active
## DGM fi
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
;;
esac

View file

@ -16,26 +16,26 @@ case "$1" in
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
## DGM if command -v systemctl; then
## DGM db_get salt-minion/active
## DGM RESLT=$(echo "$RET" | cut -d ' ' -f 1)
## DGM if [ "$RESLT" != 10 ]; then
## DGM systemctl daemon-reload
## DGM if [ "$RESLT" = "active" ]; then
## DGM systemctl restart salt-minion
## DGM fi
## DGM db_get salt-minion/enabled
## DGM RESLT=$(echo "$RET" | cut -d ' ' -f 1)
## DGM if [ "$RESLT" = "disabled" ]; then
## DGM systemctl disable salt-minion
## DGM else
## DGM systemctl enable salt-minion
## DGM fi
## DGM else
## DGM systemctl daemon-reload
## DGM systemctl restart salt-minion
## DGM systemctl enable salt-minion
## DGM fi
## DGM 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
fi
fi
;;
esac

View file

@ -16,15 +16,14 @@ 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
## DGM if command -v systemctl; then
## DGM SM_ENABLED=$(systemctl show -p UnitFileState salt-minion | cut -d '=' -f 2)
## DGM db_set salt-minion/enabled $SM_ENABLED
## DGM SM_ACTIVE=$(systemctl is-active salt-minion)
## DGM db_set salt-minion/active $SM_ACTIVE
## DGM else
## DGM db_set salt-minion/enabled enabled
## DGM db_set salt-minion/active active
## DGM fi
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
;;
esac