#!/bin/bash

set -e

gzip -t ${2} 2>/dev/null && gzip -dc ${2} >${2/vmlinuz/vmlinux} || mv ${2} ${2/vmlinuz/vmlinux}

ln -sfr ${2/vmlinuz/vmlinux} /boot
ln -sfr ${2/vmlinuz/vmlinux} /boot/vmlinux
ln -sfr $(dirname ${2})/initrd.img-${1} /boot
ln -sfr $(dirname ${2})/initrd.img-${1} /boot/initrd.img

f=/usr/local/sbin/mkefimenu
[[ -z ${f} ]] && echo -e "${BOLD}${f}${RESET}: [ ${BROWN}${BOLD}warn${RESET} ]: not found" >&2 || ${f} -c -k ${1}
