...
Reference from: https://www.redhat.com/sysadmin/create-rpm-package
Code Block | ||
---|---|---|
| ||
$ sudo dnf install -y rpmdevtools $ rpmdev-setuptree |
This will setup the rpm packaging environment. Then, download the Lynis tarball from Lynis official website and place it in ~/rpmbuild/SOURCES, note the filename to use later in the spec file.
...
Place the following content into lynis.sh under ~/rpmbuild/SOURCES directory as well.
Code Block | ||
---|---|---|
| ||
#!/bin/bash cd /opt/lynis exec ./lynis "$@" |
Place the following content into lynis-ncsa.spec under ~/rpmbuild/SPECS
Code Block | ||
---|---|---|
| ||
Name: lynis-ncsa Version: 0.1 Release: 1%{?dist} Summary: NCSA custom Lynis package BuildArch: noarch License: NCSA URL: https://git.ncsa.illinois.edu/irst/lynis-ncsa-plugins Source0: lynis-3.0.6.tar.gz Source1: lynis.sh Source2: default.prf Source3: plugin_ncsa_phase2 Requires: bash %description NCSA custom Lynis package with the NCSA plugin %prep cd ${HOME}/rpmbuild/BUILD tar xf ../SOURCES/lynis-3.0.6.tar.gz cp ../SOURCES/lynis.sh . cp ../SOURCES/default.prf . cp ../SOURCES/plugin_ncsa_phase2 . %build chmod +x lynis.sh mv default.prf lynis mv plugin_ncsa_phase2 lynis/plugins %install rm -rf $RPM_BUILD_ROOT mkdir -p $RPM_BUILD_ROOT/%{_bindir} mkdir -p $RPM_BUILD_ROOT/opt mv lynis $RPM_BUILD_ROOT/opt mv lynis.sh $RPM_BUILD_ROOT/%{_bindir}/lynis %clean rm -rf $RPM_BUILD_ROOT %files %{_bindir}/lynis /opt/lynis/ |
...