From ccfdda300eb46e1943add3074379c22c1e81695c Mon Sep 17 00:00:00 2001 From: Your Name Date: Mon, 5 Aug 2024 00:00:55 -0600 Subject: [PATCH] fix --- debian.sh | 276 +++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 263 insertions(+), 13 deletions(-) diff --git a/debian.sh b/debian.sh index aada089..eac7ec5 100755 --- a/debian.sh +++ b/debian.sh @@ -6,7 +6,7 @@ # 1. BTRFS with Grub Snapshots # 2. Full-disk-encryption # 3. Hibernation -# 4. GNOME or KDE Desktop +# 4. Hyprland, GNOME or KDE Desktop # 5. The ability to build a custom and deployable image onto any machine # 6. Easily create a bootable USB drive # 7. Automatic Partitioning @@ -47,9 +47,11 @@ AUTO_DECRYPT='False' DESKTOP="GNOME" BROWSER="librewolf" #Packages -BASE_PACKAGES=" syncthing tor firmware-realtek screenfetch linux-image-amd64 grub-efi efibootmgr plymouth plymouth-themes duperemove btrfs-compsize btrfs-progs cryptsetup-initramfs linux-headers-amd64 firmware-iwlwifi firmware-linux firmware-linux-nonfree packagekit cockpit-packagekit cockpit-storaged shfmt aardvark-dns power-profiles-daemon resolvconf wireguard wireguard-tools nmap libsecret-tools libglu1-mesa preload powertop acpi btop inotify-tools debootstrap cups apt-transport-https samba samba-common nfs-common nfs-kernel-server linux-cpupower locales zram-tools acpid ghostscript cifs-utils ntp vim-airline rsync screen base udev git network-manager cryptsetup network-manager-openvpn ntp screen docbook-xsl alsa-utils sysstat fuse3 build-essential unzip bash-completion parted dosfstools wget curl " +BASE_PACKAGES=" nyx syncthing tor firmware-realtek screenfetch linux-image-amd64 grub-efi efibootmgr plymouth plymouth-themes duperemove btrfs-compsize btrfs-progs cryptsetup-initramfs linux-headers-amd64 firmware-iwlwifi firmware-linux firmware-linux-nonfree packagekit cockpit-packagekit cockpit-storaged shfmt aardvark-dns power-profiles-daemon resolvconf wireguard wireguard-tools nmap libsecret-tools libglu1-mesa preload powertop acpi btop inotify-tools debootstrap cups apt-transport-https samba samba-common nfs-common nfs-kernel-server linux-cpupower locales zram-tools acpid ghostscript cifs-utils ntp vim-airline rsync screen base udev git network-manager cryptsetup network-manager-openvpn ntp screen docbook-xsl alsa-utils sysstat fuse3 build-essential unzip bash-completion parted dosfstools wget curl " KDE_DESKTOP_ENV=" krita libdbus-glib-1-2 korganizer print-manager kwin-addons kde-standard konsole dolphin kde-spectacle " GNOME_DESKTOP_ENV=" gnome-calendar xournalpp gnome-core gdm3 gnome-shell-extension-tiling-assistant gnome-tweaks synaptic " +HYPRLAND_DESKTOP_ENV=" wl-clipboard grim slurp hyprpaper network-manager-gnome pavucontrol wofi kitty thunar waybar swayidle xdg-desktop-portal-gtk wlogout " +SWAY_DESKTOP_ENV=" sway xwayland xdg-desktop-portal-wlr wl-clipboard grim slurp network-manager-gnome pavucontrol wofi thunar waybar swayidle xdg-desktop-portal-gtk wlogout " SHARED_DESKTOP_APPS=" krita obs-studio keepassxc telegram-desktop handbrake vlc yt-dlp " VIRTUALIZATION=" virt-manager qemu-system libvirt-daemon-system ovmf cockpit-machines" PACKAGES="" @@ -58,6 +60,7 @@ SWAP_CHOICE="" partitionDetection() { #This is used for the installer to do script-based actions + /usr/sbin/blkid -p /dev/$HARD_DISK EFI=$(blkid | grep $HARD_DISK | sort | cut -d ":" -f1 | head -1 | tail -1) BOOT=$(blkid | grep $HARD_DISK | sort | cut -d ":" -f1 | head -2 | tail -1) BTRFS=$(blkid | grep $HARD_DISK | sort | cut -d ":" -f1 | head -3 | tail -1) @@ -66,6 +69,196 @@ partitionDetection() { partitionDetection +buildHyprland() { + DEPS=( + build-essential + cmake + cmake-extras + curl + gawk + gettext + gir1.2-graphene-1.0 + git + glslang-tools + gobject-introspection + golang + hwdata + jq + libavcodec-dev + libavformat-dev + libavutil-dev + libcairo2-dev + libdeflate-dev + libdisplay-info-dev + libdrm-dev + libegl1-mesa-dev + libgbm-dev + libgdk-pixbuf-2.0-dev + libgdk-pixbuf2.0-bin + libgirepository1.0-dev + libgl1-mesa-dev + libgraphene-1.0-0 + libgraphene-1.0-dev + libgtk-3-dev + libgulkan-0.15-0t64 + libgulkan-dev + libinih-dev + libinput-dev + libjbig-dev + libjpeg-dev + libjpeg62-turbo-dev + liblerc-dev + libliftoff-dev + liblzma-dev + libnotify-bin + libpam0g-dev + libpango1.0-dev + libpipewire-0.3-dev + libqt6svg6 + libseat-dev + libstartup-notification0-dev + libswresample-dev + libsystemd-dev + libtiff-dev + libtiffxx6 + libtomlplusplus-dev + libudev-dev + libvkfft-dev + libvulkan-dev + libvulkan-volk-dev + libwayland-dev + libwebp-dev + libxcb-composite0-dev + libxcb-cursor-dev + libxcb-dri3-dev + libxcb-ewmh-dev + libxcb-icccm4-dev + libxcb-present-dev + libxcb-render-util0-dev + libxcb-res0-dev + libxcb-util-dev + libxcb-xinerama0-dev + libxcb-xinput-dev + libxcb-xkb-dev + libxkbcommon-dev + libxkbcommon-x11-dev + libxkbregistry-dev + libxml2-dev + libxxhash-dev + meson + ninja-build + openssl + psmisc + python3-mako + python3-markdown + python3-markupsafe + python3-yaml + python3-pyquery + qt6-base-dev + scdoc + seatd + spirv-tools + vulkan-validationlayers + vulkan-utility-libraries-dev + wayland-protocols + xdg-desktop-portal + xwayland + libsdbus-c++-dev + libzip-dev + librsvg2-dev + libpugixml-dev + libxcb-errors-dev + bison + flex + pandoc + doxygen + cppcheck + libmpdclient-dev + libnl-3-dev + libasound2-dev + ) + + for i in "${DEPS[@]}"; do + apt install -y $i + done + + cd /tmp + git clone https://github.com/hyprwm/hyprutils.git --depth=1 + cd hyprutils/ + cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:PATH=/usr -S . -B ./build + cmake --build ./build --config Release --target all -j$(nproc 2>/dev/null || getconf _NPROCESSORS_CONF) + cmake --install build + + cd /tmp + git clone https://github.com/hyprwm/hyprlang.git --depth=1 + cd hyprlang/ + cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:PATH=/usr -S . -B ./build + cmake --build ./build --config Release --target hyprlang -j$(nproc 2>/dev/null || getconf _NPROCESSORS_CONF) + cmake --install build + + cd /tmp + git clone https://github.com/hyprwm/hyprcursor.git --depth=1 + cd hyprcursor + cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:PATH=/usr -S . -B ./build + cmake --build ./build --config Release --target all -j$(nproc 2>/dev/null || getconf _NPROCESSORS_CONF) + cmake --install build + + cd /tmp + git clone https://github.com/hyprwm/hyprwayland-scanner.git --depth=1 + cd hyprwayland-scanner + cmake -DCMAKE_INSTALL_PREFIX=/usr -B build + cmake --build build -j $(nproc) + cmake --install build + + cd /tmp + git clone https://github.com/hyprwm/aquamarine.git --depth=1 + cd aquamarine + cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:PATH=/usr -S . -B ./build + cmake --build ./build --config Release --target all -j$(nproc 2>/dev/null || getconf _NPROCESSORS_CONF) + cmake --install build + + cd /tmp + git clone --recursive https://github.com/hyprwm/Hyprland.git --depth=1 + cd Hyprland + make all -j$(nproc 2>/dev/null || getconf _NPROCESSORS_CONF) + make install -j$(nproc 2>/dev/null || getconf _NPROCESSORS_CONF) + + cd /tmp + git clone --recursive https://github.com/hyprwm/xdg-desktop-portal-hyprland --depth=1 + cd xdg-desktop-portal-hyprland/ + sudo sed -i '8,9 s/^/#/'./src/shared/ScreencopyShared.hpp + cmake -DCMAKE_INSTALL_LIBEXECDIR=/usr/lib -DCMAKE_INSTALL_PREFIX=/usr -B build + cmake --build build + cmake --install build + + cd /tmp + git clone https://github.com/lbonn/rofi.git --depth=1 + cd rofi + meson setup build + ninja -C build + ninja -C build install +} + +torConfig() { + echo "Configuring TOR" + echo + echo "EntryNodes {us}" >/etc/tor/torrc + echo "ExitNodes {us}" >>/etc/tor/torrc + echo "AvoidDiskWrites 1" >>/etc/tor/torrc + echo "HardwareAccel 1" >>/etc/tor/torrc + echo "NumCPUs 4" >>/etc/tor/torrc + chown -R debian-tor:debian-tor /etc/tor +} + +autoLoginGetty() { + GETTY_DIR="$TARGET/etc/systemd/system/getty@tty1.service.d" + GETTY="$GETTY_DIR/override.conf" + mkdir -p $GETTY_DIR + echo "[Service]" >$GETTY + echo "ExecStart=" >>$GETTY + echo "ExecStart=-/sbin/agetty --autologin $USER --noclear %I /usr/bin/bash" >>$GETTY +} + auto_login() { if [ -f "$TARGET/usr/bin/sddm" ]; then @@ -76,6 +269,14 @@ auto_login() { echo "Relogin=false" >>$TARGET/etc/sddm.conf.d/autologin fi + if [ -f "$TARGET/usr/bin/hyprland" ]; then + autoLoginGetty + fi + + if [ -f "$TARGET/usr/bin/sway" ]; then + autoLoginGetty + fi + if [ -f "$TARGET/usr/sbin/gdm3" ]; then sed -i '/daemon/a AutomaticLoginEnable=True' $TARGET/etc/gdm3/daemon.conf sed -i "/daemon/a AutomaticLogin = $USER" $TARGET/etc/gdm3/daemon.conf @@ -176,11 +377,17 @@ liveOSrestore() { echo rm -f $TARGET/boot/* rsync -av --delete /boot/ $TARGET/boot/ + + echo "bash /usr/bin/debian.sh bootloader $1 $5 $2" >$TARGET/setup.sh + echo 'bash /usr/bin/debian.sh accounts' >>$TARGET/setup.sh + echo 'bash /usr/bin/debian.sh btrfsTweaks' >>$TARGET/setup.sh + chmod +x $TARGET/usr/bin/debian.sh - chroot $TARGET /usr/bin/debian.sh bootloader $1 $5 $2 - chroot $TARGET /usr/bin/debian.sh btrfsTweaks - chroot $TARGET /usr/bin/debian.sh accounts - read -p 'Would you like to run your UserTweaks? :' -e -i 'y' user_tweaks + chmod +x $TARGET/setup.sh + chroot $TARGET /setup.sh + rm -f $TARGET/setup.sh + + read -p 'Would you like to run your UserTweaks: ' -e -i 'y' user_tweaks if [[ $user_tweaks = *y* ]]; then userTweaks @@ -198,15 +405,28 @@ liveOSrestore() { userTweaks() { mkdir $TARGET/home/$USER/.librewolf + mkdir -p $TARGET/home/$USER/.config/waybar + mkdir -p $TARGET/home/$USER/.config/sway mkdir -p $TARGET/home/$USER/.config/autostart + mkdir -p $TARGET/home/$USER/.config/hypr + mkdir -p $TARGET/home/$USER/.config/rofi mkdir -p $TARGET/home/$USER/Documents/keys/keepass mkdir -p $TARGET/home/$USER/dotfiles mkdir -p $TARGET/home/$USER/server mkdir -p $TARGET/home/$USER/.config/Exodus mkdir -p $TARGET/home/$USER/.config/evolution mkdir -p $TARGET/home/$USER/.config/goa-1.0 + mkdir -p $TARGET/home/$USER/.local/share/fonts + $TARGET/home/$USER/.local/share/fonts/ + + cp -f /home/$USER/.bash* $TARGET/home/$USER/ rsync -av --delete /home/$USER/server/ $TARGET/home/$USER/server/ + rsync -av --delete /home/$USER/.local/share/fonts/ $TARGET/home/$USER/.local/share/fonts/ + rsync -av --delete /home/$USER/.config/hypr/ $TARGET/home/$USER/.config/hypr/ + rsync -av --delete /home/$USER/.config/sway/ $TARGET/home/$USER/.config/sway/ + rsync -av --delete /home/$USER/.config/waybar/ $TARGET/home/$USER/.config/waybar/ + rsync -av --delete /home/$USER/.config/rofi/ $TARGET/home/$USER/.config/rofi/ rsync -av --delete /home/$USER/.config/Exodus/ $TARGET/home/$USER/.config/Exodus/ rsync -av --delete /home/$USER/.config/evolution/ $TARGET/home/$USER/.config/evolution/ rsync -av --delete /home/$USER/.config/goa-1.0/ $TARGET/home/$USER/.config/goa-1.0/ @@ -302,6 +522,9 @@ makeImage() { echo "bash /usr/bin/debian.sh bootloader $1 $ROOT_NAME $ROOT_MAPPER_NAME" >>$TARGET/setup.sh echo 'bash /usr/bin/debian.sh grubSnapshotss' >>$TARGET/setup.sh echo 'bash /usr/bin/debian.sh desktop' >>$TARGET/setup.sh + if [[ $DESKTOP = *Hyprland* ]]; then + echo 'bash /usr/bin/debian.sh buildHyprland' >>$TARGET/setup.sh + fi echo '/usr/bin/apt clean all' >>$TARGET/setup.sh chmod +x $TARGET/usr/bin/debian.sh chmod +x $TARGET/setup.sh @@ -356,13 +579,14 @@ stableDiffusion() { clear VERSION="3.10.6" STABLE_VERSION="1.10.0-RC" - #installPython + installPython cd /home/$USER wget https://github.com/AUTOMATIC1111/stable-diffusion-webui/archive/refs/tags/v$STABLE_VERSION.zip unzip "v$STABLE_VERSION.zip" cd /home/$USER/stable-diffusion-webui-$STABLE_VERSION /usr/local/bin/python3.10 -m venv venv chown -R root:root /home/$USER/stable-diffusion-webui-$STABLE_VERSION + . venv/bin/activate } desktop() { @@ -405,6 +629,8 @@ desktop() { installLibreWolf installCodium installSteam + torConfig + if [[ $SWAP_CHOICE = *y* ]]; then hibernation fi @@ -454,7 +680,7 @@ bootloader() { ROOT_MAPPER_NAME="$3" ROOT_NAME="$2" #plymouth-set-default-theme -r - /sbin/plymouth-set-default-theme spacefun --rebuild-initrd + /sbin/plymouth-set-default-theme solar --rebuild-initrd echo "$ROOT_MAPPER_NAME UUID=$(/sbin/blkid | grep $BTRFS | cut -d '"' -f2) none luks" >/etc/crypttab if [ "$AUTO_DECRYPT" == "True" ]; then decryptBoot "${BTRFS}" @@ -469,7 +695,14 @@ bootloader() { echo "GRUB_ENABLE_CRYPTODISK=n" >>/etc/default/grub echo "GRUB_DISABLE_OS_PROBER=true" >>/etc/default/grub echo "GRUB_TIMEOUT=1" >>/etc/default/grub - /sbin/grub-install --removable --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=debian + echo + echo + read -p 'Install GRUB to a removable DRIVE: ' -e -i "n" REMOVEABLE + if [[ $REMOVEABLE = *y* ]]; then + /sbin/grub-install --removable --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=debian + else + /sbin/grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=debian + fi /sbin/update-grub fi @@ -483,6 +716,9 @@ setupScript() { echo 'bash /usr/bin/debian.sh grubSnapshotss' >>$TARGET/setup.sh echo 'bash /usr/bin/debian.sh accounts' >>$TARGET/setup.sh echo 'bash /usr/bin/debian.sh desktop' >>$TARGET/setup.sh + if [[ $DESKTOP = *Hyprland* ]]; then + echo 'bash /usr/bin/debian.sh buildHyprland' >>$TARGET/setup.sh + fi echo 'bash /usr/bin/debian.sh btrfsTweaks' >>$TARGET/setup.sh chmod +x $TARGET/usr/bin/debian.sh @@ -526,6 +762,7 @@ Signed-By: /usr/share/keyrings/librewolf.gpg EOF apt update apt install -y librewolf + apt remove firefox-esr -y } installSteam() { @@ -624,6 +861,7 @@ accounts() { gpasswd -a $USER libvirt gpasswd -a $USER netdev gpasswd -a $USER adm + gpasswd -a $USER debian-tor echo "$USER ALL=(ALL) ALL" >/etc/sudoers echo "root ALL=(ALL) ALL" >>/etc/sudoers echo @@ -780,9 +1018,13 @@ tweaks() { read -p 'Location to Store Image: ' -e -i "/home/$USER" image_directory read -p 'Image File Name: ' -e -i "debian" ROOT_NAME read -p 'Debian Version: ' -e -i "stable" DEBIAN_RELEASE - read -p 'KDE or GNOME: ' -e -i "GNOME" DESKTOP + read -p 'Sway, Hyprland, KDE, or GNOME: ' -e -i "sway" DESKTOP if [[ $DESKTOP = *KDE* ]]; then PACKAGES=$BASE_PACKAGES$SHARED_DESKTOP_APPS$KDE_DESKTOP_ENV$VIRTUALIZATION + elif [[ $DESKTOP = *sway* ]]; then + PACKAGES=$BASE_PACKAGES$SHARED_DESKTOP_APPS$SWAY_DESKTOP_ENV$VIRTUALIZATION + elif [[ $DESKTOP = *Hyprland* ]]; then + PACKAGES=$BASE_PACKAGES$SHARED_DESKTOP_APPS$HYPRLAND_DESKTOP_ENV$VIRTUALIZATION else PACKAGES=$BASE_PACKAGES$SHARED_DESKTOP_APPS$GNOME_DESKTOP_ENV$VIRTUALIZATION fi @@ -831,11 +1073,15 @@ menu() { echo echo read -p 'Debian Version: ' -e -i "stable" DEBIAN_RELEASE - read -p 'KDE or GNOME: ' -e -i "GNOME" DESKTOP + read -p 'Sway, Hyprland, KDE, or GNOME: ' -e -i "sway" DESKTOP if [[ $DESKTOP = *KDE* ]]; then - PACKAGES=$BASE_PACKAGES$SHARED_DESKTOP_APPS$KDE_DESKTOP_ENV + PACKAGES=$BASE_PACKAGES$SHARED_DESKTOP_APPS$KDE_DESKTOP_ENV$VIRTUALIZATION + elif [[ $DESKTOP = *sway* ]]; then + PACKAGES=$BASE_PACKAGES$SHARED_DESKTOP_APPS$SWAY_DESKTOP_ENV$VIRTUALIZATION + elif [[ $DESKTOP = *Hyprland* ]]; then + PACKAGES=$BASE_PACKAGES$SHARED_DESKTOP_APPS$HYPRLAND_DESKTOP_ENV$VIRTUALIZATION else - PACKAGES=$BASE_PACKAGES$SHARED_DESKTOP_APPS$GNOME_DESKTOP_ENV + PACKAGES=$BASE_PACKAGES$SHARED_DESKTOP_APPS$GNOME_DESKTOP_ENV$VIRTUALIZATION fi setDevices install "$HARD_DISK" @@ -939,12 +1185,16 @@ elif [ "$1" = "flatpaks" ]; then flatpaks elif [ "$1" = "bootloader" ]; then bootloader "$2" "$3" "$4" +elif [ "$1" = "buildHyprland" ]; then + buildHyprland elif [ "$1" = "snapshot" ]; then snapshots elif [ "$1" = "grubSnapshotss" ]; then grubSnapshotss elif [ "$1" = "btrfsTweaks" ]; then btrfsTweaks +elif [ "$1" = "tor" ]; then + torConfig elif [ "$1" = "remove-snapshot" ]; then removeSnapshots elif [ "$1" = "help" ]; then