[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 1.3-514-g1a01e54
Ville Skyttä
ville.skytta at iki.fi
Sun Nov 6 12:22:52 UTC 2011
The following commit has been merged in the master branch:
commit a9873c872755cbf8dde60f200fc6d982f29794e4
Author: Ville Skyttä <ville.skytta at iki.fi>
Date: Sun Nov 6 14:00:04 2011 +0200
Revert "service, _services: Make these work on Slackware GNU/Linux."
This reverts commit 9717124ab7bad30b6d8ba02ef91850c6bb74dd63.
See http://thread.gmane.org/gmane.comp.shells.bash.completion.scm/2278
diff --git a/bash_completion b/bash_completion
index 629afbc..1ef7030 100644
--- a/bash_completion
+++ b/bash_completion
@@ -1039,26 +1039,12 @@ _gids()
#
_backup_glob='@(#*#|*@(~|.@(bak|orig|rej|swp|dpkg*|rpm@(orig|new|save))))'
-# This function sets correct SysV init directory
-#
-_sysvdir()
-{
- if [ -f /etc/slackware-version ]; then
- # Slackware uses /etc/rc.d
- echo /etc/rc.d
- elif [ -d /etc/rc.d/init.d ]; then
- echo /etc/rc.d/init.d
- else
- echo /etc/init.d
- fi
-}
-
# This function completes on services
#
_services()
{
local sysvdir famdir
- sysvdir=$( _sysvdir )
+ [ -d /etc/rc.d/init.d ] && sysvdir=/etc/rc.d/init.d || sysvdir=/etc/init.d
famdir=/etc/xinetd.d
local restore_nullglob=$(shopt -p nullglob); shopt -s nullglob
@@ -1857,7 +1843,7 @@ _completion_loader()
[[ $BASH_SOURCE == */* ]] && compdir="${BASH_SOURCE%/*}/completions"
# Special case for init.d scripts.
- if [[ "$1" == $( _sysvdir )/* ]]; then
+ if [[ $1 == /etc?(/rc.d)/init.d/* ]]; then
. "$compdir/service" &>/dev/null && return 124 || return 1
fi
diff --git a/completions/service b/completions/service
index 1c7f710..f008770 100644
--- a/completions/service
+++ b/completions/service
@@ -15,7 +15,9 @@ _service()
if [[ $cword -eq 1 && $prev == ?(*/)service ]]; then
_services
else
- local sysvdir=$( _sysvdir )
+ local sysvdir
+ [ -d /etc/rc.d/init.d ] && \
+ sysvdir=/etc/rc.d/init.d || sysvdir=/etc/init.d
COMPREPLY=( $( compgen -W '`sed -e "y/|/ /" \
-ne "s/^.*\(U\|msg_u\)sage.*{\(.*\)}.*$/\2/p" \
$sysvdir/${prev##*/} 2>/dev/null` start stop' -- "$cur" ) )
@@ -24,7 +26,7 @@ _service()
return 0
} &&
complete -F _service service
-for svc in $( _sysvdir )/!($_backup_glob); do
+for svc in /etc/init.d/!($_backup_glob) /etc/rc.d/init.d/!($_backup_glob); do
[ -x "$svc" ] && complete -F _service $svc
done
unset svc
--
bash-completion
More information about the Bash-completion-commits
mailing list