#!/bin/sh

# Edit the storemp3.conf file first, the following lines will
# check this
if grep HOSTNAME storemp3.conf; then
	echo "Please edit the storemp3.conf file first!"
	exit 0;
fi

#Where to store the storemp3.conf* file ?
ETC="/etc"

#Where's your bin directory ?
BIN="/usr/local/bin"

subst="s'PATH'$ETC'gi"

perl -w -p -i -e $subst web/*.php3
perl -w -p -i -e $subst mp3save.pl

echo copy storemp3 to $BIN
cp storemp3 "$BIN"

echo copy mp3save.pl to $BIN
cp mp3save.pl "$BIN"

echo "change mode of mp3save.pl"
chmod a+x "$BIN"/mp3save.pl

echo "change mode of storemp3"
chmod a+x "$BIN"/storemp3

./makeconf

echo copy storemp3.conf and storemp3.conf.php3 to $ETC
cp storemp3.conf "$ETC"
cp storemp3.conf.php3 "$ETC"

echo "change mode of storemp3.conf and storemp3.conf.php3"
chmod a+r "$ETC"/storemp3.conf "$ETC"/storemp3.conf.php3
