### 
# References https://craigiswayne.wordpress.com/2018/01/20/my-media-centre/
###

####
# Variables
####
PI_IP=192.168.8.112;
PI_USERNAME=osmc;

####
# OSMC
# https://howtoraspberrypi.com/media-center-osmc-raspberry-pi/
####
wget http://download.osmc.tv/installers/osmc-installer.dmg
open osmc-installer.dmg
# run the qt_installer

####
# Plex Server
# https://thepi.io/how-to-set-up-a-raspberry-pi-plex-server/
####
ssh $PI_USERNAME@$PI_IP;
sudo apt-get update;
sudo apt-get install apt-transport-https -y;
wget -O - https://dev2day.de/pms/dev2day-pms.gpg.key | sudo apt-key add -
echo "deb https://dev2day.de/pms/ jessie main" | sudo tee /etc/apt/sources.list.d/pms.list
sudo apt-get update;
sudo apt-get install -t jessie plexmediaserver -y;
# change PLEX_MEDIA_SERVER_USER=plex -> PLEX_MEDIA_SERVER_USER=osmc
sudo vi /etc/default/plexmediaserver.prev;
sudo service plexmediaserver restart;
# add the following line to the end of this file "ip=192.168.8.112"
sudo nano /boot/cmdline.txt
# open the raspberry pi ip + ":32400/web/" to see your plex server

###
# Samba File Sharing
# Taken from https://help.ubuntu.com/community/How%20to%20Create%20a%20Network%20Share%20Via%20Samba%20Via%20CLI%20%28Command-line%20interface/Linux%20Terminal%29%20-%20Uncomplicated%2C%20Simple%20and%20Brief%20Way%21
###
sudo apt-get update
sudo apt-get install samba -y
sudo smbpasswd -a $PI_USERNAME; #enter the "osmc" twice
sudo cp /etc/samba/smb.conf ~
# add the below to your samba config file
# [MEDIA]
# path = /media/MEDIA              
# valid users = osmc       
# read only = no
sudo nano /etc/samba/smb.conf
sudo service smbd restart