diff options
author | Heinz Wiesinger <pprkut@slackbuilds.org> | 2010-05-11 20:30:42 +0200 |
---|---|---|
committer | Heinz Wiesinger <pprkut@slackbuilds.org> | 2010-05-11 20:30:42 +0200 |
commit | 9326029b63c523839d0b7de004e5b34d6fdd7e36 (patch) | |
tree | 419dae8cbd9490eb38236f21e6ca9b8ec310b347 /audio/SlimServer/doinst.sh | |
parent | 884e8a19ff309fe8ccf1f7914909ba80a0e65202 (diff) | |
download | slackbuilds-9326029b63c523839d0b7de004e5b34d6fdd7e36.tar.gz |
audio/SlimServer: Moved from multimedia
Diffstat (limited to 'audio/SlimServer/doinst.sh')
-rw-r--r-- | audio/SlimServer/doinst.sh | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/audio/SlimServer/doinst.sh b/audio/SlimServer/doinst.sh new file mode 100644 index 0000000000..0af3004881 --- /dev/null +++ b/audio/SlimServer/doinst.sh @@ -0,0 +1,48 @@ +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... +} + +# Keep same perms on rc.slimserver.new: +if [ -e etc/rc.d/rc.slimserver ]; then + cp -a etc/rc.d/rc.slimserver etc/rc.d/rc.slimserver.new.incoming + cat etc/rc.d/rc.slimserver.new > etc/rc.d/rc.slimserver.new.incoming + mv etc/rc.d/rc.slimserver.new.incoming etc/rc.d/rc.slimserver.new +fi + +config etc/rc.d/rc.slimserver.new + +# Create a log file - this won't be removed when the package is uninstalled +# (this is as it should be) +touch var/log/slimserver.log + +# If a slimserver.conf file exists, there's no need to install the empty one +# with a .new suffix +if [ -e etc/slimserver.conf ]; then + rm -f etc/slimserver.conf.new +else + mv etc/slimserver.conf.new etc/slimserver.conf +fi + +# If there's no slimserver user, then bail out now. +if ! grep -q ^slimserver etc/passwd ; then + echo + echo "There is no 'slimserver' user present." + echo "Add the user and then reinstall the SlimServer package." + echo "Exiting..." + exit 1 +fi + +chroot . /bin/chown slimserver:users /etc/slimserver.conf \ + /var/log/slimserver.log /var/cache/slimserver +chroot . /bin/chown -R slimserver:users /opt/slimserver + + |