1#compdef kernel-install 2# SPDX-License-Identifier: LGPL-2.1-or-later 3 4(( $+functions[_kernel-install_images] )) || 5_kernel-install_images(){ 6 if [[ "$words[2]" == "remove" ]]; then 7 _message 'No more options' 8 else 9 _path_files -W /boot/ -P /boot/ -g "vmlinuz-*" 10 fi 11} 12 13(( $+functions[_kernel-install_kernels] )) || 14_kernel-install_kernels(){ 15 read _MACHINE_ID < /etc/machine-id 16 _kernel=( /lib/modules/[0-9]* ) 17 if [[ "$cmd" == "remove" && -n "$_MACHINE_ID" ]]; then 18 _kernel=( "/boot/$_MACHINE_ID"/[0-9]* ) 19 fi 20 _kernel=( ${_kernel##*/} ) 21 _describe "installed kernels" _kernel 22} 23 24_arguments \ 25 '1::add or remove:(add remove)' \ 26 '2::kernel versions:_kernel-install_kernels' \ 27 '3::kernel images:_kernel-install_images' 28