Unverified Commit 3ff0d187 authored by Igor Pečovnik's avatar Igor Pečovnik Committed by GitHub
Browse files

Suppring upgrade to new packages when changing kernels (#71)

* Changing u-boot and BSP when changing kernel

* Merge minimal and default desktop to limit troubles
parent d31f1fea
...@@ -436,7 +436,6 @@ function other_kernel_version () ...@@ -436,7 +436,6 @@ function other_kernel_version ()
# get current kernel information # get current kernel information
CURRENT_VERSION_TEMP=$(dpkg -l | grep '^ii' | grep linux-image) CURRENT_VERSION_TEMP=$(dpkg -l | grep '^ii' | grep linux-image)
CURRENT_VERSION=$(echo $CURRENT_VERSION_TEMP | awk '{print $2}')"="$(echo $CURRENT_VERSION_TEMP | awk '{print $3}') CURRENT_VERSION=$(echo $CURRENT_VERSION_TEMP | awk '{print $2}')"="$(echo $CURRENT_VERSION_TEMP | awk '{print $3}')
# check what is available from the repository # check what is available from the repository
debconf-apt-progress -- apt-get update debconf-apt-progress -- apt-get update
LIST=($(apt-cache show linux-image*${LINUXFAMILY} | grep -E "Package:|Version:|version:" \ LIST=($(apt-cache show linux-image*${LINUXFAMILY} | grep -E "Package:|Version:|version:" \
...@@ -475,6 +474,13 @@ function other_kernel_version () ...@@ -475,6 +474,13 @@ function other_kernel_version ()
exec 3>&- exec 3>&-
if [[ $exitstatus = 0 ]]; then if [[ $exitstatus = 0 ]]; then
IFS=" " IFS=" "
# determine upgrade packages
UPGRADE_ROOT="default"
UPGRADE_UBOOT=""
[[ $TARGET_VERSION == *legacy* ]] && UPGRADE_ROOT="-legacy" && UPGRADE_UBOOT="legacy"
[[ $TARGET_VERSION == *next* ]] && UPGRADE_ROOT="-next" && UPGRADE_UBOOT="next"
[[ $TARGET_VERSION == *current* ]] && UPGRADE_ROOT="-current" && UPGRADE_UBOOT="current"
[[ $TARGET_VERSION == *dev* ]] && UPGRADE_ROOT="-dev" && UPGRADE_UBOOT="dev"
# install packages # install packages
PACKAGE_LIST="$TARGET_VERSION" PACKAGE_LIST="$TARGET_VERSION"
TARGET_VERSION_DTB=${TARGET_VERSION/image/dtb} TARGET_VERSION_DTB=${TARGET_VERSION/image/dtb}
...@@ -483,11 +489,10 @@ function other_kernel_version () ...@@ -483,11 +489,10 @@ function other_kernel_version ()
[[ -n $(apt-cache madison "$TARGET_VERSION_PRE" | grep $TARGET_VERSION_SUB ) ]] && \ [[ -n $(apt-cache madison "$TARGET_VERSION_PRE" | grep $TARGET_VERSION_SUB ) ]] && \
PACKAGE_LIST=$PACKAGE_LIST" $TARGET_VERSION_DTB" 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
debconf-apt-progress -- apt --download-only --allow-downgrades -y \ debconf-apt-progress -- apt --download-only --allow-downgrades -y --no-install-recommends install $PACKAGE_LIST
--no-install-recommends install $PACKAGE_LIST
if [[ $? = 0 ]]; then if [[ $? = 0 ]]; then
# 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
# remove old kernel
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
aptitude remove ~nlinux-image-next-${LINUXFAMILY} --quiet=100 -y >> /var/log/upgrade.log 2>&1 aptitude remove ~nlinux-image-next-${LINUXFAMILY} --quiet=100 -y >> /var/log/upgrade.log 2>&1
aptitude remove ~nlinux-image-dev-${LINUXFAMILY} --quiet=100 -y >> /var/log/upgrade.log 2>&1 aptitude remove ~nlinux-image-dev-${LINUXFAMILY} --quiet=100 -y >> /var/log/upgrade.log 2>&1
...@@ -499,7 +504,19 @@ function other_kernel_version () ...@@ -499,7 +504,19 @@ 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 -y -qq --allow-downgrades --no-install-recommends install $PACKAGE_LIST debconf-apt-progress -- apt -y -qq --allow-downgrades --no-install-recommends install $PACKAGE_LIST
# update u-boot and rootfs
debconf-apt-progress -- apt --download-only --allow-downgrades -y --no-install-recommends install linux-u-boot-${BOARD}-${UPGRADE_UBOOT}
if [[ $? = 0 ]]; then
aptitude remove ~n$(dpkg -l | grep '^ii' | grep linux-u-boot | awk '{print $2}') --quiet=100 -y >> /var/log/upgrade.log 2>&1
debconf-apt-progress -- apt -y -qq --allow-downgrades --no-install-recommends install linux-u-boot-${BOARD}-${UPGRADE_UBOOT}
fi
debconf-apt-progress -- apt --download-only --allow-downgrades -y --no-install-recommends install linux-${DISTROID}-root${UPGRADE_ROOT}-${BOARD}
if [[ $? = 0 ]]; then
aptitude remove ~n$(dpkg -l | grep '^ii' | grep linux-${DISTROID} | awk '{print $2}') --quiet=100 -y >> /var/log/upgrade.log 2>&1
debconf-apt-progress -- apt -y -qq --allow-downgrades --no-install-recommends install linux-${DISTROID}-root${UPGRADE_ROOT}-${BOARD}
fi
# clean apt cache # clean apt cache
apt clean apt clean
if [[ $? = 0 ]]; then reboot; fi if [[ $? = 0 ]]; then reboot; fi
......
...@@ -999,14 +999,10 @@ function jobs () ...@@ -999,14 +999,10 @@ function jobs ()
fi fi
;; ;;
"Minimal" ) "Default" )
configure_desktop "--install-recommends" configure_desktop "--install-recommends"
;; ;;
"Default")
configure_desktop "--install-suggests"
;;
"RDP" ) "RDP" )
if [[ -n $(service xrdp status | grep -w active) ]]; then if [[ -n $(service xrdp status | grep -w active) ]]; then
systemctl stop xrdp.service >/dev/null 2>&1 systemctl stop xrdp.service >/dev/null 2>&1
......
...@@ -96,20 +96,11 @@ while true; do ...@@ -96,20 +96,11 @@ while true; do
# desktop # desktop
if [[ -n $DISPLAY_MANAGER ]]; then if [[ -n $DISPLAY_MANAGER ]]; then
LIST+=( "Desktop" "Disable desktop or change login type" ) LIST+=( "Desktop" "Disable desktop or change login type" )
if ! check_if_installed mpv ; then
LIST+=( "Default" "Install desktop with browser and extras" )
fi
else else
if [[ -n $DESKTOP_INSTALLED ]]; then if [[ -n $DESKTOP_INSTALLED ]]; then
LIST+=( "Desktop" "Enable desktop" ) LIST+=( "Desktop" "Enable desktop" )
if ! check_if_installed mpv ; then
LIST+=( "Default" "Install desktop with browser and extras" )
fi
else else
LIST+=( "Minimal" "Install minimal desktop" ) LIST+=( "Default" "Install desktop with browser and extras" )
if ! check_if_installed mpv ; then
LIST+=( "Default" "Install desktop with browser and extras" )
fi
fi fi
fi fi
......
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