Skip to content

Commit

Permalink
Make the reboot countdown after a kernel upgrade showing remaining se…
Browse files Browse the repository at this point in the history
…conds in real time (#169)

* Make the reboot countdown after a kernel upgrade showing remaining seconds in real time

This commit makes the 5 seconds countdow before a reboot to apply a pending kernel update show the remaining seconds in real time.
  • Loading branch information
Antiz96 authored May 19, 2024
1 parent 8a850eb commit ecc196e
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 17 deletions.
14 changes: 7 additions & 7 deletions po/arch-update.pot
Original file line number Diff line number Diff line change
Expand Up @@ -423,38 +423,38 @@ msgstr ""
msgid "Would you like to reboot now? [y/N]"
msgstr ""

#: src/script/arch-update.sh:609
#: src/script/arch-update.sh:616
#, sh-format
msgid "Rebooting in 5 seconds...\\nPress ctrl+c to abort"
msgid "Rebooting in ${sec}...\\r"
msgstr ""

#: src/script/arch-update.sh:613
#: src/script/arch-update.sh:622
#, sh-format
msgid ""
"An error has occurred during the reboot process\\nThe reboot has been "
"aborted\\n"
msgstr ""

#: src/script/arch-update.sh:621
#: src/script/arch-update.sh:630
#, sh-format
msgid ""
"The reboot hasn't been performed\\nPlease, consider rebooting to finalize "
"the pending kernel update\\n"
msgstr ""

#: src/script/arch-update.sh:625
#: src/script/arch-update.sh:634
#, sh-format
msgid "No pending kernel update found\\n"
msgstr ""

#: src/script/arch-update.sh:673
#: src/script/arch-update.sh:682
#, sh-format
msgid ""
"The '${config_file}' configuration file already exists\\nPlease, remove it "
"before generating a new one"
msgstr ""

#: src/script/arch-update.sh:678
#: src/script/arch-update.sh:687
#, sh-format
msgid "The '${config_file}' configuration file has been generated"
msgstr ""
Expand Down
16 changes: 8 additions & 8 deletions po/fr.po
Original file line number Diff line number Diff line change
Expand Up @@ -452,12 +452,12 @@ msgstr ""
msgid "Would you like to reboot now? [y/N]"
msgstr "Voulez-vous redémarrer votre système maintenant ? [o/N]"

#: src/script/arch-update.sh:609
#: src/script/arch-update.sh:616
#, sh-format
msgid "Rebooting in 5 seconds...\\nPress ctrl+c to abort"
msgstr "Redémarrage dans 5 secondes...\\nAppuyez sur ctrl+c pour annuler"
msgid "Rebooting in ${sec}...\\r"
msgstr "Redémarrage dans ${sec}...\\r"

#: src/script/arch-update.sh:613
#: src/script/arch-update.sh:622
#, sh-format
msgid ""
"An error has occurred during the reboot process\\nThe reboot has been "
Expand All @@ -466,7 +466,7 @@ msgstr ""
"Une erreur est survenue pendant le processus de redémarrage\\nLe redémarrage a été "
"abandonné\\n"

#: src/script/arch-update.sh:621
#: src/script/arch-update.sh:630
#, sh-format
msgid ""
"The reboot hasn't been performed\\nPlease, consider rebooting to finalize "
Expand All @@ -475,12 +475,12 @@ msgstr ""
"Le redémarrage n'a pas été effectué\\nVeuillez considérer redémarrer votre système pour finaliser "
"la mise à jour du noyau en attente\\n"

#: src/script/arch-update.sh:625
#: src/script/arch-update.sh:634
#, sh-format
msgid "No pending kernel update found\\n"
msgstr "Aucune mise à jour du noyau en attente n'a été trouvée\\n"

#: src/script/arch-update.sh:673
#: src/script/arch-update.sh:682
#, sh-format
msgid ""
"The '${config_file}' configuration file already exists\\nPlease, remove it "
Expand All @@ -489,7 +489,7 @@ msgstr ""
"Le fichier de configuration '${config_file}' existe déjà.\\nVeuillez le supprimer "
"avant d'en générer un nouveau"

#: src/script/arch-update.sh:678
#: src/script/arch-update.sh:687
#, sh-format
msgid "The '${config_file}' configuration file has been generated"
msgstr "Le fichier de configuration '${config_file}' a été généré"
Expand Down
14 changes: 12 additions & 2 deletions src/script/arch-update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -606,8 +606,18 @@ kernel_reboot() {
case "${answer}" in
"$(eval_gettext "Y")"|"$(eval_gettext "y")")
echo
main_msg "$(eval_gettext "Rebooting in 5 seconds...\nPress ctrl+c to abort")"
sleep 5

# shellcheck disable=SC2317,SC2329
restore_cursor() {
tput cnorm
}
trap restore_cursor EXIT
# shellcheck disable=SC2034
for sec in {5..1}; do
tput civis ; echo -ne "${blue}==>${color_off}${bold} $(eval_gettext "Rebooting in \${sec}...\r")${color_off}"
sleep 1
done

if ! reboot; then
echo
error_msg "$(eval_gettext "An error has occurred during the reboot process\nThe reboot has been aborted\n")" && quit_msg
Expand Down

0 comments on commit ecc196e

Please sign in to comment.