-
Notifications
You must be signed in to change notification settings - Fork 49
/
setup_sway_isomode.bash
61 lines (52 loc) · 2.05 KB
/
setup_sway_isomode.bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/env bash
username="$1"
# Clone the repo
echo "Cloning the EOS Community Sway repo..."
git clone https://github.com/EndeavourOS-Community-Editions/sway.git
# Check if nvidia-inst is installed
# If it is, do the Nvidia stuff
if pacman -Qq nvidia-inst 2>/dev/null | grep -q .; then
echo "Adding the --unsupported-gpu flag to the sway call in greetd.conf..."
sed -i 's|sway -c|sway --unsupported-gpu -c|' sway/etc/greetd/greetd.conf
echo "Adding a custom desktop file for Nvidia sessions..."
mkdir -p /usr/share/wayland-sessions
cat <<EOF > /usr/share/wayland-sessions/sway-nvidia.desktop
[Desktop Entry]
Name=Sway-Nvidia
Comment=Sway with Nvidia
Exec=sway --unsupported-gpu
Type=Application
EOF
echo "Adding dracut config for early module loading..."
cat <<EOF > /etc/dracut.conf.d/nvidia-modules.conf
force_drivers+=" nvidia nvidia_modeset nvidia_uvm nvidia_drm "
EOF
echo "Regenerating initrds..."
reinstall-kernels || dracut-rebuild
fi
# Install the custom package list
echo "Installing needed packages..."
pacman -S --noconfirm --noprogressbar --needed --disable-download-timeout $(< ./sway/packages-repository.txt)
# Deploy user configs
echo "Deploying user configs..."
rsync -a sway/.config "/home/${username}/"
rsync -a sway/.local "/home/${username}/"
rsync -a sway/home_config/ "/home/${username}/"
# Restore user ownership
chown -R "${username}:${username}" "/home/${username}"
# Deploy system configs
echo "Deploying system configs..."
rsync -a --chown=root:root sway/etc/ /etc/
# Check if the script is running in a virtual machine
if systemd-detect-virt | grep -vq "none"; then
echo "Virtual machine detected; enabling WLR_RENDERER_ALLOW_SOFTWARE variable in ReGreet config..."
# Uncomment WLR_RENDERER_ALLOW_SOFTWARE variable in ReGreet config
sed -i '/^#WLR_RENDERER_ALLOW_SOFTWARE/s/^#//' /etc/greetd/regreet.toml
fi
# Remove the repo
echo "Removing the EOS Community Sway repo..."
rm -rf sway
# Enable the Greetd service
echo "Enabling the Greetd service..."
systemctl enable greetd.service
echo "Installation complete."