]> git.ipfire.org Git - people/ummeegge/ipfire-2.x.git/blob - config/rootfiles/core/182/update.sh
update.sh: If 'ExitNode' is in usage, it will be changed to 'ExitNodes'
[people/ummeegge/ipfire-2.x.git] / config / rootfiles / core / 182 / update.sh
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) 2023 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=182
28
29 # Remove old core updates from pakfire cache to save space...
30 for (( i=1; i<=$core; i++ )); do
31 rm -f /var/cache/pakfire/core-upgrade-*-$i.ipfire
32 done
33
34 # Stop services
35 /etc/rc.d/init.d/ipsec stop
36 /etc/rc.d/init.d/squid stop
37 /etc/rc.d/init.d/unbound stop
38 /etc/rc.d/init.d/sshd stop
39
40 KVER="xxxKVERxxx"
41
42 # Backup uEnv.txt if exist
43 if [ -e /boot/uEnv.txt ]; then
44 cp -vf /boot/uEnv.txt /boot/uEnv.txt.org
45 fi
46
47 # Extract files
48 extract_files
49
50 # Remove files
51 rm -rvf \
52 /lib/firmware/cxgb4/t4fw-1.27.3* \
53 /lib/firmware/cxgb4/t5fw-1.27.3* \
54 /lib/firmware/cxgb4/t6fw-1.27.3* \
55 /lib/firmware/ctefx.bin \
56 /lib/firmware/ctspeq.bin \
57 /lib/firmware/ess \
58 /lib/firmware/intel/ibt-* \
59 /lib/firmware/korg \
60 /lib/firmware/mediatek/BT_RAM_CODE_* \
61 /lib/firmware/nxp \
62 /lib/firmware/sb16 \
63 /lib/firmware/yamaha \
64 /usr/bin/gawk-5.2* \
65 /usr/lib/grub/{arm64-efi,i386-pc,riscv64-efi,x86_64-efi}/gmodule.pl \
66 /usr/lib/liblzma.so.5.4* \
67 /usr/lib/libqpdf.so.29.5* \
68 /usr/lib/libsodium.so.23*
69
70 # update linker config
71 ldconfig
72
73 # Update Language cache
74 /usr/local/bin/update-lang-cache
75
76 # Filesytem cleanup
77 /usr/local/bin/filesystem-cleanup
78
79 # Apply local configuration to sshd_config
80 /usr/local/bin/sshctrl
81
82 # Start services
83 /etc/init.d/unbound start
84 if grep -q "ENABLE_SSH=on" /var/ipfire/remote/settings; then
85 /etc/init.d/sshd start
86 fi
87 if [ -f /var/ipfire/proxy/enable ]; then
88 /etc/init.d/squid start
89 fi
90 if grep -q "ENABLED=on" /var/ipfire/vpn/settings; then
91 /etc/rc.d/init.d/ipsec start
92 fi
93
94 # Change deprecated option in tor configuration file if in usage
95 if grep -q 'ExitNode ' /var/ipfire/tor/torrc; then
96 if pgrep tor >/dev/null; then
97 /usr/local/bin/torctrl stop >/dev/null
98 sed -i 's/ExitNode /ExitNodes /g' /var/ipfire/tor/torrc
99 /usr/local/bin/torctrl restart >/dev/null
100 fi
101 else
102 sed -i 's/ExitNode /ExitNodes /g' /var/ipfire/tor/torrc
103 fi
104
105 # Rebuild initial ramdisks
106 dracut --regenerate-all --force
107 KVER="xxxKVERxxx"
108 case "$(uname -m)" in
109 aarch64)
110 mkimage -A arm64 -T ramdisk -C lzma -d /boot/initramfs-${KVER}-ipfire.img /boot/uInit-${KVER}-ipfire
111 # dont remove initramfs because grub need this to boot.
112 ;;
113 esac
114
115 # Call user update script (needed for some ARM boards)
116 if [ -e /boot/pakfire-kernel-update ]; then
117 /boot/pakfire-kernel-update ${KVER}
118 fi
119
120 # This update needs a reboot...
121 touch /var/run/need_reboot
122
123 # Finish
124 /etc/init.d/fireinfo start
125 sendprofile
126
127 # Grub version was updated, reinstall it
128 if [ -e /boot/grub/grub.cfg ]; then
129 /usr/bin/install-bootloader
130 fi
131
132 sync
133
134 # Don't report the exitcode last command
135 exit 0