Skip to content

Commit 8646a86

Browse files
authored
Update npcap install script
- update to new version - hide the red error text when the key is not detected
1 parent 6c59eef commit 8646a86

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

.config/appveyor/InstallNpcap.ps1

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
# Install Npcap on the machine.
22

33
# Config:
4-
$npcap_oem_file = "npcap-0.99-r9-oem.exe"
4+
$npcap_oem_file = "npcap-0.9997-oem.exe"
55

66
# Note: because we need the /S option (silent), this script has two cases:
77
# - The script is runned from a master build, then use the secure variable 'npcap_oem_key' which will be available
88
# to decode the very recent npcap install oem file and use it
99
# - The script is runned from a PR, then use the provided archived 0.96 version, which is the last public one to
1010
# provide support for the /S option
1111

12-
Try
13-
{
14-
# Check that the key is defined (build mode)
12+
if (Test-Path Env:npcap_oem_key){ # Key is here: on master
13+
echo "Using Npcap OEM version"
14+
# Unpack the key
1515
$user, $pass = (Get-ChildItem Env:npcap_oem_key).Value.replace("`"", "").split(",")
1616
if(!$user -Or !$pass){
1717
Throw (New-Object System.Exception)
@@ -25,9 +25,8 @@ Try
2525
$secpasswd = ConvertTo-SecureString $pass -AsPlainText -Force
2626
$credential = New-Object System.Management.Automation.PSCredential($user, $secpasswd)
2727
Invoke-WebRequest -uri (-join("https://nmap.org/npcap/oem/dist/",$npcap_oem_file)) -OutFile $file -Headers $headers -Credential $credential
28-
}
29-
Catch
30-
{
28+
} else { # No key: PRs
29+
echo "Using backup 0.96"
3130
$file = $PSScriptRoot+"\npcap-0.96.exe"
3231
# Download the 0.96 file from nmap servers
3332
wget "https://nmap.org/npcap/dist/npcap-0.96.exe" -UseBasicParsing -OutFile $file
@@ -40,9 +39,10 @@ Catch
4039
echo "Checksums matches !"
4140
}
4241
}
43-
echo "Installing:"
44-
echo $file
42+
echo ('Installing: ' + $file)
4543

4644
# Run installer
4745
Start-Process $file -ArgumentList "/loopback_support=yes /S" -wait
48-
echo "Npcap installation completed"
46+
if($?) {
47+
echo "Npcap installation completed"
48+
}

0 commit comments

Comments
 (0)