PIA Download via Curl

Euwanh
New Contributor III

So I use to have a script that downloaded PIA VPN but now when I run a curl command on terminal using ' curl https://www.privateinternetaccess.com/installer/x/download_installer_osx '
it just shows the website in plain text rather than an app can anyone offer any insights what is the best way to go about this?

6 REPLIES 6

Mauricio
Contributor III

Hello Euwan

The file address is https://installers.privateinternetaccess.com/download/pia-macos-1.1.1-02545.zip

You could try

curl --silent "https://installers.privateinternetaccess.com/download/pia-macos-1.1.1-02545.zip" -o /tmp/pia-macos.zip

Is this part of any automated process?

Euwanh
New Contributor III

Yea it is automated got it sorted now. Used this script

!/bin/bash

Make Temp Directory

mkdir -p /Volumes/Macintosh HD/Users/Shared/temp

Go to temp

cd /Volumes/Macintosh HD/Users/Shared/temp

download PIA text file with updated .zip name

curl -LO https://www.privateinternetaccess.com/installer/x/download_installer_osx

isolate the zip URL and ZIP file name

PIAURL=$(cat download_installer_osx | grep .zip | grep -Eo "(http|https)://[a-zA-Z0-9./?=-]")

PIAZIP=$(ls | grep *.zip)

Download zip file

curl -LO $PIAURL

Unzip files

unzip $PIAZIP

sleep 30

Run PIA Installer

open /Volumes/Macintosh HD/Users/Shared/temp/Private Internet Access Installer.app

sleep 100

Remove Temp Directory

rm -rf /Volumes/Macintosh HD/Users/Shared/temp

exit

TheHoff
New Contributor III

Three years later I find this solution. But somehow your GREP only returns 'https://i' Maybe something went wrong with the copy/paste in here?

GREP is not my specialty, so I am having a hard time trying to get it to work. If anyone has any tips?

tomatoes27
New Contributor II

@Euwanh Thanks for the script. I have something similar I want to achieve but I want the site i'm going to to m.meraki.com requires that I input a value. I've used the POST command to add value but may be doing it wrong. Any suggestions?

Euwanh
New Contributor III

@tomatoes27 sorry for the very long delay did you need further assistance with this? I know how daunting it can be when you first start using jamf and then have to write scripts

TheHoff
New Contributor III

Managed to get the script working at least. But then the installer gives a prompt to install a helper app and requiring a password. Guess that there is no way around this.....

#!/bin/bash
#Go to downloadsfolder
cd ~/Downloads
#download PIA text file with updated .zip name
curl -LO https://www.privateinternetaccess.com/installer/x/download_installer_osx
#isolate the zip URL name
PIAURL=$(cat download_installer_osx | grep .zip | grep -Eo "https://.+\.zip")
sleep 10
#Download zip file
curl -LO $PIAURL
sleep 10
#isolate the zip file name
PIAZIP=$(ls | grep pia*.zip)
#Unzip files
unzip $PIAZIP
sleep 10
#Run PIA Installer
open ~/Downloads/Private\ Internet\ Access\ Installer.app 
sleep 100
exit