Commit fdcf5417 authored by Igor Pecovnik's avatar Igor Pecovnik
Browse files

Further improvements when changing kernel and switching beta/stable

parent a9eea65f
...@@ -348,29 +348,23 @@ function reload_bsp(){ ...@@ -348,29 +348,23 @@ function reload_bsp(){
# test install packages # test install packages
TARGET_BRANCH=$BRANCH TARGET_BRANCH=$BRANCH
exceptions "$INSTALL_KERNEL" exceptions "$INSTALL_KERNEL"
dialog --backtitle "$BACKTITLE" --title "Please wait" --infobox "\nProbing test install ..." 5 28 unset PACKAGE_LIST
unset PACKAGE_LIST [[ -n $(apt-cache search --names-only "^armbian-${LINUXFAMILY}$") ]] && PACKAGE_LIST=$PACKAGE_LIST" armbian-${LINUXFAMILY}"
[[ -n $(apt-cache search --names-only "^armbian-${BOARD}$") ]] && PACKAGE_LIST=$PACKAGE_LIST" armbian-${BOARD}"
[[ -n $(apt-cache search --names-only "^armbian-${LINUXFAMILY}$") ]] && PACKAGE_LIST=$PACKAGE_LIST" armbian-${LINUXFAMILY}" [[ -n $(apt-cache search --names-only "^armbian-${DISTROID}$") ]] && PACKAGE_LIST=$PACKAGE_LIST" armbian-${DISTROID}"
[[ -n $(apt-cache search --names-only "^armbian-${BOARD}$") ]] && PACKAGE_LIST=$PACKAGE_LIST" armbian-${BOARD}" [[ -n $(apt-cache search --names-only "^armbian-${DISTROID}-desktop-xfce$") ]] && PACKAGE_LIST=$PACKAGE_LIST" armbian-${DISTROID}-desktop-xfce"
[[ -n $(apt-cache search --names-only "^armbian-${DISTROID}$") ]] && PACKAGE_LIST=$PACKAGE_LIST" armbian-${DISTROID}" # if new packages are absent, reinstall old ones
[[ -n $(apt-cache search --names-only "^armbian-${DISTROID}-desktop-xfce$") ]] && PACKAGE_LIST=$PACKAGE_LIST" armbian-${DISTROID}-desktop-xfce" if [[ -z $PACKAGE_LIST ]]; then
PACKAGE_LIST="linux-${DISTROID}-root$TARGET_BRANCH-$BOARD"
# if new packages are absent, reinstall old ones check_if_installed armbian-${DISTROID}-desktop && PACKAGE_LIST=$PACKAGE_LIST" armbian-${DISTROID}-desktop"
if [[ -z $PACKAGE_LIST ]]; then fi
PACKAGE_LIST="linux-${DISTROID}-root$TARGET_BRANCH-$BOARD" # reinstall headers only if they are already installed
check_if_installed armbian-${DISTROID}-desktop && PACKAGE_LIST=$PACKAGE_LIST" armbian-${DISTROID}-desktop" check_if_installed linux-headers${TARGET_BRANCH}-${TARGET_FAMILY} && PACKAGE_LIST=$PACKAGE_LIST" linux-headers${TARGET_BRANCH}-${TARGET_FAMILY}"
fi IFS=" "
[[ -n $(apt-cache search --names-only "^linux-dtb$TARGET_BRANCH-$TARGET_FAMILY") ]] && PACKAGE_LIST=$PACKAGE_LIST" linux-dtb$TARGET_BRANCH-$TARGET_FAMILY"
# reinstall headers only if they are already installed PACKAGE_LIST=$PACKAGE_LIST" linux-image${TARGET_BRANCH}-${TARGET_FAMILY}"
check_if_installed linux-headers${TARGET_BRANCH}-${TARGET_FAMILY} && PACKAGE_LIST=$PACKAGE_LIST" linux-headers${TARGET_BRANCH}-${TARGET_FAMILY}" debconf-apt-progress -- apt --download-only --allow-downgrades -y --no-install-recommends install $PACKAGE_LIST armbian-config
# if download is ok, remove old packages
IFS=" "
[[ -n $(apt-cache search --names-only "^linux-dtb$TARGET_BRANCH-$TARGET_FAMILY") ]] && PACKAGE_LIST=$PACKAGE_LIST" linux-dtb$TARGET_BRANCH-$TARGET_FAMILY"
PACKAGE_LIST=$PACKAGE_LIST" linux-image${TARGET_BRANCH}-${TARGET_FAMILY}"
apt-get -s -y --no-install-recommends install $PACKAGE_LIST > /tmp/reload_bsp.log 2>&1
# if test download is ok, remove old packages
if [[ $? = 0 ]]; then if [[ $? = 0 ]]; then
dialog --backtitle "$BACKTITLE" --title "Please wait" --infobox "\nRemoving current kernel ..." 5 36 dialog --backtitle "$BACKTITLE" --title "Please wait" --infobox "\nRemoving current kernel ..." 5 36
aptitude remove ~nlinux-image*${LINUXFAMILY} --quiet=100 -y >> /var/log/upgrade.log 2>&1 aptitude remove ~nlinux-image*${LINUXFAMILY} --quiet=100 -y >> /var/log/upgrade.log 2>&1
...@@ -378,21 +372,19 @@ function reload_bsp(){ ...@@ -378,21 +372,19 @@ function reload_bsp(){
aptitude remove ~nlinux-headers --quiet=100 -y >> /var/log/upgrade.log 2>&1 aptitude remove ~nlinux-headers --quiet=100 -y >> /var/log/upgrade.log 2>&1
aptitude remove ~nlinux-${DISTROID}-root --quiet=100 -y >> /var/log/upgrade.log 2>&1 aptitude remove ~nlinux-${DISTROID}-root --quiet=100 -y >> /var/log/upgrade.log 2>&1
aptitude remove ~narmbian-config --quiet=100 -y >> /var/log/upgrade.log 2>&1 aptitude remove ~narmbian-config --quiet=100 -y >> /var/log/upgrade.log 2>&1
aptitude remove ~narmbian-${LINUXFAMILY} --quiet=100 -y >> /var/log/upgrade.log 2>&1 aptitude remove ~narmbian-${LINUXFAMILY} --quiet=100 -y >> /var/log/upgrade.log 2>&1
aptitude remove ~narmbian-${BOARD} --quiet=100 -y >> /var/log/upgrade.log 2>&1 aptitude remove ~narmbian-${BOARD} --quiet=100 -y >> /var/log/upgrade.log 2>&1
aptitude remove ~narmbian-${DISTROID} --quiet=100 -y >> /var/log/upgrade.log 2>&1 aptitude remove ~narmbian-${DISTROID} --quiet=100 -y >> /var/log/upgrade.log 2>&1
aptitude remove ~narmbian-${DISTROID}-desktop --quiet=100 -y >> /var/log/upgrade.log 2>&1 aptitude remove ~narmbian-${DISTROID}-desktop --quiet=100 -y >> /var/log/upgrade.log 2>&1
aptitude remove ~narmbian-${DISTROID}-desktop-xfce --quiet=100 -y >> /var/log/upgrade.log 2>&1 aptitude remove ~narmbian-${DISTROID}-desktop-xfce --quiet=100 -y >> /var/log/upgrade.log 2>&1
# install packages # install packages
echo $PACKAGE_LIST >> /var/log/upgrade.log echo $PACKAGE_LIST >> /var/log/upgrade.log
debconf-apt-progress -- apt-get --reinstall -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" \ debconf-apt-progress -- apt -y -qq --allow-downgrades --no-install-recommends --reinstall -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" install $PACKAGE_LIST armbian-config
-y -qq --no-install-recommends install $PACKAGE_LIST armbian-config if [[ $? = 1 ]]; then
if [[ $? = 1 ]]; then echo "Something went wrong ... check logs."; exit; fi echo "Something went wrong ... check logs."; exit;
dialog --title "Switching to $1" --backtitle "$BACKTITLE" --yes-label "Reboot" \
--no-label "Cancel" --yesno "\nReboot to apply new settings?" 7 34
if [[ $? = 0 ]]; then reboot; fi
else else
dialog --backtitle "$BACKTITLE" --title "Warning" --msgbox "\nTest install failed. Can't change firmware \n\nCheck /tmp/reload_bsp.log" 9 48 reboot
fi
fi fi
} }
...@@ -451,7 +443,7 @@ function other_kernel_version () ...@@ -451,7 +443,7 @@ function other_kernel_version ()
TARGET_VERSION_SUB=$(echo $TARGET_VERSION_DTB | cut -f2 -d"=") TARGET_VERSION_SUB=$(echo $TARGET_VERSION_DTB | cut -f2 -d"=")
[[ -n $(apt-cache madison "$TARGET_VERSION_PRE" | grep $TARGET_VERSION_SUB ) ]] && PACKAGE_LIST=$PACKAGE_LIST" $TARGET_VERSION_DTB" [[ -n $(apt-cache madison "$TARGET_VERSION_PRE" | grep $TARGET_VERSION_SUB ) ]] && PACKAGE_LIST=$PACKAGE_LIST" $TARGET_VERSION_DTB"
echo $PACKAGE_LIST > /tmp/switch_kernel.log 2>&1 echo $PACKAGE_LIST > /tmp/switch_kernel.log 2>&1
apt-get -s -y --allow-downgrades --no-install-recommends install $PACKAGE_LIST >> /tmp/switch_kernel.log 2>&1 debconf-apt-progress -- apt --download-only --allow-downgrades -y --no-install-recommends install $PACKAGE_LIST
if [[ $? = 0 ]]; then if [[ $? = 0 ]]; then
# remove old kernel # remove old kernel
dialog --backtitle "$BACKTITLE" --title "Please wait" --infobox "\nRemoving current kernel ..." 5 36 dialog --backtitle "$BACKTITLE" --title "Please wait" --infobox "\nRemoving current kernel ..." 5 36
...@@ -466,7 +458,7 @@ function other_kernel_version () ...@@ -466,7 +458,7 @@ function other_kernel_version ()
find "/boot/" -name "config*" -type f -delete find "/boot/" -name "config*" -type f -delete
find "/boot/" -name "vmlinuz*" -type f -delete find "/boot/" -name "vmlinuz*" -type f -delete
find "/boot/" -name "*nitrd*" -type f -delete find "/boot/" -name "*nitrd*" -type f -delete
debconf-apt-progress -- apt-get -y -qq --allow-downgrades --no-install-recommends install $PACKAGE_LIST debconf-apt-progress -- apt -y -qq --allow-downgrades --no-install-recommends install $PACKAGE_LIST
if [[ $? = 0 ]]; then reboot; fi if [[ $? = 0 ]]; then reboot; fi
else else
dialog --backtitle "$BACKTITLE" --title "Warning" --msgbox "\nTest install failed. Can't change firmware \n\nCheck /tmp/switch_kernel.log" 9 48 dialog --backtitle "$BACKTITLE" --title "Warning" --msgbox "\nTest install failed. Can't change firmware \n\nCheck /tmp/switch_kernel.log" 9 48
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment