#Install Base Feature pack manager : 


if [ !  -d /var/www/UI ];then
 echo " This is not a Mybook Live Device."
 echo " this installer is only for  Mybook Live device , please use the feature pack installer for your device."
 exit
fi

mkdir  /var/cache/fpkmgr
chmod 775 /var/cache/fpkmgr
chown www-data:www-data /var/cache/fpkmgr

mkdir /var/www/fpkmgr
chmod 775 /var/www/fpkmgr

if [ !  -d /usr/local/fpkmgr ];then
  mkdir /usr/local/fpkmgr
  chmod 755 /usr/local/fpkmgr
fi

if [ !  -e /usr/local/fpkmgr/WebUsers.htdigest.user ];then
  echo "admin:ADMIN:e02075586e5ecb7d393905136e0c2d2c">/usr/local/fpkmgr/WebUsers.htdigest.user
  chmod 755 /usr/local/fpkmgr/WebUsers.htdigest.user
fi

mkdir /var/www/fpkmgr/inc
chmod 775 /var/www/fpkmgr/inc
wget http://highlevelbits.free.fr/download-MBLIVE/fpinstaller/_Common_Functions.inc -O /var/www/fpkmgr/inc/_Common_Functions.inc


mkdir /var/www/fpkmgr/js
chmod 775 /var/www/fpkmgr/js
wget http://highlevelbits.free.fr/download-MBLIVE/fpinstaller/md5.js -O /var/www/fpkmgr/js/md5.js

mkdir /var/www/fpkmgr/fpks
chmod 775 /var/www/fpkmgr/fpks

mkdir /var/www/fpkmgr/temp
chmod 775 /var/www/fpkmgr/temp

wget http://highlevelbits.free.fr/download-MBLIVE/fpinstaller/HTML.tar -O /var/www/fpkmgr/HTML.tar

cd /var/www/fpkmgr
tar -xf HTML.tar
rm -f /var/www/fpkmgr/HTML.tar


# Now install the System Configuration feature pack : 

wget http://highlevelbits.free.fr/download-MBLIVE/fpks/System_Configuration/System_Configuration.tar -O /var/www/fpkmgr/fpks/System_Configuration.tar
cd /var/www/fpkmgr/fpks
tar -xf /var/www/fpkmgr/fpks/System_Configuration.tar
rm -f /var/www/fpkmgr/fpks/System_Configuration.tar
sh /var/www/fpkmgr/fpks/System_Configuration/_install

cp -f /var/www/fpkmgr/fpks/System_Configuration/bin/index.php  /var/www/fpkmgr/index.php

