Skip to content

Commit

Permalink
Package for EL 7/8/9
Browse files Browse the repository at this point in the history
Using Oracle Linux 7, Rocky Linux 8+9
  • Loading branch information
jonasbroms committed Jan 25, 2023
1 parent 6d4f1a4 commit b4c0e38
Show file tree
Hide file tree
Showing 12 changed files with 267 additions and 1 deletion.
36 changes: 36 additions & 0 deletions scripts/packages/oraclelinux7/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
FROM oraclelinux:7.9

COPY entrypoint.sh /entrypoint.sh
COPY build /usr/local/src/hbm

ENV DAPPER_SOURCE /tmp
ENV DAPPER_OUTPUT dist
ENV SHELL /bin/bash

WORKDIR ${DAPPER_SOURCE}

ENV RPMBUILD_PATH="/srv/rpmbuild"

RUN build="rpm-build" \
&& set -x \
&& yum -y install $build \
&& yum -y autoremove \
&& yum clean all

RUN mkdir -p ${RPMBUILD_PATH} \
&& mkdir ${RPMBUILD_PATH}/BUILD \
&& mkdir ${RPMBUILD_PATH}/RPMS \
&& mkdir ${RPMBUILD_PATH}/SOURCES \
&& mkdir ${RPMBUILD_PATH}/SPECS \
&& mkdir ${RPMBUILD_PATH}/SRPMS \
&& mkdir ${RPMBUILD_PATH}/tmp \
&& echo "%_topdir ${RPMBUILD_PATH}" > /root/.rpmmacros \
&& echo "%_tmppath ${RPMBUILD_PATH}/tmp" >> /root/.rpmmacros

COPY hbm.spec ${RPMBUILD_PATH}/SPECS/hbm.spec

RUN set -x \
&& tar cvzf ${RPMBUILD_PATH}/SOURCES/hbm.tar.gz -C /usr/local/src hbm \
&& rm -rf /usr/local/src/hbm

ENTRYPOINT ["/entrypoint.sh"]
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM centos:7
FROM rockylinux:8.7

COPY entrypoint.sh /entrypoint.sh
COPY build /usr/local/src/hbm
Expand Down
19 changes: 19 additions & 0 deletions scripts/packages/rockylinux8/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash

VERSION=$1
RELEASE=$2

VERSION=${VERSION//-/_}

cd "${RPMBUILD_PATH}/SPECS" || exit

rpmbuild -ba \
--define "_version ${VERSION}" \
--define "_release ${RELEASE}" \
--define '_unitdir etc/systemd/system' \
hbm.spec

mkdir -p /tmp/dist
cp ${RPMBUILD_PATH}/RPMS/x86_64/*.rpm /tmp/dist/

#rpmlint hbm.spec ../SRPMS/hbm* ../RPMS/*/hbm*
59 changes: 59 additions & 0 deletions scripts/packages/rockylinux8/hbm.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
Name: hbm
Version: %{_version}
Release: %{_release}%{?dist}
Summary: Docker Engine Access Authorization Plugin
Group: Tools/Docker

License: GPLv3+

URL: https://github.com/kassisol/hbm
Vendor: Kassisol
Packager: Kassisol <support@kassisol.com>

BuildArch: x86_64
BuildRoot: %{_tmppath}/%{name}-buildroot

Source: hbm.tar.gz

%description
HBM is an authorization plugin for docker commands.

%prep
%setup -n %{name}

%install
# install binary
install -d $RPM_BUILD_ROOT/%{_sbindir}
install -p -m 755 hbm $RPM_BUILD_ROOT/%{_sbindir}/

# add init scripts
install -d $RPM_BUILD_ROOT/%{_unitdir}
install -p -m 644 hbm.service $RPM_BUILD_ROOT/%{_unitdir}/hbm.service
install -p -m 644 hbm.socket $RPM_BUILD_ROOT/%{_unitdir}/hbm.socket

# add bash completions
install -d $RPM_BUILD_ROOT/usr/share/bash-completion/completions
install -p -m 644 shellcompletion/bash $RPM_BUILD_ROOT/usr/share/bash-completion/completions/hbm

# install manpages
install -d $RPM_BUILD_ROOT/%{_mandir}/man8
install -p -m 644 man/man8/*.8 $RPM_BUILD_ROOT/%{_mandir}/man8/

%files
#%doc README.md LICENSE
%{_sbindir}/hbm
/%{_unitdir}/hbm.service
/%{_unitdir}/hbm.socket
/usr/share/bash-completion/completions/hbm
/%{_mandir}/man8/*

%post
%systemd_post hbm.service
%systemd_post hbm.socket

%preun
%systemd_preun hbm.service
%systemd_preun hbm.socket

%clean
rm -rf $RPM_BUILD_ROOT
19 changes: 19 additions & 0 deletions scripts/packages/rockylinux8/prebuild.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash

ROOTDIR=$(dirname $0)/../../..
cd $(dirname $0)

if [ -d "build" ]; then
rm -rf build
fi
mkdir -p build

cp ${ROOTDIR}/contrib/init/systemd/hbm.service build/
cp ${ROOTDIR}/contrib/init/systemd/hbm.socket build/
cp ${ROOTDIR}/bin/hbm build/

go run ${ROOTDIR}/gen/man/genman.go
cp -r /tmp/hbm/man build/

go run ${ROOTDIR}/gen/shellcompletion/genshellcompletion.go
cp -r /tmp/hbm/shellcompletion build/
36 changes: 36 additions & 0 deletions scripts/packages/rockylinux9/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
FROM rockylinux:9.1

COPY entrypoint.sh /entrypoint.sh
COPY build /usr/local/src/hbm

ENV DAPPER_SOURCE /tmp
ENV DAPPER_OUTPUT dist
ENV SHELL /bin/bash

WORKDIR ${DAPPER_SOURCE}

ENV RPMBUILD_PATH="/srv/rpmbuild"

RUN build="rpm-build" \
&& set -x \
&& yum -y install $build \
&& yum -y autoremove \
&& yum clean all

RUN mkdir -p ${RPMBUILD_PATH} \
&& mkdir ${RPMBUILD_PATH}/BUILD \
&& mkdir ${RPMBUILD_PATH}/RPMS \
&& mkdir ${RPMBUILD_PATH}/SOURCES \
&& mkdir ${RPMBUILD_PATH}/SPECS \
&& mkdir ${RPMBUILD_PATH}/SRPMS \
&& mkdir ${RPMBUILD_PATH}/tmp \
&& echo "%_topdir ${RPMBUILD_PATH}" > /root/.rpmmacros \
&& echo "%_tmppath ${RPMBUILD_PATH}/tmp" >> /root/.rpmmacros

COPY hbm.spec ${RPMBUILD_PATH}/SPECS/hbm.spec

RUN set -x \
&& tar cvzf ${RPMBUILD_PATH}/SOURCES/hbm.tar.gz -C /usr/local/src hbm \
&& rm -rf /usr/local/src/hbm

ENTRYPOINT ["/entrypoint.sh"]
19 changes: 19 additions & 0 deletions scripts/packages/rockylinux9/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash

VERSION=$1
RELEASE=$2

VERSION=${VERSION//-/_}

cd "${RPMBUILD_PATH}/SPECS" || exit

rpmbuild -ba \
--define "_version ${VERSION}" \
--define "_release ${RELEASE}" \
--define '_unitdir etc/systemd/system' \
hbm.spec

mkdir -p /tmp/dist
cp ${RPMBUILD_PATH}/RPMS/x86_64/*.rpm /tmp/dist/

#rpmlint hbm.spec ../SRPMS/hbm* ../RPMS/*/hbm*
59 changes: 59 additions & 0 deletions scripts/packages/rockylinux9/hbm.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
Name: hbm
Version: %{_version}
Release: %{_release}%{?dist}
Summary: Docker Engine Access Authorization Plugin
Group: Tools/Docker

License: GPLv3+

URL: https://github.com/kassisol/hbm
Vendor: Kassisol
Packager: Kassisol <support@kassisol.com>

BuildArch: x86_64
BuildRoot: %{_tmppath}/%{name}-buildroot

Source: hbm.tar.gz

%description
HBM is an authorization plugin for docker commands.

%prep
%setup -n %{name}

%install
# install binary
install -d $RPM_BUILD_ROOT/%{_sbindir}
install -p -m 755 hbm $RPM_BUILD_ROOT/%{_sbindir}/

# add init scripts
install -d $RPM_BUILD_ROOT/%{_unitdir}
install -p -m 644 hbm.service $RPM_BUILD_ROOT/%{_unitdir}/hbm.service
install -p -m 644 hbm.socket $RPM_BUILD_ROOT/%{_unitdir}/hbm.socket

# add bash completions
install -d $RPM_BUILD_ROOT/usr/share/bash-completion/completions
install -p -m 644 shellcompletion/bash $RPM_BUILD_ROOT/usr/share/bash-completion/completions/hbm

# install manpages
install -d $RPM_BUILD_ROOT/%{_mandir}/man8
install -p -m 644 man/man8/*.8 $RPM_BUILD_ROOT/%{_mandir}/man8/

%files
#%doc README.md LICENSE
%{_sbindir}/hbm
/%{_unitdir}/hbm.service
/%{_unitdir}/hbm.socket
/usr/share/bash-completion/completions/hbm
/%{_mandir}/man8/*

%post
%systemd_post hbm.service
%systemd_post hbm.socket

%preun
%systemd_preun hbm.service
%systemd_preun hbm.socket

%clean
rm -rf $RPM_BUILD_ROOT
19 changes: 19 additions & 0 deletions scripts/packages/rockylinux9/prebuild.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash

ROOTDIR=$(dirname $0)/../../..
cd $(dirname $0)

if [ -d "build" ]; then
rm -rf build
fi
mkdir -p build

cp ${ROOTDIR}/contrib/init/systemd/hbm.service build/
cp ${ROOTDIR}/contrib/init/systemd/hbm.socket build/
cp ${ROOTDIR}/bin/hbm build/

go run ${ROOTDIR}/gen/man/genman.go
cp -r /tmp/hbm/man build/

go run ${ROOTDIR}/gen/shellcompletion/genshellcompletion.go
cp -r /tmp/hbm/shellcompletion build/

0 comments on commit b4c0e38

Please sign in to comment.