diff options
author | Thibaut Notteboom <thibaut.notteboom@gmail.com> | 2018-07-23 22:12:25 +0100 |
---|---|---|
committer | Willy Sudiarto Raharjo <willysr@slackbuilds.org> | 2018-07-28 08:51:47 +0700 |
commit | 819088b4aaf1d84bfde15597aaff6870505534af (patch) | |
tree | 25d3fba75203c033574a7e56490457a2006d073e /network/etcd/doinst.sh | |
parent | a89d29f0f8bd2f8d7c12a3a77146a00f0f677f3d (diff) |
network/etcd: Added (key value store for shared configuration).
Signed-off-by: David Spencer <idlemoor@slackbuilds.org>
Diffstat (limited to 'network/etcd/doinst.sh')
-rw-r--r-- | network/etcd/doinst.sh | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/network/etcd/doinst.sh b/network/etcd/doinst.sh new file mode 100644 index 0000000000000..45b0c62dd7a8b --- /dev/null +++ b/network/etcd/doinst.sh @@ -0,0 +1,27 @@ +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... +} + +preserve_perms() { + NEW="$1" + OLD="$(dirname $NEW)/$(basename $NEW .new)" + if [ -e $OLD ]; then + cp -a $OLD ${NEW}.incoming + cat $NEW > ${NEW}.incoming + mv ${NEW}.incoming $NEW + fi + config $NEW +} + +preserve_perms etc/rc.d/rc.etcd.new +config etc/etcd/etcd.conf.yml.new +config etc/logrotate.d/etcd.new |