From 541498305f4b0ee54e82bcb568b4f80523916d57 Mon Sep 17 00:00:00 2001 From: Robert Nelson Date: Tue, 21 Feb 2012 16:21:15 -0600 Subject: [PATCH] setup_sdcard.sh: Add helper is_element_of() function. Add a simple helper function is_element_of() that will be used to simplify the validation of various values. This routine is not meant to be called directly; instead, it will be used to write much simpler validation routines to check for acceptable values like a filesystem type and so on. Signed-off-by: Robert P. J. Day Signed-off-by: Robert Nelson --- mk_mmc.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/mk_mmc.sh b/mk_mmc.sh index 06368ee..9bf4a2b 100755 --- a/mk_mmc.sh +++ b/mk_mmc.sh @@ -90,6 +90,14 @@ SQUEEZE_MD5SUM="f8d7e14b73c1cb89ff09c79a02694c22" DIR="$PWD" TEMPDIR=$(mktemp -d) +function is_element_of { + testelt=$1 + for validelt in $2 ; do + [ $testelt = $validelt ] && return 0 + done + return 1 +} + function check_root { if [[ $UID -ne 0 ]]; then echo "$0 must be run as sudo user or root"