Last active
September 24, 2024 20:19
-
-
Save Speyll/852a81e28565a7dca2777a78da36eaa9 to your computer and use it in GitHub Desktop.
Short, simple and easy to understand shell scripts to automate Debian post-installation with a wayland setup, you can play around with it as you see fit.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Debian Linux Post-Installation Script for Wayland | |
# Author: Speyll | |
# Last-update: 22-09-2024 | |
# NOTE: As of Debian 12 (Bookworm Stable), while Waybar and Neovim settings function, | |
# the Waybar height is misconfigured and Lua scripts for Neovim fail to load due to outdated packages. | |
# For improved compatibility, consider using the Testing branch. Future Debian versions may not require this adjustment. | |
# Enable debugging output and exit on error | |
set -x | |
# Add user to sudo group | |
sudo usermod -aG sudo $USER | |
# Backup the existing sources.list file | |
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak | |
# Add contrib and non-free to the sources.list | |
sudo sed -i '/^deb .* main/{s/main/main contrib non-free/;t;}' /etc/apt/sources.list | |
# Update package lists and upgrade existing packages | |
sudo apt-get update -y | |
sudo apt-get upgrade -y | |
# Install GPU drivers | |
install_gpu_driver() { | |
gpu_driver="" | |
case "$(lspci | grep -E 'VGA|3D')" in | |
*Intel*) gpu_driver="intel-media-va-driver intel-media-va-driver-non-free" ;; | |
*AMD*) gpu_driver="mesa-va-drivers libvdpau-va-gl1 vdpau-driver mesa-vdpau-drivers" ;; | |
*NVIDIA*)gpu_driver="mesa-va-drivers nvidia-driver libvdpau-va-gl1 vdpau-driver-all nvidia-vdpau-driver libnvcuvid1 libnvidia-encode1" ;; | |
esac | |
for pkg in $gpu_driver; do | |
[ -n "$pkg" ] && sudo apt-get install --no-install-recommends -y "$pkg" | |
done | |
} | |
install_gpu_driver # Call the function | |
# Install CPU microcode updates | |
if lspci | grep -q 'Intel'; then | |
sudo apt-get install --no-install-recommends -y intel-microcode | |
fi | |
# Install other packages | |
install_core_packages() { | |
for pkg in dbus tmux git curl polkitd policykit-1-gnome \ | |
xdg-utils xdg-desktop-portal-gtk xdg-desktop-portal-wlr xdg-desktop-portal \ | |
pipewire gstreamer1.0-pipewire libspa-0.2-bluetooth pavucontrol pipewire-audio wireplumber wlr-randr \ | |
fonts-noto-color-emoji fonts-noto-core fonts-hack-otf fonts-font-awesome fonts-noto-cjk \ | |
grim slurp wl-clipboard cliphist \ | |
imv swaybg mpv ffmpeg yt-dlp \ | |
fnott libnotify4 \ | |
nnn unzip p7zip unrar pcmanfm-qt ffmpegthumbnailer lxqt-archiver gvfs udisks2 \ | |
breeze-gtk-theme breeze-icon-theme breeze-cursor-theme qt5ct qt6ct qtwayland5 \ | |
bluez network-manager \ | |
sway neovim foot waybar wlsunset fuzzel brightnessctl; do | |
sudo apt-get install --no-install-recommends -y "$pkg" || echo "Failed to install $pkg" | |
done | |
} | |
install_networking_packages() { | |
for pkg in sshfs lynx rsync wireguard; do | |
sudo apt-get install --no-install-recommends -y "$pkg" | |
done | |
} | |
install_flatpak_packages() { | |
sudo apt-get install --no-install-recommends -y flatpak | |
flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo | |
flatpak install flathub io.gitlab.librewolf-community | |
flatpak install flathub com.github.tchx84.Flatseal | |
} | |
install_flatpak_gaming() { | |
flatpak install flathub com.usebottles.bottles | |
flatpak install flathub org.freedesktop.Platform.VulkanLayer.MangoHud | |
flatpak install flathub org.freedesktop.Platform.VulkanLayer.gamescope | |
} | |
# !IMPORTANT! here you can select what gets installed and what not by commenting | |
install_core_packages | |
install_networking_packages | |
install_flatpak_packages | |
#install_flatpak_gaming | |
#install_gaming_packages | |
# Enable and start timesync service | |
sudo systemctl enable --now systemd-timesyncd | |
# Enable and start bluetooth service | |
sudo systemctl enable --now bluetooth | |
# Enable and start polkitd | |
sudo systemctl enable --now polkitd | |
# Set up NetworkManager | |
sudo systemctl stop wpa_supplicant | |
sudo systemctl disable --now wpa_supplicant | |
sudo systemctl disable --now systemd-networkd | |
sudo systemctl mask systemd-networkd | |
sudo systemctl enable --now dbus | |
sudo systemctl enable --now NetworkManager | |
# Clone and set up dotfiles | |
git clone https://github.com/speyll/dotfiles "$HOME/dotfiles" | |
cp -r "$HOME/dotfiles/."* "$HOME/" | |
rm -rf "$HOME/dotfiles" | |
chmod -R +X "$HOME/.local/bin" "$HOME/.local/share/applications" "$HOME/.config/autostart/" | |
chmod +x "$HOME/.config/yambar/sway-switch-keyboard.sh" "$HOME/.config/yambar/xkb-layout.sh" "$HOME/.config/autostart/*" "$HOME/.local/bin/*" | |
ln -s "$HOME/.config/mimeapps.list" "$HOME/.local/share/applications/" | |
# Add user to sudo group for sudo access | |
echo "%sudo ALL=(ALL:ALL) NOPASSWD: /usr/bin/halt, /usr/bin/poweroff, /usr/bin/reboot, /usr/bin/shutdown, /usr/bin/zzz, /usr/bin/ZZZ" | sudo tee -a /etc/sudoers.d/wheel |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment