Skip to content

Commit

Permalink
Build and update Arch Mondoo Metapackage (#431)
Browse files Browse the repository at this point in the history
* Build metapackage

Signed-off-by: Ben Rockwood <[email protected]>

* Mondoo Update Action

Signed-off-by: Ben Rockwood <[email protected]>

* Omit release file from mondoo package gen

Signed-off-by: Ben Rockwood <[email protected]>

* Commit extrafiles with Mondoo package

Signed-off-by: Ben Rockwood <[email protected]>

* Remove extranious file add to pkg

Signed-off-by: Ben Rockwood <[email protected]>

* Update to cnspec

Signed-off-by: Ben Rockwood <[email protected]>

* Update mondoo.service

---------

Signed-off-by: Ben Rockwood <[email protected]>
  • Loading branch information
benr authored Feb 1, 2024
1 parent d9c6f78 commit 90249c5
Show file tree
Hide file tree
Showing 10 changed files with 507 additions and 11 deletions.
19 changes: 18 additions & 1 deletion .github/workflows/pkg_arch-aur.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ jobs:
cd packages/archlinux
echo "cnquery: $(cat cnquery/PKGBUILD | grep orignalVersion=)"
echo "cnspec: $(cat cnspec/PKGBUILD | grep orignalVersion=)"
echo "mondoo: $(cat mondoo/PKGBUILD | grep orignalVersion=)"
- name: Publish cnquery AUR package
if: ${{ !inputs.skip }}
uses: KSXGitHub/[email protected]
Expand All @@ -89,4 +90,20 @@ jobs:
commit_email: ${{ secrets.AUR_EMAIL }}
ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
commit_message: ${{ needs.setup.outputs.version }}
force_push: 'true'
force_push: 'true'
- name: Publish mondoo AUR package
if: ${{ !inputs.skip }}
uses: KSXGitHub/[email protected]
with:
pkgname: mondoo
pkgbuild: packages/archlinux/mondoo/PKGBUILD
commit_username: ${{ secrets.AUR_USERNAME }}
commit_email: ${{ secrets.AUR_EMAIL }}
ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
commit_message: ${{ needs.setup.outputs.version }}
force_push: 'true'
assets:
packages/archlinux/mondoo/mondoo.sh
packages/archlinux/mondoo/LICENSE.html
packages/archlinux/mondoo/OSS-LICENSES.tar.xz
packages/archlinux/mondoo/mondoo.service
7 changes: 6 additions & 1 deletion packages/archlinux/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
update: update-cnquery update-cnspec
update: update-cnquery update-cnspec update-mondoo

update-cnquery:
mkdir cnquery
Expand All @@ -8,3 +8,8 @@ update-cnspec:
mkdir cnspec
go run ./generator/main.go cnspec ./cnspec

update-mondoo:
go run ./generator/main.go mondoo ./mondoo

clean:
rm -rf cnquery/ cnspec/ mondoo/PKGBUILD mondoo/.SRCINFO
18 changes: 9 additions & 9 deletions packages/archlinux/generator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ type Product struct {
Class string
License string
ExtraFiles []SourceFile
BinFile bool
IncludeOpt bool
Depends []string
}
Expand Down Expand Up @@ -66,6 +67,7 @@ var products = map[string]Product{
},
},
IncludeOpt: true,
BinFile: false,
Depends: []string{
"cnspec",
},
Expand All @@ -76,15 +78,17 @@ var products = map[string]Product{
Homepage: "https://mondoo.com",
PkgName: "cnquery",
Class: "Cnquery",
License: "MPL 2.0",
License: "BUSL-1.1",
BinFile: true,
},
"cnspec": {
LatestUrl: "https://releases.mondoo.com/cnspec/latest.json?ignoreCache=1",
Description: "Cloud-Native Security and Policy Framework ",
Homepage: "https://mondoo.com",
PkgName: "cnspec",
Class: "Cnspec",
License: "MPL 2.0",
License: "BUSL-1.1",
BinFile: true,
Depends: []string{
"cnquery",
},
Expand Down Expand Up @@ -216,28 +220,24 @@ pkgdesc="{{ .Description }}"
url="https://mondoo.com"
license=('{{ .License }}')
source=(
"https://releases.mondoo.com/{{ .PkgName }}/${orignalVersion}/{{ .PkgName }}_${orignalVersion}_linux_amd64.tar.gz"
{{- if .BinFile }}"https://releases.mondoo.com/{{ .PkgName }}/${orignalVersion}/{{ .PkgName }}_${orignalVersion}_linux_amd64.tar.gz"{{- end }}
{{ range .ExtraFiles -}}
'{{ .Name }}'
{{ end -}}
)
arch=('x86_64')
depends=({{ range .Depends }}'{{ . }}'{{ end }})
sha256sums=('{{ .Sha256 }}'
sha256sums=({{- if .BinFile }}'{{ .Sha256 }}'{{- end }}
{{ range .ExtraSha256 -}}
'{{ . }}'
{{ end -}}
)
package() {
{{- if .BinFile }}
install -dm755 ${pkgdir}/usr/bin
{{- if .IncludeOpt }}
install -dm755 ${pkgdir}/opt/$pkgname/bin
cp ${srcdir}/$pkgname ${pkgdir}/opt/$pkgname/bin/.
{{- else }}
cp ${srcdir}/$pkgname ${pkgdir}/usr/bin/.
{{- end }}
Expand Down
21 changes: 21 additions & 0 deletions packages/archlinux/mondoo/.SRCINFO
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
pkgbase = mondoo
pkgdesc = Mondoo Client CLI for the Mondoo Policy as Code Platform
pkgver = 9.13.0
pkgrel = 1
url = https://mondoo.com
arch = x86_64
license = custom
source = https://releases.mondoo.com/mondoo/9.13.0/mondoo_9.13.0_linux_amd64.tar.gz
source = LICENSE.html
source = OSS-LICENSES.tar.xz
source = mondoo.service
source = mondoo.sh

sha256sums =
sha256sums = f1a7d679603a68a01583d98252ca0079986962d3ceca9a47ce01e0640a42500f
sha256sums = cd99e204a986af5a91f46c43478b28f556a4f50fd9721844d0b600d45ac43cb8
sha256sums = 2febf46353886823e6a61ca15c73e651d71d45579b0a1a17e18905a61387e7e6
sha256sums = 6eed5224af83aec8cbb751770c503eb11b15bd447aef67830922e4a2bdec4e3e


pkgname = mondoo
4 changes: 4 additions & 0 deletions packages/archlinux/mondoo/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
src/
pkg/
*.tar.gz
*.tar.zst
386 changes: 386 additions & 0 deletions packages/archlinux/mondoo/LICENSE.html

Large diffs are not rendered by default.

Binary file added packages/archlinux/mondoo/OSS-LICENSES.tar.xz
Binary file not shown.
42 changes: 42 additions & 0 deletions packages/archlinux/mondoo/PKGBUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Maintainer: Mondoo Inc <[email protected]>
# Maintainer: Dominik Richter <[email protected]>
# Maintainer: Patrick Münch <[email protected]>
#
pkgname=mondoo
orignalVersion="2.2.3"
pkgver="${orignalVersion/-/_}"
pkgrel=1
pkgdesc="Mondoo Client CLI for the Mondoo Policy as Code Platform"
url="https://mondoo.com"
license=('custom')
source=(
"https://releases.mondoo.com/mondoo/${orignalVersion}/mondoo_${orignalVersion}_linux_amd64.tar.gz"
'LICENSE.html'
'OSS-LICENSES.tar.xz'
'mondoo.service'
'mondoo.sh'
)
arch=('x86_64')
depends=('cnspec')

sha256sums=(''
'f1a7d679603a68a01583d98252ca0079986962d3ceca9a47ce01e0640a42500f'
'cd99e204a986af5a91f46c43478b28f556a4f50fd9721844d0b600d45ac43cb8'
'2febf46353886823e6a61ca15c73e651d71d45579b0a1a17e18905a61387e7e6'
'6eed5224af83aec8cbb751770c503eb11b15bd447aef67830922e4a2bdec4e3e'
)


package() {
install -dm755 ${pkgdir}/usr/bin
install -dm755 ${pkgdir}/opt/$pkgname/bin
cp ${srcdir}/$pkgname ${pkgdir}/opt/$pkgname/bin/.

install -Dm 644 LICENSE.html "$pkgdir"/usr/share/licenses/$pkgname/LICENSE.html
install -Dm 644 OSS-LICENSES.tar.xz "$pkgdir"/usr/share/licenses/$pkgname/OSS-LICENSES.tar.xz
install -Dm 644 mondoo.service "$pkgdir"/usr/lib/systemd/system/mondoo.service
install -Dm 755 mondoo.sh "$pkgdir"/usr/bin/mondoo

}

#vim: syntax=sh
15 changes: 15 additions & 0 deletions packages/archlinux/mondoo/mondoo.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[Unit]
Description=Mondoo Service
After=network-online.target

[Service]
Type=simple
WorkingDirectory=/opt/mondoo/bin/
ExecStart=/usr/bin/cnspec --config /etc/opt/mondoo/mondoo.yml serve
KillMode=process
Restart=on-failure
RestartSec=90
RestartPreventExitStatus=78

[Install]
WantedBy=multi-user.target
6 changes: 6 additions & 0 deletions packages/archlinux/mondoo/mondoo.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh
# Copyright (c) Mondoo, Inc.
# SPDX-License-Identifier: BUSL-1.1

/usr/bin/cnspec --config /etc/opt/mondoo/mondoo.yml "$@"

0 comments on commit 90249c5

Please sign in to comment.