Move ignition binary into dracut module directory

It's too dangerous to put in the PATH.
This commit is contained in:
Benjamin Gilbert 2019-03-15 22:38:01 -04:00
parent a4778c4191
commit 49656b1105
3 changed files with 36 additions and 7 deletions

View File

@ -0,0 +1,24 @@
diff --git a/dracut/30ignition/module-setup.sh b/dracut/30ignition/module-setup.sh
index 4b1c1aa..211da77 100755
--- a/dracut/30ignition/module-setup.sh
+++ b/dracut/30ignition/module-setup.sh
@@ -11,7 +11,6 @@ install() {
chroot \
groupadd \
id \
- ignition \
mkfs.ext4 \
mkfs.vfat \
mkfs.xfs \
@@ -32,6 +31,11 @@ install() {
# inst_script "$moddir/retry-umount.sh" \
# "/usr/sbin/retry-umount"
+ # Distro packaging is expected to install the ignition binary into the
+ # module directory.
+ inst_simple "$moddir/ignition" \
+ "/usr/bin/ignition"
+
inst_simple "$moddir/ignition-generator" \
"$systemdutildir/system-generators/ignition-generator"

View File

@ -82,6 +82,8 @@ Source1: https://%{dracutprovider_prefix}/archive/%{dracutcommit}/%{dracu
Patch0: 0001-grub-find-boot-partition-and-use-it-directly.patch
Patch1: 0001-02_ignition_firstboot-Enable-networking-if-Ignition-.patch
# https://github.com/coreos/ignition-dracut/pull/56
Patch2: dracut-ignition-not-in-path.patch
# For RHEL7 we'll want to specify gopath and list of arches since there is no
# gopath or go_arches macro. We'll also want to make sure we pull in golang
@ -343,6 +345,7 @@ This package contains a tool for validating Ignition configurations.
cd %{dracutrepo}-%{dracutcommit}
%patch0 -p1
%patch1 -p1
%patch2 -p1
mv LICENSE ../LICENSE.dracut
@ -372,11 +375,6 @@ echo "Building ignition-validate..."
%install
# ignition
install -d -p %{buildroot}%{_bindir}
install -p -m 0755 ./ignition %{buildroot}%{_bindir}
install -p -m 0755 ./ignition-validate %{buildroot}%{_bindir}
# ignition-dracut
install -d -p %{buildroot}/%{dracutlibdir}/modules.d
install -d -p %{buildroot}/%{_prefix}/lib/systemd/system
@ -388,6 +386,13 @@ install -m 0644 -t %{buildroot}/%{_prefix}/lib/systemd/system/ systemd/*
install -m 0755 -t %{buildroot}/%{_sysconfdir}/grub.d/ grub/*
popd >/dev/null
# ignition
install -d -p %{buildroot}%{_bindir}
install -p -m 0755 ./ignition-validate %{buildroot}%{_bindir}
# The ignition binary is only for dracut, and is dangerous to run from
# the command line. Install directly into the dracut module dir.
install -p -m 0755 ./ignition %{buildroot}/%{dracutlibdir}/modules.d/30ignition
# source codes for building projects
%if 0%{?with_devel}
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
@ -472,7 +477,6 @@ export GOPATH=%{buildroot}/%{gopath}:$(pwd)/vendor:%{gopath}
%files
%license LICENSE LICENSE.dracut
%doc README.md doc/
%{_bindir}/%{name}
%{dracutlibdir}/modules.d/30ignition
%{dracutlibdir}/modules.d/99journald-conf
%{_sysconfdir}/grub.d/*
@ -499,6 +503,7 @@ export GOPATH=%{buildroot}/%{gopath}:$(pwd)/vendor:%{gopath}
%changelog
* Mon Mar 18 2019 Benjamin Gilbert <bgilbert@backtick.net> - 0.31.0-4.gitf59a653
- Move dracut modules into main ignition package
- Move ignition binary out of the PATH
- Move ignition-validate into a subpackage
- Include ignition-dracut license file
- Drop developer docs from base package

View File

@ -9,7 +9,7 @@
tests:
- ignition-run-version:
dir: ./
run: /usr/bin/ignition --version
run: /usr/lib/dracut/modules.d/30ignition/ignition --version
- ignition-rpm-installed:
dir: ./
run: /usr/bin/rpm -q ignition