bash completion for tuned and tuned-adm
This commit is contained in:
parent
0483497c7f
commit
00e2281db3
3 changed files with 50 additions and 1 deletions
6
Makefile
6
Makefile
|
|
@ -8,7 +8,7 @@ MANDIR = /usr/share/man/
|
|||
GITTAG = v$(VERSION)
|
||||
|
||||
DIRS = doc doc/examples contrib tuningplugins monitorplugins ktune
|
||||
FILES = tuned tuned.spec Makefile tuned.py tuned.initscript tuned.conf tuned-adm tuned_adm.py tuned-adm.pam tuned-adm.consolehelper tuned-adm.conf tuned_nettool.py tuned_logging.py
|
||||
FILES = tuned tuned.spec Makefile tuned.py tuned.initscript tuned.conf tuned-adm tuned_adm.py tuned-adm.pam tuned-adm.consolehelper tuned-adm.conf tuned_nettool.py tuned_logging.py tuned.bash
|
||||
FILES_doc = doc/DESIGN.txt doc/README.utils doc/TIPS.txt doc/tuned.8 doc/tuned.conf.5 doc/tuned-adm.1 doc/README.scomes
|
||||
FILES_examples = ktune/sysctl.ktune
|
||||
FILES_contrib = contrib/diskdevstat contrib/netdevstat contrib/scomes contrib/varnetload
|
||||
|
|
@ -118,6 +118,10 @@ install:
|
|||
cp -a tune-profiles/* $(DESTDIR)/etc/tune-profiles
|
||||
install -m 0644 tuned-adm.conf $(DESTDIR)//etc/tune-profiles/active-profile
|
||||
|
||||
# Install bash completion
|
||||
mkdir -p $(DESTDIR)/etc/bash_completion.d
|
||||
install -m 0644 tuned.bash $(DESTDIR)/etc/bash_completion.d/tuned.bash
|
||||
|
||||
# Create log directory
|
||||
mkdir -p $(DESTDIR)/var/log/tuned
|
||||
|
||||
|
|
|
|||
44
tuned.bash
Normal file
44
tuned.bash
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
# bash completion for tuned and tuned-adm
|
||||
|
||||
_tuned()
|
||||
{
|
||||
local options="-d --daemon -c --config -D --debug"
|
||||
local current="${COMP_WORDS[$COMP_CWORD]}"
|
||||
local previous="${COMP_WORDS[$COMP_CWORD-1]}"
|
||||
|
||||
if [[ "$previous" == "-c" || "$previous" == "--config" ]]; then
|
||||
COMPREPLY=( $(compgen -f -- "$current") )
|
||||
else
|
||||
COMPREPLY=( $(compgen -W "$options" -- "$current") )
|
||||
fi
|
||||
|
||||
return 0
|
||||
} &&
|
||||
complete -F _tuned -o filenames tuned
|
||||
|
||||
_tuned_adm()
|
||||
{
|
||||
local commands="help list active off profile"
|
||||
local current="${COMP_WORDS[$COMP_CWORD]}"
|
||||
local previous="${COMP_WORDS[$COMP_CWORD-1]}"
|
||||
|
||||
if [[ $COMP_CWORD -eq 1 ]]; then
|
||||
COMPREPLY=( $(compgen -W "$commands" -- "$current" ) )
|
||||
elif [[ $COMP_CWORD -eq 2 && "$previous" == "profile" ]]; then
|
||||
COMPREPLY=( $(compgen -W "$(command ls -F /etc/tune-profiles | \
|
||||
sed '/\/$/!d;s/.$//')" -- "$current" ) )
|
||||
else
|
||||
COMPREPLY=()
|
||||
fi
|
||||
|
||||
return 0
|
||||
} &&
|
||||
complete -F _tuned_adm tuned-adm
|
||||
|
||||
# Local variables:
|
||||
# mode: shell-script
|
||||
# sh-basic-offset: 4
|
||||
# sh-indent-comment: t
|
||||
# indent-tabs-mode: nil
|
||||
# End:
|
||||
# ex: ts=4 sw=4 et filetype=sh
|
||||
|
|
@ -77,6 +77,7 @@ fi
|
|||
%config(noreplace) %{_sysconfdir}/tuned.conf
|
||||
%config(noreplace) %{_sysconfdir}/pam.d/tuned-adm
|
||||
%config(noreplace) %{_sysconfdir}/security/console.apps/tuned-adm
|
||||
%{_sysconfdir}/bash_completion.d/tuned.bash
|
||||
%{_sbindir}/tuned
|
||||
%{_sbindir}/tuned-adm
|
||||
# consolehelper hard link
|
||||
|
|
|
|||
Loading…
Reference in a new issue