2022-09-17 12:16:13 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -euxo pipefail
|
|
|
|
|
|
|
|
#======================================
|
|
|
|
# Functions...
|
|
|
|
#--------------------------------------
|
|
|
|
test -f /.kconfig && . /.kconfig
|
|
|
|
test -f /.profile && . /.profile
|
|
|
|
|
|
|
|
#======================================
|
|
|
|
# Greeting...
|
|
|
|
#--------------------------------------
|
|
|
|
echo "Configure image: [$kiwi_iname]-[$kiwi_profiles]..."
|
|
|
|
|
|
|
|
#======================================
|
|
|
|
# Turn on sticky vendors
|
|
|
|
#--------------------------------------
|
|
|
|
echo "allow_vendor_change=False" >> /etc/dnf/dnf.conf
|
|
|
|
|
|
|
|
#======================================
|
|
|
|
# Set SELinux booleans
|
|
|
|
#--------------------------------------
|
|
|
|
## Fixes KDE Plasma, see rhbz#2058657
|
|
|
|
setsebool -P selinuxuser_execmod 1
|
|
|
|
|
|
|
|
#======================================
|
|
|
|
# Clear machine specific configuration
|
|
|
|
#--------------------------------------
|
|
|
|
## Clear machine-id on pre generated images
|
|
|
|
rm -f /etc/machine-id
|
2023-03-29 20:52:03 +00:00
|
|
|
echo 'uninitialized' > /etc/machine-id
|
2022-09-17 12:16:13 +00:00
|
|
|
## remove random seed, the newly installed instance should make its own
|
|
|
|
rm -f /var/lib/systemd/random-seed
|
|
|
|
|
2022-12-20 12:31:04 +00:00
|
|
|
#======================================
|
|
|
|
# Configure grub correctly
|
|
|
|
#--------------------------------------
|
|
|
|
## Works around issues with grub-bls
|
|
|
|
## See: https://github.com/OSInside/kiwi/issues/2198
|
|
|
|
echo "GRUB_DEFAULT=saved" >> /etc/default/grub
|
2023-03-18 16:28:45 +00:00
|
|
|
## Disable submenus to match Fedora
|
|
|
|
echo "GRUB_DISABLE_SUBMENU=true" >> /etc/default/grub
|
|
|
|
## Disable recovery entries to match Fedora
|
|
|
|
echo "GRUB_DISABLE_RECOVERY=true" >> /etc/default/grub
|
2022-12-20 12:31:04 +00:00
|
|
|
|
2022-09-17 12:16:13 +00:00
|
|
|
#======================================
|
|
|
|
# Delete & lock the root user password
|
|
|
|
#--------------------------------------
|
|
|
|
passwd -d root
|
|
|
|
passwd -l root
|
|
|
|
|
|
|
|
#======================================
|
|
|
|
# Setup default services
|
|
|
|
#--------------------------------------
|
|
|
|
|
|
|
|
## Enable persistent journal
|
|
|
|
mkdir -p /var/log/journal
|
|
|
|
|
|
|
|
#======================================
|
|
|
|
# Setup firstboot initial setup
|
|
|
|
#--------------------------------------
|
|
|
|
|
2023-09-04 02:17:10 +00:00
|
|
|
if [[ "$kiwi_profiles" == *"KDE"* ]]; then
|
|
|
|
## Enable calamares
|
|
|
|
systemctl enable calamares-firstboot.service
|
2023-09-24 00:38:37 +00:00
|
|
|
elif [[ "$kiwi_profiles" != *"GNOME"* ]] && [[ "$kiwi_profiles" != *"KDE"* ]]; then
|
2023-09-04 02:17:10 +00:00
|
|
|
## Enable initial-setup
|
|
|
|
systemctl enable initial-setup.service
|
|
|
|
## Enable reconfig mode
|
|
|
|
touch /etc/reconfigSys
|
|
|
|
fi
|
2022-09-17 12:16:13 +00:00
|
|
|
|
2023-12-18 16:45:32 +00:00
|
|
|
## Enable swap setup on firstboot
|
|
|
|
systemctl enable asahi-setup-swap-firstboot.service
|
|
|
|
|
2023-09-06 14:44:37 +00:00
|
|
|
## Enable extras install on firstboot; this will only run if the extras are
|
|
|
|
## actually present (and self disable afterwards)
|
|
|
|
systemctl enable asahi-extras-firstboot.service
|
|
|
|
|
2022-09-17 12:16:13 +00:00
|
|
|
#======================================
|
|
|
|
# Setup default target
|
|
|
|
#--------------------------------------
|
2023-04-16 15:18:49 +00:00
|
|
|
if [[ "$kiwi_profiles" == *"GNOME"* ]] || [[ "$kiwi_profiles" == *"KDE"* ]]; then
|
2022-09-17 12:16:13 +00:00
|
|
|
systemctl set-default graphical.target
|
|
|
|
else
|
|
|
|
systemctl set-default multi-user.target
|
|
|
|
fi
|
|
|
|
|
|
|
|
#======================================
|
|
|
|
# Import GPG keys
|
|
|
|
#--------------------------------------
|
|
|
|
|
|
|
|
releasever=$(rpm --eval '%{fedora}')
|
|
|
|
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-primary
|
|
|
|
echo "Packages within this disk image"
|
|
|
|
rpm -qa --qf '%{size}\t%{name}-%{version}-%{release}.%{arch}\n' |sort -rn
|
|
|
|
|
|
|
|
# Note that running rpm recreates the rpm db files which aren't needed or wanted
|
|
|
|
rm -f /var/lib/rpm/__db*
|
|
|
|
|
2022-11-04 16:30:55 +00:00
|
|
|
#======================================
|
|
|
|
# Generate boot.bin
|
|
|
|
#======================================
|
|
|
|
mkdir -p /boot/efi/m1n1
|
|
|
|
update-m1n1 /boot/efi/m1n1/boot.bin
|
2022-12-23 07:23:14 +00:00
|
|
|
rm /boot/.builder
|
2022-11-04 16:30:55 +00:00
|
|
|
|
2022-09-17 12:16:13 +00:00
|
|
|
exit 0
|