#!/bin/bash

apt update -y
apt upgrade -y

apt install -y nginx php-fpm
apt --fix-broken install

wget https://git.willamettevalleymesh.net/K9RCP-AUTO-INSTALLERS/raw/master/MAPCACHE/nginx.conf -O /etc/nginx/nginx.conf

rm -rf /var/www/
mkdir /var/www/
mkdir /var/www/css/
mkdir /var/www/js/
mkdir /var/www/images/

#Index.php
wget https://git.willamettevalleymesh.net/K9RCP-AUTO-INSTALLERS/raw/master/MAPCACHE/html/index.php -O /var/www/index.php

#CSS
wget https://git.willamettevalleymesh.net/K9RCP-AUTO-INSTALLERS/raw/master/MAPCACHE/html/css/leaflet.css -O /var/www/css/leaflet.css

#IMAGES
wget https://git.willamettevalleymesh.net/K9RCP-AUTO-INSTALLERS/raw/master/MAPCACHE/html/images/layers-2x.png -O /var/www/images/layers-2x.png
wget https://git.willamettevalleymesh.net/K9RCP-AUTO-INSTALLERS/raw/master/MAPCACHE/html/images/layers.png -O /var/www/images/layers.png
wget https://git.willamettevalleymesh.net/K9RCP-AUTO-INSTALLERS/raw/master/MAPCACHE/html/images/marker-icon-2x.png -O /var/www/images/marker-icon-2x.png
wget https://git.willamettevalleymesh.net/K9RCP-AUTO-INSTALLERS/raw/master/MAPCACHE/html/images/marker-icon.png -O /var/www/images/marker-icon.png
wget https://git.willamettevalleymesh.net/K9RCP-AUTO-INSTALLERS/raw/master/MAPCACHE/html/images/marker-shadow.png -O /var/www/images/marker-shadow.png

#JS
wget https://git.willamettevalleymesh.net/K9RCP-AUTO-INSTALLERS/raw/master/MAPCACHE/html/js/leaflet.js -O /var/www/js/leaflet.js
wget https://git.willamettevalleymesh.net/K9RCP-AUTO-INSTALLERS/raw/master/MAPCACHE/html/js/Leaflet.VectorGrid.js -O /var/www/js/Leaflet.VectorGrid.js


echo "Install done!