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
This commit is contained in:
Sayali Lunkad 2021-07-13 12:28:14 +00:00 committed by Git OBS Bridge
parent 2278446fe9
commit 78a2c6cd8d
5 changed files with 66 additions and 3 deletions

View File

@ -1,3 +1,15 @@
-------------------------------------------------------------------
Mon Jul 12 20:00:43 UTC 2021 - Robert Schweikert <rjschwei@suse.com> Sayali Lunkad <sayali.lunkad@suse.com>
- 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 <sayali.lunkad@suse.com>

View File

@ -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

View File

@ -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() {

15
no-network-args.patch Normal file
View File

@ -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"
}

11
set-default-user.patch Normal file
View File

@ -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