@@ -515,3 +515,30 @@ _set_combined_conditions()
done
COND_DESC="$_cond_desc"
}
+
+# Check both old and new parameters are not configured. If the old parameter is
+# set, propagate to the new parameter. If neither is set, set the default value
+# to the new parameter.
+_check_conflict_and_set_default()
+{
+ local new_name="$1"
+ local old_name="$2"
+ local default_val="$3"
+ local new_name_checked="$new_name"_checked
+
+ if [[ -n ${!new_name_checked} ]]; then
+ return
+ fi
+
+ if [[ -n ${!old_name} ]]; then
+ if [[ -n ${!new_name} ]]; then
+ echo "Both ${old_name} and ${new_name} are specified"
+ exit 1
+ fi
+ eval "${new_name}=\"${!old_name}\""
+ elif [[ -z ${!new_name} ]]; then
+ eval "${new_name}=\"${default_val}\""
+ fi
+
+ eval "${new_name_checked}=true"
+}