about summary refs log tree commit diff
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
parent4f142f279468a2d2d2500555e00649db9e74836f (diff)
downloadzsh-da025c6349ba299d29cd79c0fcd4c907bc5be355.tar.gz
zsh-da025c6349ba299d29cd79c0fcd4c907bc5be355.tar.xz
zsh-da025c6349ba299d29cd79c0fcd4c907bc5be355.zip
Michael Proko: 30414: more flexible configuration file finding for _mdadm
-rw-r--r--ChangeLog5
-rw-r--r--Completion/Linux/Command/_mdadm10
2 files changed, 13 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 23fd23f31..522aa2960 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2012-04-16  Peter Stephenson  <pws@csr.com>
 
+	* Michael Prokop: 30414: Completion/Linux/Command/_mdadm: more
+	flexible configuration file usage.
+
 	* 30413: Src/params.c, Src/utils.c, Test/D04parameter.ztst:
 	(q-) parameter flag should quote the empty string and should
 	report an error with extra trailing q's.
@@ -16208,5 +16211,5 @@
 
 *****************************************************
 * This is used by the shell to define $ZSH_PATCHLEVEL
-* $Revision: 1.5632 $
+* $Revision: 1.5633 $
 *****************************************************
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]'