This repository has been archived by the owner on Oct 10, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cnspec-generate.sh
executable file
·71 lines (56 loc) · 2.72 KB
/
cnspec-generate.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/bin/bash
if [[ $VERSION = "" ]]; then
echo "ERROR: You must supply a version number"
exit 1
fi
rm -rf cnspec/
mkdir cnspec && cd cnspec
echo "Generating NuSpec"
cat >cnspec.nuspec <<NUSPEC
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
<metadata>
<id>cnspec</id>
<version>${VERSION}</version>
<packageSourceUrl>https://github.com/mondoohq/cnspec</packageSourceUrl>
<owners>Mondoo</owners>
<dependencies>
<dependency id="cnquery" />
</dependencies>
<title>Mondoo cnspec</title>
<authors>Mondoo</authors>
<projectUrl>https://github.com/mondoohq/cnspec</projectUrl>
<iconUrl>https://mondoo.com/mondoo_choco_logo.jpg</iconUrl>
<copyright>2023 Mondoo, Inc.</copyright>
<licenseUrl>https://raw.githubusercontent.com/mondoohq/cnquery/617d62a9117f10c52872cad85ddf689d09140434/LICENSE.txt</licenseUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<docsUrl>https://mondoo.com/docs/cnspec/</docsUrl>
<bugTrackerUrl>https://github.com/mondoohq/cnspec/issues</bugTrackerUrl>
<releaseNotes>[Release Notes](https://mondoo.com/releases/)</releaseNotes>
<tags>cnspec mondoo security compliance cloud kubernetes server</tags>
<summary>cnspec is an open source, cloud-native tool that evaluates the security of your entire infrastructure. Using intuitive policy as code, cnspec scans everything and identifies gaps that attackers can use to breach your systems.</summary>
<description>cnspec is an open source, cloud-native tool that evaluates the security of your entire infrastructure. Using intuitive policy as code, cnspec scans everything and identifies gaps that attackers can use to breach your systems. Scan public and private cloud environments, Kubernetes clusters, containers, container registries, servers and endpoints, SaaS products, infrastructure as code, APIs, and more.</description>
</metadata>
<files>
<file src="tools\**" target="tools" />
</files>
</package>
NUSPEC
CHECKSUM=`curl -s https://install.mondoo.com/package/cnspec/windows/amd64/zip/${VERSION}/sha256`
echo "Generating Install Script"
mkdir tools
cat >tools/chocolateyInstall.ps1 <<CHOCOSTALL
\$ErrorActionPreference = 'Stop'; # stop on all errors
\$toolsDir = "\$(Split-Path -parent \$MyInvocation.MyCommand.Definition)"
\$version = '${VERSION}'
\$url = "https://releases.mondoo.com/cnspec/${VERSION}/cnspec_${VERSION}_windows_amd64.zip"
\$checksum = '${CHECKSUM}'
\$packageArgs = @{
packageName = \$env:ChocolateyPackageName
unzipLocation = \$toolsDir
url64bit = \$url
checksum64 = \$checksum
checksumType64= 'sha256' #default is checksumType
}
Install-ChocolateyZipPackage @packageArgs
CHOCOSTALL