#!/usr/bin/with-contenv bash

#If variable $ADVANCED_GIT_BRANCH, set branch to $ADVANCED_GIT_BRANCH, otherwise, default to master
[ "$ADVANCED_GIT_BRANCH" ] && \
	echo "Using this variable is unsupported., THERE IS NO PATH BACK TO MASTER GIT BRANCH OTHER THAN REMOVING EXISTING APPDATA FOLDER, WE MEAN IT WHEN WE SAY UNSUPPORTED" || \
	ADVANCED_GIT_BRANCH="master"

# install app 
[[ ! -d "/opt/plexpy/.git" ]] && \
	git clone --branch $ADVANCED_GIT_BRANCH https://github.com/JonnyWong16/plexpy.git /opt/plexpy

# permissions
chown -R abc:abc \
	/opt/plexpy
