add error function

This commit is contained in:
Tobias Powalowski 2023-08-05 15:59:44 +02:00
parent 5e120cd163
commit e280f5ec5a

View file

@ -18,23 +18,30 @@ _run_pacman(){
echo -e "\nPackage Installation Complete." >>/tmp/pacman.log echo -e "\nPackage Installation Complete." >>/tmp/pacman.log
fi fi
rm /.archboot) & rm /.archboot) &
_progress_wait "0" "100" "Installing package:${_PACKAGES}..." "2" _progress_wait "0" "99" "Installing package:\n${_PACKAGES}..." "2"
# pacman finished, display scrollable output # pacman finished, display scrollable output
local _RESULT='' local _RESULT=''
if [[ $(cat /tmp/.pacman-retcode) -ne 0 ]]; then if [[ $(cat /tmp/.pacman-retcode) -ne 0 ]]; then
_RESULT="Installation Failed (see errors below)" _progress "100" "Package installation failed." 6 75
_dialog --title "${_RESULT}" --exit-label "Continue" \ sleep 2
--textbox "/tmp/pacman.log" 18 70 || return 1
else else
_progress "100" "Package installation complete." 6 75 _progress "100" "Package installation complete." 6 75
sleep 2 sleep 2
fi fi
rm /tmp/.pacman-retcode
# ensure the disk is synced # ensure the disk is synced
sync sync
_chroot_umount _chroot_umount
} }
_pacman_error() {
if [[ $(cat /tmp/.pacman-retcode) -ne 0 ]]; then
_RESULT="Installation Failed (see errors below)"
_dialog --title "${_RESULT}" --exit-label "Continue" \
--textbox "/tmp/pacman.log" 18 70 || return 1
fi
rm /tmp/.pacman-retcode
fi
_install_packages() { _install_packages() {
_destdir_mounts || return 1 _destdir_mounts || return 1
_PACKAGES="" _PACKAGES=""
@ -47,6 +54,7 @@ _install_packages() {
_PACKAGES="${_PACKAGES// / }" _PACKAGES="${_PACKAGES// / }"
_dialog --title " Summary " --yesno "Next step will install the following packages for a minimal system:\n${_PACKAGES}\n\nYou can watch the progress on your ${_VC} console." 9 75 || return 1 _dialog --title " Summary " --yesno "Next step will install the following packages for a minimal system:\n${_PACKAGES}\n\nYou can watch the progress on your ${_VC} console." 9 75 || return 1
_run_pacman | _dialog --title " Logging to ${_LOG} " --gauge "Installing package:\n${_PACKAGES}..." 8 75 0 _run_pacman | _dialog --title " Logging to ${_LOG} " --gauge "Installing package:\n${_PACKAGES}..." 8 75 0
_pacman_error
_NEXTITEM="3" _NEXTITEM="3"
_chroot_mount _chroot_mount
# automagic time! # automagic time!