Skip to content

Commit

Permalink
Restore systemd handling in preinst and postinst for Debina/Ubuntu
Browse files Browse the repository at this point in the history
  • Loading branch information
dmurphy18 committed Sep 4, 2024
1 parent 9f0a2f1 commit d1c3902
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 93 deletions.
42 changes: 21 additions & 21 deletions pkg/debian/salt-api.postinst
Original file line number Diff line number Diff line change
Expand Up @@ -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
19 changes: 9 additions & 10 deletions pkg/debian/salt-api.preinst
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,14 @@ 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
## DGM if command -v systemctl; then
## DGM SM_ENABLED=$(systemctl show -p UnitFileState salt-api | cut -d '=' -f 2)
## DGM db_set salt-api/enabled $SM_ENABLED
## DGM SM_ACTIVE=$(systemctl is-active salt-api)
## DGM db_set salt-api/active $SM_ACTIVE
## DGM else
## DGM db_set salt-api/enabled enabled
## DGM db_set salt-api/active active

## DGM fi
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
;;
esac
42 changes: 21 additions & 21 deletions pkg/debian/salt-master.postinst
Original file line number Diff line number Diff line change
Expand Up @@ -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
19 changes: 9 additions & 10 deletions pkg/debian/salt-master.preinst
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
42 changes: 21 additions & 21 deletions pkg/debian/salt-minion.postinst
Original file line number Diff line number Diff line change
Expand Up @@ -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
19 changes: 9 additions & 10 deletions pkg/debian/salt-minion.preinst
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit d1c3902

Please sign in to comment.