#!/bin/sh

TARGET=/opt/amco/pisui/AVLSAppResources/PisResources

# Move the new content to the right paths 
echo "*** Creating directories under : $TARGET" 
mkdir -p $TARGET
mkdir -p $TARGET/Bitmaps/logos
mkdir -p $TARGET/Images
mkdir -p $TARGET/Videos

echo "*** Copying content"
cp -f ./Bitmaps/the_logo.png  $TARGET/Bitmaps/logos/
cp -f ./Images/*          $TARGET/Images/
cp -f ./Videos/*          $TARGET/Videos/
cp -f ./playlist.json     $TARGET/JsonFiles/Config/Playlist.json

# Delete all the .sys files that are no longer needed if any, except the lastest .sys file
echo "* Delete old .sys media files in bundles directory... *"
ls -F /opt/amco/updateman-media/bundles/*.sys | head -n -1 | xargs -r rm