Skip to content

Commit

Permalink
Build Metapackages without shim
Browse files Browse the repository at this point in the history
Signed-off-by: Ben Rockwood <[email protected]>
  • Loading branch information
benr committed Oct 6, 2023
1 parent 5134088 commit dc3d8a7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 28 deletions.
13 changes: 7 additions & 6 deletions helper/build_debs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ echo "--------- Creating Debian Package ${PKG_NAME} ${VERSION} ---------"
# Create the package directory:
mkdir ${PKG_NAME}

### v9 no longer includes a helper script
# Copy in contents:
mkdir -p ${PKG_NAME}/usr/bin
cp mondoo.sh ${PKG_NAME}/usr/bin/mondoo
#mkdir -p ${PKG_NAME}/usr/bin
#cp mondoo.sh ${PKG_NAME}/usr/bin/mondoo

# Create Package Metadata (Control File):
mkdir ${PKG_NAME}/DEBIAN
Expand All @@ -27,8 +28,8 @@ Section: utils
Priority: optional
Architecture: all
Maintainer: Mondoo <[email protected]>
Description: Mondoo Compatibility Wrapper for cnspec
Depends: cnspec (>= 8.0.0)
Description: Mondoo Metapackage for cnspec
Depends: cnspec (>= 9.0.0)
Installed-Size: 261 B
EOF

Expand All @@ -41,10 +42,10 @@ echo "Checking DPKG Contents:"
dpkg -c ${PKG_NAME}.deb
echo "Complete!"

# Create arch varieties for compatibility with Legacy Mondoo CLI
# Create arch varieties for compatibility with Legacy Mondoo CLI
echo "Creating platform variants:"
mkdir packages
for arch in 386 amd64 arm64 armv6 armv7 ppc64le; do
for arch in 386 amd64 arm64 armv6 armv7 ppc64le; do
# ex: mondoo_8.2.0_linux_amd64.deb
echo "Creating Deb for ${arch}..."
cp "${PKG_NAME}.deb" "packages/${PKG_NAME}_${VERSION}_linux_${arch}.deb"
Expand Down
32 changes: 10 additions & 22 deletions helper/build_rpms.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ MONDOO_VERSION=$VERSION
OUTDIR=packages
mkdir -p ${OUTDIR}

echo "--------- Creating RPM Package mondoo ${MONDOO_VERSION} ---------"
echo "--------- Creating RPM Meta-Package mondoo ${MONDOO_VERSION} ---------"

SCRIPT_LOCATION=$(readlink -f "$0")
REPO_DIR=$(dirname "${SCRIPT_LOCATION}")
Expand All @@ -18,54 +18,42 @@ cd "$TMPDIR"
# Set up files/directories for a rpmbuild environment
mkdir BUILD BUILDROOT RPMS SOURCES SPECS SRPMS

# Make a "release" tarball
mkdir mondoo-wrapper
cp "${REPO_DIR}/mondoo.sh" mondoo-wrapper/
tar czf "./SOURCES/mondoo-${MONDOO_VERSION}.tar.gz" ./mondoo-wrapper
SOURCES_PATH=${TMPDIR}/SOURCES/mondoo-${MONDOO_VERSION}.tar.gz

# The spec file pointing to the location we placed the "release" tarball
cat << EOF > ./SPECS/mondoo.spec
Name: mondoo
Version: ${MONDOO_VERSION}
Release: 1
Summary: Mondoo checks systems for vulnerabilities, security issues and misconfigurations
License: MPL 2.0
License: BUSL-1.1
URL: https://mondoo.com
Vendor: Mondoo, Inc
Source: ${SOURCES_PATH}
BuildArch: noarch
BuildRoot: \${_tmppath}/\${name}-root
Requires: cnspec
%description
Mondoo checks systems for vulnerabilities, security issues and misconfigurations
%prep
%setup -q -n mondoo-wrapper
%build
# it's a shell script
%install
mkdir -p \${RPM_BUILD_ROOT}/%{_bindir}
pwd
ls *
cp mondoo.sh \${RPM_BUILD_ROOT}/%{_bindir}/mondoo
%clean
%post
%files
%defattr(-,root,root)
%{_bindir}/mondoo
%changelog
* Mon Mar 20 2023 Mondoo, Inc <[email protected]>
Initial Mondoo shell wrapper script.
* Mon Mar 20 2023 Mondoo, Inc <[email protected]> 1-1
- Mondoo shell wrapper script.
EOF

# Build
echo "Building RPM..."
rpmbuild --define "_topdir $(pwd)" -v -ba ./SPECS/mondoo.spec
rpmbuild --define "_topdir $(pwd)" -v -bb ./SPECS/mondoo.spec

# Save
echo "Creating NOARCH RPM"
Expand All @@ -77,6 +65,6 @@ for arch in 386 amd64 arm64 armv6 armv7 ppc64le; do
cp "${OUTDIR}/mondoo_${MONDOO_VERSION}_linux_noarch.rpm" "${OUTDIR}/mondoo_${MONDOO_VERSION}_linux_${arch}.rpm"
done

## To Test:
## To Test:
## curl -sSL https://releases.mondoo.com/rpm/mondoo.repo > /etc/yum.repos.d/mondoo.repo
## yum install ./mondoo_0.0.1_linux_noarch.rpm

0 comments on commit dc3d8a7

Please sign in to comment.