Skip to content

Commit e85078b

Browse files
committed
dietpi-distro-upgrade: fix Microsoft repo update
Each suite has its own repo and key. The repo is commonly installed as APT package, which contains both and should keep it updated in case of key rotations. A distro upgrade requires a new list+key package, at best installed before touching the existing list.
1 parent 8feb55b commit e85078b

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

.meta/dietpi-bookworm-upgrade

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,13 @@ mapfile -t apackages < <(apt-mark showhold)
6464
unset -v apackages
6565

6666
G_DIETPI-NOTIFY 2 'Migrating package lists to Bookworm suite'
67+
# Update Microsoft list properly: https://dietpi.com/blog/?p=3128#comment-6199
68+
if dpkg-query -s 'packages-microsoft-prod' 2> /dev/null | grep -q '^Status: install ok installed$'
69+
then
70+
G_EXEC curl -sSf 'https://packages.microsoft.com/config/debian/12/packages-microsoft-prod.deb'
71+
G_EXEC dpkg -i --force-confnew packages-microsoft-prod.deb
72+
G_EXEC rm packages-microsoft-prod.deb
73+
fi
6774
G_EXEC sed --follow-symlinks -i 's/bullseye/bookworm/g' /etc/apt/sources.list
6875
(( $G_RASPBIAN )) || G_EXEC sed --follow-symlinks -i -e 's/ non-free$/ non-free non-free-firmware/' -e 's/archive.debian.org/deb.debian.org/' /etc/apt/sources.list
6976
# Remove obsolete WSDD repo
@@ -81,7 +88,7 @@ G_DIETPI-NOTIFY 2 'Reverting some package lists to Bullseye which have no Bookwo
8188
[[ -f '/etc/apt/sources.list.d/radxa.list' ]] && G_EXEC sed --follow-symlinks -i 's/bookworm/bullseye/g' /etc/apt/sources.list.d/radxa.list
8289
[[ -f '/etc/apt/sources.list.d/dietpi-radxa.list' ]] && G_EXEC sed --follow-symlinks -i 's/bookworm/bullseye/g' /etc/apt/sources.list.d/dietpi-radxa.list
8390

84-
if dpkg-query -s 'postgresql' &> /dev/null
91+
if dpkg-query -s 'postgresql' 2> /dev/null | grep -q '^Status: install ok installed$'
8592
then
8693
G_DIETPI-NOTIFY 2 'Preventing automatic v15 main cluster generation'
8794
G_CONFIG_INJECT 'create_main_cluster[[:blank:]]' 'create_main_cluster = false' /etc/postgresql-common/createcluster.conf

.meta/dietpi-trixie-upgrade

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,13 @@ mapfile -t apackages < <(apt-mark showhold)
7070
unset -v apackages
7171

7272
G_DIETPI-NOTIFY 2 'Migrating package lists to Trixie suite'
73+
# Update Microsoft list properly: https://dietpi.com/blog/?p=3128#comment-6199
74+
if dpkg-query -s 'packages-microsoft-prod' 2> /dev/null | grep -q '^Status: install ok installed$'
75+
then
76+
G_EXEC curl -sSf 'https://packages.microsoft.com/config/debian/13/packages-microsoft-prod.deb'
77+
G_EXEC dpkg -i --force-confnew packages-microsoft-prod.deb
78+
G_EXEC rm packages-microsoft-prod.deb
79+
fi
7380
G_EXEC sed --follow-symlinks -i 's/bookworm/trixie/g' /etc/apt/sources.list
7481
# Remove obsolete lists, including those obsoleted with Bookworm
7582
G_EXEC rm -f /etc/apt/sources.list.d/dietpi-{mono,wsdd}.list /etc/apt/trusted.gpg.d/dietpi-{mono,wsdd}.gpg
@@ -251,7 +258,7 @@ then
251258
fi
252259

253260
# PostgreSQL migration
254-
if dpkg-query -s 'postgresql' &> /dev/null
261+
if dpkg-query -s 'postgresql' 2> /dev/null | grep -q '^Status: install ok installed$'
255262
then
256263
G_DIETPI-NOTIFY 2 'Migrating PostgreSQL 15 clusters to v17'
257264
mapfile -t clusters < <(pg_lsclusters | mawk '$1 == "15" {print $2}')

0 commit comments

Comments
 (0)