Skip to content

Commit a651a33

Browse files
committed
Choco package added
1 parent 767a501 commit a651a33

6 files changed

Lines changed: 310 additions & 0 deletions

File tree

Choco/NETworkManager/ReadMe.md

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
## Summary
2+
How do I create packages? See https://chocolatey.org/docs/create-packages
3+
4+
If you are submitting packages to the community feed (https://chocolatey.org)
5+
always try to ensure you have read, understood and adhere to the create
6+
packages wiki link above.
7+
8+
## Automatic Packaging Updates?
9+
Consider making this package an automatic package, for the best
10+
maintainability over time. Read up at https://chocolatey.org/docs/automatic-packages
11+
12+
## Shim Generation
13+
Any executables you include in the package or download (but don't call
14+
install against using the built-in functions) will be automatically shimmed.
15+
16+
This means those executables will automatically be included on the path.
17+
Shim generation runs whether the package is self-contained or uses automation
18+
scripts.
19+
20+
By default, these are considered console applications.
21+
22+
If the application is a GUI, you should create an empty file next to the exe
23+
named 'name.exe.gui' e.g. 'bob.exe' would need a file named 'bob.exe.gui'.
24+
See https://chocolatey.org/docs/create-packages#how-do-i-set-up-shims-for-applications-that-have-a-gui
25+
26+
If you want to ignore the executable, create an empty file next to the exe
27+
named 'name.exe.ignore' e.g. 'bob.exe' would need a file named
28+
'bob.exe.ignore'.
29+
See https://chocolatey.org/docs/create-packages#how-do-i-exclude-executables-from-getting-shims
30+
31+
## Self-Contained?
32+
If you have a self-contained package, you can remove the automation scripts
33+
entirely and just include the executables, they will automatically get shimmed,
34+
which puts them on the path. Ensure you have the legal right to distribute
35+
the application though. See https://chocolatey.org/docs/legal.
36+
37+
You should read up on the Shim Generation section to familiarize yourself
38+
on what to do with GUI applications and/or ignoring shims.
39+
40+
## Automation Scripts
41+
You have a powerful use of Chocolatey, as you are using PowerShell. So you
42+
can do just about anything you need. Choco has some very handy built-in
43+
functions that you can use, these are sometimes called the helpers.
44+
45+
### Built-In Functions
46+
https://chocolatey.org/docs/helpers-reference
47+
48+
A note about a couple:
49+
* Get-BinRoot - this is a horribly named function that doesn't do what new folks think it does. It gets you the 'tools' root, which by default is set to 'c:\tools', not the chocolateyInstall bin folder - see https://chocolatey.org/docs/helpers-get-tools-location
50+
* Install-BinFile - used for non-exe files - executables are automatically shimmed... - see https://chocolatey.org/docs/helpers-install-bin-file
51+
* Uninstall-BinFile - used for non-exe files - executables are automatically shimmed - see https://chocolatey.org/docs/helpers-uninstall-bin-file
52+
53+
### Getting package specific information
54+
Use the package parameters pattern - see https://chocolatey.org/docs/how-to-parse-package-parameters-argument
55+
56+
### Need to mount an ISO?
57+
https://chocolatey.org/docs/how-to-mount-an-iso-in-chocolatey-package
58+
59+
### Environment Variables
60+
Chocolatey makes a number of environment variables available (You can access any of these with $env:TheVariableNameBelow):
61+
62+
* TEMP/TMP - Overridden to the CacheLocation, but may be the same as the original TEMP folder
63+
* ChocolateyInstall - Top level folder where Chocolatey is installed
64+
* ChocolateyPackageName - The name of the package, equivalent to the `<id />` field in the nuspec (0.9.9+)
65+
* ChocolateyPackageTitle - The title of the package, equivalent to the `<title />` field in the nuspec (0.10.1+)
66+
* ChocolateyPackageVersion - The version of the package, equivalent to the `<version />` field in the nuspec (0.9.9+)
67+
* ChocolateyPackageFolder - The top level location of the package folder - the folder where Chocolatey has downloaded and extracted the NuGet package, typically `C:\ProgramData\chocolatey\lib\packageName`.
68+
69+
#### Advanced Environment Variables
70+
The following are more advanced settings:
71+
72+
* ChocolateyPackageParameters - Parameters to use with packaging, not the same as install arguments (which are passed directly to the native installer). Based on `--package-parameters`. (0.9.8.22+)
73+
* CHOCOLATEY_VERSION - The version of Choco you normally see. Use if you are 'lighting' things up based on choco version. (0.9.9+) - Otherwise take a dependency on the specific version you need.
74+
* ChocolateyForceX86 = If available and set to 'true', then user has requested 32bit version. (0.9.9+) - Automatically handled in built in Choco functions.
75+
* OS_PLATFORM - Like Windows, OSX, Linux. (0.9.9+)
76+
* OS_VERSION - The version of OS, like 6.1 something something for Windows. (0.9.9+)
77+
* OS_NAME - The reported name of the OS. (0.9.9+)
78+
* USER_NAME = The user name (0.10.6+)
79+
* USER_DOMAIN = The user domain name (could also be local computer name) (0.10.6+)
80+
* IS_PROCESSELEVATED = Is the process elevated? (0.9.9+)
81+
* IS_SYSTEM = Is the user the system account? (0.10.6+)
82+
* IS_REMOTEDESKTOP = Is the user in a terminal services session? (0.10.6+)
83+
* ChocolateyToolsLocation - formerly 'ChocolateyBinRoot' ('ChocolateyBinRoot' will be removed with Chocolatey v2.0.0), this is where tools being installed outside of Chocolatey packaging will go. (0.9.10+)
84+
85+
#### Set By Options and Configuration
86+
Some environment variables are set based on options that are passed, configuration and/or features that are turned on:
87+
88+
* ChocolateyEnvironmentDebug - Was `--debug` passed? If using the built-in PowerShell host, this is always true (but only logs debug messages to console if `--debug` was passed) (0.9.10+)
89+
* ChocolateyEnvironmentVerbose - Was `--verbose` passed? If using the built-in PowerShell host, this is always true (but only logs verbose messages to console if `--verbose` was passed). (0.9.10+)
90+
* ChocolateyForce - Was `--force` passed? (0.9.10+)
91+
* ChocolateyForceX86 - Was `-x86` passed? (CHECK)
92+
* ChocolateyRequestTimeout - How long before a web request will time out. Set by config `webRequestTimeoutSeconds` (CHECK)
93+
* ChocolateyResponseTimeout - How long to wait for a download to complete? Set by config `commandExecutionTimeoutSeconds` (CHECK)
94+
* ChocolateyPowerShellHost - Are we using the built-in PowerShell host? Set by `--use-system-powershell` or the feature `powershellHost` (0.9.10+)
95+
96+
#### Business Edition Variables
97+
98+
* ChocolateyInstallArgumentsSensitive - Encrypted arguments passed from command line `--install-arguments-sensitive` that are not logged anywhere. (0.10.1+ and licensed editions 1.6.0+)
99+
* ChocolateyPackageParametersSensitive - Package parameters passed from command line `--package-parameters-senstivite` that are not logged anywhere. (0.10.1+ and licensed editions 1.6.0+)
100+
* ChocolateyLicensedVersion - What version is the licensed edition on?
101+
* ChocolateyLicenseType - What edition / type of the licensed edition is installed?
102+
* USER_CONTEXT - The original user context - different when self-service is used (Licensed v1.10.0+)
103+
104+
#### Experimental Environment Variables
105+
The following are experimental or use not recommended:
106+
107+
* OS_IS64BIT = This may not return correctly - it may depend on the process the app is running under (0.9.9+)
108+
* CHOCOLATEY_VERSION_PRODUCT = the version of Choco that may match CHOCOLATEY_VERSION but may be different (0.9.9+) - based on git describe
109+
* IS_ADMIN = Is the user an administrator? But doesn't tell you if the process is elevated. (0.9.9+)
110+
* IS_REMOTE = Is the user in a remote session? (0.10.6+)
111+
112+
#### Not Useful Or Anti-Pattern If Used
113+
114+
* ChocolateyInstallOverride = Not for use in package automation scripts. Based on `--override-arguments` being passed. (0.9.9+)
115+
* ChocolateyInstallArguments = The installer arguments meant for the native installer. You should use chocolateyPackageParameters intead. Based on `--install-arguments` being passed. (0.9.9+)
116+
* ChocolateyIgnoreChecksums - Was `--ignore-checksums` passed or the feature `checksumFiles` turned off? (0.9.9.9+)
117+
* ChocolateyAllowEmptyChecksums - Was `--allow-empty-checksums` passed or the feature `allowEmptyChecksums` turned on? (0.10.0+)
118+
* ChocolateyAllowEmptyChecksumsSecure - Was `--allow-empty-checksums-secure` passed or the feature `allowEmptyChecksumsSecure` turned on? (0.10.0+)
119+
* ChocolateyCheckLastExitCode - Should Chocolatey check LASTEXITCODE? Is the feature `scriptsCheckLastExitCode` turned on? (0.10.3+)
120+
* ChocolateyChecksum32 - Was `--download-checksum` passed? (0.10.0+)
121+
* ChocolateyChecksumType32 - Was `--download-checksum-type` passed? (0.10.0+)
122+
* ChocolateyChecksum64 - Was `--download-checksum-x64` passed? (0.10.0)+
123+
* ChocolateyChecksumType64 - Was `--download-checksum-type-x64` passed? (0.10.0)+
124+
* ChocolateyPackageExitCode - The exit code of the script that just ran - usually set by `Set-PowerShellExitCode` (CHECK)
125+
* ChocolateyLastPathUpdate - Set by Chocolatey as part of install, but not used for anything in particular in packaging.
126+
* ChocolateyProxyLocation - The explicit proxy location as set in the configuration `proxy` (0.9.9.9+)
127+
* ChocolateyDownloadCache - Use available download cache? Set by `--skip-download-cache`, `--use-download-cache`, or feature `downloadCache` (0.9.10+ and licensed editions 1.1.0+)
128+
* ChocolateyProxyBypassList - Explicitly set locations to ignore in configuration `proxyBypassList` (0.10.4+)
129+
* ChocolateyProxyBypassOnLocal - Should the proxy bypass on local connections? Set based on configuration `proxyBypassOnLocal` (0.10.4+)
130+
* http_proxy - Set by original `http_proxy` passthrough, or same as `ChocolateyProxyLocation` if explicitly set. (0.10.4+)
131+
* https_proxy - Set by original `https_proxy` passthrough, or same as `ChocolateyProxyLocation` if explicitly set. (0.10.4+)
132+
* no_proxy- Set by original `no_proxy` passthrough, or same as `ChocolateyProxyBypassList` if explicitly set. (0.10.4+)
133+
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- Read this before creating packages: https://chocolatey.org/docs/create-packages -->
3+
<!-- It is especially important to read the above link to understand additional requirements when publishing packages to the community feed aka dot org (https://chocolatey.org/packages). -->
4+
5+
<!-- Test your packages in a test environment: https://github.com/chocolatey/chocolatey-test-environment -->
6+
7+
<!--
8+
This is a nuspec. It mostly adheres to https://docs.nuget.org/create/Nuspec-Reference. Chocolatey uses a special version of NuGet.Core that allows us to do more than was initially possible. As such there are certain things to be aware of:
9+
10+
* the package xmlns schema url may cause issues with nuget.exe
11+
* Any of the following elements can ONLY be used by choco tools - projectSourceUrl, docsUrl, mailingListUrl, bugTrackerUrl, packageSourceUrl, provides, conflicts, replaces
12+
* nuget.exe can still install packages with those elements but they are ignored. Any authoring tools or commands will error on those elements
13+
-->
14+
15+
<!-- You can embed software files directly into packages, as long as you are not bound by distribution rights. -->
16+
<!-- * If you are an organization making private packages, you probably have no issues here -->
17+
<!-- * If you are releasing to the community feed, you need to consider distribution rights. -->
18+
<!-- Do not remove this test for UTF-8: if “Ω” doesn’t appear as greek uppercase omega letter enclosed in quotation marks, you should use an editor that supports UTF-8, not this one. -->
19+
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
20+
<metadata>
21+
<!-- == PACKAGE SPECIFIC SECTION == -->
22+
<!-- This section is about this package, although id and version have ties back to the software -->
23+
<!-- id is lowercase and if you want a good separator for words, use '-', not '.'. Dots are only acceptable as suffixes for certain types of packages, e.g. .install, .portable, .extension, .template -->
24+
<!-- If the software is cross-platform, attempt to use the same id as the debian/rpm package(s) if possible. -->
25+
<id>NETworkManager</id>
26+
<!-- version should MATCH as closely as possible with the underlying software -->
27+
<!-- Is the version a prerelease of a version? https://docs.nuget.org/create/versioning#creating-prerelease-packages -->
28+
<!-- Note that unstable versions like 0.0.1 can be considered a released version, but it's possible that one can release a 0.0.1-beta before you release a 0.0.1 version. If the version number is final, that is considered a released version and not a prerelease. -->
29+
<version>1.6.2</version>
30+
<!-- <packageSourceUrl>Where is this Chocolatey package located (think GitHub)? packageSourceUrl is highly recommended for the community feed</packageSourceUrl>-->
31+
<!-- owners is a poor name for maintainers of the package. It sticks around by this name for compatibility reasons. It basically means you. -->
32+
<owners>BornToBeRoot</owners>
33+
<!-- ============================== -->
34+
35+
<!-- == SOFTWARE SPECIFIC SECTION == -->
36+
<!-- This section is about the software itself -->
37+
<title>NETworkManager (Install)</title>
38+
<authors>BornToBeRoot</authors>
39+
<!-- projectUrl is required for the community feed -->
40+
<projectUrl>https://github.com/BornToBeRoot/NETworkManager</projectUrl>
41+
<iconUrl>https://raw.githubusercontent.com/BornToBeRoot/NETworkManager/master/Icon/NETworkManager.ico</iconUrl>
42+
<!-- <copyright>Year Software Vendor</copyright> -->
43+
<!-- If there is a license Url available, it is required for the community feed -->
44+
<licenseUrl>https://github.com/BornToBeRoot/NETworkManager/blob/master/LICENSE</licenseUrl>
45+
<requireLicenseAcceptance>true</requireLicenseAcceptance>
46+
<projectSourceUrl>https://github.com/BornToBeRoot/NETworkManager</projectSourceUrl>
47+
<docsUrl>https://github.com/BornToBeRoot/NETworkManager/tree/master/Documentation</docsUrl>
48+
<!--<mailingListUrl></mailingListUrl>-->
49+
<bugTrackerUrl>https://github.com/BornToBeRoot/NETworkManager/issues</bugTrackerUrl>
50+
<tags>networkmanager networkinterface ipscanner portscanner wakeonlan traceroute tracert trace ping icmp dns dnslookup subnet calculator httpheader snmp rdp remotedesktop putty ssh</tags>
51+
<summary>Network Interface (Information, Configure)
52+
IP-Scanner
53+
Port-Scanner
54+
Ping
55+
Traceroute
56+
DNS Lookup
57+
Remote Desktop (with Tabs)
58+
PuTTY (with Tabs)
59+
SNMP - Get/Walk/Set (v1, v2c, v3)
60+
Wake on LAN
61+
HTTP Headers
62+
Subnet-Calculator
63+
Lokup (OUI, Port)
64+
ARP Table</summary>
65+
<description>A powerful tool for managing networks and troubleshoot network problems!</description>
66+
<!-- <releaseNotes>__REPLACE_OR_REMOVE__MarkDown_Okay</releaseNotes> -->
67+
<!-- =============================== -->
68+
69+
<!-- Specifying dependencies and version ranges? https://docs.nuget.org/create/versioning#specifying-version-ranges-in-.nuspec-files -->
70+
<!--<dependencies>
71+
<dependency id="" version="__MINIMUM_VERSION__" />
72+
<dependency id="" version="[__EXACT_VERSION__]" />
73+
<dependency id="" version="[_MIN_VERSION_INCLUSIVE, MAX_VERSION_INCLUSIVE]" />
74+
<dependency id="" version="[_MIN_VERSION_INCLUSIVE, MAX_VERSION_EXCLUSIVE)" />
75+
<dependency id="" />
76+
<dependency id="chocolatey-core.extension" version="1.1.0" />
77+
</dependencies>-->
78+
<!-- chocolatey-core.extension - https://chocolatey.org/packages/chocolatey-core.extension
79+
- You want to use Get-UninstallRegistryKey on less than 0.9.10 (in chocolateyUninstall.ps1)
80+
- You want to use Get-PackageParameters and on less than 0.11.0
81+
- You want to take advantage of other functions in the core community maintainer's team extension package
82+
-->
83+
84+
<!--<provides>NOT YET IMPLEMENTED</provides>-->
85+
<!--<conflicts>NOT YET IMPLEMENTED</conflicts>-->
86+
<!--<replaces>NOT YET IMPLEMENTED</replaces>-->
87+
</metadata>
88+
<files>
89+
<!-- this section controls what actually gets packaged into the Chocolatey package -->
90+
<file src="tools\**" target="tools" />
91+
<!--Building from Linux? You may need this instead: <file src="tools/**" target="tools" />-->
92+
</files>
93+
</package>
4.09 MB
Binary file not shown.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# This runs in 0.9.10+ before upgrade and uninstall.
2+
# Use this file to do things like stop services prior to upgrade or uninstall.
3+
# NOTE: It is an anti-pattern to call chocolateyUninstall.ps1 from here. If you
4+
# need to uninstall an MSI prior to upgrade, put the functionality in this
5+
# file without calling the uninstall script. Make it idempotent in the
6+
# uninstall script so that it doesn't fail when it is already uninstalled.
7+
# NOTE: For upgrades - like the uninstall script, this script always runs from
8+
# the currently installed version, not from the new upgraded package version.
9+
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
2+
$ErrorActionPreference = 'Stop';
3+
$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"
4+
$fileLocation = Join-Path $toolsDir 'NETworkManager_v1.6.2.0_Setup.msi'
5+
6+
$packageArgs = @{
7+
packageName = $env:ChocolateyPackageName
8+
unzipLocation = $toolsDir
9+
fileType = 'MSI'
10+
file = $fileLocation
11+
12+
softwareName = 'NETworkManager*'
13+
14+
checksum = '9DBED1062CCC8B99E682227C31B7E272CBA126B700CE5A0095D1AAD9ABE4CDDB'
15+
checksumType = 'sha256'
16+
checksum64 = '9DBED1062CCC8B99E682227C31B7E272CBA126B700CE5A0095D1AAD9ABE4CDDB'
17+
checksumType64= 'sha256'
18+
19+
silentArgs = "/qn /norestart /l*v `"$($env:TEMP)\$($packageName).$($env:chocolateyPackageVersion).MsiInstall.log`""
20+
validExitCodes= @(0, 3010, 1641)
21+
}
22+
23+
Install-ChocolateyPackage @packageArgs
24+
25+
26+
27+
28+
29+
30+
31+
32+
33+
34+
35+
36+
37+
38+
39+
40+
41+
42+
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
$ErrorActionPreference = 'Stop';
2+
$packageArgs = @{
3+
packageName = $env:ChocolateyPackageName
4+
softwareName = 'NETworkManager*'
5+
fileType = 'MSI'
6+
silentArgs = "/qn /norestart"
7+
validExitCodes= @(0, 3010, 1605, 1614, 1641)
8+
}
9+
10+
$uninstalled = $false
11+
[array]$key = Get-UninstallRegistryKey -SoftwareName $packageArgs['softwareName']
12+
13+
if ($key.Count -eq 1) {
14+
$key | % {
15+
$packageArgs['file'] = "$($_.UninstallString)"
16+
if ($packageArgs['fileType'] -eq 'MSI') {
17+
$packageArgs['silentArgs'] = "$($_.PSChildName) $($packageArgs['silentArgs'])"
18+
19+
$packageArgs['file'] = ''
20+
}
21+
22+
Uninstall-ChocolateyPackage @packageArgs
23+
}
24+
} elseif ($key.Count -eq 0) {
25+
Write-Warning "$packageName has already been uninstalled by other means."
26+
} elseif ($key.Count -gt 1) {
27+
Write-Warning "$($key.Count) matches found!"
28+
Write-Warning "To prevent accidental data loss, no programs will be uninstalled."
29+
Write-Warning "Please alert package maintainer the following keys were matched:"
30+
$key | % {Write-Warning "- $($_.DisplayName)"}
31+
}
32+
33+

0 commit comments

Comments
 (0)