From 78a2c6cd8d2a09e1c21d41970bf4f3bc84735c2c6778cea8fa02bf604aef3422 Mon Sep 17 00:00:00 2001 From: Sayali Lunkad Date: Tue, 13 Jul 2021 12:28:14 +0000 Subject: [PATCH] Accepting request 905904 from home:rjschwei:branches:devel:kubic:ignition - Add set-default-user.patch + Set the default user to suse - Add fix-authorized-keys-location.patch + Write the ssh keys to the standard location - Add no-network-args.patch + Networks arguments on the kernel command line are set during image build there is no need for another place for a hard coded list. - Create target dir for afterburn to write configuration file to OBS-URL: https://build.opensuse.org/request/show/905904 OBS-URL: https://build.opensuse.org/package/show/devel:kubic:ignition/afterburn?expand=0&rev=10 --- afterburn.changes | 12 ++++++++++++ afterburn.spec | 18 +++++++++++++++--- fix-authorized-keys-location.patch | 13 +++++++++++++ no-network-args.patch | 15 +++++++++++++++ set-default-user.patch | 11 +++++++++++ 5 files changed, 66 insertions(+), 3 deletions(-) create mode 100644 fix-authorized-keys-location.patch create mode 100644 no-network-args.patch create mode 100644 set-default-user.patch diff --git a/afterburn.changes b/afterburn.changes index 53b7519..c7570ee 100644 --- a/afterburn.changes +++ b/afterburn.changes @@ -1,3 +1,15 @@ +------------------------------------------------------------------- +Mon Jul 12 20:00:43 UTC 2021 - Robert Schweikert Sayali Lunkad + +- Add set-default-user.patch + + Set the default user to suse +- Add fix-authorized-keys-location.patch + + Write the ssh keys to the standard location +- Add no-network-args.patch + + Networks arguments on the kernel command line are set during image build + there is no need for another place for a hard coded list. +- Create target dir for afterburn to write configuration file to + ------------------------------------------------------------------- Fri Jun 11 14:02:00 UTC 2021 - Sayali Lunkad diff --git a/afterburn.spec b/afterburn.spec index 13a2c19..02186e3 100644 --- a/afterburn.spec +++ b/afterburn.spec @@ -29,6 +29,9 @@ URL: https://coreos.github.io/afterburn/ Source0: https://github.com/coreos/afterburn/archive/refs/tags/v%{version}.tar.gz#/%{name}-%{version}.tar.gz Source1: https://github.com/coreos/afterburn/releases/download/v%{version}/afterburn-%{version}-vendor.tar.gz Source2: cargo_config +Patch1: fix-authorized-keys-location.patch +Patch2: set-default-user.patch +Patch3: no-network-args.patch ExcludeArch: %ix86 s390x ppc64le armhfp armv7hl @@ -50,7 +53,11 @@ Dracut module that enables afterburn and corresponding services to run in the initramfs on boot. %prep -%autosetup -p1 -a1 +%autosetup -N -a1 +%patch1 -p0 +%patch2 -p0 +%patch3 -p0 + mkdir .cargo cp %{SOURCE2} .cargo/config # Remove exec bits to prevent an issue in fedora shebang checking @@ -63,16 +70,19 @@ cargo build --offline --release %install install -D -d -m 0755 %{buildroot}%{_bindir} install -D -d -m 0755 %{buildroot}%{_unitdir} +install -D -d -m 0755 %{buildroot}%{_sysconfdir}/cmdline.d install -m 0755 %{_builddir}/%{name}-%{version}/target/release/%{name} %{buildroot}%{_bindir}/%{name} install -m 0644 %{_builddir}/%{name}-%{version}/systemd/%{name}.service %{buildroot}%{_unitdir}/%{name}.service install -m 0644 %{_builddir}/%{name}-%{version}/systemd/%{name}-checkin.service %{buildroot}%{_unitdir}/%{name}-checkin.service -install -m 0644 %{_builddir}/%{name}-%{version}/systemd/%{name}-firstboot-checkin.service %{buildroot}%{_unitdir}/%{name}-firstboot-checkin.service -sed -e 's,@DEFAULT_INSTANCE@,'core',' < systemd/%{name}-sshkeys@.service.in > systemd/%{name}-sshkeys@.service.tmp +install -m 0644 %{_builddir}/%{name}-%{version}/systemd/%{name}-firstboot-checkin.service %{buildroot}%{_unitdir}/%{name}-firstboot-checkin.service +install -m 0644 %{_builddir}/%{name}-%{version}/systemd/%{name}-sshkeys.target %{buildroot}%{_unitdir}/%{name}-sshkeys.target +sed -e 's,@DEFAULT_INSTANCE@,'suse',' < systemd/%{name}-sshkeys@.service.in > systemd/%{name}-sshkeys@.service.tmp mv systemd/%{name}-sshkeys@.service.tmp systemd/%{name}-sshkeys@.service install -m 0644 %{_builddir}/%{name}-%{version}/systemd/%{name}-sshkeys@.service %{buildroot}%{_unitdir}/%{name}-sshkeys@.service mkdir -p %{buildroot}%{dracutmodulesdir} cp -a dracut/* %{buildroot}%{dracutmodulesdir} +rm %{buildroot}%{dracutmodulesdir}/30afterburn/afterburn-network-kargs.service %pre %service_add_pre %{name}.service %{name}-checkin.service %{name}-firstboot-checkin.service %{name}-sshkeys@.service @@ -94,8 +104,10 @@ cp -a dracut/* %{buildroot}%{dracutmodulesdir} %{_unitdir}/afterburn-checkin.service %{_unitdir}/afterburn-firstboot-checkin.service %{_unitdir}/afterburn-sshkeys@.service +%{_unitdir}/%{name}-sshkeys.target %files dracut +%dir %{_sysconfdir}/cmdline.d %{dracutmodulesdir}/30afterburn/ %changelog diff --git a/fix-authorized-keys-location.patch b/fix-authorized-keys-location.patch new file mode 100644 index 0000000..88a67bf --- /dev/null +++ b/fix-authorized-keys-location.patch @@ -0,0 +1,13 @@ +--- src/providers/mod.rs.orig ++++ src/providers/mod.rs +@@ -130,8 +130,8 @@ fn write_ssh_keys(user: User, ssh_keys: + .chain_err(|| "failed to switch user/group")?; + + // get paths +- let dir_path = user.home_dir().join(".ssh").join("authorized_keys.d"); +- let file_name = "afterburn"; ++ let dir_path = user.home_dir().join(".ssh"); ++ let file_name = "authorized_keys"; + let file_path = &dir_path.join(file_name); + + if !ssh_keys.is_empty() { diff --git a/no-network-args.patch b/no-network-args.patch new file mode 100644 index 0000000..49ac2d3 --- /dev/null +++ b/no-network-args.patch @@ -0,0 +1,15 @@ +--- dracut/30afterburn/module-setup.sh.orig ++++ dracut/30afterburn/module-setup.sh +@@ -16,12 +16,8 @@ install() { + inst_simple "$moddir/afterburn-hostname.service" \ + "$systemdutildir/system/afterburn-hostname.service" + +- inst_simple "$moddir/afterburn-network-kargs.service" \ +- "$systemdutildir/system/afterburn-network-kargs.service" +- + # These services are only run once on first-boot, so they piggyback + # on Ignition completion target. + mkdir -p "$initdir/$systemdsystemunitdir/ignition-complete.target.requires" + ln -s "../afterburn-hostname.service" "$initdir/$systemdsystemunitdir/ignition-complete.target.requires/afterburn-hostname.service" +- ln -s "../afterburn-network-kargs.service" "$initdir/$systemdsystemunitdir/ignition-complete.target.requires/afterburn-network-kargs.service" + } diff --git a/set-default-user.patch b/set-default-user.patch new file mode 100644 index 0000000..fa51de8 --- /dev/null +++ b/set-default-user.patch @@ -0,0 +1,11 @@ +--- Makefile.orig ++++ Makefile +@@ -1,7 +1,7 @@ + DESTDIR ?= + PREFIX ?= /usr + RELEASE ?= 1 +-DEFAULT_INSTANCE ?= core ++DEFAULT_INSTANCE ?= suse + + ifeq ($(RELEASE),1) + PROFILE ?= release