. /opt/pakfire/lib/functions.sh
/usr/local/bin/backupctrl exclude >/dev/null 2>&1
+
+function find_device() {
+ local mountpoint="${1}"
+
+ local root
+ local dev mp fs flags rest
+ while read -r dev mp fs flags rest; do
+ # Skip unwanted entries
+ [ "${dev}" = "rootfs" ] && continue
+
+ if [ "${mp}" = "${mountpoint}" ] && [ -b "${dev}" ]; then
+ root="$(basename "${dev}")"
+ break
+ fi
+ done < /proc/mounts
+
+ # Get the actual device from the partition that holds /
+ while [ -n "${root}" ]; do
+ if [ -e "/sys/block/${root}" ]; then
+ echo "${root}"
+ return 0
+ fi
+
+ # Remove last character
+ root="${root::-1}"
+ done
+
+ return 1
+}
+
+
#
# Remove old core updates from pakfire cache to save space...
core=86
echo
echo Update Kernel to $KVER ...
#
-# Remove old kernel, configs, initrd, modules ...
+# Remove old kernel, configs, initrd, modules, dtb's ...
#
rm -rf /boot/System.map-*
rm -rf /boot/config-*
rm -rf /boot/vmlinuz-*
rm -rf /boot/uImage-ipfire-*
rm -rf /boot/uInit-ipfire-*
+rm -rf /boot/dtb-*-ipfire-*
rm -rf /lib/modules
case "$(uname -m)" in
i?86)
- # Backup grub.conf
- cp -vf /boot/grub/grub.conf /boot/grub-legacy.conf
+ # Backup old grub config
+ if [ -f /boot/grub/grub.conf ]; then
+ cp -vf /boot/grub/grub.conf /boot/old-grub-config
+ fi
+ if [ -f /boot/grub/menu.lst ]; then
+ cp -vf /boot/grub/menu.lst /boot/old-grub-config
+ fi
+ if [ -f /boot/grub/grub.cfg ]; then
+ cp -vf /boot/grub/grub.cfg /boot/old-grub-config
+ fi
# Remove all files that belong to GRUB-legacy
rm -rfv /boot/grub
;;
+ armv*)
+ # Backup uEnv.txt if exist
+ if [ -e /boot/uEnv.txt ]; then
+ cp -vf /boot/uEnv.txt /boot/uEnv.txt.org
+ fi
+
+ # work around the u-boot folder detection bug
+ mkdir -pv /boot/dtb-$KVER-ipfire-kirkwood
+ mkdir -pv /boot/dtb-$KVER-ipfire-multi
+ ;;
esac
+
#
#Stop services
/etc/init.d/snort stop
# Special handling for old kirkwood images.
# (install only kirkwood kernel)
rm -rf /boot/*
+ # work around the u-boot folder detection bug
+ mkdir -pv /boot/dtb-$KVER-ipfire-kirkwood
tar xavf /opt/pakfire/tmp/files* --no-overwrite-dir -p \
--numeric-owner -C / --wildcards 'boot/*-kirkwood*'
;;
case "$(uname -m)" in
i?86)
- #
- # Update to GRUB2
- #
- echo
- echo Update grub configuration ...
- if grep -qE "^serial" /boot/grub-legacy.conf; then
- sed -i /etc/default/grub \
- -e "s| panic=10 | console=ttyS0,115200n8 panic=10 |g"
- echo "GRUB_TERMINAL=\"serial\"" >> /etc/default/grub
- echo "GRUB_SERIAL_COMMAND=\"serial --unit=0 --speed=115200\"" >> /etc/default/grub
- fi
+ case "$(find_device "/")" in
+ xvd* )
+ echo Skip bootloader update on xen.
+ ;;
+ * )
+ #
+ # Update to GRUB2
+ #
+ echo
+ echo Update grub configuration ...
+ if grep -qE "^serial" /boot/old-grub-config; then
+ sed -i /etc/default/grub \
+ -e "s|panic=10|& console=ttyS0,115200n8|g"
+ echo "GRUB_TERMINAL=\"serial\"" >> /etc/default/grub
+ echo "GRUB_SERIAL_COMMAND=\"serial --unit=0 --speed=115200\"" >> /etc/default/grub
+ fi
- if ! /usr/local/bin/update-bootloader; then
- logger -p syslog.emerg -t ipfire \
- "Could not update the bootloader!"
- fi
- ;;
+ if ! /usr/local/bin/update-bootloader; then
+ logger -p syslog.emerg -t ipfire \
+ "Could not update the bootloader!"
+ fi
+ ;;
+ esac
esac
# Force (re)install pae kernel if pae is supported
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: 0" >> /opt/pakfire/db/installed/meta-linux-xen
- echo "Release: 0" >> /opt/pakfire/db/installed/meta-linux-xen
- echo "Name: linux-xen" > /opt/pakfire/db/meta/meta-linux-xen
- echo "ProgVersion: 0" >> /opt/pakfire/db/meta/meta-linux-xen
- echo "Release: 0" >> /opt/pakfire/db/meta/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
#