forked from roots/phyllomeos
		
	working version for live
needs to be trimmed down
This commit is contained in:
		| @@ -8,10 +8,10 @@ keyboard --xlayouts='ch (fr)' | ||||
| rootpw --iscrypted --lock locked | ||||
| # System language | ||||
| lang en_US.UTF-8 | ||||
| # Use text mode install | ||||
| text | ||||
| # Shutdown after installation | ||||
| shutdown | ||||
| # Network information | ||||
| network  --bootproto=dhcp --device=link --hostname=phyllome --activate | ||||
| network  --bootproto=dhcp --device=link --activate | ||||
| # Firewall configuration | ||||
| firewall --enabled --service=mdns | ||||
| # Use network installation | ||||
| @@ -22,18 +22,17 @@ repo --name="updates" --mirrorlist=https://mirrors.fedoraproject.org/mirrorlist? | ||||
| timezone Europe/Paris --utc | ||||
| # SELinux configuration | ||||
| selinux --enforcing | ||||
| # System services | ||||
| services --disabled="sshd" --enabled="NetworkManager" | ||||
| # System bootloader configuration | ||||
| bootloader --location=mbr --timeout=1 | ||||
| bootloader --location=none | ||||
| # Clear the Master Boot Record | ||||
| zerombr | ||||
| # Partition clearing information | ||||
| clearpart --all | ||||
| # Disk partitioning information | ||||
| part / --fstype="ext4" --size=5120 | ||||
| part / --size=5120 | ||||
|  | ||||
| %post --logfile=/root/bl.log | ||||
|  | ||||
| # FIXME: it'd be better to get this installed from a package | ||||
| cat > /etc/rc.d/init.d/livesys << EOF | ||||
| #!/bin/bash | ||||
| @@ -180,7 +179,7 @@ touch /.liveimg-configured | ||||
| # https://bugzilla.redhat.com/show_bug.cgi?id=679486 | ||||
| # the hostname must be something else than 'localhost' | ||||
| # https://bugzilla.redhat.com/show_bug.cgi?id=1370222 | ||||
| # hostnamectl set-hostname "localhost-live" | ||||
| hostnamectl set-hostname "localhost-live" | ||||
|  | ||||
| EOF | ||||
|  | ||||
| @@ -219,24 +218,24 @@ for o in \`cat /proc/cmdline\` ; do | ||||
| done | ||||
|  | ||||
| # if liveinst or textinst is given, start anaconda | ||||
| #if strstr "\`cat /proc/cmdline\`" liveinst ; then | ||||
| #   plymouth --quit | ||||
| #   /usr/sbin/liveinst \$ks | ||||
| #fi | ||||
| #if strstr "\`cat /proc/cmdline\`" textinst ; then | ||||
| #   plymouth --quit | ||||
| #   /usr/sbin/liveinst --text \$ks | ||||
| #fi | ||||
| if strstr "\`cat /proc/cmdline\`" liveinst ; then | ||||
|    plymouth --quit | ||||
|    /usr/sbin/liveinst \$ks | ||||
| fi | ||||
| if strstr "\`cat /proc/cmdline\`" textinst ; then | ||||
|    plymouth --quit | ||||
|    /usr/sbin/liveinst --text \$ks | ||||
| fi | ||||
|  | ||||
| # configure X, allowing user to override xdriver | ||||
| #if [ -n "\$xdriver" ]; then | ||||
| #   cat > /etc/X11/xorg.conf.d/00-xdriver.conf <<FOE | ||||
| #Section "Device" | ||||
| #	Identifier	"Videocard0" | ||||
| #	Driver	"\$xdriver" | ||||
| #EndSection | ||||
| #FOE | ||||
| #fi | ||||
| if [ -n "\$xdriver" ]; then | ||||
|    cat > /etc/X11/xorg.conf.d/00-xdriver.conf <<FOE | ||||
| Section "Device" | ||||
| 	Identifier	"Videocard0" | ||||
| 	Driver	"\$xdriver" | ||||
| EndSection | ||||
| FOE | ||||
| fi | ||||
|  | ||||
| EOF | ||||
|  | ||||
| @@ -313,62 +312,64 @@ fi | ||||
| cat >> /etc/rc.d/init.d/livesys << EOF | ||||
|  | ||||
| # disable gnome-software automatically downloading updates | ||||
| # cat >> /usr/share/glib-2.0/schemas/org.gnome.software.gschema.override << FOE | ||||
| # [org.gnome.software] | ||||
| # download-updates=false | ||||
| # FOE | ||||
| cat >> /usr/share/glib-2.0/schemas/org.gnome.software.gschema.override << FOE | ||||
| [org.gnome.software] | ||||
| download-updates=false | ||||
| FOE | ||||
|  | ||||
| # 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 | ||||
| # FOE | ||||
| cat >> /usr/share/gnome-shell/search-providers/org.gnome.Software-search-provider.ini << FOE | ||||
| DefaultDisabled=true | ||||
| FOE | ||||
|  | ||||
| # don't run gnome-initial-setup | ||||
| mkdir ~liveuser/.config | ||||
| touch ~liveuser/.config/gnome-initial-setup-done | ||||
|  | ||||
| # suppress anaconda spokes redundant with gnome-initial-setup | ||||
| # cat >> /etc/sysconfig/anaconda << FOE | ||||
| # [NetworkSpoke] | ||||
| # visited=1 | ||||
| cat >> /etc/sysconfig/anaconda << FOE | ||||
| [NetworkSpoke] | ||||
| visited=1 | ||||
|  | ||||
| # [PasswordSpoke] | ||||
| # visited=1 | ||||
| [PasswordSpoke] | ||||
| visited=1 | ||||
|  | ||||
| # [UserSpoke] | ||||
| # visited=1 | ||||
| # FOE | ||||
| [UserSpoke] | ||||
| visited=1 | ||||
| FOE | ||||
|  | ||||
| # 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 | ||||
| #  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 | ||||
| #  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 | ||||
| #[org.gnome.shell] | ||||
| #favorite-apps=['firefox.desktop', 'org.gnome.Calendar.desktop', 'rhythmbox.desktop', 'org.gnome.Photos.desktop', 'org.gnome.Nautilus.desktop', 'anaconda.desktop'] | ||||
| #FOE | ||||
|   cat >> /usr/share/glib-2.0/schemas/org.gnome.shell.gschema.override << FOE | ||||
| [org.gnome.shell] | ||||
| favorite-apps=['firefox.desktop', 'org.gnome.Calendar.desktop', 'rhythmbox.desktop', 'org.gnome.Photos.desktop', 'org.gnome.Nautilus.desktop', 'anaconda.desktop'] | ||||
| FOE | ||||
|  | ||||
|   # Make the welcome screen show up | ||||
| #  if [ -f /usr/share/anaconda/gnome/fedora-welcome.desktop ]; then | ||||
| #    mkdir -p ~liveuser/.config/autostart | ||||
| #    cp /usr/share/anaconda/gnome/fedora-welcome.desktop /usr/share/applications/ | ||||
| #    cp /usr/share/anaconda/gnome/fedora-welcome.desktop ~liveuser/.config/autostart/ | ||||
| #  fi | ||||
|   if [ -f /usr/share/anaconda/gnome/fedora-welcome.desktop ]; then | ||||
|     mkdir -p ~liveuser/.config/autostart | ||||
|     cp /usr/share/anaconda/gnome/fedora-welcome.desktop /usr/share/applications/ | ||||
|     cp /usr/share/anaconda/gnome/fedora-welcome.desktop ~liveuser/.config/autostart/ | ||||
|   fi | ||||
|  | ||||
|   # 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 | ||||
| #welcome-dialog-last-shown-version='4294967295' | ||||
| #FOE | ||||
|   cat >> /usr/share/glib-2.0/schemas/org.gnome.shell.gschema.override << FOE | ||||
| welcome-dialog-last-shown-version='4294967295' | ||||
| FOE | ||||
|  | ||||
|   # Copy Anaconda branding in place | ||||
| #  if [ -d /usr/share/lorax/product/usr/share/anaconda ]; then | ||||
| #    cp -a /usr/share/lorax/product/* / | ||||
| #  fi | ||||
| #fi | ||||
|   if [ -d /usr/share/lorax/product/usr/share/anaconda ]; then | ||||
|     cp -a /usr/share/lorax/product/* / | ||||
|   fi | ||||
| fi | ||||
|  | ||||
| # rebuild schema cache with any overrides we installed | ||||
| glib-compile-schemas /usr/share/glib-2.0/schemas | ||||
| @@ -393,24 +394,30 @@ EOF | ||||
|  | ||||
| %end | ||||
|  | ||||
| %post --nochroot --logfile=/root/bh.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 | ||||
| %post --logfile=/root/bhl.log | ||||
|  | ||||
| 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/ | ||||
| chmod +x /mnt/sysimage/usr/sbin/post-install.sh | ||||
| # fetch custom script and make it executable | ||||
| 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: | ||||
| #  | ||||
| # cat > /mnt/sysimage/etc/systemd/system/post-install.service<< EOF | ||||
| # 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/ | ||||
| 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] | ||||
| # Description=post-installation configuration for Phyllome OS | ||||
| # After=systemd-remount-fs.service | ||||
| # Before=systemd-sysusers.service sysinit.target shutdown.target | ||||
| # ConditionFirstBoot=yes | ||||
| # Description=Post-installation configuration for Phyllome OS | ||||
| # After=gdm.service | ||||
| # Requires=gdm.service | ||||
| #  | ||||
| # [Service] | ||||
| # Type=oneshot | ||||
| @@ -421,48 +428,50 @@ chmod +x /mnt/sysimage/usr/sbin/post-install.sh | ||||
| # WantedBy=multi-user.target | ||||
| # 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 | ||||
| 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 up 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 up br0 | ||||
|  | ||||
| %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 | ||||
| echo "vfio" > /mnt/sysimage/etc/modules-load.d/vfio.conf | ||||
| echo "vfio-pci" > /mnt/sysimage/etc/modules-load.d/vfio-pci.conf | ||||
| echo "vfio_iommu_type1" > /mnt/sysimage/etc/modules-load.d/vfio_iommu_type1.conf | ||||
| echo "vfio_virqfd" > /mnt/sysimage/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 "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" > /etc/modules-load.d/vfio.conf | ||||
| echo "vfio-pci" > /etc/modules-load.d/vfio-pci.conf | ||||
| echo "vfio_iommu_type1" > /etc/modules-load.d/vfio_iommu_type1.conf | ||||
| echo "vfio_virqfd" > /etc/modules-load.d/vfio_virqfd.conf | ||||
| 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" > /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 | ||||
| dracut --force # Regenerate initramfs | ||||
| # The following part seems useless | ||||
| # 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 | ||||
| # dracut: Cannot find /usr/lib/dracut/dracut-init.sh. | ||||
| # 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 | ||||
|  | ||||
| %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. | ||||
| chown liveuser:liveuser /mnt/sysimage/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/iso # Make the user "liveuser" 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 | ||||
| cat > /mnt/sysimage/etc/xdg/autostart/virt-manager.desktop << EOF | ||||
| cat > /etc/xdg/autostart/virt-manager.desktop << EOF | ||||
| [Desktop Entry] | ||||
| Type=Application | ||||
| Name=Virtual Machine Manager | ||||
| @@ -472,25 +481,19 @@ EOF | ||||
| %end | ||||
|  | ||||
| %packages --exclude-weakdeps | ||||
| @core | ||||
| @anaconda-tools | ||||
| @x86-baremetal-tools | ||||
| aajohan-comfortaa-fonts | ||||
| anaconda | ||||
| anaconda-install-env-deps | ||||
| anaconda-live | ||||
| chkconfig | ||||
| dejavu-sans-mono-fonts | ||||
| dracut-config-generic | ||||
| dracut-live | ||||
| efibootmgr | ||||
| elementary-wallpapers-gnome.noarch | ||||
| fedora-remix-logos | ||||
| generic-logos | ||||
| generic-release | ||||
| generic-release-common | ||||
| generic-release-notes | ||||
| glibc-all-langpacks | ||||
| gnome-shell | ||||
| gnome-terminal | ||||
| grub2 | ||||
| grub2-efi | ||||
| grub2-efi-*-cdboot | ||||
| grub2-efi-ia32 | ||||
| guestfs-tools | ||||
| initscripts | ||||
| kernel | ||||
| @@ -501,22 +504,14 @@ libvirt | ||||
| libvirt-daemon-config-network | ||||
| libvirt-daemon-kvm | ||||
| nano | ||||
| pciutils | ||||
| python3-libguestfs | ||||
| qemu-guest-agent | ||||
| qemu-kvm | ||||
| shim | ||||
| shim-ia32 | ||||
| spice-vdagent | ||||
| virt-install | ||||
| virt-manager | ||||
| virt-top | ||||
| wpa_supplicant | ||||
| -fedora-logos | ||||
| -fedora-release | ||||
| -fedora-release-common | ||||
| -fedora-release-identity-basic | ||||
| -fedora-release-notes | ||||
| -device-mapper-multipath | ||||
| -fcoe-utils | ||||
| -gnome-tour | ||||
|  | ||||
| %end | ||||
|   | ||||
		Reference in New Issue
	
	Block a user