mirror of
https://gitlab.archlinux.org/tpowa/archboot.git
synced 2024-09-20 03:50:37 +02:00
progressbar on mkinitcpio running
This commit is contained in:
parent
0cb142dde3
commit
695354c899
3 changed files with 64 additions and 48 deletions
|
@ -232,7 +232,8 @@ _auto_mkinitcpio() {
|
|||
[[ -e "${_DESTDIR}/boot/initramfs-linux-fallback.img" ]] && rm -f "${_DESTDIR}/boot/initramfs-linux-fallback.img"
|
||||
sleep 2
|
||||
_AUTO_MKINITCPIO=1
|
||||
_run_mkinitcpio
|
||||
_run_mkinitcpio | _dialog --title " Logging to ${_LOG} " --gauge "Rebuilding initramfs on installed system..." 8 75 0
|
||||
_error_mkinitcpio
|
||||
_printk on
|
||||
fi
|
||||
}
|
||||
|
|
|
@ -1,18 +1,54 @@
|
|||
#!/usr/bin/env bash
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
# created by Tobias Powalowski <tpowa@archlinux.org>
|
||||
_check_root_password() {
|
||||
# check if empty password is set
|
||||
if chroot "${_DESTDIR}" passwd -S root | cut -d ' ' -f2 | grep -q NP; then
|
||||
_dialog --no-mouse --infobox "Setup detected no password set for root user,\nplease set new password now." 6 50
|
||||
sleep 3
|
||||
_set_password || return 1
|
||||
_mkinitcpio() {
|
||||
if [[ "${_RUNNING_ARCH}" == "aarch64" ]]; then
|
||||
chroot "${_DESTDIR}" mkinitcpio -p "${_KERNELPKG}"-"${_RUNNING_ARCH}" |& tee -a "${_LOG}" /tmp/mkinitcpio.log &>"${_LOG}"
|
||||
else
|
||||
chroot "${_DESTDIR}" mkinitcpio -p "${_KERNELPKG}" |& tee -a "${_LOG}" /tmp/mkinitcpio.log &>"${_LOG}"
|
||||
fi
|
||||
# check if account is locked
|
||||
if chroot "${_DESTDIR}" passwd -S root | cut -d ' ' -f2 | grep -q L; then
|
||||
_dialog --no-mouse --infobox "Setup detected locked account for root user,\nplease set new password to unlock account now." 6 50
|
||||
_set_password || return 1
|
||||
echo $? > /tmp/.mkinitcpio-retcode
|
||||
if [[ $(cat /tmp/.mkinitcpio-retcode) -ne 0 ]]; then
|
||||
echo -e "\nMkinitcpio FAILED." >>/tmp/pacman.log
|
||||
else
|
||||
echo -e "\nMkinitcpio Complete." >>/tmp/pacman.log
|
||||
fi
|
||||
rm /.archboot
|
||||
}
|
||||
|
||||
_run_mkinitcpio() {
|
||||
_dialog --no-mouse --infobox "" 3 70
|
||||
_chroot_mount
|
||||
echo "Initramfs progress..." > /tmp/mkinitcpio.log
|
||||
touch /.archboot
|
||||
_mkinitcpio &
|
||||
_progress_wait "0" "99" "Rebuilding initramfs on installed system..." "0.1"
|
||||
if [[ $(cat /tmp/.mkinitcpio-retcode) -ne 0 ]]; then
|
||||
progress "100" "Rebuilding initramfs failed." 6 75
|
||||
sleep 2
|
||||
else
|
||||
_progress "100" "Rebuilding initramfs complete." 6 75
|
||||
sleep 2
|
||||
fi
|
||||
_chroot_umount
|
||||
}
|
||||
|
||||
_mkinitcpio_error() {
|
||||
# mkinitcpio finished, display scrollable output on error
|
||||
if [[ $(cat /tmp/.mkinitcpio-retcode) -ne 0 ]]; then
|
||||
_RESULT="Mkinitcpio Failed (see errors below)"
|
||||
_dialog --title "${_RESULT}" --exit-label "Continue" \
|
||||
--textbox "/tmp/mkinitcpio.log" 18 70 || return 1
|
||||
fi
|
||||
rm /tmp/.mkinitcpio-retcode
|
||||
}
|
||||
|
||||
_run_locale_gen() {
|
||||
touch /.archboot
|
||||
_locale_gen &
|
||||
_progress_wait "0" "99" "Rebuilding glibc locales on installed system..." "0.05"
|
||||
_progress "100" "Rebuilding glibc locales on installed system complete." 6 75
|
||||
sleep 2
|
||||
}
|
||||
|
||||
_set_mkinitcpio() {
|
||||
|
@ -26,7 +62,8 @@ _set_mkinitcpio() {
|
|||
_dialog --title " ERROR " --no-mouse --infobox "Detected error in 'HOOKS=' line,\nplease correct HOOKS= in /etc/mkinitcpio.conf!" 6 70
|
||||
sleep 5
|
||||
else
|
||||
_run_mkinitcpio
|
||||
_run_mkinitcpio | _dialog --title " Logging to ${_LOG} " --gauge "Rebuilding initramfs on installed system..." 8 75 0
|
||||
_error_mkinitcpio
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -40,6 +77,20 @@ _set_locale() {
|
|||
_S_LOCALE=1
|
||||
}
|
||||
|
||||
_check_root_password() {
|
||||
# check if empty password is set
|
||||
if chroot "${_DESTDIR}" passwd -S root | cut -d ' ' -f2 | grep -q NP; then
|
||||
_dialog --no-mouse --infobox "Setup detected no password set for root user,\nplease set new password now." 6 50
|
||||
sleep 3
|
||||
_set_password || return 1
|
||||
fi
|
||||
# check if account is locked
|
||||
if chroot "${_DESTDIR}" passwd -S root | cut -d ' ' -f2 | grep -q L; then
|
||||
_dialog --no-mouse --infobox "Setup detected locked account for root user,\nplease set new password to unlock account now." 6 50
|
||||
_set_password || return 1
|
||||
fi
|
||||
}
|
||||
|
||||
_set_password() {
|
||||
_PASSWORD=""
|
||||
_PASS=""
|
||||
|
@ -69,39 +120,4 @@ _set_password() {
|
|||
chroot "${_DESTDIR}" passwd root < /tmp/.password &>"${_NO_LOG}"
|
||||
rm /tmp/.password
|
||||
}
|
||||
|
||||
_run_mkinitcpio() {
|
||||
_dialog --no-mouse --infobox "Rebuilding initramfs on installed system..." 3 70
|
||||
_chroot_mount
|
||||
echo "Initramfs progress..." > /tmp/mkinitcpio.log
|
||||
if [[ "${_RUNNING_ARCH}" == "aarch64" ]]; then
|
||||
chroot "${_DESTDIR}" mkinitcpio -p "${_KERNELPKG}"-"${_RUNNING_ARCH}" |& tee -a "${_LOG}" /tmp/mkinitcpio.log &>"${_NO_LOG}"
|
||||
else
|
||||
chroot "${_DESTDIR}" mkinitcpio -p "${_KERNELPKG}" |& tee -a "${_LOG}" /tmp/mkinitcpio.log &>"${_NO_LOG}"
|
||||
fi
|
||||
echo $? > /tmp/.mkinitcpio-retcode
|
||||
if [[ $(cat /tmp/.mkinitcpio-retcode) -ne 0 ]]; then
|
||||
echo -e "\nMkinitcpio FAILED." >>/tmp/mkinitcpio.log
|
||||
else
|
||||
echo -e "\nMkinitcpio Complete." >>/tmp/mkinitcpio.log
|
||||
fi
|
||||
local _result=''
|
||||
# mkinitcpio finished, display scrollable output on error
|
||||
if [[ $(cat /tmp/.mkinitcpio-retcode) -ne 0 ]]; then
|
||||
_result="Mkinitcpio Failed (see errors below)"
|
||||
_dialog --title "${_result}" --exit-label "Continue" \
|
||||
--textbox "/tmp/mkinitcpio.log" 18 70 || return 1
|
||||
fi
|
||||
rm /tmp/.mkinitcpio-retcode
|
||||
_chroot_umount
|
||||
sleep 2
|
||||
}
|
||||
|
||||
_run_locale_gen() {
|
||||
touch /.archboot
|
||||
_locale_gen &
|
||||
_progress_wait "0" "99" "Rebuilding glibc locales on installed system..." "0.05"
|
||||
_progress "100" "Rebuilding glibc locales on installed system complete." 6 75
|
||||
sleep 2
|
||||
}
|
||||
# vim: set ft=sh ts=4 sw=4 et:
|
||||
|
|
|
@ -25,7 +25,6 @@ _run_pacman(){
|
|||
_pacman &
|
||||
_progress_wait "0" "99" "Installing package(s):\n${_PACKAGES}..." "2"
|
||||
# pacman finished, display scrollable output
|
||||
local _RESULT=''
|
||||
if [[ $(cat /tmp/.pacman-retcode) -ne 0 ]]; then
|
||||
_progress "100" "Package installation failed." 6 75
|
||||
sleep 2
|
||||
|
|
Loading…
Reference in a new issue