| 1 |
#-*- mode: shell-script;-*-
|
| 2 |
|
| 3 |
# Debian GNU/Linux make-kpkg(1) completion.
|
| 4 |
# Copyright 2002 "Dr. Rafael Sepulveda" <drs@gnulinux.org.mx>
|
| 5 |
#
|
| 6 |
have make-kpkg &&
|
| 7 |
_make_kpkg()
|
| 8 |
{
|
| 9 |
local cur prev options paroptions special i
|
| 10 |
|
| 11 |
#check if we are in a kernel directory.
|
| 12 |
[[ -d "drivers" && -d "kernel" && -d "fs" && -d "include/linux" ]] || \
|
| 13 |
return 0
|
| 14 |
|
| 15 |
COMPREPLY=()
|
| 16 |
cur=${COMP_WORDS[COMP_CWORD]}
|
| 17 |
prev=${COMP_WORDS[COMP_CWORD-1]}
|
| 18 |
options='--added_modules --added-modules --added_patches --added-patches \
|
| 19 |
--append_to_version --append-to-version --arch --arch_in_name \
|
| 20 |
--arch-in-name binary build buildpackage --bzimage clean \
|
| 21 |
--config configure --cross_compile --cross-compile debian \
|
| 22 |
--flavour --help --initrd kernel_doc kernel_headers kernel_image \
|
| 23 |
kernel_source libc-kheaders modules modules_clean modules_config \
|
| 24 |
modules_image --noexec --pgpsign --stem --revision --rootcmd --subarch \
|
| 25 |
--targets --uc --us --zimage'
|
| 26 |
|
| 27 |
paroptions="$options"
|
| 28 |
|
| 29 |
|
| 30 |
[[ $prev == '--config' ]] && \
|
| 31 |
paroptions='config oldconfig menuconfig xconfig'
|
| 32 |
|
| 33 |
#exclude some options
|
| 34 |
[[ "$DEBIAN_REVISION_MANDATORY" ]] ||\
|
| 35 |
{ [[ -a "stamp-configure" ]] && paroptions=${paroptions/--revision}; }
|
| 36 |
[[ "$ARCH_IN_NAME" ]] && paroptions=${paroptions//--arch[-_]in[-_]name}
|
| 37 |
[[ "$CROSS_COMPILE" ]] && paroptions=${paroptions//--cross[-_]compile}
|
| 38 |
[[ "$KPKG_ARCH" ]] && paroptions=${paroptions/--arch}
|
| 39 |
[[ "$KPKG_SUBARCH" ]] && paroptions=${paroptions/--subarch}
|
| 40 |
[[ $(grep CONFIG_BLK_DEV_INITRD .config 2>/dev/null \
|
| 41 |
| cut -d= -f2) == "y" ]] && \
|
| 42 |
[[ "$INITRD" == "YES" ]] && paroptions=${paroptions/--initrd}
|
| 43 |
|
| 44 |
for (( i=0; i < ${#COMP_WORDS}-1; i++ )); do
|
| 45 |
#we need to start and end every line with '|' so it can be recognized.
|
| 46 |
if [[ ${COMP_WORDS[i]} == @(binary|build|buildpackage|clean|\
|
| 47 |
|configure|debian|kernel_doc|kernel_headers|kernel_image|\
|
| 48 |
|kernel_source|libc-kheaders|modules|modules_clean|\
|
| 49 |
|modules_config|modules_image|binary-indep|binary-arch|\
|
| 50 |
|kernel-manual|kernel_manual|modules_clean) ]]; then
|
| 51 |
paroptions=$( echo $options | sed s/--[^\ ]*//g )
|
| 52 |
COMPREPLY=( $( compgen -W "$paroptions" | grep ^$cur ) )
|
| 53 |
return 0;
|
| 54 |
fi
|
| 55 |
done
|
| 56 |
|
| 57 |
COMPREPLY=( $( compgen -W "$paroptions" | grep ^$cur ) )
|
| 58 |
|
| 59 |
return 0
|
| 60 |
|
| 61 |
}
|
| 62 |
[ "$have" ] && complete -F _make_kpkg -o filenames make-kpkg
|