Commit 15dc0865 authored by Jaroslav Škarvada's avatar Jaroslav Škarvada

Fixed bash completion

Resolves: rhbz#1207668
Signed-off-by: default avatarJaroslav Škarvada <jskarvad@redhat.com>
parent 65edc838
......@@ -9,7 +9,7 @@ DESTDIR = /
DOCDIR = /usr/share/doc/$(NAME)
PYTHON_SITELIB = /usr/lib/python2.7/site-packages
TUNED_PROFILESDIR = /usr/lib/tuned
BASH_COMPLETIONS = /usr/share/bash-completion/completions/
BASH_COMPLETIONS = /usr/share/bash-completion/completions
archive: clean
mkdir -p $(VERSIONED_NAME)
......@@ -17,8 +17,9 @@ archive: clean
cp AUTHORS COPYING INSTALL README $(VERSIONED_NAME)
cp tuned.py tuned.spec tuned.service tuned.tmpfiles Makefile tuned-adm.py \
tuned.bash dbus.conf recommend.conf tuned-main.conf 00_tuned bootcmdline \
org.tuned.gui.policy tuned-gui.py tuned-gui.glade $(VERSIONED_NAME)
tuned-adm.bash dbus.conf recommend.conf tuned-main.conf 00_tuned \
bootcmdline org.tuned.gui.policy tuned-gui.py tuned-gui.glade \
$(VERSIONED_NAME)
cp -a doc experiments libexec man profiles systemtap tuned $(VERSIONED_NAME)
tar cjf $(VERSIONED_NAME).tar.bz2 $(VERSIONED_NAME)
......@@ -62,8 +63,8 @@ install:
cp -a profiles/* $(DESTDIR)$(TUNED_PROFILESDIR)/
install -pm 0644 recommend.conf $(DESTDIR)$(TUNED_PROFILESDIR)/recommend.conf
# Install bash completion
install -Dpm 0644 tuned.bash $(DESTDIR)$(BASH_COMPLETIONS)/tuned/tuned.bash
# bash completion
install -Dpm 0644 tuned-adm.bash $(DESTDIR)$(BASH_COMPLETIONS)/tuned-adm
# log dir
mkdir -p $(DESTDIR)/var/log/tuned
......
......@@ -3,13 +3,13 @@
_tuned_adm()
{
local commands="active list off profile recommend"
local current="${COMP_WORDS[$COMP_CWORD]}"
local previous="${COMP_WORDS[$COMP_CWORD-1]}"
local cur prev words cword
_init_completion || return
if [[ $COMP_CWORD -eq 1 ]]; then
COMPREPLY=( $(compgen -W "$commands" -- "$current" ) )
elif [[ $COMP_CWORD -eq 2 && "$previous" == "profile" ]]; then
COMPREPLY=( $(compgen -W "$(command find /usr/lib/tuned /etc/tuned -mindepth 1 -maxdepth 1 -type d -printf "%f\n")" -- "$current" ) )
if [[ "$cword" -eq 1 ]]; then
COMPREPLY=( $(compgen -W "$commands" -- "$cur" ) )
elif [[ "$cword" -eq 2 && "$prev" == "profile" ]]; then
COMPREPLY=( $(compgen -W "$(command find /usr/lib/tuned /etc/tuned -mindepth 1 -maxdepth 1 -type d -printf "%f\n")" -- "$cur" ) )
else
COMPREPLY=()
fi
......
......@@ -139,7 +139,7 @@ fi
%doc COPYING
%doc README
%doc doc/TIPS.txt
%{_datadir}/bash-completion/completions/tuned
%{_datadir}/bash-completion/completions/tuned-adm
%exclude %{python_sitelib}/tuned/gtk
%{python_sitelib}/tuned
%{_sbindir}/tuned
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment