flash_kernel() { major=$(mountpoint -d / | cut -f 1 -d ':') minor=$(mountpoint -d / | cut -f 2 -d ':') device=$(awk '{if ($1 == "'"${major}"'" && $2 == "'"${minor}"'") print $4}' < /proc/partitions) device="/dev/${device/%2/1}" echo "A new kernel version needs to be flashed onto ${device}." echo -n " do you want to do this now? [y/N] " read -n 1 -r (( ${#REPLY} == 1 )) && echo if [[ ! $REPLY =~ ^[Yy]$ ]]; then echo "You can do this later by running:" echo "# dd if=/boot/vmlinux.kpart of=${device}" else dd if=/boot/vmlinux.kpart of="${device}" sync fi } post_install () { flash_kernel } post_upgrade() { if [ "$(uname -m)" = "x86_64" ] || [ "$(uname -m)" = "i686" ]; then if findmnt --fstab -uno SOURCE /boot &>/dev/null && ! mountpoint -q /boot; then echo "WARNING: /boot appears to be a separate partition but is not mounted." fi fi flash_kernel } post_remove() { rm -f boot/initramfs-%PKGBASE%.img rm -f boot/initramfs-%PKGBASE%-fallback.img }