Skip to content

Commit 1a90089

Browse files
committed
Implement dist-upgrade to debian trixie
1 parent 190f95e commit 1a90089

4 files changed

Lines changed: 79 additions & 3 deletions

File tree

bin/ncp-dist-upgrade

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ then
1515
elif [[ "$VERSION_ID" -eq 11 ]]
1616
then
1717
UPGRADE_CMD=(bash /usr/local/bin/ncp-dist-upgrade.d/debian-11.sh)
18+
elif [[ "$VERSION_ID" -eq 12 ]]
19+
then
20+
UPGRADE_CMD=(bash /usr/local/bin/ncp-dist-upgrade.d/debian-12.sh)
1821
else
1922
echo "No dist-upgrade available for OS version: Debian ${VERSION}."
2023
exit 0

bin/ncp-dist-upgrade.d/debian-11.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/bin/bash
22

33
set -eu -o pipefail
44

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
#!/bin/bash
2+
3+
set -eu -o pipefail
4+
5+
new_cfg=/usr/local/etc/ncp-recommended.cfg
6+
[[ -f "${new_cfg}" ]] || { echo "Already on the lastest recommended distribution. Abort." >&2; exit 1; }
7+
8+
echo "
9+
>>> ATTENTION <<<
10+
This is a dangerous process that is only guaranteed to work properly if you
11+
have not made manual changes in the system. Backup the SD card first and
12+
proceed at your own risk.
13+
14+
Note that this is not a requirement for NCP to continue working properly.
15+
The current distribution will keep receiving updates for some time.
16+
17+
Do you want to continue? [y/N]"
18+
19+
if [[ "${DEBIAN_FRONTEND:-}" == "noninteractive" ]] || ! [[ -t 0 ]]
20+
then
21+
echo "Noninteractive environment detected. Automatically proceeding in 30 seconds..."
22+
sleep 30
23+
else
24+
read -n1 -r key
25+
[[ "${key,,}" == y ]] || exit 0
26+
fi
27+
28+
export DEBIAN_FRONTEND=noninteractive
29+
30+
source /usr/local/etc/library.sh
31+
is_more_recent_than "${PHPVER}.0" "8.2.0" || {
32+
echo "You still have PHP version ${PHPVER} installed. Please update to the latest supported version of nextcloud (which will also update your PHP version) before proceeding with the distribution upgrade."
33+
echo "Exiting."
34+
exit 1
35+
}
36+
save_maintenance_mode
37+
set -x
38+
39+
# Perform dist-upgrade
40+
41+
42+
apt-get update
43+
apt-get upgrade -y
44+
for aptlist in /etc/apt/sources.list /etc/apt/sources.list.d/{php.list,armbian.list,raspi.list}
45+
do
46+
[ -f "$aptlist" ] && sed -i -e "s/bookworm/trixie/g" "$aptlist"
47+
done
48+
49+
for aptlist in /etc/apt/sources.list.d/*.list
50+
do
51+
[[ "$aptlist" =~ "/etc/apt/sources.list.d/"(php|armbian|raspi)".list" ]] || {
52+
echo "Disabling repositories from \"$aptlist\""
53+
sed -i -e "s/deb/#deb/g" "$aptlist"
54+
}
55+
done
56+
apt-get update
57+
apt-get upgrade -y dpkg
58+
apt-get upgrade -y --without-new-pkgs
59+
apt-get full-upgrade -y
60+
sudo apt-get --purge autoremove -y
61+
restore_maintenance_mode
62+
cfg="$(jq "." "$NCPCFG")"
63+
cfg="$(jq ".release = \"bookworm\"" <<<"$cfg")"
64+
echo "$cfg" > "$NCPCFG"
65+
rm -f /etc/update-motd.d/30ncp-dist-upgrade
66+
rm -f /usr/local/etc/ncp-recommended.cfg
67+
echo "Update to Debian 13 (trixie) successful."
68+
69+
is_active_app unattended-upgrades && {
70+
echo "Setting up unattended upgrades..."
71+
run_app unattended-upgrades || true
72+
echo "done."
73+
}

etc/ncp.cfg

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"nextcloud_version": "33.0.2",
2+
"nextcloud_version": "33.0.5",
33
"php_version": "8.3",
4-
"release": "bookworm"
4+
"release": "trixie"
55
}

0 commit comments

Comments
 (0)