From b1fb79b57e5a4b51c68c25bb1294a6cbfd2c3637 Mon Sep 17 00:00:00 2001 From: Igor Pecovnik Date: Fri, 19 Jun 2020 17:29:55 +0000 Subject: [PATCH] Fixes kernel switching --- debian-config-functions | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/debian-config-functions b/debian-config-functions index a8fcb21..e1774f0 100644 --- a/debian-config-functions +++ b/debian-config-functions @@ -462,6 +462,8 @@ function other_kernel_version () new_list+=( "${LIST[$prvi]}=${LIST[$drugi]}" ) new_list+=( ${LIST[$tretji]} ) fi + local tmp="${LIST[$prvi]}=${LIST[$drugi]}${LIST[$tretji]}" + [[ ${#tmp} -gt $chrlen ]] && local chrlen=${#tmp} done # copy back to main array @@ -475,9 +477,8 @@ function other_kernel_version () \n\n\Z1In case of troubles expect no help!\Z0" if [[ -n $ACKNOWLEDGEMENT ]]; then exec 3>&1 - TARGET_VERSION=$(dialog --cancel-label "Cancel" --backtitle "$BACKTITLE" --no-collapse \ - --title "Switch from and reboot" --clear --menu "\n${CURRENT_VERSION} $(uname -r) \n \n" \ - $((9+${LIST_LENGTH})) 62 25 "${LIST[@]}" 2>&1 1>&3) + TARGET_VERSION=$(dialog --ok-label "Reboot" --cancel-label "Cancel" --backtitle "$BACKTITLE" --no-collapse \ + --title "Select kernel and reboot" --clear --menu "" $((6+${LIST_LENGTH})) $((7+${chrlen})) 25 "${LIST[@]}" 2>&1 1>&3) exitstatus=$?; exec 3>&- if [[ $exitstatus = 0 ]]; then @@ -497,8 +498,11 @@ function other_kernel_version () TARGET_VERSION_PRE=$(echo $TARGET_VERSION_DTB | cut -f1 -d"=") TARGET_VERSION_SUB=$(echo $TARGET_VERSION_DTB | cut -f2 -d"=") [[ -n $(apt-cache madison "$TARGET_VERSION_PRE" | grep $TARGET_VERSION_SUB ) ]] && \ + # installs u-boot only if exits + apt-cache show linux-u-boot-${BOARD}-${UPGRADE_UBOOT} 2> /dev/null + [[ $? -eq 0 ]] && PACKAGE_LIST=$PACKAGE_LIST" linux-u-boot-${BOARD}-${UPGRADE_UBOOT}" - PACKAGE_LIST=$PACKAGE_LIST" $TARGET_VERSION_DTB linux-u-boot-${BOARD}-${UPGRADE_UBOOT}" + PACKAGE_LIST=$PACKAGE_LIST" $TARGET_VERSION_DTB" echo $PACKAGE_LIST > /tmp/switch_kernel.log 2>&1 debconf-apt-progress -- apt --download-only --allow-downgrades -y --no-install-recommends install $PACKAGE_LIST