Files
PTS-Team/menu/portguard/portguard.sh
thesammykins b85d46105c Revert "Merge pull request #31 from Pandaura/dev"
This reverts commit 619678b60b, reversing
changes made to 9ec20a91e5.
2021-11-03 08:42:27 +11:00

67 lines
2.0 KiB
Bash

#!/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
################################################################################
# KEY VARIABLE RECALL & EXECUTION
program=$(cat /tmp/program_var)
mkdir -p /var/plexguide/cron/
mkdir -p /opt/appdata/plexguide/cron
# FUNCTIONS START ##############################################################
# BAD INPUT
badinput() {
echo
read -p '⛔️ ERROR - BAD INPUT! | PRESS [ENTER] ' typed </dev/tty
}
# FIRST QUESTION
question1() {
ports=$(cat /var/plexguide/server.ports)
if [ "$ports" == "127.0.0.1:" ]; then
guard="CLOSED" && opp="Open"
else guard="OPEN" && opp="Close"; fi
tee <<-EOF
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🤖 Welcome to PortGuard!
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Ports Are Currently: [$guard]
[ 1 ] $opp Ports
[ Z ] Exit
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
EOF
read -p '↘️ Type Number | Press [ENTER]: ' typed </dev/tty
case $typed in
1)
if [ "$guard" == "CLOSED" ]; then
echo "" >/var/plexguide/server.ports
else echo "127.0.0.1:" >/var/plexguide/server.ports; fi
bash /opt/plexguide/menu/portguard/rebuild.sh
question1
;;
z)
exit
;;
Z)
exit
;;
*)
question1
;;
esac
}
# FUNCTIONS END ##############################################################
break=off && while [ "$break" == "off" ]; do question1; done