Skip to content

Commit

Permalink
added powershell scripts to download
Browse files Browse the repository at this point in the history
  • Loading branch information
rm-Umar committed Nov 26, 2021
1 parent 5d0dc28 commit bf1f586
Show file tree
Hide file tree
Showing 10 changed files with 185 additions and 0 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ allowing you to:

The `ipinfo` CLI is available for download via multiple mechanisms.

### Windows Powershell

*Note*: run powershell as administrator before executing this command.

```bash
iwr -useb https://github.com/ipinfo/cli/releases/download/ipinfo-2.6.1/windows.ps1 | iex
```

### macOS

```bash
Expand Down
22 changes: 22 additions & 0 deletions cidr2ip/windows.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
$VSN = "1.0.0"

# build the filename for the Zip archive and exe file
$FileName ="cidr2ip_$($VSN)_windows_amd64"
$ZipFileName = "$($FileName).zip"

# download and extract zip
Invoke-WebRequest -Uri "https://github.com/cidr2ip/cli/releases/download/cidr2ip-$VSN/$FileName.zip" -OutFile ./$ZipFileName
Unblock-File ./$ZipFileName
Expand-Archive -Path ./$ZipFileName -DestinationPath $env:LOCALAPPDATA\cidr2ip -Force

# delete if already exists
if (Test-Path "$env:LOCALAPPDATA\cidr2ip\cidr2ip.exe") {
Remove-Item "$env:LOCALAPPDATA\cidr2ip\cidr2ip.exe"
}
Rename-Item -Path "$env:LOCALAPPDATA\cidr2ip\$FileName.exe" -NewName "cidr2ip.exe"

# setting up env. and cleaning files
[System.Environment]::SetEnvironmentVariable("PATH", $Env:Path + ";$env:LOCALAPPDATA\cidr2ip", "Machine")
$env:PATH="$env:PATH;$env:LOCALAPPDATA\cidr2ip"
Remove-Item -Path ./$ZipFileName
"You can use cidr2ip now"
22 changes: 22 additions & 0 deletions cidr2range/windows.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
$VSN = "1.2.0"

# build the filename for the Zip archive and exe file
$FileName ="cidr2range_$($VSN)_windows_amd64"
$ZipFileName = "$($FileName).zip"

# download and extract zip
Invoke-WebRequest -Uri "https://github.com/cidr2range/cli/releases/download/cidr2range-$VSN/$FileName.zip" -OutFile ./$ZipFileName
Unblock-File ./$ZipFileName
Expand-Archive -Path ./$ZipFileName -DestinationPath $env:LOCALAPPDATA\cidr2range -Force

# delete if already exists
if (Test-Path "$env:LOCALAPPDATA\cidr2range\cidr2range.exe") {
Remove-Item "$env:LOCALAPPDATA\cidr2range\cidr2range.exe"
}
Rename-Item -Path "$env:LOCALAPPDATA\cidr2range\$FileName.exe" -NewName "cidr2range.exe"

# setting up env. and cleaning files
[System.Environment]::SetEnvironmentVariable("PATH", $Env:Path + ";$env:LOCALAPPDATA\cidr2range", "Machine")
$env:PATH="$env:PATH;$env:LOCALAPPDATA\cidr2range"
Remove-Item -Path ./$ZipFileName
"You can use cidr2range now"
22 changes: 22 additions & 0 deletions grepip/windows.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
$VSN = "1.2.1"

# build the filename for the Zip archive and exe file
$FileName ="grepip_$($VSN)_windows_amd64"
$ZipFileName = "$($FileName).zip"

# download and extract zip
Invoke-WebRequest -Uri "https://github.com/grepip/cli/releases/download/grepip-$VSN/$FileName.zip" -OutFile ./$ZipFileName
Unblock-File ./$ZipFileName
Expand-Archive -Path ./$ZipFileName -DestinationPath $env:LOCALAPPDATA\grepip -Force

# delete if already exists
if (Test-Path "$env:LOCALAPPDATA\grepip\grepip.exe") {
Remove-Item "$env:LOCALAPPDATA\grepip\grepip.exe"
}
Rename-Item -Path "$env:LOCALAPPDATA\grepip\$FileName.exe" -NewName "grepip.exe"

# setting up env. and cleaning files
[System.Environment]::SetEnvironmentVariable("PATH", $Env:Path + ";$env:LOCALAPPDATA\grepip", "Machine")
$env:PATH="$env:PATH;$env:LOCALAPPDATA\grepip"
Remove-Item -Path ./$ZipFileName
"You can use grepip now"
22 changes: 22 additions & 0 deletions ipinfo/windows.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
$VSN = "2.6.1"

# build the filename for the Zip archive and exe file
$FileName ="ipinfo_$($VSN)_windows_amd64"
$ZipFileName = "$($FileName).zip"

# download and extract zip
Invoke-WebRequest -Uri "https://github.com/ipinfo/cli/releases/download/ipinfo-$VSN/$FileName.zip" -OutFile ./$ZipFileName
Unblock-File ./$ZipFileName
Expand-Archive -Path ./$ZipFileName -DestinationPath $env:LOCALAPPDATA\ipinfo -Force

# delete if already exists
if (Test-Path "$env:LOCALAPPDATA\ipinfo\ipinfo.exe") {
Remove-Item "$env:LOCALAPPDATA\ipinfo\ipinfo.exe"
}
Rename-Item -Path "$env:LOCALAPPDATA\ipinfo\$FileName.exe" -NewName "ipinfo.exe"

# setting up env. and cleaning files
[System.Environment]::SetEnvironmentVariable("PATH", $Env:Path + ";$env:LOCALAPPDATA\ipinfo", "Machine")
$env:PATH="$env:PATH;$env:LOCALAPPDATA\ipinfo"
Remove-Item -Path ./$ZipFileName
"You can use ipinfo now"
22 changes: 22 additions & 0 deletions prips/windows.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
$VSN = "1.0.0"

# build the filename for the Zip archive and exe file
$FileName ="prips_$($VSN)_windows_amd64"
$ZipFileName = "$($FileName).zip"

# download and extract zip
Invoke-WebRequest -Uri "https://github.com/prips/cli/releases/download/prips-$VSN/$FileName.zip" -OutFile ./$ZipFileName
Unblock-File ./$ZipFileName
Expand-Archive -Path ./$ZipFileName -DestinationPath $env:LOCALAPPDATA\prips -Force

# delete if already exists
if (Test-Path "$env:LOCALAPPDATA\prips\prips.exe") {
Remove-Item "$env:LOCALAPPDATA\prips\prips.exe"
}
Rename-Item -Path "$env:LOCALAPPDATA\prips\$FileName.exe" -NewName "prips.exe"

# setting up env. and cleaning files
[System.Environment]::SetEnvironmentVariable("PATH", $Env:Path + ";$env:LOCALAPPDATA\prips", "Machine")
$env:PATH="$env:PATH;$env:LOCALAPPDATA\prips"
Remove-Item -Path ./$ZipFileName
"You can use prips now"
22 changes: 22 additions & 0 deletions randip/windows.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
$VSN = "1.1.0"

# build the filename for the Zip archive and exe file
$FileName ="randip_$($VSN)_windows_amd64"
$ZipFileName = "$($FileName).zip"

# download and extract zip
Invoke-WebRequest -Uri "https://github.com/randip/cli/releases/download/randip-$VSN/$FileName.zip" -OutFile ./$ZipFileName
Unblock-File ./$ZipFileName
Expand-Archive -Path ./$ZipFileName -DestinationPath $env:LOCALAPPDATA\randip -Force

# delete if already exists
if (Test-Path "$env:LOCALAPPDATA\randip\randip.exe") {
Remove-Item "$env:LOCALAPPDATA\randip\randip.exe"
}
Rename-Item -Path "$env:LOCALAPPDATA\randip\$FileName.exe" -NewName "randip.exe"

# setting up env. and cleaning files
[System.Environment]::SetEnvironmentVariable("PATH", $Env:Path + ";$env:LOCALAPPDATA\randip", "Machine")
$env:PATH="$env:PATH;$env:LOCALAPPDATA\randip"
Remove-Item -Path ./$ZipFileName
"You can use randip now"
22 changes: 22 additions & 0 deletions range2cidr/windows.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
$VSN = "1.2.0"

# build the filename for the Zip archive and exe file
$FileName ="range2cidr_$($VSN)_windows_amd64"
$ZipFileName = "$($FileName).zip"

# download and extract zip
Invoke-WebRequest -Uri "https://github.com/range2cidr/cli/releases/download/range2cidr-$VSN/$FileName.zip" -OutFile ./$ZipFileName
Unblock-File ./$ZipFileName
Expand-Archive -Path ./$ZipFileName -DestinationPath $env:LOCALAPPDATA\range2cidr -Force

# delete if already exists
if (Test-Path "$env:LOCALAPPDATA\range2cidr\range2cidr.exe") {
Remove-Item "$env:LOCALAPPDATA\range2cidr\range2cidr.exe"
}
Rename-Item -Path "$env:LOCALAPPDATA\range2cidr\$FileName.exe" -NewName "range2cidr.exe"

# setting up env. and cleaning files
[System.Environment]::SetEnvironmentVariable("PATH", $Env:Path + ";$env:LOCALAPPDATA\range2cidr", "Machine")
$env:PATH="$env:PATH;$env:LOCALAPPDATA\range2cidr"
Remove-Item -Path ./$ZipFileName
"You can use range2cidr now"
22 changes: 22 additions & 0 deletions range2ip/windows.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
$VSN = "1.0.0"

# build the filename for the Zip archive and exe file
$FileName ="range2ip_$($VSN)_windows_amd64"
$ZipFileName = "$($FileName).zip"

# download and extract zip
Invoke-WebRequest -Uri "https://github.com/range2ip/cli/releases/download/range2ip-$VSN/$FileName.zip" -OutFile ./$ZipFileName
Unblock-File ./$ZipFileName
Expand-Archive -Path ./$ZipFileName -DestinationPath $env:LOCALAPPDATA\range2ip -Force

# delete if already exists
if (Test-Path "$env:LOCALAPPDATA\range2ip\range2ip.exe") {
Remove-Item "$env:LOCALAPPDATA\range2ip\range2ip.exe"
}
Rename-Item -Path "$env:LOCALAPPDATA\range2ip\$FileName.exe" -NewName "range2ip.exe"

# setting up env. and cleaning files
[System.Environment]::SetEnvironmentVariable("PATH", $Env:Path + ";$env:LOCALAPPDATA\range2ip", "Machine")
$env:PATH="$env:PATH;$env:LOCALAPPDATA\range2ip"
Remove-Item -Path ./$ZipFileName
"You can use range2ip now"
1 change: 1 addition & 0 deletions scripts/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,5 @@ gh release create ${CLI}-${VSN} \
$ROOT/build/${CLI}_${VSN}*.zip \
$ROOT/build/${CLI}_${VSN}*.deb \
$ROOT/${CLI}/macos.sh \
$ROOT/${CLI}/windows.ps1 \
$ROOT/${CLI}/deb.sh

0 comments on commit bf1f586

Please sign in to comment.