base-files: vkpurge should detect arch specific kernel image (#8360)

On aarch64, kernel images are named `/boot/vmlinux-<version>` rather
than `/boot/vmlinuz-<version>`.  This update checks which architecture
we are running on and selects the appropriate kernel image format.

This fixes #7697.
This commit is contained in:
Peter Bui 2017-10-21 04:00:41 -04:00 committed by Juan RP
parent c65ebc73c2
commit c0e7037941
2 changed files with 9 additions and 4 deletions

View file

@ -5,6 +5,11 @@
# #
: ${progname:=$(basename $0)} : ${progname:=$(basename $0)}
case "$(xbps-uhelper arch)" in
aarch64*) KIMAGE="vmlinux";;
*) KIMAGE="vmlinuz";;
esac
usage() usage()
{ {
cat <<_EOF cat <<_EOF
@ -25,7 +30,7 @@ list_kernels()
{ {
local k kpkg installed kver _f local k kpkg installed kver _f
for k in /boot/vmlinuz-*; do for k in /boot/$KIMAGE-*; do
_f=$(basename $k) _f=$(basename $k)
kver=$(echo ${_f}|sed -e 's|-rc|rc|') kver=$(echo ${_f}|sed -e 's|-rc|rc|')
installed=$(xbps-query -o "$k" 2>/dev/null) installed=$(xbps-query -o "$k" 2>/dev/null)
@ -54,7 +59,7 @@ remove_kernel()
local rmkver="$1" local rmkver="$1"
local installed f kfile local installed f kfile
if [ ! -f /boot/vmlinuz-${rmkver} -a ! -d /lib/modules/${rmkver} ]; then if [ ! -f /boot/$KIMAGE-${rmkver} -a ! -d /lib/modules/${rmkver} ]; then
echo "Kernel ${rmkver} not installed." echo "Kernel ${rmkver} not installed."
exit 0 exit 0
fi fi
@ -68,7 +73,7 @@ remove_kernel()
# Execute pre-remove kernel hooks. # Execute pre-remove kernel hooks.
run_hooks pre-remove $rmkver run_hooks pre-remove $rmkver
# Remove kernel files in /boot. # Remove kernel files in /boot.
for f in config System.map vmlinuz; do for f in config System.map $KIMAGE; do
kfile="/boot/${f}-${rmkver}" kfile="/boot/${f}-${rmkver}"
[ ! -f "${kfile}" ] && continue [ ! -f "${kfile}" ] && continue
echo "Removing ${kfile}..." echo "Removing ${kfile}..."

View file

@ -1,7 +1,7 @@
# Template file for 'base-files' # Template file for 'base-files'
pkgname=base-files pkgname=base-files
version=0.139 version=0.139
revision=8 revision=9
bootstrap=yes bootstrap=yes
depends="xbps-triggers" depends="xbps-triggers"
short_desc="Void Linux base system files" short_desc="Void Linux base system files"