mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-13 12:32:59 +02:00
Conflicts: config/rootfiles/core/121/filelists/acpid config/rootfiles/core/121/filelists/apache2 config/rootfiles/core/121/filelists/apr config/rootfiles/core/121/filelists/aprutil config/rootfiles/core/121/filelists/armv5tel/files config/rootfiles/core/121/filelists/armv5tel/linux-initrd-kirkwood config/rootfiles/core/121/filelists/armv5tel/linux-initrd-multi config/rootfiles/core/121/filelists/armv5tel/linux-kirkwood config/rootfiles/core/121/filelists/armv5tel/linux-multi config/rootfiles/core/121/filelists/armv5tel/rpi-firmware config/rootfiles/core/121/filelists/armv5tel/u-boot config/rootfiles/core/121/filelists/armv5tel/u-boot-kirkwood config/rootfiles/core/121/filelists/armv5tel/u-boot-mkimage config/rootfiles/core/121/filelists/beep config/rootfiles/core/121/filelists/cmake config/rootfiles/core/121/filelists/crda config/rootfiles/core/121/filelists/dhcp config/rootfiles/core/121/filelists/flex config/rootfiles/core/121/filelists/i586/grub config/rootfiles/core/121/filelists/i586/intel-microcode config/rootfiles/core/121/filelists/i586/linux config/rootfiles/core/121/filelists/i586/linux-initrd config/rootfiles/core/121/filelists/iw config/rootfiles/core/121/filelists/jwhois config/rootfiles/core/121/filelists/libidn config/rootfiles/core/121/filelists/multipath-tools config/rootfiles/core/121/filelists/pcre config/rootfiles/core/121/filelists/tar config/rootfiles/core/121/filelists/unbound config/rootfiles/core/121/filelists/wget config/rootfiles/core/121/filelists/x86_64/grub config/rootfiles/core/121/filelists/x86_64/intel-microcode config/rootfiles/core/121/filelists/x86_64/linux config/rootfiles/core/121/filelists/x86_64/linux-initrd config/rootfiles/core/122/filelists/aarch64/files config/rootfiles/core/122/filelists/acpid config/rootfiles/core/122/filelists/apache2 config/rootfiles/core/122/filelists/apr config/rootfiles/core/122/filelists/aprutil config/rootfiles/core/122/filelists/armv5tel/linux-initrd-kirkwood config/rootfiles/core/122/filelists/armv5tel/linux-initrd-multi config/rootfiles/core/122/filelists/armv5tel/linux-kirkwood config/rootfiles/core/122/filelists/armv5tel/linux-multi config/rootfiles/core/122/filelists/armv5tel/rpi-firmware config/rootfiles/core/122/filelists/armv5tel/u-boot config/rootfiles/core/122/filelists/armv5tel/u-boot-kirkwood config/rootfiles/core/122/filelists/armv5tel/u-boot-mkimage config/rootfiles/core/122/filelists/beep config/rootfiles/core/122/filelists/cmake config/rootfiles/core/122/filelists/crda config/rootfiles/core/122/filelists/dhcp config/rootfiles/core/122/filelists/flex config/rootfiles/core/122/filelists/i586/grub config/rootfiles/core/122/filelists/i586/intel-microcode config/rootfiles/core/122/filelists/i586/linux config/rootfiles/core/122/filelists/i586/linux-initrd config/rootfiles/core/122/filelists/iw config/rootfiles/core/122/filelists/jwhois config/rootfiles/core/122/filelists/libidn config/rootfiles/core/122/filelists/multipath-tools config/rootfiles/core/122/filelists/pcre config/rootfiles/core/122/filelists/tar config/rootfiles/core/122/filelists/unbound config/rootfiles/core/122/filelists/wget config/rootfiles/core/122/filelists/x86_64/grub config/rootfiles/core/122/filelists/x86_64/intel-microcode config/rootfiles/core/122/filelists/x86_64/linux config/rootfiles/core/122/filelists/x86_64/linux-initrd config/rootfiles/core/123/filelists/unbound config/rootfiles/oldcore/121/filelists/acpid config/rootfiles/oldcore/121/filelists/apache2 config/rootfiles/oldcore/121/filelists/apr config/rootfiles/oldcore/121/filelists/aprutil config/rootfiles/oldcore/121/filelists/armv5tel/files config/rootfiles/oldcore/121/filelists/armv5tel/linux-initrd-kirkwood config/rootfiles/oldcore/121/filelists/armv5tel/linux-initrd-multi config/rootfiles/oldcore/121/filelists/armv5tel/linux-initrd-rpi config/rootfiles/oldcore/121/filelists/armv5tel/linux-kirkwood config/rootfiles/oldcore/121/filelists/armv5tel/linux-multi config/rootfiles/oldcore/121/filelists/armv5tel/linux-rpi config/rootfiles/oldcore/121/filelists/armv5tel/rpi-firmware config/rootfiles/oldcore/121/filelists/armv5tel/u-boot config/rootfiles/oldcore/121/filelists/armv5tel/u-boot-kirkwood config/rootfiles/oldcore/121/filelists/armv5tel/u-boot-mkimage config/rootfiles/oldcore/121/filelists/beep config/rootfiles/oldcore/121/filelists/cmake config/rootfiles/oldcore/121/filelists/crda config/rootfiles/oldcore/121/filelists/dhcp config/rootfiles/oldcore/121/filelists/flex config/rootfiles/oldcore/121/filelists/i586/grub config/rootfiles/oldcore/121/filelists/i586/intel-microcode config/rootfiles/oldcore/121/filelists/i586/linux config/rootfiles/oldcore/121/filelists/i586/linux-initrd config/rootfiles/oldcore/121/filelists/iw config/rootfiles/oldcore/121/filelists/jwhois config/rootfiles/oldcore/121/filelists/libidn config/rootfiles/oldcore/121/filelists/multipath-tools config/rootfiles/oldcore/121/filelists/pcre config/rootfiles/oldcore/121/filelists/tar config/rootfiles/oldcore/121/filelists/wget config/rootfiles/oldcore/121/filelists/x86_64/grub config/rootfiles/oldcore/121/filelists/x86_64/intel-microcode config/rootfiles/oldcore/121/filelists/x86_64/linux config/rootfiles/oldcore/121/filelists/x86_64/linux-initrd make.sh
116 lines
4.2 KiB
Bash
116 lines
4.2 KiB
Bash
#!/bin/bash
|
|
############################################################################
|
|
# #
|
|
# This file is part of the IPFire Firewall. #
|
|
# #
|
|
# IPFire is free software; you can redistribute it and/or modify #
|
|
# it under the terms of the GNU General Public License as published by #
|
|
# the Free Software Foundation; either version 3 of the License, or #
|
|
# (at your option) any later version. #
|
|
# #
|
|
# IPFire is distributed in the hope that it will be useful, #
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
|
|
# GNU General Public License for more details. #
|
|
# #
|
|
# You should have received a copy of the GNU General Public License #
|
|
# along with IPFire; if not, write to the Free Software #
|
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
|
# #
|
|
# Copyright (C) 2018 IPFire-Team <info@ipfire.org>. #
|
|
# #
|
|
############################################################################
|
|
#
|
|
. /opt/pakfire/lib/functions.sh
|
|
/usr/local/bin/backupctrl exclude >/dev/null 2>&1
|
|
|
|
core=121
|
|
|
|
exit_with_error() {
|
|
# Set last succesfull installed core.
|
|
echo $(($core-1)) > /opt/pakfire/db/core/mine
|
|
# don't start pakfire again at error
|
|
killall -KILL pak_update
|
|
/usr/bin/logger -p syslog.emerg -t ipfire \
|
|
"core-update-${core}: $1"
|
|
exit $2
|
|
}
|
|
|
|
# Remove old core updates from pakfire cache to save space...
|
|
for (( i=1; i<=$core; i++ )); do
|
|
rm -f /var/cache/pakfire/core-upgrade-*-$i.ipfire
|
|
done
|
|
|
|
# Do some sanity checks.
|
|
case $(uname -r) in
|
|
*-ipfire*)
|
|
# Ok.
|
|
;;
|
|
*)
|
|
exit_with_error "ERROR cannot update. No IPFire Kernel." 1
|
|
;;
|
|
esac
|
|
|
|
# Check diskspace on root
|
|
ROOTSPACE=`df / -Pk | sed "s| * | |g" | cut -d" " -f4 | tail -n 1`
|
|
|
|
if [ $ROOTSPACE -lt 220000 ]; then
|
|
exit_with_error "ERROR cannot update because not enough free space on root." 2
|
|
exit 2
|
|
fi
|
|
|
|
# Stop services
|
|
|
|
# Extract files
|
|
extract_files
|
|
|
|
# update linker config
|
|
ldconfig
|
|
|
|
# Update Language cache
|
|
|
|
# Start services
|
|
/etc/init.d/apache restart
|
|
|
|
# This update needs a reboot...
|
|
#touch /var/run/need_reboot
|
|
|
|
# Finish
|
|
/etc/init.d/fireinfo start
|
|
sendprofile
|
|
|
|
# Update grub config to display new core version
|
|
if [ -e /boot/grub/grub.cfg ]; then
|
|
grub-mkconfig -o /boot/grub/grub.cfg
|
|
fi
|
|
|
|
|
|
#
|
|
# After pakfire has ended run it again and update the lists and do upgrade
|
|
#
|
|
echo '#!/bin/bash' > /tmp/pak_update
|
|
echo 'while [ "$(ps -A | grep " update.sh")" != "" ]; do' >> /tmp/pak_update
|
|
echo ' sleep 1' >> /tmp/pak_update
|
|
echo 'done' >> /tmp/pak_update
|
|
echo 'while [ "$(ps -A | grep " pakfire")" != "" ]; do' >> /tmp/pak_update
|
|
echo ' sleep 1' >> /tmp/pak_update
|
|
echo 'done' >> /tmp/pak_update
|
|
echo '/opt/pakfire/pakfire update -y --force' >> /tmp/pak_update
|
|
echo '/opt/pakfire/pakfire upgrade -y' >> /tmp/pak_update
|
|
echo '/opt/pakfire/pakfire upgrade -y' >> /tmp/pak_update
|
|
echo '/opt/pakfire/pakfire upgrade -y' >> /tmp/pak_update
|
|
echo '/usr/bin/logger -p syslog.emerg -t ipfire "Core-upgrade finished. If you use a customized grub/uboot config"' >> /tmp/pak_update
|
|
echo '/usr/bin/logger -p syslog.emerg -t ipfire "Check it before reboot !!!"' >> /tmp/pak_update
|
|
echo '/usr/bin/logger -p syslog.emerg -t ipfire " *** Please reboot... *** "' >> /tmp/pak_update
|
|
echo 'touch /var/run/need_reboot ' >> /tmp/pak_update
|
|
#
|
|
killall -KILL pak_update
|
|
chmod +x /tmp/pak_update
|
|
/tmp/pak_update &
|
|
|
|
sync
|
|
|
|
# Don't report the exitcode last command
|
|
exit 0
|
|
|