# armv7h mkinitcpio and install hooks do not manage the /boot dir properly (BR #3520)

_pkgbase=linux-libre-vanilla
_variant=${_pkgbase#linux-libre}
_kernel_dest=boot/vmlinuz-${_pkgbase}

_install()
{
  local pkgver=${1%-*}
  local kver=${pkgver}-gnu-[0-9]${_variant}

  [[ ! -f "${_kernel_dest}" ]] || ! echo "nothing to do" || return 0

# mv ${kver} 2> /dev/null            ${_kernel_dest} ||
  mv ${kver}                         ${_kernel_dest} ||
  cp usr/lib/modules/${kver}/vmlinuz ${_kernel_dest}
}

post_install() { _install $1 ; }

post_upgrade() { _install $1 ; }

post_remove()
{
  [[ -f boot/initramfs-${_pkgbase}.img ]] ||
  [[ -f boot/vmlinuz-${_pkgbase}       ]] || ! echo "nothing to do" || return 0

  rm -f boot/initramfs-${_pkgbase}.img
  rm -f boot/vmlinuz-${_pkgbase}
}
