From 9326029b63c523839d0b7de004e5b34d6fdd7e36 Mon Sep 17 00:00:00 2001 From: Heinz Wiesinger Date: Tue, 11 May 2010 20:30:42 +0200 Subject: audio/SlimServer: Moved from multimedia --- audio/SlimServer/doinst.sh | 48 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 audio/SlimServer/doinst.sh (limited to 'audio/SlimServer/doinst.sh') 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 + + -- cgit v1.2.3