This adds support for two new options (-E/-O) which complement the existing -e/-o options by providing negative versions of them. For example, while -e VAR means "only do stuff when VAR is set to y", -E var means "only do stuff when VAR is not set to y". This is useful when you want to install a configuration file or make a configuration file tweak when a conflicting option is not defined by the user.
This patch may not apply cleanly without the -M patch, but that's only because they touch pieces of code close to each other ... they don't actually rely on each other. Signed-off-by: Mike Frysinger <[EMAIL PROTECTED]> --- --- romfs-inst.sh (revision 5999) +++ romfs-inst.sh (revision 6000) @@ -16,7 +16,9 @@ cat << !EOF >&2 $0: [options] [src] dst -v : output actions performed. -e env-var : only take action if env-var is set to "y". + -E env-var : only take action if env-var is not set to "y". -o option : only take action if option is set to "y". + -O option : only take action if option is not set to "y". -p perms : chmod style permissions for dst. -d : make dst directory if it doesn't exist -S : don't strip after installing @@ -143,6 +145,7 @@ fi v= option=y +noption= pattern= perm= func=file_copy @@ -152,7 +155,7 @@ dst= strip=1 kernmod= -while getopts 'dSMve:o:A:p:a:l:s:' opt "$@" +while getopts 'dSMve:E:o:O:A:p:a:l:s:' opt "$@" do case "$opt" in v) v="1"; ;; @@ -160,7 +163,9 @@ do S) strip=; ;; M) kernmod="1"; ;; o) option="$OPTARG"; ;; + O) noption="$OPTARG"; ;; e) eval option=\"\$$OPTARG\"; ;; + E) eval noption=\"\$$OPTARG\"; ;; p) perm="$OPTARG"; ;; a) src="$OPTARG"; func=file_append; ;; A) pattern="$OPTARG"; ;; @@ -180,6 +185,18 @@ do exit 0 ;; esac + +# +# process negative options here to get an ANDing effect +# + case "${noption:-n}" in + *[nN]*) # this gives OR effect, ie., yNy + ;; + *) + [ "$v" ] && echo "Condition not satisfied." + exit 0 + ;; + esac done shift `expr $OPTIND - 1` _______________________________________________ uClinux-dev mailing list uClinux-dev@uclinux.org http://mailman.uclinux.org/mailman/listinfo/uclinux-dev This message was resent by uclinux-dev@uclinux.org To unsubscribe see: http://mailman.uclinux.org/mailman/options/uclinux-dev