Skip to content

Instantly share code, notes, and snippets.

@zachcb
Last active August 19, 2020 20:34
Show Gist options
  • Save zachcb/da05bf6c3c267d776672edfa4df3e8eb to your computer and use it in GitHub Desktop.
Save zachcb/da05bf6c3c267d776672edfa4df3e8eb to your computer and use it in GitHub Desktop.
PGBLITZ
#!/bin/bash
#
# Title: PGBlitz (Reference Title File)
# Author(s): Admin9705 - Deiteq - Sub7Seven
# URL: https://pgblitz.com - http://github.pgblitz.com
# GNU: General Public License v3.0
################################################################################
# Upgrade
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"
# apt-add-repository --yes --update ppa:ansible/ansible
apt-get update -y
apt-cache policy docker-ce
# apt-get upgrade -y # causes problems when you forced on an interactive screen
apt-get install \
software-properties-common \
git zip unzip dialog \
apt-transport-https \
ca-certificates \
software-properties-common \
python-dev \
ansible \
docker \
curl \
-y
tee <<-EOF
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🌎 INSTALLING: PGBlitz Notice
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
By Installing PGBlitz, you are agreeing to the terms and conditions
of the GNUv3 Project License! Please Standby...
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
EOF
sleep 3
# Delete If it Exist for Cloning
file="/opt/plexguide"
if [ -e "$file" ]; then rm -rf /opt/plexguide; fi
file="/opt/pgstage"
if [ -e "$file" ]; then rm -rf /opt/pgstage; fi
rm -rf /opt/pgstage/place.holder 1>/dev/null 2>&1
git clone -b v8.5 --single-branch https://github.com/PGBlitz/Install.git /opt/pgstage
mkdir -p /var/plexguide/logs
echo "" >/var/plexguide/server.ports
echo "51" >/var/plexguide/pg.pythonstart
touch /var/plexguide/pg.pythonstart.stored
start=$(cat /var/plexguide/pg.pythonstart)
stored=$(cat /var/plexguide/pg.pythonstart.stored)
if [ "$start" != "$stored" ]; then
bash /opt/pgstage/pyansible.sh
fi
echo "51" >/var/plexguide/pg.pythonstart.stored
ansible-playbook /opt/pgstage/clone.yml
cp /opt/plexguide/menu/alias/templates/plexguide /bin/plexguide
cp /opt/plexguide/menu/alias/templates/pgblitz /bin/pgblitz
cp /opt/plexguide/menu/alias/templates/plexguide /bin/pg
tee <<-EOF
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⌛ Verifiying PGBlitz / PGBlitz Installed @ /bin/plexguide - Standby!
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
EOF
sleep 2
file="/bin/plexguide"
if [ ! -e "$file" ]; then
tee <<-EOF
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⛔️ WARNING! Installed Failed! PGBlitz / PGBlitz Command Missing!
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Please Reinstall PGBlitz by running the Command Again! We are doing
this to ensure that your installation continues to work!
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
EOF
exit
fi
tee <<-EOF
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✅️ PASSED! The PGBlitz Commands Installed!
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
EOF
rm -rf /var/plexguide/new.install 1>/dev/null 2>&1
sleep 2
chmod 775 /bin/plexguide
chown 1000:1000 /bin/plexguide
chmod 775 /bin/pgblitz
chown 1000:1000 /bin/pgblitz
chmod 775 /bin/pg
chown 1000:1000 /bin/pg
## Other Folders
mkdir -p /opt/appdata/plexguide
mkdir -p /var/plexguide
tee <<-EOF
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
↘️ Start AnyTime By Typing >>> pg [or] pgblitz
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment