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 <rpjday@crashcourse.ca>
Signed-off-by: Robert Nelson <robertcnelson@gmail.com>
pull/8/head
Robert Nelson 13 years ago
parent 720240673f
commit 541498305f

@ -90,6 +90,14 @@ SQUEEZE_MD5SUM="f8d7e14b73c1cb89ff09c79a02694c22"
DIR="$PWD" DIR="$PWD"
TEMPDIR=$(mktemp -d) TEMPDIR=$(mktemp -d)
function is_element_of {
testelt=$1
for validelt in $2 ; do
[ $testelt = $validelt ] && return 0
done
return 1
}
function check_root { function check_root {
if [[ $UID -ne 0 ]]; then if [[ $UID -ne 0 ]]; then
echo "$0 must be run as sudo user or root" echo "$0 must be run as sudo user or root"

Loading…
Cancel
Save