#!/bin/sh
# Installing jukebox [mpd, mpc] for CF/MMC/SD/USB
scriptdir=`/usr/bin/dirname $0`
# choosing the correct tar archive:
# $scriptdir could be "/media/cf/mpd_install", "/media/card/mpd_install",  "/mnt/usb/mpd_install"
# Please note: on MMC,CF $scriptdir starts with "/media/" not "/mnt/"; this was crux of bug in v2.2
# after sed we get "cf", "card", "usb"
#echo "$scriptdir" > ${scriptdir}/scriptdir.txt
memory_type=`echo "$scriptdir" | sed -e 's/\/mnt\///' -e 's/\/media\///' -e 's/\/mpd_install//'`
cd /mnt/${memory_type}
# [1] CL link to script folder [000_mpd], script folder "Music", & mpd config file -> e.g. cf.tgz
tar -zxf ${scriptdir}/${memory_type}.tgz
# [2] directory "mpd" -> mpd.tgz
tar -zxf ${scriptdir}/mpd.tgz
mv ${scriptdir}/installed.xml ${scriptdir}/manifest.xml