-
Notifications
You must be signed in to change notification settings - Fork 212
/
fix6to7upgrade
executable file
·87 lines (70 loc) · 2.43 KB
/
fix6to7upgrade
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/bin/bash
#
# shellcheck disable=SC1090,SC1091,SC1117,SC2016,SC2046,SC2086
#
# version: 0.0.9
#
if [[ $(id -u) -ne 0 ]]; then
echo "This script must be executed as root or using sudo."
exit 99
fi
export DEBIAN_FRONTEND=noninteractive
export APT_LISTCHANGES_FRONTEND=none
export LANG=C.UTF-8
echo "Removing old sources ..."
rm -f /etc/apt/sources.list.d/omvextras.list /etc/apt/sources.list.d/omv-extras-org.list
if [ -f "/etc/apt/sources.list.d/pvekernel.list" ]; then
rm -fv /etc/apt/sources.list.d/pvekernel.list
fi
echo "Installing omv-extras 7.x ..."
url="https://github.com/OpenMediaVault-Plugin-Developers/packages/raw/master/"
file="openmediavault-omvextrasorg_latest_all7.deb"
deb="omvextras7.deb"
wget "${url}/${file}" -O ${deb}
if [ -f "${deb}" ]; then
dpkg -i ${deb}
fi
echo "Clearing cache ..."
/usr/bin/salt-call --local saltutil.clear_cache
omv-salt stage run prepare
echo "Change to bullseye and shaitan just in case ..."
sed -i "s/bullseye/bookworm/g" /etc/apt/sources.list
sed -i "s/bullseye/bookworm/g" /etc/apt/sources.list.d/*
sed -i "s/shaitan/sandworm/g" /etc/apt/sources.list.d/*
if [ -f /etc/apt/apt.conf ]; then
echo "Changing apt.conf ..."
sed -i "s/bullseye/bookworm/g" /etc/apt/apt.conf
fi
armbian="/etc/apt/sources.list.d/armbian.list"
if [ -f "${armbian}" ]; then
echo "Fixing Armbian repo ..."
echo "deb http://apt.armbian.com bookworm main bookworm-utils" | tee ${armbian}
fi
security="/etc/apt/sources.list.d/openmediavault-os-security.list"
if [ -f "${security}" ]; then
echo "Fixing Debian security repo ..."
echo "deb http://security.debian.org/debian-security bookworm-security main contrib non-free" | tee ${security}
fi
echo "Running apt-get update ..."
if ! apt-get update; then
echo "apt-get update failed. Your repos need to be fixed."
exit 1
fi
echo "Running apt-get dist-upgrade ..."
apt-get --yes \
--option DPkg::Options::="--force-confdef" \
--option DPkg::Options::="--force-confold" \
dist-upgrade
mkaptidx_url="https://github.com/openmediavault/openmediavault/raw/master/deb/openmediavault/usr/sbin/omv-mkaptidx"
mkaptidx_path="/usr/sbin/omv-mkaptidx"
rm -fv "${mkaptidx_path}"
echo "Downloading omv-mkaptidx..."
wget --output-document="${mkaptidx_path}" "${mkaptidx_url}"
chmod +x "${mkaptidx_path}"
echo "Rebuild apt index ..."
omv-mkaptidx
sudo omv-salt deploy run nginx phpfpm ssh
sudo systemctl restart nginx
sudo systemctl restart php8.2-fpm
echo "Done."
exit 0