[Bash-completion-devel] [SCM] bash-completion branch, master, updated. 1.3-512-g9717124
Igor Murzov
e-mail at date.by
Sun Nov 6 16:12:31 UTC 2011
On Sun, 06 Nov 2011 14:25:14 +0200
Ville Skyttä <ville.skytta at iki.fi> wrote:
> > It looks like we have a collision. Then it's easier for me to patch bash-completion before packaging to set proper directories for Slackware.
>
> Don't give up yet, I think this is solvable :)
Ok :)
> I just reverted your previous commit and pushed another solution that I
> believe could work, see commit 1a01e54. Could you test it?
+ if [[ -d /etc/rc.d/init.d ]]; then
+ sysvdir=/etc/rc.d/init.d
+ elif [[ -f /etc/slackware-version ]]; then
+ sysvdir=/etc/rc.d
+ fi
This would not work in Slackware as it does have /etc/rc.d/init.d directory and it's there to provide some compatibility with Red Hat "solely for commercial (or other) software that expects to find Red Hat-isms" :) I haven't seen any package around that uses this directory, so it is rather unused. But let me say, I can't see /etc/xinetd.d or `systemctl` anywhere, so the whole _services() is probably useless in Slackware anyway. So it's fine to leave this function alone.
- if [[ $1 == /etc?(/rc.d)/init.d/* ]]; then
+ if [[ $1 == /etc?(/rc.d)/init.d/* || \
+ ( $1 == /etc/rc.d/* && -f /etc/slackware-version ) ]]; then
Is this better than "if [[ "$1" == /etc/@(rc.d|init.d)/* ]]; then" ? I think, this simpler condition will not break anything.
COMPREPLY=( $( compgen -W '`sed -e "y/|/ /" \
-ne "s/^.*\(U\|msg_u\)sage.*{\(.*\)}.*$/\2/p" \
$sysvdir/${prev##*/} 2>/dev/null` start stop' -- "$cur" ) )
I don't understand why use "$sysvdir/${prev##*/}" instead of plain "$prev". Can we drop $sysvdir completely here?
+svcdirs=( /etc/init.d /etc/rc.d/init.d )
+[[ -f /etc/slackware-version ]] && svcdirs=( /etc/rc.d )
+for svcdir in ${svcdirs[@]}; do
+ for svc in $svcdir/!($_backup_glob); do
+ [ -x "$svc" ] && complete -F _service $svc
+ done
done
This part looks good to me.
-- Igor
More information about the Bash-completion-devel
mailing list