From 40b7729123043d8061555fbbe8764bcbb0bcf83c Mon Sep 17 00:00:00 2001 From: Andrea Bolognani Date: Thu, 18 Apr 2024 19:31:45 +0200 Subject: [PATCH] Improve creation of regular user Do it as part of %post instead of waiting until boot. There are several advantages to this approach: it makes boot a little bit faster, and prevents a warning about sysvinit compatibility being deprecated from being printed. Most importantly, if the user decides to change the password after installation, that change will now stick instead of being reverted every time the machine is booted. Signed-off-by: Andrea Bolognani (cherry picked from commit 2e51a65e040ac1caf556d0f87e3facea407ca301) --- fedora-riscv64-developer-f40.ks | 37 ++++------------------ fedora-riscv64-minimal-f40-experimental.ks | 37 ++++------------------ fedora-riscv64-minimal-f40-kiwi.ks | 37 ++++------------------ fedora-riscv64-minimal-f40.ks | 37 ++++------------------ 4 files changed, 28 insertions(+), 120 deletions(-) diff --git a/fedora-riscv64-developer-f40.ks b/fedora-riscv64-developer-f40.ks index 4156129..7c26f62 100644 --- a/fedora-riscv64-developer-f40.ks +++ b/fedora-riscv64-developer-f40.ks @@ -60,6 +60,8 @@ uboot-images-riscv64 dracut-config-generic -dracut-config-rescue +# For user creation and manipulation +shadow-utils passwd # Adding kiwi for disk image generation @@ -252,10 +254,6 @@ haveged # end of gcc packages watchdog -# No longer in @core since 2018-10, but needed for livesys script -initscripts -chkconfig - # Lets resize / on first boot #dracut-modules-growroot @@ -423,32 +421,11 @@ dnf -y remove dracut-config-generic # and mounting processes. This should help on systems where boot takes longer. sed -i 's|noatime|noatime,x-systemd.device-timeout=300s,x-systemd.mount-timeout=300s|g' /etc/fstab -# Fedora 31 -# https://fedoraproject.org/wiki/Changes/DisableRootPasswordLoginInSshd -cat > /etc/rc.d/init.d/livesys << EOF -#!/bin/bash -# -# live: Init script for live image -# -# chkconfig: 345 00 99 -# description: Init script for live image. -### BEGIN INIT INFO -# X-Start-Before: display-manager chronyd -### END INIT INFO - -. /etc/rc.d/init.d/functions - -useradd -c "Fedora RISCV User" riscv -echo fedora_rocks! | passwd --stdin riscv > /dev/null -usermod -aG wheel riscv > /dev/null -usermod -aG mock riscv > /dev/null - -exit 0 -EOF - -chmod 755 /etc/rc.d/init.d/livesys -/sbin/restorecon /etc/rc.d/init.d/livesys -/sbin/chkconfig --add livesys +# Create regular user +/usr/sbin/useradd -c "Fedora RISCV User" riscv +echo fedora_rocks! | passwd --stdin riscv +/usr/sbin/usermod -aG wheel riscv +/usr/sbin/usermod -aG mock riscv # Create Fedora RISC-V repo cat << EOF > /etc/yum.repos.d/fedora-riscv.repo diff --git a/fedora-riscv64-minimal-f40-experimental.ks b/fedora-riscv64-minimal-f40-experimental.ks index b878fcd..2bec8a9 100644 --- a/fedora-riscv64-minimal-f40-experimental.ks +++ b/fedora-riscv64-minimal-f40-experimental.ks @@ -60,6 +60,8 @@ uboot-images-riscv64 dracut-config-generic -dracut-config-rescue +# For user creation and manipulation +shadow-utils passwd # Install the English locale, but not all the other ones @@ -71,10 +73,6 @@ chrony haveged watchdog -# No longer in @core since 2018-10, but needed for livesys script -initscripts -chkconfig - # Lets resize / on first boot #dracut-modules-growroot @@ -101,32 +99,11 @@ dnf -y remove dracut-config-generic # and mounting processes. This should help on systems where boot takes longer. sed -i 's|noatime|noatime,x-systemd.device-timeout=300s,x-systemd.mount-timeout=300s|g' /etc/fstab -# Fedora 31 -# https://fedoraproject.org/wiki/Changes/DisableRootPasswordLoginInSshd -cat > /etc/rc.d/init.d/livesys << EOF -#!/bin/bash -# -# live: Init script for live image -# -# chkconfig: 345 00 99 -# description: Init script for live image. -### BEGIN INIT INFO -# X-Start-Before: display-manager chronyd -### END INIT INFO - -. /etc/rc.d/init.d/functions - -useradd -c "Fedora RISCV User" riscv -echo fedora_rocks! | passwd --stdin riscv > /dev/null -usermod -aG wheel riscv > /dev/null -usermod -aG mock riscv > /dev/null - -exit 0 -EOF - -chmod 755 /etc/rc.d/init.d/livesys -/sbin/restorecon /etc/rc.d/init.d/livesys -/sbin/chkconfig --add livesys +# Create regular user +/usr/sbin/useradd -c "Fedora RISCV User" riscv +echo fedora_rocks! | passwd --stdin riscv +/usr/sbin/usermod -aG wheel riscv +/usr/sbin/usermod -aG mock riscv # Create Fedora RISC-V repo cat << EOF > /etc/yum.repos.d/fedora-riscv.repo diff --git a/fedora-riscv64-minimal-f40-kiwi.ks b/fedora-riscv64-minimal-f40-kiwi.ks index 0c52c4d..bd4c26d 100644 --- a/fedora-riscv64-minimal-f40-kiwi.ks +++ b/fedora-riscv64-minimal-f40-kiwi.ks @@ -57,6 +57,8 @@ uboot-images-riscv64 dracut-config-generic -dracut-config-rescue +# For user creation and manipulation +shadow-utils passwd # Install the English locale, but not all the other ones @@ -68,10 +70,6 @@ chrony haveged watchdog -# No longer in @core since 2018-10, but needed for livesys script -initscripts -chkconfig - # Lets resize / on first boot #dracut-modules-growroot @@ -98,32 +96,11 @@ dnf -y remove dracut-config-generic # and mounting processes. This should help on systems where boot takes longer. sed -i 's|noatime|noatime,x-systemd.device-timeout=300s,x-systemd.mount-timeout=300s|g' /etc/fstab -# Fedora 31 -# https://fedoraproject.org/wiki/Changes/DisableRootPasswordLoginInSshd -cat > /etc/rc.d/init.d/livesys << EOF -#!/bin/bash -# -# live: Init script for live image -# -# chkconfig: 345 00 99 -# description: Init script for live image. -### BEGIN INIT INFO -# X-Start-Before: display-manager chronyd -### END INIT INFO - -. /etc/rc.d/init.d/functions - -useradd -c "Fedora RISCV User" riscv -echo fedora_rocks! | passwd --stdin riscv > /dev/null -usermod -aG wheel riscv > /dev/null -usermod -aG mock riscv > /dev/null - -exit 0 -EOF - -chmod 755 /etc/rc.d/init.d/livesys -/sbin/restorecon /etc/rc.d/init.d/livesys -/sbin/chkconfig --add livesys +# Create regular user +/usr/sbin/useradd -c "Fedora RISCV User" riscv +echo fedora_rocks! | passwd --stdin riscv +/usr/sbin/usermod -aG wheel riscv +/usr/sbin/usermod -aG mock riscv # Create Fedora RISC-V repo cat << EOF > /etc/yum.repos.d/fedora-riscv.repo diff --git a/fedora-riscv64-minimal-f40.ks b/fedora-riscv64-minimal-f40.ks index 0a76a82..f268b3e 100644 --- a/fedora-riscv64-minimal-f40.ks +++ b/fedora-riscv64-minimal-f40.ks @@ -53,6 +53,8 @@ uboot-images-riscv64 dracut-config-generic -dracut-config-rescue +# For user creation and manipulation +shadow-utils passwd # Install the English locale, but not all the other ones @@ -64,10 +66,6 @@ chrony haveged watchdog -# No longer in @core since 2018-10, but needed for livesys script -initscripts -chkconfig - # Lets resize / on first boot #dracut-modules-growroot @@ -94,32 +92,11 @@ dnf -y remove dracut-config-generic # and mounting processes. This should help on systems where boot takes longer. sed -i 's|noatime|noatime,x-systemd.device-timeout=300s,x-systemd.mount-timeout=300s|g' /etc/fstab -# Fedora 31 -# https://fedoraproject.org/wiki/Changes/DisableRootPasswordLoginInSshd -cat > /etc/rc.d/init.d/livesys << EOF -#!/bin/bash -# -# live: Init script for live image -# -# chkconfig: 345 00 99 -# description: Init script for live image. -### BEGIN INIT INFO -# X-Start-Before: display-manager chronyd -### END INIT INFO - -. /etc/rc.d/init.d/functions - -useradd -c "Fedora RISCV User" riscv -echo fedora_rocks! | passwd --stdin riscv > /dev/null -usermod -aG wheel riscv > /dev/null -usermod -aG mock riscv > /dev/null - -exit 0 -EOF - -chmod 755 /etc/rc.d/init.d/livesys -/sbin/restorecon /etc/rc.d/init.d/livesys -/sbin/chkconfig --add livesys +# Create regular user +/usr/sbin/useradd -c "Fedora RISCV User" riscv +echo fedora_rocks! | passwd --stdin riscv +/usr/sbin/usermod -aG wheel riscv +/usr/sbin/usermod -aG mock riscv # Create Fedora RISC-V repo cat << EOF > /etc/yum.repos.d/fedora-riscv.repo