Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes to support ostree bootable containers #328

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions plugins/pkg_commands.d/centos
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

. /etc/os-release

if [ -f "/run/ostree-booted" ];then
# OSTree based filesystems are read-only and install with rpm-ostree
RSTRNT_PKG_CMD=${RSTRNT_PKG_CMD:-rpm-ostree}
RSTRNT_PKG_ARGS=${RSTRNT_PKG_ARGS:--y --apply-live --idempotent --allow-inactive}
elif [ 0"$(echo $VERSION_ID | cut -d'.' -f1)" -ge 8 ]; then
# CentOS 8 and newer use dnf as default
RSTRNT_PKG_CMD=${RSTRNT_PKG_CMD:-dnf}
fi
8 changes: 6 additions & 2 deletions plugins/pkg_commands.d/fedora
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

. /etc/os-release

# Fedora 22 and newer use dnf as default
if [ 0"$VERSION_ID" -gt 21 ]; then
if [ -f "/run/ostree-booted" ]; then
# OSTree based filesystems are read-only and install with rpm-ostree
RSTRNT_PKG_CMD=${RSTRNT_PKG_CMD:-rpm-ostree}
RSTRNT_PKG_ARGS=${RSTRNT_PKG_ARGS:--y --apply-live --idempotent --allow-inactive}
elif [ 0"$VERSION_ID" -gt 21 ]; then
# Fedora 22 and newer use dnf as default
RSTRNT_PKG_CMD=${RSTRNT_PKG_CMD:-dnf}
fi
8 changes: 6 additions & 2 deletions plugins/pkg_commands.d/rhel
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

. /etc/os-release

# RHEL 8 and newer use dnf as default
if [ 0"$(echo $VERSION_ID | cut -d'.' -f1)" -ge 8 ]; then
if [ -f "/run/ostree-booted" ];then
# OSTree based filesystems are read-only and install with rpm-ostree
RSTRNT_PKG_CMD=${RSTRNT_PKG_CMD:-rpm-ostree}
RSTRNT_PKG_ARGS=${RSTRNT_PKG_ARGS:--y --apply-live --idempotent --allow-inactive}
elif [ 0"$(echo $VERSION_ID | cut -d'.' -f1)" -ge 8 ]; then
# RHEL 8 and newer use dnf as default
RSTRNT_PKG_CMD=${RSTRNT_PKG_CMD:-dnf}
fi
3 changes: 3 additions & 0 deletions restraint.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Type Path Mode User Group Age Argument
d /mnt/scratchspace 0777 root root -
d /mnt/testarea 1777 root root -
11 changes: 11 additions & 0 deletions restraint.spec
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Group: Applications/Internet
License: GPLv3+ and MIT
URL: https://github.com/beaker-project/%{name}
Source0: https://github.com/beaker-project/restraint/archive/%{name}-%{version}.tar.gz
Source1: %{name}.conf

%if 0%{?with_static:1}
# Sources for bundled, statically linked libraries
Expand Down Expand Up @@ -249,6 +250,12 @@ fi
popd
%endif

%if %{with_systemd}
mkdir -p $RPM_BUILD_ROOT/%{_tmpfilesdir}
install -m 0644 %{SOURCE1} $RPM_BUILD_ROOT/%{_tmpfilesdir}/%{name}.conf
%endif


%post
if [ "$1" -le "1" ] ; then # First install
%if %{with_systemd}
Expand Down Expand Up @@ -381,8 +388,12 @@ fi
%{_bindir}/rhts_recipe_sync_block
%{_bindir}/rhts-abort
%{_datadir}/rhts/lib/rhts-make.include
%if %{with_systemd}
%config %{_tmpfilesdir}/%{name}.conf
%else
/mnt/scratchspace
%attr(1777,root,root)/mnt/testarea
%endif
%if 0%{?rhel}%{?fedora} > 4
%{_datadir}/selinux/packages/%{name}/rhts.pp
%endif
Expand Down