diff options
author | Robby Workman <rworkman@slackbuilds.org> | 2013-02-23 23:22:36 -0600 |
---|---|---|
committer | Robby Workman <rworkman@slackbuilds.org> | 2013-02-24 13:25:01 -0600 |
commit | b2b78b8bc2b60d1db146e5a814317079ea7a1ef6 (patch) | |
tree | 49c41e8df69117c0835210cbae0947b99ce1d16a /network/etherpad-lite/doinst.sh | |
parent | 196f57a4114b8966d69c22d25914af25146f1a5d (diff) | |
download | slackbuilds-b2b78b8bc2b60d1db146e5a814317079ea7a1ef6.tar.gz |
network/etherpad-lite: Don't clobber system configs/logs on upgrade
This commit creates if needed (otherwise, updates timestamps on)
the log files during package install as opposed to creating them
inside the package itself - if they're present inside the package,
then a package upgrade clobbers the files on the installed system
if they happen to already exist.
This commit also installs the init script and a couple of config
files with .new extensions and then does the config() routine on
them (or preserve_perms() in the case of the init script).
The downside is that this will cause any .new'd files *and* the
logs to be removed on this upgrade; I hope this doesn't cause
much pain for users, but it's got to happen sooner or later,
so let's get it over with...
Signed-off-by: Robby Workman <rworkman@slackbuilds.org>
Diffstat (limited to 'network/etherpad-lite/doinst.sh')
-rw-r--r-- | network/etherpad-lite/doinst.sh | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/network/etherpad-lite/doinst.sh b/network/etherpad-lite/doinst.sh new file mode 100644 index 0000000000..544d5c4eec --- /dev/null +++ b/network/etherpad-lite/doinst.sh @@ -0,0 +1,30 @@ +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.etherpad-lite.new +config etc/etherpad-lite/settings.json.new + +touch var/log/$PRGNAM/etherpad.log +touch var/log/$PRGNAM/error.log + |