summary refs log tree commit diff
path: root/Completion/Linux/Command/_mdadm
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2012-04-16 12:35:51 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2012-04-16 12:35:51 +0000
commitda025c6349ba299d29cd79c0fcd4c907bc5be355 (patch)
tree95a1436809b5730356d6e210f017d84fe7be6046 /Completion/Linux/Command/_mdadm
parent4f142f279468a2d2d2500555e00649db9e74836f (diff)
downloadzsh-da025c6349ba299d29cd79c0fcd4c907bc5be355.tar.gz
zsh-da025c6349ba299d29cd79c0fcd4c907bc5be355.tar.xz
zsh-da025c6349ba299d29cd79c0fcd4c907bc5be355.zip
Michael Proko: 30414: more flexible configuration file finding for _mdadm
Diffstat (limited to 'Completion/Linux/Command/_mdadm')
-rw-r--r--Completion/Linux/Command/_mdadm10
1 files changed, 9 insertions, 1 deletions
diff --git a/Completion/Linux/Command/_mdadm b/Completion/Linux/Command/_mdadm
index 461e66617..940eb6887 100644
--- a/Completion/Linux/Command/_mdadm
+++ b/Completion/Linux/Command/_mdadm
@@ -147,7 +147,15 @@ fi
 
 _mds () {
 	local -a vals
-	vals=( ${${${(M)${(f)"$(< /etc/mdadm.conf)"}##ARRAY *}//ARRAY /}%%[[:blank:]]*} )
+	if [ -r /etc/mdadm.conf ] ; then
+	  local mdadm_conf=/etc/mdadm.conf
+	elif [ -r /etc/mdadm/mdadm.conf ] ; then
+	  local mdadm_conf=/etc/mdadm/mdadm.conf
+	else
+	  _message "could not find mdadm.conf"
+	  return 1
+	fi
+	vals=( ${${${(M)${(f)"$(< $mdadm_conf)"}##ARRAY *}//ARRAY /}%%[[:blank:]]*} )
 	_describe -t mds "RAID devices" vals
 	_arguments \
 		"(-h --help)"{-h,--help}'[display a mode specific help message]'