Advertisement
Guest User

Untitled

a guest
Mar 19th, 2017
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.64 KB | None | 0 0
  1. #!/bin/bash
  2. # Install Plex without the need for the SSH manual forwarding
  3. # Bobtentpeg
  4. # bobtentpeg@feralhosting.com
  5. ### Version 0.1b ###
  6. ### This script is under development and may not function properly ###
  7. ### Back up any data you wish to keep in ~/Library or ~/private/plex ###
  8. rm -rf ~/Library ~/private/plex
  9. port=$(shuf -i 10001-32001 -n 1)
  10. UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
  11. read -ep "Enter your plex username: " username
  12. printf "Enter your plex password (For your privacy, nothing will show while entering your password): "
  13. password=$(read -es )
  14. echo
  15. token=$(curl -sS -H "Content-Length: 0" -H "X-Plex-Client-Identifier: $UUID" --user "$username:$password" -X POST https://my.plexapp.com/users/sign_in.xml | tail -n 2 | head -n 1 | cut -c25-44)
  16. mkdir -p ~/Library/Application\ Support/Plex\ Media\ Server/
  17. mkdir -p ~/.config/feral/ns/forwarding/tcp && rm -f ~/.config/feral/ns/forwarding/tcp/*
  18. mkdir -p ~/private/plex
  19. echo 32400 > ~/.config/feral/ns/forwarding/tcp/$port
  20. echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>
  21. <Preferences MachineIdentifier=\"$uuid\" agentAutoEnabled.com.plexapp.agents.lastfm.Artists.com.plexapp.agents.vevo=\"1\" MetricsEpoch=\"1\" AcceptedEULA=\"1\" PlexOnlineToken=\"$token\" ManualPortMappingMode=\"1\" ManualPortMappingPort=\"$port\"/>" > ~/Library/Application\ Support/Plex\ Media\ Server/Preferences.xml
  22. while [ ! -f ~/private/plex/README ]; do printf '\rInstalling plex, please wait (May take up to 10min)...'; sleep 2; done && echo -e "Installion completed, please visit the below link and login to begin using your plex:\nhttp://$(hostname).feralhosting.com:$port/web"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement