Skip to content

Commit

Permalink
Merge pull request #44 from lbr38/devel
Browse files Browse the repository at this point in the history
2.2.8
  • Loading branch information
lbr38 authored Jun 19, 2023
2 parents b482476 + 8932ee6 commit 98d5df4
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ jobs:
with:
tag_name: ${{ env.VERSION }}
release_name: ${{ env.VERSION }}
body: ""
body: "Fixed services restart after update"
draft: false
prerelease: false

Expand Down
23 changes: 14 additions & 9 deletions functions/02_check-packages-before-update
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function checkPackagesBeforeUpdate

# Then unhold them all
if [ ! -z "$HOLDED_PACKAGES" ];then
OLD_IFS="$IFS"
OLD_IFS=$IFS
IFS=$'\n'

for HOLDED_PACKAGE in $(echo "$HOLDED_PACKAGES");do
Expand Down Expand Up @@ -99,7 +99,7 @@ function checkPackagesBeforeUpdate
if egrep -q "^${PACKAGE} " $CHECK_UPDATE_TMP;then

# Save the actual IFS (comma) because it will be needed again by the previous FOR loop
old_IFS=$IFS
OLD_IFS=$IFS
IFS=$'\n'

# For every occurence of the package found in $CHECK_UPDATE_TMP (there could be more than one),
Expand Down Expand Up @@ -162,7 +162,7 @@ function checkPackagesBeforeUpdate
done

# Set back the prviously saved IFS (comma) for the previous FOR loop to work
IFS=$old_IFS
IFS=$OLD_IFS

# Cas no update is available for this package
else
Expand Down Expand Up @@ -190,7 +190,7 @@ function checkPackagesBeforeUpdate
if egrep -q "^${PACKAGE} " $CHECK_UPDATE_TMP;then

# Save the actual IFS (comma) because it will be needed again by the previous FOR loop
old_IFS=$IFS
OLD_IFS=$IFS
IFS=$'\n'

# For every occurence of the package found in $CHECK_UPDATE_TMP (there could be more than one),
Expand All @@ -200,7 +200,7 @@ function checkPackagesBeforeUpdate
done

# Set back the prviously saved IFS (comma) for the previous FOR loop to work
IFS=$old_IFS
IFS=$OLD_IFS
fi
done
fi
Expand All @@ -215,19 +215,24 @@ function checkPackagesBeforeUpdate

# Process services that will need a restart after packages update
if [ ! -z "$CONF_SOFT_NEED_RESTART" ];then
OLD_IFS=$IFS
IFS=','

# Run through CONF_SOFT_NEED_RESTART
for SERVICE in "${CONF_SOFT_NEED_RESTART[@]}"; do

# Inject services list into SERVICES_TO_RESTART
read -ra SERVICES_TO_RESTART <<< "$CONF_SOFT_NEED_RESTART"

# Run through SERVICES_TO_RESTART
for SERVICE in "${SERVICES_TO_RESTART[@]}"; do
# Check if specified service really exists, if yes then add it to the final services to restart list
if ! systemctl list-unit-files "${SERVICE}.service" | grep -q "0 unit files";then
if systemctl list-units --all -t service --full | grep "${SERVICE}.service";then
SERVICE_TO_BE_RESTARTED+=" $SERVICE"
fi
done

SERVICE_TO_BE_RESTARTED="${SERVICE_TO_BE_RESTARTED} "
SERVICE_TO_BE_RESTARTED="${SERVICE_TO_BE_RESTARTED/ /}"

IFS=$OLD_IFS
fi

echo ""
Expand Down
6 changes: 3 additions & 3 deletions functions/09_service-restart
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ function restartService
{
# Si $SERVICE_TO_BE_RESTARTED contient des services nécessitant un redémarrage, on traite
if [ ! -z "$SERVICE_TO_BE_RESTARTED" ];then
OLD_IFS="$IFS"
IFS=','
OLD_IFS=$IFS
IFS=' '

for SERVICE in $SERVICE_TO_BE_RESTARTED; do
for SERVICE in $(echo "$SERVICE_TO_BE_RESTARTED"); do
SERVICE=$(echo "$SERVICE" | sed 's/ //g')
echo -ne "→ Restarting ${YELLOW}${SERVICE}${RESET} service: "
systemctl restart "$SERVICE" --quiet
Expand Down
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.2.7
2.2.8

0 comments on commit 98d5df4

Please sign in to comment.