#chmod +x lm.sh
rm -rf /var/root/Library/Caches/MapTiles/MapTiles.sqlitedb
rm -rf /var/root/Library/Preferences/com.apple.Maps.plist
if [ "$#" = 0 ]
then
echo "Cleared map database and location"
echo ""
echo "To load a map database run the script with"
echo "(eg: ./lm.sh ny) def: link db & copy location"
echo "./lm.sh ny l to link, c to copy db & location"
echo "one of the following maps from Media/Maps:"
echo ""
ls /var/root/Media/Maps
else
echo "Loading, wait..."
echo ""
if [ "$#" = 2 ] && [ $2 = "c" ]
then
cp -pr /var/root/Media/Maps/$1/MapTiles.sqlitedb /var/root/Library/Caches/MapTiles/MapTiles.sqlitedb
echo "Copied the specified map database"
else
ln -s /var/root/Media/Maps/$1/MapTiles.sqlitedb /var/root/Library/Caches/MapTiles/MapTiles.sqlitedb
echo "Linked the specified map database"
fi
if [ "$#" = 2 ] && [ $2 = "l" ]
then
ln -s /var/root/Media/Maps/$1/com.apple.Maps.plist /var/root/Library/Preferences/com.apple.Maps.plist
echo "Linked the location settings"
else
cp -pr /var/root/Media/Maps/$1/com.apple.Maps.plist /var/root/Library/Preferences/com.apple.Maps.plist
echo "Copied the location settings"
fi
echo ""
echo "Wait while Maps.app launches..."
/Applications/Maps.app/Maps
fi
