]> git.ipfire.org Git - ipfire-2.x.git/blame - config/rootfiles/core/171/update.sh
modules.d: Drop orphaned blacklist statements
[ipfire-2.x.git] / config / rootfiles / core / 171 / update.sh
CommitLineData
67eff38d
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
27core=171
28
42368583
PM
29exit_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
67eff38d
PM
41# Remove old core updates from pakfire cache to save space...
42for (( i=1; i<=$core; i++ )); do
43 rm -f /var/cache/pakfire/core-upgrade-*-$i.ipfire
44done
45
46# Stop services
79fb0874 47/etc/rc.d/init.d/apache stop
64fc1360 48/etc/rc.d/init.d/unbound stop
ddbc886c 49/etc/rc.d/init.d/squid stop
492c9fb6
PM
50/usr/local/bin/openvpnctrl -k
51/usr/local/bin/openvpnctrl -kn2n
78ba0514 52/etc/rc.d/init.d/ipsec stop
415afe55 53/etc/rc.d/init.d/suricata stop
b029818d 54/etc/rc.d/init.d/collectd stop
67eff38d 55
42368583
PM
56KVER="xxxKVERxxx"
57
58# Backup uEnv.txt if exist
59if [ -e /boot/uEnv.txt ]; then
60 cp -vf /boot/uEnv.txt /boot/uEnv.txt.org
61fi
62
63# Do some sanity checks prior to the kernel update
64case $(uname -r) in
65 *-ipfire*)
66 # Ok.
67 ;;
68 *)
69 exit_with_error "ERROR cannot update. No IPFire Kernel." 1
70 ;;
71esac
72
73# Check diskspace on root
74ROOTSPACE=`df / -Pk | sed "s| * | |g" | cut -d" " -f4 | tail -n 1`
75
76if [ $ROOTSPACE -lt 100000 ]; then
77 exit_with_error "ERROR cannot update because not enough free space on root." 2
78 exit 2
79fi
80
81# Remove the old kernel
82rm -rvf \
83 /boot/System.map-* \
84 /boot/config-* \
85 /boot/ipfirerd-* \
86 /boot/initramfs-* \
87 /boot/vmlinuz-* \
88 /boot/uImage-* \
89 /boot/zImage-* \
90 /boot/uInit-* \
91 /boot/dtb-* \
92 /lib/modules
93
67eff38d 94# Remove files
41a518ae 95rm -rvf \
9826ac9b 96 /etc/modprobe.d/cfg80211.conf \
3b01f08a
PM
97 /lib/firmware/3com/3C359.bin \
98 /lib/firmware/TDA7706_OM_v2.5.1_boot.txt \
99 /lib/firmware/TDA7706_OM_v3.0.2_boot.txt \
100 /lib/firmware/atmsar11.fw \
101 /lib/firmware/bnx2/bnx2-mips-06-4.6.16.fw \
102 /lib/firmware/bnx2/bnx2-mips-06-5.0.0.j3.fw \
103 /lib/firmware/bnx2/bnx2-mips-06-5.0.0.j6.fw \
104 /lib/firmware/bnx2/bnx2-mips-06-6.0.15.fw \
105 /lib/firmware/bnx2/bnx2-mips-06-6.2.1.fw \
106 /lib/firmware/bnx2/bnx2-mips-09-4.6.17.fw \
107 /lib/firmware/bnx2/bnx2-mips-09-5.0.0.j15.fw \
108 /lib/firmware/bnx2/bnx2-mips-09-5.0.0.j3.fw \
109 /lib/firmware/bnx2/bnx2-mips-09-5.0.0.j9.fw \
110 /lib/firmware/bnx2/bnx2-mips-09-6.0.17.fw \
111 /lib/firmware/bnx2/bnx2-mips-09-6.2.1.fw \
112 /lib/firmware/bnx2/bnx2-mips-09-6.2.1a.fw \
113 /lib/firmware/bnx2/bnx2-rv2p-06-4.6.16.fw \
114 /lib/firmware/bnx2/bnx2-rv2p-06-5.0.0.j3.fw \
115 /lib/firmware/bnx2/bnx2-rv2p-09-4.6.15.fw \
116 /lib/firmware/bnx2/bnx2-rv2p-09-5.0.0.j10.fw \
117 /lib/firmware/bnx2/bnx2-rv2p-09-5.0.0.j3.fw \
118 /lib/firmware/bnx2/bnx2-rv2p-09ax-5.0.0.j10.fw \
119 /lib/firmware/bnx2/bnx2-rv2p-09ax-5.0.0.j3.fw \
120 /lib/firmware/bnx2x-e1-4.8.53.0.fw \
121 /lib/firmware/bnx2x-e1-5.2.13.0.fw \
122 /lib/firmware/bnx2x-e1-5.2.7.0.fw \
123 /lib/firmware/bnx2x-e1h-4.8.53.0.fw \
124 /lib/firmware/bnx2x-e1h-5.2.13.0.fw \
125 /lib/firmware/bnx2x-e1h-5.2.7.0.fw \
126 /lib/firmware/bnx2x/bnx2x-e1-6.0.34.0.fw \
127 /lib/firmware/bnx2x/bnx2x-e1-6.2.5.0.fw \
128 /lib/firmware/bnx2x/bnx2x-e1-6.2.9.0.fw \
129 /lib/firmware/bnx2x/bnx2x-e1-7.0.20.0.fw \
130 /lib/firmware/bnx2x/bnx2x-e1-7.0.23.0.fw \
131 /lib/firmware/bnx2x/bnx2x-e1-7.0.29.0.fw \
132 /lib/firmware/bnx2x/bnx2x-e1-7.10.51.0.fw \
133 /lib/firmware/bnx2x/bnx2x-e1-7.12.30.0.fw \
134 /lib/firmware/bnx2x/bnx2x-e1-7.2.16.0.fw \
135 /lib/firmware/bnx2x/bnx2x-e1-7.2.51.0.fw \
136 /lib/firmware/bnx2x/bnx2x-e1-7.8.17.0.fw \
137 /lib/firmware/bnx2x/bnx2x-e1-7.8.19.0.fw \
138 /lib/firmware/bnx2x/bnx2x-e1-7.8.2.0.fw \
139 /lib/firmware/bnx2x/bnx2x-e1h-6.0.34.0.fw \
140 /lib/firmware/bnx2x/bnx2x-e1h-6.2.5.0.fw \
141 /lib/firmware/bnx2x/bnx2x-e1h-6.2.9.0.fw \
142 /lib/firmware/bnx2x/bnx2x-e1h-7.0.20.0.fw \
143 /lib/firmware/bnx2x/bnx2x-e1h-7.0.23.0.fw \
144 /lib/firmware/bnx2x/bnx2x-e1h-7.0.29.0.fw \
145 /lib/firmware/bnx2x/bnx2x-e1h-7.10.51.0.fw \
146 /lib/firmware/bnx2x/bnx2x-e1h-7.12.30.0.fw \
147 /lib/firmware/bnx2x/bnx2x-e1h-7.2.16.0.fw \
148 /lib/firmware/bnx2x/bnx2x-e1h-7.2.51.0.fw \
149 /lib/firmware/bnx2x/bnx2x-e1h-7.8.17.0.fw \
150 /lib/firmware/bnx2x/bnx2x-e1h-7.8.19.0.fw \
151 /lib/firmware/bnx2x/bnx2x-e1h-7.8.2.0.fw \
152 /lib/firmware/bnx2x/bnx2x-e2-6.0.34.0.fw \
153 /lib/firmware/bnx2x/bnx2x-e2-6.2.5.0.fw \
154 /lib/firmware/bnx2x/bnx2x-e2-6.2.9.0.fw \
155 /lib/firmware/bnx2x/bnx2x-e2-7.0.20.0.fw \
156 /lib/firmware/bnx2x/bnx2x-e2-7.0.23.0.fw \
157 /lib/firmware/bnx2x/bnx2x-e2-7.0.29.0.fw \
158 /lib/firmware/bnx2x/bnx2x-e2-7.10.51.0.fw \
159 /lib/firmware/bnx2x/bnx2x-e2-7.12.30.0.fw \
160 /lib/firmware/bnx2x/bnx2x-e2-7.2.16.0.fw \
161 /lib/firmware/bnx2x/bnx2x-e2-7.2.51.0.fw \
162 /lib/firmware/bnx2x/bnx2x-e2-7.8.17.0.fw \
163 /lib/firmware/bnx2x/bnx2x-e2-7.8.19.0.fw \
164 /lib/firmware/bnx2x/bnx2x-e2-7.8.2.0.fw \
165 /lib/firmware/cbfw-3.2.1.1.bin \
166 /lib/firmware/cbfw-3.2.3.0.bin \
167 /lib/firmware/ct2fw-3.2.1.1.bin \
168 /lib/firmware/ct2fw-3.2.3.0.bin \
169 /lib/firmware/ctfw-3.2.1.1.bin \
170 /lib/firmware/ctfw-3.2.3.0.bin \
171 /lib/firmware/intel/ice/ddp/ice-1.3.28.0.pkg \
8f312961 172 /lib/firmware/intel/ibt-* \
3b01f08a 173 /lib/firmware/intelliport2.bin \
d62babe0 174 /lib/firmware/LICENCE* \
8f312961
PM
175 /lib/firmware/mediatek/BT_RAM_CODE_MT7922_1_1_hdr.bin \
176 /lib/firmware/mediatek/BT_RAM_CODE_MT7961_1_2_hdr.bin \
3b01f08a 177 /lib/firmware/tr_smctr.bin \
41a518ae 178 /usr/bin/perl5.32* \
8f4b4833 179 /usr/lib/libbfd-2.37.so \
4c4953a0 180 /usr/lib/libbind9-9.16.31.so \
80305dd4 181 /usr/lib/libbind9-9.16.32.so \
d62babe0 182 /usr/lib/libdns-9.16.2* \
4c4953a0 183 /usr/lib/libdns-9.16.31.so \
80305dd4 184 /usr/lib/libdns-9.16.32.so \
1564096b
PM
185 /usr/lib/libefiboot.so.1.37 \
186 /usr/lib/libefivar.so.1.37 \
1c154e51 187 /usr/lib/libexpat.so.1.8.8 \
c6e683d0 188 /usr/lib/libhogweed.so.6.4 \
4c4953a0 189 /usr/lib/libirs-9.16.31.so \
80305dd4 190 /usr/lib/libirs-9.16.32.so \
4c4953a0 191 /usr/lib/libisc-9.16.31.so \
80305dd4 192 /usr/lib/libisc-9.16.32.so \
4c4953a0 193 /usr/lib/libisccc-9.16.31.so \
80305dd4 194 /usr/lib/libisccc-9.16.32.so \
4c4953a0 195 /usr/lib/libisccfg-9.16.31.so \
80305dd4 196 /usr/lib/libisccfg-9.16.32.so \
c6e683d0 197 /usr/lib/libnettle.so.8.4 \
4c4953a0 198 /usr/lib/libns-9.16.31.so \
80305dd4 199 /usr/lib/libns-9.16.32.so \
d62babe0 200 /usr/lib/libopcodes-2.36* \
8f4b4833 201 /usr/lib/libopcodes-2.37.so \
64fc1360 202 /usr/lib/libunbound.so.8.1.18 \
41a518ae 203 /usr/lib/perl5/5.32* \
d62babe0 204 /usr/lib/perl5/site_perl/5.32* \
c309bdcf 205 /usr/share/man/* \
d62babe0
PM
206 /usr/share/usb_modeswitch/1004:61aa \
207 /usr/share/usb_modeswitch/12d1:\#android \
208 /usr/share/usb_modeswitch/12d1:\#linux \
209 /usr/share/usb_modeswitch/19d2:\#linux \
c153f735 210 /sbin/tipc \
d62babe0 211 /srv/web/ipfire/html/themes/ipfire/include/css/style-rounded.css
67eff38d
PM
212
213# Extract files
214extract_files
215
216# update linker config
217ldconfig
218
219# Update Language cache
220/usr/local/bin/update-lang-cache
221
222# Filesytem cleanup
223/usr/local/bin/filesystem-cleanup
224
c073cb7f
PM
225# Rebuild fcrontab from scratch
226/usr/bin/fcrontab -z
227
520d2144
PM
228# Fix backup file permissions
229chown -v root:root /var/ipfire/backup/{in,ex}clude*
230
67eff38d 231# Start services
b029818d 232/etc/rc.d/init.d/collectd start
415afe55 233if grep -q "ENABLE_IDS=on" /var/ipfire/suricata/settings; then
2f0fb449
PM
234 /etc/rc.d/init.d/suricata start
235fi
64fc1360 236/etc/rc.d/init.d/unbound start
79fb0874 237/etc/rc.d/init.d/apache start
3ce996ff 238if grep -q "ENABLED=on" /var/ipfire/ovpn/settings; then
492c9fb6
PM
239 /usr/local/bin/openvpnctrl -s
240 /usr/local/bin/openvpnctrl -sn2n
3ce996ff 241fi
78ba0514
PM
242if grep -q "ENABLED=on" /var/ipfire/vpn/settings; then
243 /etc/init.d/ipsec start
244fi
492c9fb6 245if [ -f /var/ipfire/proxy/enable ]; then
3ce996ff
PM
246 /etc/init.d/squid start
247fi
248
42368583
PM
249# Regenerate all initrds
250dracut --regenerate-all --force
251case "$(uname -m)" in
252 armv*)
253 mkimage -A arm -T ramdisk -C lzma -d /boot/initramfs-${KVER}-ipfire.img /boot/uInit-${KVER}-ipfire
254 rm /boot/initramfs-${KVER}-ipfire.img
255 ;;
256 aarch64)
257 mkimage -A arm64 -T ramdisk -C lzma -d /boot/initramfs-${KVER}-ipfire.img /boot/uInit-${KVER}-ipfire
258 # dont remove initramfs because grub need this to boot.
259 ;;
260esac
261
67eff38d 262# This update needs a reboot...
0892c58e 263touch /var/run/need_reboot
67eff38d 264
42368583
PM
265# remove lm_sensor config after collectd was started
266# to reserch sensors at next boot with updated kernel
267rm -f /etc/sysconfig/lm_sensors
268
269# Upadate Kernel version in uEnv.txt
270if [ -e /boot/uEnv.txt ]; then
271 sed -i -e "s/KVER=.*/KVER=${KVER}/g" /boot/uEnv.txt
272fi
273
274# Call user update script (needed for some ARM boards)
275if [ -e /boot/pakfire-kernel-update ]; then
276 /boot/pakfire-kernel-update ${KVER}
277fi
278
67eff38d
PM
279# Finish
280/etc/init.d/fireinfo start
281sendprofile
282
283# Update grub config to display new core version
284if [ -e /boot/grub/grub.cfg ]; then
285 grub-mkconfig -o /boot/grub/grub.cfg
286fi
287
288sync
289
290# Don't report the exitcode last command
291exit 0