Skip to content

Commit

Permalink
pgscan update / sgtore details for pgscan
Browse files Browse the repository at this point in the history
  • Loading branch information
MrDoobPG authored and MrDoobPG committed Oct 24, 2019
1 parent c16f4cd commit 1ad6781
Show file tree
Hide file tree
Showing 3 changed files with 151 additions and 1 deletion.
9 changes: 8 additions & 1 deletion menu/pgscan/pgscan.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@ EOF
fi
}

user () {
touch /var/plexguide/plex.pw
user=$(cat /var/plexguide/plex.pw)
if [ "$user" == "" ]; then
bash /opt/plexguide/menu/pgscan/scripts/plex_pw.sh
fi
}
token() {
touch /opt/appdata/pgscan/plex.token
ptoken=$(cat /opt/appdata/pgscan/plex.token)
Expand All @@ -59,7 +66,6 @@ EOF
fi
fi
}

# BAD INPUT
badinput() {
echo
Expand Down Expand Up @@ -135,6 +141,7 @@ EOF

# FUNCTIONS END ##############################################################
plexcheck
user
token
deploycheck
question1
142 changes: 142 additions & 0 deletions menu/pgscan/scripts/plex_pw.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
#!/bin/bash
#
# Title: PGBlitz (Reference Title File)
# Author(s): Admin9705 - Deiteq
# URL: https://pgblitz.com - http://github.pgblitz.com
# GNU: General Public License v3.0
################################################################################

# FUNCTIONS START ##############################################################

# BAD INPUT
badinput() {
echo
read -p '⛔️ ERROR - BAD INPUT! | PRESS [ENTER] ' typed </dev/tty
question1
}

badinput2() {
echo
read -p '⛔️ ERROR - BAD INPUT! | PRESS [ENTER] ' typed </dev/tty
question2
}

# FIRST QUESTION

question1() {
tee <<-EOF
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🌎 Plex User Name Store
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
[1] - Generate stored details for PTS - PAS - Scan
[Z] - Exit
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
EOF
read -p 'Make a Selection | Press [ENTER]: ' typed </dev/tty
echo

if [ "$typed" == "1" ]; then
read -p 'Enter the PLEX User Name | Press [ENTER]: ' user </dev/tty
read -p 'Enter the PLEX User Pass | Press [ENTER]: ' pw </dev/tty

tee <<-EOF
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🍖 NOM NOM - Saved Your Information!
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
EOF
sleep 3
question2
elif [ "$typed" == "2" ]; then

tee <<-EOF
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🍖 NOM NOM - Read Your Information!
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
EOF
sleep 3
question 2

pw=$(cat /var/plexguide/plex.pw)
user=$(cat /var/plexguide/plex.user)

elif [[ "$typed" == "Z" || "$typed" == "z" ]]; then
exit
else badinput; fi
}

question2() {
tee <<-EOF
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📂 User Name & Password Confirmation
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
User Name: $user
User Pass: $pw
⚠️ Information Correct?
[1] YES
[2] NO
[Z] - Exit Interface
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
EOF
read -p 'Make a Selection | Press [ENTER]: ' typed </dev/tty

if [ "$typed" == "1" ]; then
tee <<-EOF
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🍖 NOM NOM - Got It!
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
NOTE: If the token is bad, this process will repeat again!
EOF
sleep 4
question3
elif [ "$typed" == "2" ]; then
question1
elif [[ "$typed" == "Z" || "$typed" == "z" ]]; then
exit
else badinput2; fi
}

question3() {
echo "$pw" >/var/plexguide/plex.pw
echo "$user" >/var/plexguide/plex.user
ansible-playbook /opt/plexguide/menu/plex/token.yml
token=$(cat /var/plexguide/plex.token)
if [ "$token" != "" ]; then
tee <<-EOF
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✅️ Details stored Succeeded!
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
EOF
sleep 4
else
tee <<-EOF
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⛔️ Details Failed!
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
NOTE: Process will repeat until you succeed or exit!
EOF
read -p 'Confirm Info | Press [ENTER] ' typed </dev/tty
question1
fi
}

1 change: 1 addition & 0 deletions menu/pgscan/scripts/plex_token.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#########################################################################
# MIT License #
#########################################################################

PLEX_LOGIN=$(cat /var/plexguide/plex.user)
PLEX_PASSWORD=$(cat /var/plexguide/plex.pw)

Expand Down

0 comments on commit 1ad6781

Please sign in to comment.