From 58f21d30bdacb8af2a9c1f0a893ff10c2a4828b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D0=B8=D0=BC=D0=BE=D0=BD=20=D0=91=D0=BE=D0=BB=D0=BE?= =?UTF-8?q?=D0=BA=D0=B0=D0=BD=D0=BE=D0=B2?= Date: Tue, 16 Sep 2014 08:20:42 +0700 Subject: system/rhash: Added (verify hash). Signed-off-by: Willy Sudiarto Raharjo --- system/rhash/doinst.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 system/rhash/doinst.sh (limited to 'system/rhash/doinst.sh') diff --git a/system/rhash/doinst.sh b/system/rhash/doinst.sh new file mode 100644 index 0000000000000..e6646ec82c97a --- /dev/null +++ b/system/rhash/doinst.sh @@ -0,0 +1,14 @@ +config() { + NEW="$1" + OLD="$(dirname $NEW)/$(basename $NEW .new)" + # If there's no config file by that name, mv it over: + if [ ! -r $OLD ]; then + mv $NEW $OLD + elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then + # toss the redundant copy + rm $NEW + fi + # Otherwise, we leave the .new copy for the admin to consider... +} + +config etc/rhashrc.new -- cgit v1.2.3