#!/bin/bash rm -f install-gnome.log exec 1> >(tee -a install-gnome.log) exec 2>&1 set -e groupadd -g 1000 rocky useradd -c "rocky linux user" -d /home/rocky -g rocky -s /bin/bash -m -u 1000 rocky usermod -a -G wheel rocky usermod -a -G rtkit rocky usermod -a -G pipewire rocky echo -n "rocky:rocky123" | chpasswd -c SHA512 passwd -l root rm -f /.dockerenv echo -e "[boot]\nsystemd=true\n" >/etc/wsl.conf dnf upgrade -y dnf install -y systemd dbus-x11 procps bind-utils iproute iputils nmap-ncat dnf swap -y curl-minimal curl dnf swap -y coreutils-single coreutils dnf groupinstall -y "Server with GUI" dnf install -y gnome-extensions-app gnome-shell-extension-dash-to-dock dnf install -y gnome-shell-extension-window-list dconf-editor dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-9 /usr/bin/crb enable dnf install -y --nogpgcheck https://mirrors.rpmfusion.org/free/el/rpmfusion-free-release-9.noarch.rpm https://mirrors.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-9.noarch.rpm rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-rpmfusion-free-el-9 rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-rpmfusion-nonfree-el-9 dnf check-update -y dnf install -y ffmpeg mkdir -p /etc/polkit-1/localauthority/50-local.d/ cat >/etc/polkit-1/localauthority/50-local.d/color.pkla <<'EOF' [Allow colord for all users] Identity=unix-user:* Action=org.freedesktop.color-manager.create-device;org.freedesktop.color-manager.create-profile;org.freedesktop.color-manager.delete-device;org.freedesktop.color-manager.delete-profile;org.freedesktop.color-manager.modify-device; org.freedesktop.color-manager.org.freedesktop.color-manager.modify-profile ResultAny=yes ResultInactive=yes ResultActive=yes EOF systemctl set-default multi-user.target mkdir -p /etc/systemd/system/ModemManager.service.d echo -e "[Unit]\nConditionVirtualization=\n" > /etc/systemd/system/ModemManager.service.d/override.conf mkdir -p /etc/systemd/system/fwupd.service.d echo -e "[Unit]\nConditionVirtualization=\n" > /etc/systemd/system/fwupd.service.d/override.conf echo -e "[Install]\nWantedBy=multi-user.target\n" >> /etc/systemd/system/fwupd.service.d/override.conf systemctl enable ModemManager.service systemctl enable fwupd.service mkdir -p /home/rocky/.config/systemd/user/default.target.wants ln -s /usr/lib/systemd/user/pipewire.service /home/rocky/.config/systemd/user/default.target.wants/pipewire.service mkdir -p /home/rocky/.config/systemd/user/sockets.target.wants ln -s /usr/lib/systemd/user/pipewire.socket /home/rocky/.config/systemd/user/sockets.target.wants/pipewire.socket cat >/etc/profile.d/show_password_notification.sh <<'EOF' echo -e "Change your user password now with the 'passwd' command.\nThe default password is 'rocky123'.\nAfter changing it, run 'sudo rm -f /etc/profile.d/show_password_notification.sh'.\nTo start Gnome, run 'start-gnome &'.\n" EOF chmod 755 /etc/profile.d/show_password_notification.sh systemctl enable rtkit-daemon.service mkdir -p /etc/security/limits.d echo -e "@pipewire - rtprio 95\n@pipewire - nice -19\n" > /etc/security/limits.d/95-pipewire.conf echo "/bin/mount -o remount,rw /tmp/.X11-unix" >> /etc/rc.d/rc.local chmod 700 /etc/rc.d/rc.local mkdir -p /home/rocky/bin cat >/home/rocky/bin/start-gnome <<'EOF' #!/bin/bash nohup Xwayland -br -ac :1 >/dev/null 2>&1 & env DISPLAY=:1 WAYLAND_DISPLAY= XDG_SESSION_TYPE=x11 gnome-session --disable-acceleration-check pkill -9 Xwayland >/dev/null 2>&1 EOF chown -R rocky:rocky /home/rocky chmod +x /home/rocky/bin/start-gnome