mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-11 19:55:52 +02:00
updater: several improvements and fixes.
print log errors to "ipfire:" so it will showed at webif. check free space on root. initiate pae kernel installation if pae is supported.
This commit is contained in:
@@ -35,7 +35,9 @@ function add_to_backup ()
|
||||
|
||||
#
|
||||
# Remove old core updates from pakfire cache to save space...
|
||||
core=65
|
||||
#
|
||||
# TODO: need to be corrected before release
|
||||
core=64
|
||||
for (( i=1; i<=$core; i++ ))
|
||||
do
|
||||
rm -f /var/cache/pakfire/core-upgrade-*-$i.ipfire
|
||||
@@ -44,8 +46,8 @@ done
|
||||
#
|
||||
# Do some sanity checks.
|
||||
if [ ! "$(mount | grep " reiser4 (")" == "" ]; then
|
||||
/usr/bin/logger -p syslog.emerg -t core-upgrade-$core \
|
||||
"ERROR: cannot update because there is a reiser4 fs mounted."
|
||||
/usr/bin/logger -p syslog.emerg -t ipfire \
|
||||
"core-update-$core: ERROR cannot update because there is a reiser4 fs mounted."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -81,12 +83,22 @@ add_to_backup lib/libncurses*
|
||||
add_to_backup etc/dircolors
|
||||
add_to_backup etc/profile.d
|
||||
add_to_backup usr/share/terminfo
|
||||
|
||||
add_to_backup etc/sysconfig/lm_sensors
|
||||
add_to_backup etc/sysconfig/rc.local
|
||||
|
||||
# Backup the files
|
||||
tar cJvf /var/ipfire/backup/core-upgrade_$KVER.tar.xz \
|
||||
-C / -T /opt/pakfire/tmp/ROOTFILES --exclude='#*' --exclude='/var/cache' > /dev/null 2>&1
|
||||
|
||||
# Check diskspace on root
|
||||
ROOTSPACE=`df / -Pk | sed "s| * | |g" | cut -d" " -f4 | tail -n 1`
|
||||
|
||||
if [ $ROOTSPACE -lt 70000 ]; then
|
||||
/usr/bin/logger -p syslog.emerg -t ipfire \
|
||||
"core-update-$core: ERROR cannot update because not enough free space on root."
|
||||
exit 2
|
||||
fi
|
||||
|
||||
echo
|
||||
echo Update Kernel to $KVER ...
|
||||
#
|
||||
@@ -196,6 +208,11 @@ grub-install --no-floppy ${ROOT::`expr length $ROOT`-1} --recheck
|
||||
#
|
||||
rm -rf /etc/sysconfig/lm_sensors
|
||||
|
||||
#
|
||||
# Remove powerbutton loop from rc local.
|
||||
#
|
||||
sed -i "/# power button shutdown/,+3d" /etc/sysconfig/rc.local
|
||||
|
||||
#
|
||||
#Update Language cache
|
||||
perl -e "require '/var/ipfire/lang.pl'; &Lang::BuildCacheLang"
|
||||
@@ -206,6 +223,21 @@ perl -e "require '/var/ipfire/lang.pl'; &Lang::BuildCacheLang"
|
||||
rm -rf /opt/pakfire/db/*/meta-fontconfig
|
||||
rm -rf /opt/pakfire/db/*/meta-glib
|
||||
|
||||
# Force (re)install pae kernel if pae is supported
|
||||
rm -rf /opt/pakfire/db/*/meta-linux-pae
|
||||
if [ ! "$(grep "^flags.* pae " /proc/cpuinfo)" == "" ]; then
|
||||
echo "Name: linux-pae" > /opt/pakfire/db/installed/meta-linux-pae
|
||||
echo "ProgVersion: 0" >> /opt/pakfire/db/installed/meta-linux-pae
|
||||
echo "Release: 0" >> /opt/pakfire/db/installed/meta-linux-pae
|
||||
fi
|
||||
|
||||
# Force reinstall xen kernel if it was installed
|
||||
if [ -e "/opt/pakfire/db/installed/meta-linux-xen" ]; then
|
||||
echo "Name: linux-xen" > /opt/pakfire/db/installed/meta-linux-xen
|
||||
echo "ProgVersion: 0" >> /opt/pakfire/db/installed/meta-linux-xen
|
||||
echo "Release: 0" >> /opt/pakfire/db/installed/meta-linux-xen
|
||||
fi
|
||||
|
||||
#
|
||||
# After pakfire has ended run it again and update the lists and do upgrade
|
||||
#
|
||||
@@ -220,9 +252,9 @@ 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 core-upgrade-$core "Upgrade finished. If you use a customized grub.cfg"' >> /tmp/pak_update
|
||||
echo '/usr/bin/logger -p syslog.emerg -t core-upgrade-$core "Check it before reboot !!!"' >> /tmp/pak_update
|
||||
echo '/usr/bin/logger -p syslog.emerg -t core-upgrade-$core " *** Please reboot... *** "' >> /tmp/pak_update
|
||||
echo '/usr/bin/logger -p syslog.emerg -t ipfire "Core-upgrade finished. If you use a customized grub.cfg"' >> /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
|
||||
#
|
||||
chmod +x /tmp/pak_update
|
||||
|
||||
Reference in New Issue
Block a user