Distinguish between oneshot and simple services
This commit is contained in:
parent
1716c73a53
commit
489adc762e
12
install.sh
12
install.sh
|
@ -376,7 +376,7 @@ updateMirrors() {
|
||||||
countriesFmt=$(echo "$countries" | sed -r 's/" "/,/g')
|
countriesFmt=$(echo "$countries" | sed -r 's/" "/,/g')
|
||||||
reflector --country \"${countriesFmt//\"/}\" --protocol https --sort rate --save /etc/pacman.d/mirrorlist 2>&1 | debug
|
reflector --country \"${countriesFmt//\"/}\" --protocol https --sort rate --save /etc/pacman.d/mirrorlist 2>&1 | debug
|
||||||
else
|
else
|
||||||
checkForSystemdUnit "mirrors update" "reflector.service"
|
checkForSystemdUnit "mirrors update" "reflector.service" "oneshot"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -454,15 +454,21 @@ getDotfiles() {
|
||||||
|
|
||||||
checkForSystemdUnit() {
|
checkForSystemdUnit() {
|
||||||
trap 'systemctl stop ${2}; forceExit=true' INT
|
trap 'systemctl stop ${2}; forceExit=true' INT
|
||||||
systemctl is-active --quiet ${2}
|
|
||||||
[ $? -eq 0 ] && return
|
|
||||||
forceExit=false
|
forceExit=false
|
||||||
calcWidthAndRun "whiptail --infobox \"Waiting for the ${1} to finish. Please wait.\" 7 WIDTH"
|
calcWidthAndRun "whiptail --infobox \"Waiting for the ${1} to finish. Please wait.\" 7 WIDTH"
|
||||||
|
if [ "${3}" = "oneshot" ]; then
|
||||||
systemctl is-active --quiet ${2}
|
systemctl is-active --quiet ${2}
|
||||||
while [ $? -ne 0 ] && [ $forceExit = false ]; do
|
while [ $? -ne 0 ] && [ $forceExit = false ]; do
|
||||||
sleep 1
|
sleep 1
|
||||||
systemctl is-active --quiet ${2}
|
systemctl is-active --quiet ${2}
|
||||||
done
|
done
|
||||||
|
else
|
||||||
|
while [ $forceExit = false ]; do
|
||||||
|
result=$(systemctl show -p ActiveState --value ${2})
|
||||||
|
[ "$result" = "activating" ] && break
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
fi
|
||||||
trap - INT
|
trap - INT
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue