From ff34476ecd5de0da1104b13e6b42e6cc9eff8792 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Mon, 30 Mar 2009 00:13:39 +0200 Subject: update-initramfs: Cleanup run_bootloader() rework it's logic, instead of 2 nested top ifs use one if with 2 "&&" connected checks. gets us rid of one nested level. simplify codeflow inside too as bonus. make clear why mbr_check() is run. --- update-initramfs | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) (limited to 'update-initramfs') diff --git a/update-initramfs b/update-initramfs index 3235437..2eed8cb 100755 --- a/update-initramfs +++ b/update-initramfs @@ -233,23 +233,22 @@ mbr_check() run_bootloader() { # if both lilo and grub around, figure out if lilo needs to be run - if [ -x "$(command -v update-grub)" ] || [ -e /boot/grub/menu.lst ] \ - || [ -e /boot/grub/grub.cfg ]; then - if [ -e /etc/lilo.conf ] && [ -x /sbin/lilo ]; then - [ -r "${KPKGCONF}" ] && \ - do_b=$(awk '/^do_bootloader/{print $3}' "${KPKGCONF}") - if [ "${do_b}" = "yes" ] || [ "${do_b}" = "Yes" ] \ - || [ "${do_b}" = "YES" ]; then - run_lilo - return 0 - elif [ "${do_b}" = "no" ] || [ "${do_b}" = "No" ] \ - || [ "${do_b}" = "NO" ]; then - return 0 - else - mbr_check - return 0 - fi + if ( [ -x "$(command -v update-grub)" ] || [ -e /boot/grub/menu.lst ] \ + || [ -e /boot/grub/grub.cfg ] ) \ + && ( [ -e /etc/lilo.conf ] && [ -x /sbin/lilo ] ); then + [ -r "${KPKGCONF}" ] && \ + do_b=$(awk '/^do_bootloader/{print $3}' "${KPKGCONF}") + if [ "${do_b}" = "yes" ] || [ "${do_b}" = "Yes" ] \ + || [ "${do_b}" = "YES" ]; then + run_lilo + return 0 + elif [ "${do_b}" = "no" ] || [ "${do_b}" = "No" ] \ + || [ "${do_b}" = "NO" ]; then + return 0 fi + + # do_bootloader unconfigured + mbr_check return 0 fi if [ -r /etc/lilo.conf ] && [ -x /sbin/lilo ]; then -- cgit v1.2.3