Skip to content

Commit 5639be4

Browse files
Fix, improve and enable distribution upgrade routines (#669)
* Adjust release upgrade routines * Apply suggestion from @coderabbitai[bot] Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Don't check those that might broke --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
1 parent 567bc20 commit 5639be4

File tree

5 files changed

+41
-9
lines changed

5 files changed

+41
-9
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Long-Term Support (LTS) upgrades provide a **well-tested and stable release** of the underlying Linux distribution (Debian or Ubuntu). These versions receive **security patches and critical bug fixes** for an extended period, making them the recommended choice for production systems and users who prioritize stability over new features.
2+
3+
!!! Note
4+
5+
While LTS upgrades are considered safe, always back up your data before proceeding with a distribution upgrade.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Testing upgrades track the **latest distribution releases** that are not yet fully stabilized. They include **new features, packages, and improvements**, but may also introduce regressions or breaking changes. This option is best suited for **developers, testers, and enthusiasts** who want early access and are willing to troubleshoot issues.
2+
3+
!! Warning
4+
5+
Testing upgrades may cause system instability. Avoid using this option on production devices. Always back up important data before upgrading.
6+
7+

tools/json/config.system.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -535,24 +535,26 @@
535535
"condition": "module_armbian_firmware repository rolling status"
536536
},
537537
{
538-
"id": "UPD005",
538+
"id": "LTSREL",
539539
"description": "Distribution upgrade to latest stable / LTS",
540+
"short": "Stable LTS Distribution Upgrade",
540541
"about": "Release upgrade is irriversible operation which upgrades all packages. \n\nResoulted upgrade might break your build beyond repair!",
541542
"command": [
542543
"release_upgrade stable"
543544
],
544-
"status": "Disabled",
545+
"status": "Stable",
545546
"author": "@igorpecovnik",
546547
"condition": "[ -f /etc/armbian-distribution-status ] && release_upgrade stable verify"
547548
},
548549
{
549-
"id": "UPD006",
550+
"id": "ROLREL",
550551
"description": "Distribution upgrade to rolling unstable",
552+
"short": "Unstable Testing Distribution Upgrade",
551553
"about": "Release upgrade is irriversible operation which upgrades all packages. \n\nResoulted upgrade might break your build beyond repair!",
552554
"command": [
553555
"release_upgrade rolling"
554556
],
555-
"status": "Disabled",
557+
"status": "Stable",
556558
"author": "@igorpecovnik",
557559
"condition": "[ -f /etc/armbian-distribution-status ] && release_upgrade rolling verify"
558560
},

tools/modules/functions/package.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,3 +95,16 @@ pkg_upgrade()
9595
{
9696
_pkg_have_stdin && debconf-apt-progress -- apt-get -y upgrade "$@" || apt-get -y upgrade "$@"
9797
}
98+
99+
module_options+=(
100+
["pkg_fix,author"]="@igorpecovnik"
101+
["pkg_fix,desc"]="Fix dependency issues"
102+
["pkg_fix,example"]="pkg_fix"
103+
["pkg_fix,feature"]="pkg_fix"
104+
["pkg_fix,status"]="Interface"
105+
)
106+
107+
pkg_fix()
108+
{
109+
_pkg_have_stdin && debconf-apt-progress -- apt-get -y --fix-broken install "$@" || apt-get -y --fix-broken install "$@"
110+
}

tools/modules/system/release_upgrade.sh

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ release_upgrade(){
1818
local distroid=${DISTROID}
1919

2020
if [[ "${upgrade_type}" == stable ]]; then
21-
local filter=$(grep "supported" /etc/armbian-distribution-status | cut -d"=" -f1)
21+
local filter=$(grep "supported" /etc/armbian-distribution-status | cut -d"=" -f1 | grep -v "^${distroid}")
2222
elif [[ "${upgrade_type}" == rolling ]]; then
23-
local filter=$(grep "eos\|csc" /etc/armbian-distribution-status | cut -d"=" -f1 | sed "s/sid/testing/g")
23+
local filter=$(grep "eos\|csc" /etc/armbian-distribution-status | cut -d"=" -f1 | sed "s/sid/testing/g" | grep -v "^${distroid}")
2424
else
25-
local filter=$(cat /etc/armbian-distribution-status | cut -d"=" -f1)
25+
local filter=$(cat /etc/armbian-distribution-status | cut -d"=" -f1 | grep -v "^${distroid}")
2626
fi
2727

2828
local upgrade=$(for j in $filter; do
@@ -41,9 +41,14 @@ release_upgrade(){
4141
[[ -f /etc/apt/sources.list ]] && sed -i "s/$distroid/$upgrade/g" /etc/apt/sources.list
4242
[[ "${upgrade}" == "testing" ]] && upgrade="sid" # our repo and everything is tied to sid
4343
[[ -f /etc/apt/sources.list.d/armbian.sources ]] && sed -i "s/$distroid/$upgrade/g" /etc/apt/sources.list.d/armbian.sources
44+
[[ -f /etc/apt/sources.list.d/armbian.list ]] && sed -i "s/$distroid/$upgrade/g" /etc/apt/sources.list.d/armbian.list
4445
pkg_update
45-
apt_upgrade -o Dpkg::Options::="--force-confold" --without-new-pkgs
46-
apt_full_upgrade -o Dpkg::Options::="--force-confold"
46+
pkg_upgrade -o Dpkg::Options::="--force-confold" --without-new-pkgs
47+
pkg_fix || return 1 # Hacks for Ubuntu
48+
pkg_full_upgrade -o Dpkg::Options::="--force-confold"
49+
pkg_fix || return 1 # Hacks for Ubuntu
50+
pkg_full_upgrade -o Dpkg::Options::="--force-confold"
51+
pkg_fix || return 1 # Hacks for Ubuntu
4752
pkg_remove # remove all auto-installed packages
4853
fi
4954
}

0 commit comments

Comments
 (0)