working version for live

needs to be trimmed down
This commit is contained in:
lukas 2021-11-10 09:42:19 +01:00
parent 9dc9ff3868
commit 59cbc7cf05

View File

@ -8,10 +8,10 @@ keyboard --xlayouts='ch (fr)'
rootpw --iscrypted --lock locked rootpw --iscrypted --lock locked
# System language # System language
lang en_US.UTF-8 lang en_US.UTF-8
# Use text mode install # Shutdown after installation
text shutdown
# Network information # Network information
network --bootproto=dhcp --device=link --hostname=phyllome --activate network --bootproto=dhcp --device=link --activate
# Firewall configuration # Firewall configuration
firewall --enabled --service=mdns firewall --enabled --service=mdns
# Use network installation # Use network installation
@ -22,18 +22,17 @@ repo --name="updates" --mirrorlist=https://mirrors.fedoraproject.org/mirrorlist?
timezone Europe/Paris --utc timezone Europe/Paris --utc
# SELinux configuration # SELinux configuration
selinux --enforcing selinux --enforcing
# System services
services --disabled="sshd" --enabled="NetworkManager"
# System bootloader configuration # System bootloader configuration
bootloader --location=mbr --timeout=1 bootloader --location=none
# Clear the Master Boot Record # Clear the Master Boot Record
zerombr zerombr
# Partition clearing information # Partition clearing information
clearpart --all clearpart --all
# Disk partitioning information # Disk partitioning information
part / --fstype="ext4" --size=5120 part / --size=5120
%post --logfile=/root/bl.log %post --logfile=/root/bl.log
# FIXME: it'd be better to get this installed from a package # FIXME: it'd be better to get this installed from a package
cat > /etc/rc.d/init.d/livesys << EOF cat > /etc/rc.d/init.d/livesys << EOF
#!/bin/bash #!/bin/bash
@ -180,7 +179,7 @@ touch /.liveimg-configured
# https://bugzilla.redhat.com/show_bug.cgi?id=679486 # https://bugzilla.redhat.com/show_bug.cgi?id=679486
# the hostname must be something else than 'localhost' # the hostname must be something else than 'localhost'
# https://bugzilla.redhat.com/show_bug.cgi?id=1370222 # https://bugzilla.redhat.com/show_bug.cgi?id=1370222
# hostnamectl set-hostname "localhost-live" hostnamectl set-hostname "localhost-live"
EOF EOF
@ -219,24 +218,24 @@ for o in \`cat /proc/cmdline\` ; do
done done
# if liveinst or textinst is given, start anaconda # if liveinst or textinst is given, start anaconda
#if strstr "\`cat /proc/cmdline\`" liveinst ; then if strstr "\`cat /proc/cmdline\`" liveinst ; then
# plymouth --quit plymouth --quit
# /usr/sbin/liveinst \$ks /usr/sbin/liveinst \$ks
#fi fi
#if strstr "\`cat /proc/cmdline\`" textinst ; then if strstr "\`cat /proc/cmdline\`" textinst ; then
# plymouth --quit plymouth --quit
# /usr/sbin/liveinst --text \$ks /usr/sbin/liveinst --text \$ks
#fi fi
# configure X, allowing user to override xdriver # configure X, allowing user to override xdriver
#if [ -n "\$xdriver" ]; then if [ -n "\$xdriver" ]; then
# cat > /etc/X11/xorg.conf.d/00-xdriver.conf <<FOE cat > /etc/X11/xorg.conf.d/00-xdriver.conf <<FOE
#Section "Device" Section "Device"
# Identifier "Videocard0" Identifier "Videocard0"
# Driver "\$xdriver" Driver "\$xdriver"
#EndSection EndSection
#FOE FOE
#fi fi
EOF EOF
@ -313,62 +312,64 @@ fi
cat >> /etc/rc.d/init.d/livesys << EOF cat >> /etc/rc.d/init.d/livesys << EOF
# disable gnome-software automatically downloading updates # disable gnome-software automatically downloading updates
# cat >> /usr/share/glib-2.0/schemas/org.gnome.software.gschema.override << FOE cat >> /usr/share/glib-2.0/schemas/org.gnome.software.gschema.override << FOE
# [org.gnome.software] [org.gnome.software]
# download-updates=false download-updates=false
# FOE FOE
# don't autostart gnome-software session service # don't autostart gnome-software session service
# rm -f /etc/xdg/autostart/gnome-software-service.desktop rm -f /etc/xdg/autostart/gnome-software-service.desktop
# disable the gnome-software shell search provider # disable the gnome-software shell search provider
# FOE cat >> /usr/share/gnome-shell/search-providers/org.gnome.Software-search-provider.ini << FOE
DefaultDisabled=true
FOE
# don't run gnome-initial-setup # don't run gnome-initial-setup
mkdir ~liveuser/.config mkdir ~liveuser/.config
touch ~liveuser/.config/gnome-initial-setup-done touch ~liveuser/.config/gnome-initial-setup-done
# suppress anaconda spokes redundant with gnome-initial-setup # suppress anaconda spokes redundant with gnome-initial-setup
# cat >> /etc/sysconfig/anaconda << FOE cat >> /etc/sysconfig/anaconda << FOE
# [NetworkSpoke] [NetworkSpoke]
# visited=1 visited=1
# [PasswordSpoke] [PasswordSpoke]
# visited=1 visited=1
# [UserSpoke] [UserSpoke]
# visited=1 visited=1
# FOE FOE
# make the installer show up # make the installer show up
#if [ -f /usr/share/applications/liveinst.desktop ]; then if [ -f /usr/share/applications/liveinst.desktop ]; then
# Show harddisk install in shell dash # Show harddisk install in shell dash
# sed -i -e 's/NoDisplay=true/NoDisplay=false/' /usr/share/applications/liveinst.desktop "" sed -i -e 's/NoDisplay=true/NoDisplay=false/' /usr/share/applications/liveinst.desktop ""
# need to move it to anaconda.desktop to make shell happy # need to move it to anaconda.desktop to make shell happy
# mv /usr/share/applications/liveinst.desktop /usr/share/applications/anaconda.desktop mv /usr/share/applications/liveinst.desktop /usr/share/applications/anaconda.desktop
# cat >> /usr/share/glib-2.0/schemas/org.gnome.shell.gschema.override << FOE cat >> /usr/share/glib-2.0/schemas/org.gnome.shell.gschema.override << FOE
#[org.gnome.shell] [org.gnome.shell]
#favorite-apps=['firefox.desktop', 'org.gnome.Calendar.desktop', 'rhythmbox.desktop', 'org.gnome.Photos.desktop', 'org.gnome.Nautilus.desktop', 'anaconda.desktop'] favorite-apps=['firefox.desktop', 'org.gnome.Calendar.desktop', 'rhythmbox.desktop', 'org.gnome.Photos.desktop', 'org.gnome.Nautilus.desktop', 'anaconda.desktop']
#FOE FOE
# Make the welcome screen show up # Make the welcome screen show up
# if [ -f /usr/share/anaconda/gnome/fedora-welcome.desktop ]; then if [ -f /usr/share/anaconda/gnome/fedora-welcome.desktop ]; then
# mkdir -p ~liveuser/.config/autostart mkdir -p ~liveuser/.config/autostart
# cp /usr/share/anaconda/gnome/fedora-welcome.desktop /usr/share/applications/ cp /usr/share/anaconda/gnome/fedora-welcome.desktop /usr/share/applications/
# cp /usr/share/anaconda/gnome/fedora-welcome.desktop ~liveuser/.config/autostart/ cp /usr/share/anaconda/gnome/fedora-welcome.desktop ~liveuser/.config/autostart/
# fi fi
# Disable GNOME welcome tour so it doesn't overlap with Fedora welcome screen # Disable GNOME welcome tour so it doesn't overlap with Fedora welcome screen
# cat >> /usr/share/glib-2.0/schemas/org.gnome.shell.gschema.override << FOE cat >> /usr/share/glib-2.0/schemas/org.gnome.shell.gschema.override << FOE
#welcome-dialog-last-shown-version='4294967295' welcome-dialog-last-shown-version='4294967295'
#FOE FOE
# Copy Anaconda branding in place # Copy Anaconda branding in place
# if [ -d /usr/share/lorax/product/usr/share/anaconda ]; then if [ -d /usr/share/lorax/product/usr/share/anaconda ]; then
# cp -a /usr/share/lorax/product/* / cp -a /usr/share/lorax/product/* /
# fi fi
#fi fi
# rebuild schema cache with any overrides we installed # rebuild schema cache with any overrides we installed
glib-compile-schemas /usr/share/glib-2.0/schemas glib-compile-schemas /usr/share/glib-2.0/schemas
@ -393,24 +394,30 @@ EOF
%end %end
%post --nochroot --logfile=/root/bh.log %post --logfile=/root/bhl.log
# %post --log=/root/bh.log # Beginning of %post section. Those commands are executed outside the chroot environment. Logging is enabled to help with post-installation troubleshooting
mkdir /mnt/sysimage/var/lib/libvirt/iso # Create a directory to store iso images mkdir /var/lib/libvirt/iso # Create a directory to store iso images
wget https://boot.netboot.xyz/ipxe/netboot.xyz.iso -P /mnt/sysimage/var/lib/libvirt/iso/ wget https://boot.netboot.xyz/ipxe/netboot.xyz.iso -P /var/lib/libvirt/iso/ # fetch netboot.xyz iso
wget https://git.phyllo.me/home/PhyllomeOS/raw/branch/main/post-installation/post-install.sh -P /mnt/sysimage/usr/sbin/ # fetch custom script and make it executable
chmod +x /mnt/sysimage/usr/sbin/post-install.sh wget https://git.phyllo.me/home/PhyllomeOS/raw/branch/main/post/configure-vmm-and-desktop.sh -P /usr/sbin/
chmod +x /usr/sbin/configure-vmm-and-desktop.sh
# Create new file /etc/systemd/system/postinstall.service using cat: # fetch custom script and make it executable
# wget https://git.phyllo.me/home/PhyllomeOS/raw/branch/main/post/create-live-vm.sh -P /usr/sbin/
# cat > /mnt/sysimage/etc/systemd/system/post-install.service<< EOF chmod +x /usr/sbin/create-live-vm.sh
# fetch custom script and make it executable
wget https://git.phyllo.me/home/PhyllomeOS/raw/branch/main/post/virtualization-tweaks-root-needed.sh -P /usr/sbin/
chmod +x /usr/sbin/virtualization-tweaks-root-needed.sh
# # Create new file /etc/systemd/system/postinstall.service using cat:
# cat > /etc/systemd/system/post-install.service<< EOF
# [Unit] # [Unit]
# Description=post-installation configuration for Phyllome OS # Description=Post-installation configuration for Phyllome OS
# After=systemd-remount-fs.service # After=gdm.service
# Before=systemd-sysusers.service sysinit.target shutdown.target # Requires=gdm.service
# ConditionFirstBoot=yes
# #
# [Service] # [Service]
# Type=oneshot # Type=oneshot
@ -421,48 +428,50 @@ chmod +x /mnt/sysimage/usr/sbin/post-install.sh
# WantedBy=multi-user.target # WantedBy=multi-user.target
# EOF # EOF
# #
# systemctl enable post-install.service # Enable systemd unit # systemctl enable /etc/systemd/system/post-install.service # Enable systemd unit
# Add a network bridge. Still need to declare it to libvirt/virt-manager # Add a network bridge. Still need to declare it to libvirt/virt-manager
nmcli con add ifname br0 type bridge con-name br0 # nmcli con add ifname br0 type bridge con-name br0
nmcli con add type bridge-slave ifname enp1s0 master br0 # to-do : generalize this command so that it could regardless of the name of the ethernet device # nmcli con add type bridge-slave ifname enp1s0 master br0 # to-do : generalize this command so that it could regardless of the name of the ethernet device
nmcli con up br0 # nmcli con up br0
%end %end
%post --nochroot --logfile=/mnt/sysimage/root/bhi.log %post --logfile=/root/blhi.log
sed -i 's/\(quiet\)/\1 intel_iommu=on iommu=pt rd.driver.pre=vfio-pci i915.enable_gvt=1/i' /mnt/sysimage/etc/default/grub # Load kernel modules in grub. sed -i 's/\(quiet\)/\1 intel_iommu=on iommu=pt rd.driver.pre=vfio-pci i915.enable_gvt=1/i' /etc/default/grub # Load kernel modules in grub.
# Load kernel modules by adding vfio, vfio_pci, vfio_iommu_type1, vfio_virqfd # Load kernel modules by adding vfio, vfio_pci, vfio_iommu_type1, vfio_virqfd
echo "vfio" > /mnt/sysimage/etc/modules-load.d/vfio.conf echo "vfio" > /etc/modules-load.d/vfio.conf
echo "vfio-pci" > /mnt/sysimage/etc/modules-load.d/vfio-pci.conf echo "vfio-pci" > /etc/modules-load.d/vfio-pci.conf
echo "vfio_iommu_type1" > /mnt/sysimage/etc/modules-load.d/vfio_iommu_type1.conf echo "vfio_iommu_type1" > /etc/modules-load.d/vfio_iommu_type1.conf
echo "vfio_virqfd" > /mnt/sysimage/etc/modules-load.d/vfio_virqfd.conf echo "vfio_virqfd" > /etc/modules-load.d/vfio_virqfd.conf
echo "kvmgt" > /mnt/sysimage/etc/modules-load.d/kvmgt.conf # Load specific kernel modules kvmgt and vfio-mdev, for Intel (tm) GVT-g and Nvidia (tm) echo "kvmgt" > /etc/modules-load.d/kvmgt.conf # Load specific kernel modules kvmgt and vfio-mdev, for Intel (tm) GVT-g and Nvidia (tm)
echo "vfio-mdev" > /mnt/sysimage/etc/modules-load.d/vfio-mdev.conf # Load specific kernel modules kvmgt and vfio-mdev, for Intel (tm) GVT-g and Nvidia (tm) echo "vfio-mdev" > /etc/modules-load.d/vfio-mdev.conf # Load specific kernel modules kvmgt and vfio-mdev, for Intel (tm) GVT-g and Nvidia (tm)
echo "options kvm_intel nested=1" >> /mnt/sysimage/etc/modprobe.d/kvm.conf # Add support for nested-virtualization echo "options kvm_intel nested=1" >> /etc/modprobe.d/kvm.conf # Add support for nested-virtualization
dracut --add-drivers " vfio vfio-pci vfio_iommu_type1 vfio_virqfd vfio-mdev kvmgt " --force # Instruct dracut to load the vfio drivers # The following part seems useless
dracut --force # Regenerate initramfs # dracut --add-drivers " vfio vfio-pci vfio_iommu_type1 vfio_virqfd vfio-mdev kvmgt " --force # Instruct dracut to load the vfio drivers
# dracut --force # Regenerate initramfs
# Doesn't seem to work # Doesn't seem to work
# dracut: Cannot find /usr/lib/dracut/dracut-init.sh. # dracut: Cannot find /usr/lib/dracut/dracut-init.sh.
# dracut: Are you running from a git checkout? # dracut: Are you running from a git checkout?
# dracut: Try passing -l as an argument to /mnt/sysimage/usr/bin/dracut # dracut: Try passing -l as an argument to /usr/bin/dracut
grub2-mkconfig -o /mnt/sysimage/boot/grub2/grub.cfg # Update grub. Does it fail ? /usr/sbin/grub2-probe: error: failed to get canonical path of `LiveOS_rootfs'. # The following part seems useless too. No need to regenerate grub
# grub2-mkconfig -o /boot/grub2/grub.cfg # Update grub. Does it fail ? /usr/sbin/grub2-probe: error: failed to get canonical path of `LiveOS_rootfs'.
%end %end
%post --nochroot --logfile=/mnt/sysimage/root/ldhi.log %post --logfile=/root/ldhi.log
usermod -a -G libvirt liveuser # Make user "liveuser" part of the existing libvirt group to allow it to interact with the guest-hypervisor. usermod -a -G libvirt liveuser # Make user "liveuser" part of the existing libvirt group to allow it to interact with the guest-hypervisor.
chown liveuser:liveuser /mnt/sysimage/var/lib/libvirt/iso # Make the user "liveuser" the owner of this directory chown liveuser:liveuser /var/lib/libvirt/iso # Make the user "liveuser" the owner of this directory
chown liveuser:liveuser /mnt/sysimage/var/lib/libvirt/images # Make the user "test" the owner of this directory chown liveuser:liveuser /var/lib/libvirt/images # Make the user "test" the owner of this directory
# Create a file to autostart virt-manager # Create a file to autostart virt-manager
cat > /mnt/sysimage/etc/xdg/autostart/virt-manager.desktop << EOF cat > /etc/xdg/autostart/virt-manager.desktop << EOF
[Desktop Entry] [Desktop Entry]
Type=Application Type=Application
Name=Virtual Machine Manager Name=Virtual Machine Manager
@ -472,25 +481,19 @@ EOF
%end %end
%packages --exclude-weakdeps %packages --exclude-weakdeps
@core @anaconda-tools
@x86-baremetal-tools
aajohan-comfortaa-fonts
anaconda
anaconda-install-env-deps
anaconda-live
chkconfig chkconfig
dejavu-sans-mono-fonts dejavu-sans-mono-fonts
dracut-config-generic
dracut-live dracut-live
efibootmgr
elementary-wallpapers-gnome.noarch elementary-wallpapers-gnome.noarch
fedora-remix-logos
generic-logos
generic-release
generic-release-common
generic-release-notes
glibc-all-langpacks glibc-all-langpacks
gnome-shell gnome-shell
gnome-terminal gnome-terminal
grub2
grub2-efi
grub2-efi-*-cdboot
grub2-efi-ia32
guestfs-tools guestfs-tools
initscripts initscripts
kernel kernel
@ -501,22 +504,14 @@ libvirt
libvirt-daemon-config-network libvirt-daemon-config-network
libvirt-daemon-kvm libvirt-daemon-kvm
nano nano
pciutils
python3-libguestfs python3-libguestfs
qemu-guest-agent
qemu-kvm qemu-kvm
shim
shim-ia32
spice-vdagent
virt-install virt-install
virt-manager virt-manager
virt-top virt-top
wpa_supplicant wpa_supplicant
-fedora-logos -device-mapper-multipath
-fedora-release -fcoe-utils
-fedora-release-common
-fedora-release-identity-basic
-fedora-release-notes
-gnome-tour -gnome-tour
%end %end