Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Create directories
- mkdir -p ExpressVPN_tmp ExpressVPN_bak
- # Move existing files to backup directory
- mv expressvpn* ExpressVPN_bak
- expressvpn status
- echo "Main: https://www.expressvpn.com/latest#linux ;; Clients: https://www.expressvpn.works/clients/linux/"
- if [[ "$1" -eq "" ]]; then
- read -p "ExpressVPN Fedora link: " link
- else
- link="$1"
- printf "Given ExpressVPN(.Works: %s)\n" "$1"
- fi
- cd ExpressVPN_tmp
- # Check if the link is HTTPS
- if [[ "$link" =~ ^https:// ]]; then
- echo "Detected HTTPS link. Proceeding."
- else
- echo "Error: no HTTPS detected. Exiting."
- exit 1
- fi
- # Clear temporary files
- rm *
- # Download the files
- echo
- wget "$link"
- error1=$?
- wget "$link.asc"
- error2=$?
- echo
- # Check for download errors
- if [[ $error1 -ne 0 ]] || [[ $error2 -ne 0 ]]; then
- echo "Exiting due to download errors."
- exit 2
- fi
- # Find RPM and ASC files
- file_rpm=$(ls *.rpm)
- file_asc=$(ls *.asc)
- # Check file names
- if [[ "$file_rpm" = expressvpn*.rpm ]] && [[ "$file_asc" = "$file_rpm.asc" ]]; then
- printf "Found \"%s\" and \"%s\". Proceeding.\n" "$file_rpm" "$file_asc"
- else
- printf "Error: must have expressvpn*.rpm=\"%s\" and expressvpn*.rpm.asc=\"%s\". Exiting.\n" "$file_rpm" "$file_asc"
- exit 3
- fi
- # Calculate file hashes
- sha256_rpm=$(sha256sum "$file_rpm")
- sha256_asc=$(sha256sum "$file_asc")
- sha512_rpm=$(sha512sum "$file_rpm")
- sha512_asc=$(sha512sum "$file_asc")
- printf "The SHA256 of \"%s\" and \"%s\".\nThe SHA512 of \"%s\" and \"%s\".\n" "$sha256_rpm" "$sha256_asc" "$sha512_rpm" "$sha512_asc"
- echo "Reading \"$file_asc\":"
- cat "$file_asc"
- # Verify the ASC file with GPG
- gpg --verify "$file_asc"
- if [[ $? -ne 0 ]]; then
- echo "Signature error."
- exit 4
- else
- echo "GPG verification successful. Proceeding."
- fi
- # Check root access
- if [[ "$(sudo whoami)" = "root" ]]; then
- echo "Root access granted. Proceeding."
- else
- echo "Root access denied. Exiting."
- exit 5
- fi
- cd ..
- # Backup existing files
- mv expressvpn* ExpressVPN_bak
- # Move new files to the current directory
- mv ExpressVPN_tmp/* .
- # Install the RPM package
- sudo dnf install -y "$file_rpm"
- # Upgrade packages and refresh
- sudo dnf upgrade -y --refresh
- # Restart expressvpn service
- sudo systemctl restart expressvpn --now
- # Wait and check on service
- sleep 5
- sudo systemctl status expressvpn
- # Connect to expressvpn
- expressvpn connect smart
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement