#!/bin/sh


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/rc.d/rc.mpd.new
config /etc/mpd.conf.new




( echo -e "\E[0;32m+----------------------------------------------------------------------+\E[0;0m" )
( echo -e "\E[0;32m|  Done. Now edit /etc/mpd.conf as a superuser:                        |\E[0;0m" )
( echo -e "\E[0;32m|                                                                      |\E[0;0m" )
( echo -e "\E[0;32m|  Warning: The log files you specified in /etc/mpd.conf must exist    |\E[0;0m" )
( echo -e "\E[0;32m|  before running MPD.                                                 |\E[0;0m" )
( echo -e "\E[0;32m|                                                                      |\E[0;0m" )
( echo -e "\E[0;32m|  The log files must also have the permissions set so that they can   |\E[0;0m" )
( echo -e "\E[0;32m|  be edited by the default user                                       |\E[0;0m" )
( echo -e "\E[0;32m|                                                                      |\E[0;0m" )
( echo -e "\E[0;32m|  Put your music/playlists in the directories defined in /etc/mpd.conf|\E[0;0m" )
( echo -e "\E[0;32m|  --symlinks are fine--                                               |\E[0;0m" )
( echo -e "\E[0;32m|                                                                      |\E[0;0m" )
( echo -e "\E[0;32m|  Create the MPD database  /etc/rc.d/rc.mpd create-db                 |\E[0;0m" )
( echo -e "\E[0;32m|                                                                      |\E[0;0m" )
( echo -e "\E[0;32m|  Start MPD daemon         /etc/rc.d/rc.mpd start                     |\E[0;0m" )
( echo -e "\E[0;32m|                                                                      |\E[0;0m" )
( echo -e "\E[0;32m+--------------------------------------------------------------------- +\E[0;0m" )



