From c129c323925f04c0d8e4e639767f83532a1dbc15 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Wed, 7 Sep 2016 18:08:13 +0200 Subject: config: add a new "diff" command This command relies on save-etc -d and restore-etc -d to report a diff between the factory config and the current config, and between the flash and the current config respectively. --- config | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/config b/config index 6182a92..2721889 100755 --- a/config +++ b/config @@ -24,6 +24,7 @@ do_help() { echo " add [.] [-] : add a config key." echo " del [.] [-] [] : remove a config key." echo " changes [ -q ] : displays a list of files that have changed." + echo " diff [flash|factory] : shows difference from these configs." echo " write, write flash : writes changes to flash" echo " write : writes changes to " echo " write - : writes changes to stdout (for use in scripts)" @@ -56,6 +57,18 @@ do_changes() { fi } +do_diff() { + if [ "$1" = "factory" ]; then + save-etc -d 2>/dev/null + elif [ "$1" = "flash" ]; then + restore-etc -d 2>/dev/null + else + echo "Need to specify either \"flash\" or \"factory\"" + exit 1 + fi + exit 0 +} + do_send() { local proto server defp port file tmp @@ -475,6 +488,7 @@ shift case "$cmd" in edit) do_edit "$@" ;; changes) do_changes "$@" ;; + diff) do_diff "$@" ;; write) do_write "$@" ;; save) do_write flash ;; send) do_send "$@" ;; -- 1.7.12.1