Fix checks for GNUish userland, thanks to Robert Millan (Debian: #529510)

This commit is contained in:
David Paleino 2009-05-20 22:08:53 +02:00
parent be2e112cbf
commit 4fadb6887a
2 changed files with 14 additions and 8 deletions

View File

@ -7,6 +7,7 @@ bash-completion (1.x)
(Alioth: #311595) (Alioth: #311595)
* Fix svk completion using $filenames instead of $default (Debian: #524961) * Fix svk completion using $filenames instead of $default (Debian: #524961)
* Really add build-dep to aptitude's completion (Debian: #495883) * Really add build-dep to aptitude's completion (Debian: #495883)
* Fix checks for GNUish userland, thanks to Robert Millan (Debian: #529510)
[ Ville Skyttä ] [ Ville Skyttä ]
* Split yum and yum-arch completion into contrib/yum. * Split yum and yum-arch completion into contrib/yum.
@ -92,7 +93,7 @@ bash-completion (1.x)
* Patched _known_hosts() to support multiple {Global,User}KnownHosts in SSH * Patched _known_hosts() to support multiple {Global,User}KnownHosts in SSH
config files, thanks to Thomas Nilsson (Alioth: #311595) (Debian: #524190) config files, thanks to Thomas Nilsson (Alioth: #311595) (Debian: #524190)
-- David Paleino <d.paleino@gmail.com> Wed, 25 Mar 2009 23:18:24 +0100 -- David Paleino <d.paleino@gmail.com> Wed, 20 May 2009 22:08:42 +0200
bash-completion (1.0) bash-completion (1.0)

View File

@ -53,6 +53,11 @@ UNAME=$( uname -s )
# strip OS type and version under Cygwin (e.g. CYGWIN_NT-5.1 => Cygwin) # strip OS type and version under Cygwin (e.g. CYGWIN_NT-5.1 => Cygwin)
UNAME=${UNAME/CYGWIN_*/Cygwin} UNAME=${UNAME/CYGWIN_*/Cygwin}
case ${UNAME} in
Linux|GNU|GNU/*) USERLAND=GNU ;;
*) USERLAND=${UNAME} ;;
esac
# features supported by bash 2.05 and higher # features supported by bash 2.05 and higher
if [ ${BASH_VERSINFO[0]} -eq 2 ] && [[ ${BASH_VERSINFO[1]} > 04 ]] || if [ ${BASH_VERSINFO[0]} -eq 2 ] && [[ ${BASH_VERSINFO[1]} > 04 ]] ||
[ ${BASH_VERSINFO[0]} -gt 2 ]; then [ ${BASH_VERSINFO[0]} -gt 2 ]; then
@ -190,7 +195,7 @@ have()
# use GNU sed if we have it, since its extensions are still used in our code # use GNU sed if we have it, since its extensions are still used in our code
# #
[ $UNAME != Linux ] && have gsed && alias sed=gsed [ $USERLAND != GNU ] && have gsed && alias sed=gsed
# This function checks whether a given readline variable # This function checks whether a given readline variable
# is `on'. # is `on'.
@ -998,7 +1003,7 @@ complete -F _insmod $filenames insmod modprobe modinfo
# man(1) completion # man(1) completion
# #
[ $UNAME = GNU -o $UNAME = Linux -o $UNAME = Darwin \ [ $USERLAND = GNU -o $UNAME = Darwin \
-o $UNAME = FreeBSD -o $UNAME = SunOS -o $UNAME = Cygwin \ -o $UNAME = FreeBSD -o $UNAME = SunOS -o $UNAME = Cygwin \
-o $UNAME = OpenBSD ] && -o $UNAME = OpenBSD ] &&
_man() _man()
@ -1028,7 +1033,7 @@ _man()
UNAME=$( uname -s ) UNAME=$( uname -s )
# strip OS type and version under Cygwin # strip OS type and version under Cygwin
UNAME=${UNAME/CYGWIN_*/Cygwin} UNAME=${UNAME/CYGWIN_*/Cygwin}
if [ $UNAME = GNU -o $UNAME = Linux -o $UNAME = FreeBSD \ if [ $USERLAND = GNU -o $UNAME = FreeBSD \
-o $UNAME = Cygwin ]; then -o $UNAME = Cygwin ]; then
manpath=$( manpath 2>/dev/null || command man --path ) manpath=$( manpath 2>/dev/null || command man --path )
else else
@ -1070,7 +1075,7 @@ _man()
return 0 return 0
} }
[ $UNAME = GNU -o $UNAME = Linux -o $UNAME = Darwin \ [ $USERLAND = GNU -o $UNAME = Darwin \
-o $UNAME = FreeBSD -o $UNAME = SunOS -o $UNAME = Cygwin \ -o $UNAME = FreeBSD -o $UNAME = SunOS -o $UNAME = Cygwin \
-o $UNAME = OpenBSD ] && \ -o $UNAME = OpenBSD ] && \
complete -F _man $filenames man apropos whatis complete -F _man $filenames man apropos whatis
@ -1466,7 +1471,7 @@ complete -F _iwpriv iwpriv
# Red Hat & Debian GNU/Linux if{up,down} completion # Red Hat & Debian GNU/Linux if{up,down} completion
# #
[ $UNAME = Linux ] && { have ifup || have ifdown; } && [ $USERLAND = GNU ] && { have ifup || have ifdown; } &&
_ifupdown() _ifupdown()
{ {
local cur local cur
@ -1482,7 +1487,7 @@ _ifupdown()
return 0 return 0
} && } &&
complete -F _ifupdown ifup ifdown complete -F _ifupdown ifup ifdown
[ $UNAME = Linux ] && have ifstatus && complete -F _ifupdown ifstatus [ $USERLAND = GNU ] && have ifstatus && complete -F _ifupdown ifstatus
# Linux ipsec(8) completion (for FreeS/WAN) # Linux ipsec(8) completion (for FreeS/WAN)
# #
@ -3711,7 +3716,7 @@ _gcc()
fi fi
} && } &&
complete $filenames -F _gcc gcc g++ c++ g77 gcj gpc complete $filenames -F _gcc gcc g++ c++ g77 gcj gpc
[ $UNAME = GNU -o $UNAME = Linux -o $UNAME = Cygwin ] && \ [ $USERLAND = GNU -o $UNAME = Cygwin ] && \
[ -n "${have:-}" ] && complete $filenames -F _gcc cc [ -n "${have:-}" ] && complete $filenames -F _gcc cc
# Linux cardctl(8) completion # Linux cardctl(8) completion