7eb942c4086c563ca08f1b94c974d896eedb2e64Daniel Wallace#compdef kernel-install
7eb942c4086c563ca08f1b94c974d896eedb2e64Daniel Wallace if [[ "$words[2]" == "remove" ]]; then
7eb942c4086c563ca08f1b94c974d896eedb2e64Daniel Wallace _message 'No more options'
7eb942c4086c563ca08f1b94c974d896eedb2e64Daniel Wallace _path_files -W /boot/ -P /boot/ -g "vmlinuz-*"
7eb942c4086c563ca08f1b94c974d896eedb2e64Daniel Wallace read _MACHINE_ID < /etc/machine-id
7eb942c4086c563ca08f1b94c974d896eedb2e64Daniel Wallace _kernel=( /lib/modules/[0-9]* )
7eb942c4086c563ca08f1b94c974d896eedb2e64Daniel Wallace if [[ "$cmd" == "remove" && -n "$_MACHINE_ID" ]]; then
d72143bad46b51fc0bbedf01ff92aea8b07afac6Tom Gundersen _kernel=( "/boot/$_MACHINE_ID"/[0-9]* )
7eb942c4086c563ca08f1b94c974d896eedb2e64Daniel Wallace _kernel=( ${_kernel##*/} )
7eb942c4086c563ca08f1b94c974d896eedb2e64Daniel Wallace _describe "installed kernels" _kernel
7eb942c4086c563ca08f1b94c974d896eedb2e64Daniel Wallace '1::add or remove:(add remove)' \
7eb942c4086c563ca08f1b94c974d896eedb2e64Daniel Wallace '2::kernel versions:_kernels' \
7eb942c4086c563ca08f1b94c974d896eedb2e64Daniel Wallace '3::kernel images:_images'
7eb942c4086c563ca08f1b94c974d896eedb2e64Daniel Wallace#vim: set ft=zsh sw=4 ts=4 et