提交 3a975b8c 编写于 作者: M Masahiro Yamada 提交者: Michal Marek

merge_config.sh: improve indentation

It is true that we do not want to move the code too far to the
right, but something like below is not preferred:

    if [ "x$PREV_VAL" != "x$NEW_VAL" ] ; then
    echo Value of $CFG is redefined by fragment $MERGE_FILE:
    echo Previous  value: $PREV_VAL
    echo New value:       $NEW_VAL
    echo
    elif [ "$WARNREDUN" = "true" ]; then
    echo Value of $CFG is redundant by fragment $MERGE_FILE:
    fi

To fix this, call "continue" if the "grep" command fails to find the
given CONFIG.
Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: NJosh Triplett <josh@joshtriplett.org>
Reviewed-by: NDarren Hart <dvhart@linux.intel.com>
Signed-off-by: NMichal Marek <mmarek@suse.cz>
上级 371cfd4f
......@@ -103,20 +103,18 @@ for MERGE_FILE in $MERGE_LIST ; do
CFG_LIST=$(sed -n "$SED_CONFIG_EXP" $MERGE_FILE)
for CFG in $CFG_LIST ; do
grep -q -w $CFG $TMP_FILE
if [ $? -eq 0 ] ; then
PREV_VAL=$(grep -w $CFG $TMP_FILE)
NEW_VAL=$(grep -w $CFG $MERGE_FILE)
if [ "x$PREV_VAL" != "x$NEW_VAL" ] ; then
grep -q -w $CFG $TMP_FILE || continue
PREV_VAL=$(grep -w $CFG $TMP_FILE)
NEW_VAL=$(grep -w $CFG $MERGE_FILE)
if [ "x$PREV_VAL" != "x$NEW_VAL" ] ; then
echo Value of $CFG is redefined by fragment $MERGE_FILE:
echo Previous value: $PREV_VAL
echo New value: $NEW_VAL
echo
elif [ "$WARNREDUN" = "true" ]; then
elif [ "$WARNREDUN" = "true" ]; then
echo Value of $CFG is redundant by fragment $MERGE_FILE:
fi
sed -i "/$CFG[ =]/d" $TMP_FILE
fi
sed -i "/$CFG[ =]/d" $TMP_FILE
done
cat $MERGE_FILE >> $TMP_FILE
done
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册