+#
+# Start services
+#
+/etc/init.d/apache start
+/etc/init.d/squid start
+/etc/init.d/snort start
+if [ `grep "ENABLED=on" /var/ipfire/vpn/settings` ]; then
+ /etc/init.d/ipsec start
+fi
+
+#
+# Rebuild qosscript if enabled
+#
+if [ -e /var/ipfire/qos/enable ]; then
+ /usr/local/bin/qosctrl stop
+ /usr/local/bin/qosctrl generate
+ /usr/local/bin/qosctrl start
+fi
+
+
+case $(uname -m) in
+ i?86 )
+ #
+ # Modify grub.conf
+ #
+ echo
+ echo Update grub configuration ...
+ ROOT=`mount | grep " / " | cut -d" " -f1`
+
+ if [ ! -z $ROOT ]; then
+ ROOTUUID=`blkid -c /dev/null -sUUID $ROOT | cut -d'"' -f2`
+ fi
+
+ if [ ! -z $ROOTUUID ]; then
+ sed -i "s|ROOT|UUID=$ROOTUUID|g" /boot/grub/grub.conf
+ else
+ sed -i "s|ROOT|$ROOT|g" /boot/grub/grub.conf
+ fi
+ sed -i "s|KVER|$KVER|g" /boot/grub/grub.conf
+ sed -i "s|MOUNT|$MOUNT|g" /boot/grub/grub.conf
+
+ if [ "$(grep "^serial" /boot/grub/grub.conf.org)" == "" ]; then
+ echo "grub use default console ..."
+ else
+ echo "grub use serial console ..."
+ sed -i -e "s|splashimage|#splashimage|g" /boot/grub/grub.conf
+ sed -i -e "s|#serial|serial|g" /boot/grub/grub.conf
+ sed -i -e "s|#terminal|terminal|g" /boot/grub/grub.conf
+ sed -i -e "s| panic=10 | console=ttyS0,115200n8 panic=10 |g" /boot/grub/grub.conf
+ fi
+
+ #
+ # ReInstall grub
+ #
+ echo "(hd0) ${ROOT::`expr length $ROOT`-1}" > /boot/grub/device.map
+ grub-install --no-floppy ${ROOT::`expr length $ROOT`-1}
+ ;;
+esac
+#
+# Delete old lm-sensor modullist to force search at next boot
+#
+rm -rf /etc/sysconfig/lm_sensors
+
+
+# Force (re)install pae kernel if pae is supported
+rm -rf /opt/pakfire/db/*/meta-linux-pae
+if [ ! "$(grep "^flags.* pae " /proc/cpuinfo)" == "" ]; then
+ ROOTSPACE=`df / -Pk | sed "s| * | |g" | cut -d" " -f4 | tail -n 1`
+ BOOTSPACE=`df /boot -Pk | sed "s| * | |g" | cut -d" " -f4 | tail -n 1`
+ if [ $BOOTSPACE -lt 8000 -o $ROOTSPACE -lt 70000 ]; then
+ /usr/bin/logger -p syslog.emerg -t ipfire \
+ "core-update-$core: WARNING not enough space for pae kernel."
+ else
+ echo "Name: linux-pae" > /opt/pakfire/db/installed/meta-linux-pae
+ echo "ProgVersion: 3.10.24" >> /opt/pakfire/db/installed/meta-linux-pae
+ echo "Release: 30" >> /opt/pakfire/db/installed/meta-linux-pae
+ fi
+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: 2.6.32.60" >> /opt/pakfire/db/installed/meta-linux-xen
+ echo "Release: 24" >> /opt/pakfire/db/installed/meta-linux-xen
+ # Add xvc0 to /etc/securetty
+ echo "xvc0" >> /etc/securetty
+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.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
+/tmp/pak_update &