]>
Commit | Line | Data |
---|---|---|
690d4208 PM |
1 | #!/bin/bash |
2 | ############################################################################ | |
3 | # # | |
4 | # This file is part of the IPFire Firewall. # | |
5 | # # | |
6 | # IPFire is free software; you can redistribute it and/or modify # | |
7 | # it under the terms of the GNU General Public License as published by # | |
8 | # the Free Software Foundation; either version 3 of the License, or # | |
9 | # (at your option) any later version. # | |
10 | # # | |
11 | # IPFire is distributed in the hope that it will be useful, # | |
12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of # | |
13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # | |
14 | # GNU General Public License for more details. # | |
15 | # # | |
16 | # You should have received a copy of the GNU General Public License # | |
17 | # along with IPFire; if not, write to the Free Software # | |
18 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # | |
19 | # # | |
20 | # Copyright (C) 2022 IPFire-Team <info@ipfire.org>. # | |
21 | # # | |
22 | ############################################################################ | |
23 | # | |
24 | . /opt/pakfire/lib/functions.sh | |
25 | /usr/local/bin/backupctrl exclude >/dev/null 2>&1 | |
26 | ||
27 | core=169 | |
28 | ||
b41631c1 PM |
29 | exit_with_error() { |
30 | # Set last succesfull installed core. | |
31 | echo $(($core-1)) > /opt/pakfire/db/core/mine | |
32 | # force fsck at next boot, this may fix free space on xfs | |
33 | touch /forcefsck | |
34 | # don't start pakfire again at error | |
35 | killall -KILL pak_update | |
36 | /usr/bin/logger -p syslog.emerg -t ipfire \ | |
37 | "core-update-${core}: $1" | |
38 | exit $2 | |
39 | } | |
40 | ||
690d4208 PM |
41 | # Remove old core updates from pakfire cache to save space... |
42 | for (( i=1; i<=$core; i++ )); do | |
43 | rm -f /var/cache/pakfire/core-upgrade-*-$i.ipfire | |
44 | done | |
45 | ||
46 | # Stop services | |
9152d4e4 | 47 | /etc/init.d/unbound stop |
7dd29254 | 48 | /etc/init.d/squid stop |
a56d36b0 | 49 | /etc/init.d/apache stop |
690d4208 | 50 | |
b41631c1 PM |
51 | KVER="xxxKVERxxx" |
52 | ||
53 | # Backup uEnv.txt if exist | |
54 | if [ -e /boot/uEnv.txt ]; then | |
55 | cp -vf /boot/uEnv.txt /boot/uEnv.txt.org | |
56 | fi | |
57 | ||
58 | # Do some sanity checks prior to the kernel update | |
59 | case $(uname -r) in | |
60 | *-ipfire*) | |
61 | # Ok. | |
62 | ;; | |
63 | *) | |
64 | exit_with_error "ERROR cannot update. No IPFire Kernel." 1 | |
65 | ;; | |
66 | esac | |
67 | ||
68 | # Check diskspace on root | |
69 | ROOTSPACE=`df / -Pk | sed "s| * | |g" | cut -d" " -f4 | tail -n 1` | |
70 | ||
71 | if [ $ROOTSPACE -lt 100000 ]; then | |
72 | exit_with_error "ERROR cannot update because not enough free space on root." 2 | |
73 | exit 2 | |
74 | fi | |
75 | ||
76 | # Remove the old kernel | |
77 | rm -rvf \ | |
78 | /boot/System.map-* \ | |
79 | /boot/config-* \ | |
80 | /boot/ipfirerd-* \ | |
81 | /boot/initramfs-* \ | |
82 | /boot/vmlinuz-* \ | |
83 | /boot/uImage-* \ | |
84 | /boot/zImage-* \ | |
85 | /boot/uInit-* \ | |
86 | /boot/dtb-* \ | |
87 | /lib/modules | |
88 | ||
690d4208 | 89 | # Remove files |
b86439a2 | 90 | rm -rvf \ |
b55842c2 PM |
91 | /etc/rc.d/init.d/random \ |
92 | /etc/rc.d/rcsysinit.d/S66random \ | |
f391d862 PM |
93 | /lib/firmware/ath10k/QCA99X0/hw2.0/board.bin \ |
94 | /lib/firmware/intel/ice/ddp/ice-1.3.26.0.pkg \ | |
95 | /lib/firmware/iwlwifi-3160-10.ucode \ | |
96 | /lib/firmware/iwlwifi-3160-12.ucode \ | |
97 | /lib/firmware/iwlwifi-3160-13.ucode \ | |
98 | /lib/firmware/iwlwifi-3160-16.ucode \ | |
99 | /lib/firmware/iwlwifi-3160-7.ucode \ | |
100 | /lib/firmware/iwlwifi-3160-8.ucode \ | |
101 | /lib/firmware/iwlwifi-3160-9.ucode \ | |
102 | /lib/firmware/iwlwifi-3168-21.ucode \ | |
103 | /lib/firmware/iwlwifi-7260-10.ucode \ | |
104 | /lib/firmware/iwlwifi-7260-12.ucode \ | |
105 | /lib/firmware/iwlwifi-7260-13.ucode \ | |
106 | /lib/firmware/iwlwifi-7260-16.ucode \ | |
107 | /lib/firmware/iwlwifi-7260-7.ucode \ | |
108 | /lib/firmware/iwlwifi-7260-8.ucode \ | |
109 | /lib/firmware/iwlwifi-7260-9.ucode \ | |
110 | /lib/firmware/iwlwifi-7265-10.ucode \ | |
111 | /lib/firmware/iwlwifi-7265-12.ucode \ | |
112 | /lib/firmware/iwlwifi-7265-13.ucode \ | |
113 | /lib/firmware/iwlwifi-7265-16.ucode \ | |
114 | /lib/firmware/iwlwifi-7265-8.ucode \ | |
115 | /lib/firmware/iwlwifi-7265-9.ucode \ | |
116 | /lib/firmware/iwlwifi-7265D-10.ucode \ | |
117 | /lib/firmware/iwlwifi-7265D-12.ucode \ | |
118 | /lib/firmware/iwlwifi-7265D-13.ucode \ | |
119 | /lib/firmware/iwlwifi-7265D-16.ucode \ | |
120 | /lib/firmware/iwlwifi-7265D-17.ucode \ | |
121 | /lib/firmware/iwlwifi-7265D-21.ucode \ | |
122 | /lib/firmware/iwlwifi-8000C-13.ucode \ | |
123 | /lib/firmware/iwlwifi-8000C-16.ucode \ | |
124 | /lib/firmware/iwlwifi-8000C-21.ucode \ | |
125 | /lib/firmware/iwlwifi-8265-21.ucode \ | |
b86439a2 PM |
126 | /lib/libxtables.so.12.4.0 \ |
127 | /lib/xtables/libip6t_DNAT.so \ | |
128 | /lib/xtables/libip6t_REDIRECT.so \ | |
129 | /lib/xtables/libipt_DNAT.so \ | |
130 | /lib/xtables/libipt_REDIRECT.so \ | |
8000bc0a | 131 | /srv/web/ipfire/cgi-bin/entropy.cgi \ |
071e3153 | 132 | /usr/lib/libfuse3.so.3.10.4 \ |
9152d4e4 | 133 | /usr/lib/libunbound.so.8.1.14 |
5d03d99e | 134 | /usr/lib/libxml2.so.2.9.12 \ |
8065ec21 | 135 | /usr/lib/libxslt.so.1.1.34 \ |
071e3153 | 136 | /usr/lib/libyang.so.2.1.4 |
690d4208 PM |
137 | |
138 | # Extract files | |
139 | extract_files | |
140 | ||
141 | # update linker config | |
142 | ldconfig | |
143 | ||
144 | # Update Language cache | |
145 | /usr/local/bin/update-lang-cache | |
146 | ||
147 | # Filesytem cleanup | |
148 | /usr/local/bin/filesystem-cleanup | |
149 | ||
0360d235 PM |
150 | # Apply sysctl changes |
151 | /etc/init.d/sysctl start | |
152 | ||
f26f08b4 PM |
153 | # Delete unused initrd on 32-bit ARM to save space in /boot |
154 | case "$(uname -m)" in | |
155 | armv*) | |
156 | rm /boot/initramfs-${KVER}-ipfire.img | |
157 | ;; | |
158 | esac | |
159 | ||
690d4208 | 160 | # Start services |
0f5b4846 | 161 | telinit u |
73bac85d | 162 | /etc/init.d/firewall restart |
a924020e | 163 | /etc/init.d/ntp restart |
a56d36b0 | 164 | /etc/init.d/apache start |
9152d4e4 | 165 | /etc/init.d/unbound start |
7dd29254 | 166 | /etc/init.d/squid start |
690d4208 | 167 | |
3356af4e PM |
168 | # krb5 is now part of the core system, remove Pakfire metadata for it |
169 | if [ -e "/opt/pakfire/db/installed/meta-krb5" ] && [ -e "/opt/pakfire/db/meta/meta-krb5" ]; then | |
170 | rm -vf \ | |
171 | /opt/pakfire/db/installed/meta-krb5 \ | |
172 | /opt/pakfire/db/meta/meta-krb5 \ | |
173 | /opt/pakfire/db/rootfiles/krb5 | |
174 | fi | |
175 | ||
176 | # libtiff is now part of the core system, remove Pakfire metadata for it | |
177 | if [ -e "/opt/pakfire/db/installed/meta-libtiff" ] && [ -e "/opt/pakfire/db/meta/meta-libtiff" ]; then | |
178 | rm -vf \ | |
179 | /opt/pakfire/db/installed/meta-libtiff \ | |
180 | /opt/pakfire/db/meta/meta-libtiff \ | |
181 | /opt/pakfire/db/rootfiles/libtiff | |
182 | fi | |
183 | ||
690d4208 | 184 | # This update needs a reboot... |
73bac85d | 185 | touch /var/run/need_reboot |
690d4208 PM |
186 | |
187 | # Finish | |
188 | /etc/init.d/fireinfo start | |
189 | sendprofile | |
190 | ||
b41631c1 PM |
191 | # remove lm_sensor config after collectd was started |
192 | # to reserch sensors at next boot with updated kernel | |
193 | rm -f /etc/sysconfig/lm_sensors | |
194 | ||
195 | # Upadate Kernel version in uEnv.txt | |
196 | if [ -e /boot/uEnv.txt ]; then | |
197 | sed -i -e "s/KVER=.*/KVER=${KVER}/g" /boot/uEnv.txt | |
198 | fi | |
199 | ||
200 | # Call user update script (needed for some ARM boards) | |
201 | if [ -e /boot/pakfire-kernel-update ]; then | |
202 | /boot/pakfire-kernel-update ${KVER} | |
203 | fi | |
204 | ||
690d4208 PM |
205 | # Update grub config to display new core version |
206 | if [ -e /boot/grub/grub.cfg ]; then | |
207 | grub-mkconfig -o /boot/grub/grub.cfg | |
208 | fi | |
209 | ||
210 | sync | |
211 | ||
212 | # Don't report the exitcode last command | |
213 | exit 0 |