2 ############################################################################
4 # This file is part of the IPFire Firewall. #
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. #
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. #
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 #
20 # Copyright (C) 2014 IPFire-Team <info@ipfire.org>. #
22 ############################################################################
24 .
/opt
/pakfire
/lib
/functions.sh
25 /usr
/local
/bin
/backupctrl exclude
>/dev
/null
2>&1
28 # Remove old core updates from pakfire cache to save space...
30 for (( i
=1; i
<=${core}; i
++ ))
32 rm -f /var
/cache
/pakfire
/core-upgrade-
*-$i.ipfire
36 # Do some sanity checks.
39 /usr
/bin
/logger
-p syslog.emerg
-t ipfire \
40 "core-update-${core}: ERROR cannot update. versatile support is dropped."
41 # Report no error to pakfire. So it does not try to install it again.
48 /usr
/bin
/logger
-p syslog.emerg
-t ipfire \
49 "core-update-${core}: ERROR cannot update. No IPFire Kernel."
59 # Check diskspace on root
60 ROOTSPACE
=`df / -Pk | sed "s| * | |g" | cut -d" " -f4 | tail -n 1`
62 if [ $ROOTSPACE -lt 100000 ]; then
63 /usr
/bin
/logger
-p syslog.emerg
-t ipfire \
64 "core-update-${core}: ERROR cannot update because not enough free space on root."
70 echo Update Kernel to
$KVER ...
72 # Remove old kernel, configs, initrd, modules, dtb's ...
74 rm -rf /boot
/System.map-
*
76 rm -rf /boot
/ipfirerd-
*
77 rm -rf /boot
/initramfs-
*
78 rm -rf /boot
/vmlinuz-
*
79 rm -rf /boot
/uImage-ipfire-
*
80 rm -rf /boot
/uInit-ipfire-
*
81 rm -rf /boot
/dtb-
*-ipfire-*
87 cp -vf /boot
/grub
/grub.conf
/boot
/grub-legacy.conf
89 # Remove all files that belong to GRUB-legacy
93 # Backup uEnv.txt if exist
94 if [ -e /boot
/uEnv.txt
]; then
95 cp -vf /boot
/uEnv.txt
/boot
/uEnv.txt.org
100 /etc
/init.d
/snort stop
101 /etc
/init.d
/squid stop
102 /etc
/init.d
/ipsec stop
103 /etc
/init.d
/apache stop
107 tar xavf
/opt
/pakfire
/tmp
/files
* --no-overwrite-dir -p --numeric-owner -C /
110 #restart init because glibc was updated.
113 # Check diskspace on boot
114 BOOTSPACE
=`df /boot -Pk | sed "s| * | |g" | cut -d" " -f4 | tail -n 1`
116 if [ $BOOTSPACE -lt 1000 ]; then
119 # Special handling for old kirkwood images.
120 # (install only kirkwood kernel)
122 tar xavf
/opt
/pakfire
/tmp
/files
* --no-overwrite-dir -p \
123 --numeric-owner -C / --wildcards 'boot/*-kirkwood*'
126 /usr
/bin
/logger
-p syslog.emerg
-t ipfire \
127 "core-update-${core}: FATAL-ERROR space run out on boot. System is not bootable..."
128 /etc
/init.d
/apache start
134 # Update Language cache
135 perl
-e "require '/var/ipfire/lang.pl'; &Lang::BuildCacheLang"
137 # Add nobody to group dialout
138 usermod
-a -G dialout nobody
143 /etc
/init.d
/apache start
144 /etc
/init.d
/squid start
145 /etc
/init.d
/snort start
146 if [ `grep "ENABLED=on" /var/ipfire/vpn/settings` ]; then
147 /etc
/init.d
/ipsec start
150 case "$(uname -m)" in
156 echo Update grub configuration ...
157 if grep -qE "^serial" /boot
/grub-legacy.conf
; then
158 sed -i /etc
/default
/grub \
159 -e "s| panic=10 | console=ttyS0,115200n8 panic=10 |g"
160 echo "GRUB_TERMINAL=\"serial\"" >> /etc
/default
/grub
161 echo "GRUB_SERIAL_COMMAND=\"serial --unit=0 --speed=115200\"" >> /etc
/default
/grub
164 if ! /usr
/local
/bin
/update-bootloader
; then
165 logger
-p syslog.emerg
-t ipfire \
166 "Could not update the bootloader!"
171 # Force (re)install pae kernel if pae is supported
172 rm -rf /opt
/pakfire
/db
/*/meta-linux-pae
173 if [ ! "$(grep "^flags.
* pae
" /proc/cpuinfo)" == "" ]; then
174 ROOTSPACE
=`df / -Pk | sed "s| * | |g" | cut -d" " -f4 | tail -n 1`
175 BOOTSPACE
=`df /boot -Pk | sed "s| * | |g" | cut -d" " -f4 | tail -n 1`
176 if [ $BOOTSPACE -lt 12000 -o $ROOTSPACE -lt 90000 ]; then
177 /usr
/bin
/logger
-p syslog.emerg
-t ipfire \
178 "core-update-${core}: WARNING not enough space for pae kernel."
180 echo "Name: linux-pae" > /opt
/pakfire
/db
/installed
/meta-linux-pae
181 echo "ProgVersion: 0" >> /opt
/pakfire
/db
/installed
/meta-linux-pae
182 echo "Release: 0" >> /opt
/pakfire
/db
/installed
/meta-linux-pae
183 echo "Name: linux-pae" > /opt
/pakfire
/db
/meta
/meta-linux-pae
184 echo "ProgVersion: 0" >> /opt
/pakfire
/db
/meta
/meta-linux-pae
185 echo "Release: 0" >> /opt
/pakfire
/db
/meta
/meta-linux-pae
190 # After pakfire has ended run it again and update the lists and do upgrade
192 echo '#!/bin/bash' > /tmp
/pak_update
193 echo 'while [ "$(ps -A | grep " update.sh")" != "" ]; do' >> /tmp
/pak_update
194 echo ' sleep 1' >> /tmp
/pak_update
195 echo 'done' >> /tmp
/pak_update
196 echo 'while [ "$(ps -A | grep " pakfire")" != "" ]; do' >> /tmp
/pak_update
197 echo ' sleep 1' >> /tmp
/pak_update
198 echo 'done' >> /tmp
/pak_update
199 echo '/opt/pakfire/pakfire update -y --force' >> /tmp
/pak_update
200 echo '/opt/pakfire/pakfire upgrade -y' >> /tmp
/pak_update
201 echo '/opt/pakfire/pakfire upgrade -y' >> /tmp
/pak_update
202 echo '/opt/pakfire/pakfire upgrade -y' >> /tmp
/pak_update
203 echo '/usr/bin/logger -p syslog.emerg -t ipfire "Core-upgrade finished. If you use a customized grub/uboot config"' >> /tmp
/pak_update
204 echo '/usr/bin/logger -p syslog.emerg -t ipfire "Check it before reboot !!!"' >> /tmp
/pak_update
205 echo '/usr/bin/logger -p syslog.emerg -t ipfire " *** Please reboot... *** "' >> /tmp
/pak_update
206 echo 'touch /var/run/need_reboot ' >> /tmp
/pak_update
208 killall
-KILL pak_update
209 chmod +x
/tmp
/pak_update
217 /etc
/init.d
/fireinfo start
221 # Update Package list for addon installation
222 /opt
/pakfire
/pakfire update
-y --force
225 echo Please
wait until pakfire has ended...
228 # Don't report the exitcode last command