From 4d39d473e5d0a3a09def1520d60440c6a819370d Mon Sep 17 00:00:00 2001 From: Krish G <2088089+krish-gh@users.noreply.github.com> Date: Sat, 21 Feb 2026 22:37:43 +0530 Subject: [PATCH 01/18] optimizing scripts --- desktop/gnome.sh | 61 ++--- distros/arch.sh | 51 ++-- scripts/setup-main.sh | 533 ++++++++++++++++++++---------------------- setup.sh | 23 +- 4 files changed, 322 insertions(+), 346 deletions(-) diff --git a/desktop/gnome.sh b/desktop/gnome.sh index 0e36927..3cc7134 100644 --- a/desktop/gnome.sh +++ b/desktop/gnome.sh @@ -4,22 +4,23 @@ GUI_TEXT_EDITOR=org.gnome.TextEditor.desktop setup_gnome() { - echo -e "Configuring gnome stuffs..." + printf 'Configuring GNOME stuff...\n' install_pkgs "$GNOME_PACKAGES_TO_INSTALL" - # GDM - #sudo mkdir -p /etc/dconf/db/gdm.d - #copy_file 95-gdm-settings ${BASE_REPO_LOCATION}system/etc/dconf/db/gdm.d/95-gdm-settings - #sudo mv -f 95-gdm-settings /etc/dconf/db/gdm.d/ - - echo -e "Installing some extensions..." + printf 'Installing some extensions...\n' if command_exists flatpak; then - $FLATPAK_INSTALL_CMD com.mattjakeman.ExtensionManager + eval "$FLATPAK_INSTALL_CMD" com.mattjakeman.ExtensionManager || printf 'Warning: Failed to install extension manager\n' >&2 else install_pkgs "$GNOME_EXT_MGR_PKG" fi - pipx ensurepath - pipx install gnome-extensions-cli --system-site-packages + + if command_exists pipx; then + pipx ensurepath >/dev/null 2>&1 || true + pipx install gnome-extensions-cli --system-site-packages 2>/dev/null || printf 'Warning: Failed to install gnome-extensions-cli\n' >&2 + else + printf 'Warning: pipx not found, skipping gnome-extensions-cli\n' >&2 + return + fi declare -A exts exts[1]=AlphabeticalAppGrid@stuarthayhurst @@ -27,34 +28,36 @@ setup_gnome() { exts[3]=status-area-horizontal-spacing@mathematical.coffee.gmail.com exts[4]=xwayland-indicator@swsnr.de exts[5]=apps-menu@gnome-shell-extensions.gcampax.github.com - [[ $DIST_ID != ubuntu ]] && exts[6]=appindicatorsupport@rgcjonas.gmail.com - [[ $DIST_ID != ubuntu ]] && exts[7]=dash-to-dock@micxgx.gmail.com - [[ $DISTRO_TYPE == arch ]] && exts[arch]=arch-update@RaphaelRochet - [[ $DISTRO_TYPE == debian ]] && exts[debian]=debian-updates-indicator@glerro.pm.me - [[ $DISTRO_TYPE == fedora ]] && exts[fedora]=update-extension@purejava.org + [[ "$DIST_ID" != "ubuntu" ]] && exts[6]=appindicatorsupport@rgcjonas.gmail.com + [[ "$DIST_ID" != "ubuntu" ]] && exts[7]=dash-to-dock@micxgx.gmail.com + [[ "$DISTRO_TYPE" == "arch" ]] && exts[arch]=arch-update@RaphaelRochet + [[ "$DISTRO_TYPE" == "debian" ]] && exts[debian]=debian-updates-indicator@glerro.pm.me + [[ "$DISTRO_TYPE" == "fedora" ]] && exts[fedora]=update-extension@purejava.org - extdir=~/.local/share/gnome-shell/extensions + local extdir=~/.local/share/gnome-shell/extensions for i in "${exts[@]}"; do - ~/.local/bin/gnome-extensions-cli --filesystem install "$i" - [[ -d $extdir/"$i"/schemas ]] && glib-compile-schemas $extdir/"$i"/schemas/ + ~/.local/bin/gnome-extensions-cli --filesystem install "$i" 2>/dev/null || printf 'Warning: Failed to install extension %s\n' "$i" >&2 + [[ -d "$extdir/$i/schemas" ]] && glib-compile-schemas "$extdir/$i/schemas/" 2>/dev/null || true done - if [[ $TERMINAL_TO_INSTALL != none ]]; then - python -m pip install --user --upgrade nautilus-open-any-terminal - glib-compile-schemas ~/.local/share/glib-2.0/schemas/ - gsettings set com.github.stunkymonkey.nautilus-open-any-terminal terminal "$TERMINAL_TO_INSTALL" + if [[ "$TERMINAL_TO_INSTALL" != "none" ]]; then + python -m pip install --user --upgrade nautilus-open-any-terminal 2>/dev/null || printf 'Warning: Failed to install nautilus-open-any-terminal\n' >&2 + glib-compile-schemas ~/.local/share/glib-2.0/schemas/ 2>/dev/null || true + gsettings set com.github.stunkymonkey.nautilus-open-any-terminal terminal "$TERMINAL_TO_INSTALL" 2>/dev/null || true fi - copy_file "$TEMP_DIR"/gnome.dconf "${BASE_REPO_LOCATION}"desktop/gnome.dconf - dconf load / <"$TEMP_DIR"/gnome.dconf - rm -f "$TEMP_DIR"/gnome.dconf + copy_file "$TEMP_DIR/gnome.dconf" "${BASE_REPO_LOCATION}desktop/gnome.dconf" && { + dconf load / < "$TEMP_DIR/gnome.dconf" 2>/dev/null || printf 'Warning: Failed to load dconf settings\n' >&2 + rm -f "$TEMP_DIR/gnome.dconf" + } } set_gnome_wallpaper() { - # shellcheck disable=SC2046 - gsettings set org.gnome.desktop.background picture-uri "file://$1" - gsettings set org.gnome.desktop.background picture-uri-dark "file://$1" + # Set both light and dark wallpaper + local wallpaper_uri="file://$1" + gsettings set org.gnome.desktop.background picture-uri "$wallpaper_uri" 2>/dev/null || true + gsettings set org.gnome.desktop.background picture-uri-dark "$wallpaper_uri" 2>/dev/null || true } -echo -e "Done gnome.sh..." +printf 'Done gnome.sh...\n' diff --git a/distros/arch.sh b/distros/arch.sh index 3145930..cdd1c71 100644 --- a/distros/arch.sh +++ b/distros/arch.sh @@ -31,45 +31,35 @@ PACKAGES_TO_REMOVE="" setup_arch() { if [[ -f /etc/vconsole.conf ]]; then - vsconsoleAppend="$( - grep "FONT=" /etc/vconsole.conf >/dev/null 2>&1 - echo $? - )" - if [[ "${vsconsoleAppend}" -ne 0 ]]; then - echo -e "FONT is not set in vconsole.conf, updating..." - echo -e 'FONT="eurlatgr"' | sudo tee -a /etc/vconsole.conf + if ! grep -q "FONT=" /etc/vconsole.conf; then + printf 'FONT is not set in vconsole.conf, updating...\n' + printf 'FONT="eurlatgr"\n' | sudo tee -a /etc/vconsole.conf >/dev/null fi fi - echo -e "Doing some cool stuffs in /etc/pacman.conf ..." - sudo sed -i "/^#Color/c\Color\nILoveCandy - /^#VerbosePkgLists/c\VerbosePkgLists - /^#ParallelDownloads/c\ParallelDownloads = 5" /etc/pacman.conf + printf 'Doing some cool stuff in /etc/pacman.conf...\n' + sudo sed -i "/^#Color/c\\Color\\nILoveCandy" /etc/pacman.conf + sudo sed -i "/^#VerbosePkgLists/c\\VerbosePkgLists" /etc/pacman.conf + sudo sed -i "/^#ParallelDownloads/c\\ParallelDownloads = 5" /etc/pacman.conf sudo sed -i '/^#\[multilib\]/,+1 s/^#//' /etc/pacman.conf # https://aur.chaotic.cx/docs if [[ ! -f /etc/pacman.d/chaotic-mirrorlist ]]; then - echo -e "Configuring Chaotic-AUR..." - sudo pacman-key --recv-key 3056513887B78AEB --keyserver keyserver.ubuntu.com - sudo pacman-key --lsign-key 3056513887B78AEB - sudo pacman -U --noconfirm 'https://cdn-mirror.chaotic.cx/chaotic-aur/chaotic-keyring.pkg.tar.zst' - sudo pacman -U --noconfirm 'https://cdn-mirror.chaotic.cx/chaotic-aur/chaotic-mirrorlist.pkg.tar.zst' + printf 'Configuring Chaotic-AUR...\n' + sudo pacman-key --recv-key 3056513887B78AEB --keyserver keyserver.ubuntu.com 2>/dev/null || printf 'Warning: Failed to receive key\n' >&2 + sudo pacman-key --lsign-key 3056513887B78AEB 2>/dev/null || printf 'Warning: Failed to sign key\n' >&2 + sudo pacman -U --noconfirm 'https://cdn-mirror.chaotic.cx/chaotic-aur/chaotic-keyring.pkg.tar.zst' 2>/dev/null || printf 'Warning: Failed to install chaotic-keyring\n' >&2 + sudo pacman -U --noconfirm 'https://cdn-mirror.chaotic.cx/chaotic-aur/chaotic-mirrorlist.pkg.tar.zst' 2>/dev/null || printf 'Warning: Failed to install chaotic-mirrorlist\n' >&2 fi - chaoticAurAppend="$( - grep "chaotic-aur" /etc/pacman.conf >/dev/null 2>&1 - echo $? - )" - if [[ "${chaoticAurAppend}" -ne 0 ]]; then - echo "Appending Chaotic-AUR in pacman.conf..." - echo -e | sudo tee -a /etc/pacman.conf - echo -e "[chaotic-aur]" | sudo tee -a /etc/pacman.conf - echo -e "Include = /etc/pacman.d/chaotic-mirrorlist" | sudo tee -a /etc/pacman.conf + if ! grep -q "chaotic-aur" /etc/pacman.conf; then + printf 'Appending Chaotic-AUR in pacman.conf...\n' + printf '\n[chaotic-aur]\nInclude = /etc/pacman.d/chaotic-mirrorlist\n' | sudo tee -a /etc/pacman.conf >/dev/null fi refresh_package_sources - echo -e "Installing some stuffs..." + printf 'Installing some packages...\n' [[ -f /etc/mkinitcpio.conf ]] && install_pkgs "mkinitcpio-firmware" pamacvar='aur' @@ -79,15 +69,12 @@ setup_arch() { install_pkgs "pamac-${pamacvar}" # Configure pamac - sudo sed -i "/RemoveUnrequiredDeps/s/^#//g - /NoUpdateHideIcon/s/^#//g - /KeepNumPackages/c\KeepNumPackages = 1 - /RefreshPeriod/c\RefreshPeriod = 0" /etc/pamac.conf + sudo sed -i "/RemoveUnrequiredDeps/s/^#//g; /NoUpdateHideIcon/s/^#//g; /KeepNumPackages/c\\KeepNumPackages = 1; /RefreshPeriod/c\\RefreshPeriod = 0" /etc/pamac.conf 2>/dev/null || true # misc flagstocopy=(code electron chromium chrome microsoft-edge-stable) for i in "${flagstocopy[@]}"; do - copy_file ~/.config/"${i}"-flags.conf "${BASE_REPO_LOCATION}"home/.config/"${i}"-flags.conf + copy_file ~/.config/"${i}"-flags.conf "${BASE_REPO_LOCATION}home/.config/${i}-flags.conf" || true done } @@ -95,4 +82,4 @@ setup_arch_cinnamon() { setup_cinnamon_theme } -echo -e "Done arch.sh..." +printf 'Done arch.sh...\n' diff --git a/scripts/setup-main.sh b/scripts/setup-main.sh index 5d71f9c..c917add 100644 --- a/scripts/setup-main.sh +++ b/scripts/setup-main.sh @@ -1,11 +1,11 @@ #!/bin/bash -# shellcheck disable=SC2034 +# shellcheck disable=SC2034,SC2128 +set -o pipefail -# shellcheck disable=SC2128 -scriptDir=$(dirname -- "$(readlink -f -- "$BASH_SOURCE")") +scriptDir=$(dirname -- "$(readlink -f -- "${BASH_SOURCE[0]}")") || { printf 'Failed to determine script directory\n' >&2; exit 1; } repoDir="$(dirname "$scriptDir")" -if [[ -d $repoDir/.git && -f $repoDir/scripts/setup-main.sh ]]; then - BASE_REPO_LOCATION=$repoDir/ +if [[ -d "$repoDir/.git" && -f "$repoDir/scripts/setup-main.sh" ]]; then + BASE_REPO_LOCATION="$repoDir/" else BASE_REPO_LOCATION="https://raw.githubusercontent.com/krish-gh/linux-setup/main/" fi @@ -16,191 +16,216 @@ command_exists() { DISTRO_TYPE='' PKG_MGR='' -command_exists pacman && PKG_MGR=pacman && DISTRO_TYPE=arch -command_exists apt && PKG_MGR=apt && DISTRO_TYPE=debian -command_exists dnf && PKG_MGR=dnf && DISTRO_TYPE=fedora -command_exists zypper && PKG_MGR=zypper && DISTRO_TYPE=opensuse -if [[ $DISTRO_TYPE == '' ]]; then - >&2 echo "You are not running supported Linux distrbution..." +if command_exists pacman; then + PKG_MGR=pacman + DISTRO_TYPE=arch +elif command_exists apt; then + PKG_MGR=apt + DISTRO_TYPE=debian +elif command_exists dnf; then + PKG_MGR=dnf + DISTRO_TYPE=fedora +elif command_exists zypper; then + PKG_MGR=zypper + DISTRO_TYPE=opensuse +fi + +if [[ -z "$DISTRO_TYPE" ]]; then + printf 'Error: Unsupported Linux distribution\n' >&2 exit 1 fi if ! command_exists curl; then - >&2 echo "curl required, but not found..." + printf 'Error: curl is required but not found\n' >&2 exit 2 fi DIST_ID='' -# shellcheck disable=SC1091 -[[ -f /etc/os-release ]] && source /etc/os-release && DIST_ID=$ID - -# shellcheck disable=SC2086 -DESKTOP=$(echo ${XDG_CURRENT_DESKTOP##*:} | tr '[:upper:]' '[:lower:]' | sed 's/^x-//') -CURRENT_TERMINAL=$(ps -p $PPID -o comm= | sed 's/-$//') - -echo -e "#################################################################" -echo -e "BASE_REPO_LOCATION=$BASE_REPO_LOCATION" -echo -e "DISTRO_TYPE=$DISTRO_TYPE" -echo -e "PACKAGE_MANAGER=$PKG_MGR" -echo -e "DESKTOP=$DESKTOP" -echo -e "TERMINAL=$CURRENT_TERMINAL" -echo -e "DISTRO_ID=$DIST_ID" -echo -e "#################################################################" +if [[ -f /etc/os-release ]]; then + # shellcheck disable=SC1091 + source /etc/os-release + DIST_ID="${ID:-}" +fi + +DESKTOP=$(printf '%s\n' "${XDG_CURRENT_DESKTOP##*:}" | tr '[:upper:]' '[:lower:]' | sed 's/^x-//') +CURRENT_TERMINAL=$(ps -p "$PPID" -o comm= | sed 's/-$//') + +printf '#################################################################\n' +printf 'BASE_REPO_LOCATION=%s\n' "$BASE_REPO_LOCATION" +printf 'DISTRO_TYPE=%s\n' "$DISTRO_TYPE" +printf 'PACKAGE_MANAGER=%s\n' "$PKG_MGR" +printf 'DESKTOP=%s\n' "$DESKTOP" +printf 'TERMINAL=%s\n' "$CURRENT_TERMINAL" +printf 'DISTRO_ID=%s\n' "$DIST_ID" +printf '#################################################################\n' cat /etc/os-release -echo -e "#################################################################" - -REFRESH_CMD="" #override from DISTRO_TYPE specific script -UPDATE_CMD="" #override from DISTRO_TYPE specific script -INSTALL_CMD="" #override from DISTRO_TYPE specific script -UNINSTALL_CMD="" #override from DISTRO_TYPE specific script -UNINSTALL_ONLY_CMD="" #override from DISTRO_TYPE specific script - -FLATPAK_INSTALL_CMD="flatpak install --assumeyes flathub" #override from DISTRO_TYPE specific script -FLATPAK_UPDATE_CMD="flatpak update --assumeyes" #override from DISTRO_TYPE specific script - -REQUIREMENTS="" #override from DISTRO_TYPE specific script -SYSTEM_PACKAGES_TO_INSTALL="" #override from DISTRO_TYPE specific script -INTEL_PACKAGES_TO_INSTALL="" #override from DISTRO_TYPE specific script -VMWARE_PACKAGES_TO_INSTALL="" #override from DISTRO_TYPE specific script -VBOX_PACKAGES_TO_INSTALL="" #override from DISTRO_TYPE specific script -HYPERV_PACKAGES_TO_INSTALL="" #override from DISTRO_TYPE specific script -VIRT_PACKAGES_TO_INSTALL="" #override from DISTRO_TYPE specific script -FONTS_TO_INSTALL="" #override from DISTRO_TYPE specific script -TERM_PACKAGES_TO_INSTALL="" #override from DISTRO_TYPE specific script -APP_PACKAGES_TO_INSTALL="" #override from DISTRO_TYPE specific script -DEV_PACKAGES_TO_INSTALL="" #override from DISTRO_TYPE specific script -GTK_PACKAGES_TO_INSTALL="" #override from DISTRO_TYPE specific script -QT_PACKAGES_TO_INSTALL="" #override from DISTRO_TYPE specific script -QT_PATCHES_TO_INSTALL="" #override from DISTRO_TYPE specific script -GNOME_PACKAGES_TO_INSTALL="" #override from DISTRO_TYPE specific script -GNOME_EXT_MGR_PKG="" #override from DISTRO_TYPE specific script -KDE_PACKAGES_TO_INSTALL="" #override from DISTRO_TYPE specific script -CINNAMON_PACKAGES_TO_INSTALL="" #override from DISTRO_TYPE specific script -XFCE_PACKAGES_TO_INSTALL="" #override from DISTRO_TYPE specific script -XFCE_MENU_LOGO="" #override from DISTRO_TYPE specific script -PACKAGES_TO_REMOVE="" #override from DISTRO_TYPE specific script +printf '#################################################################\n' + +REFRESH_CMD="" +UPDATE_CMD="" +INSTALL_CMD="" +UNINSTALL_CMD="" +UNINSTALL_ONLY_CMD="" + +FLATPAK_INSTALL_CMD="flatpak install --assumeyes flathub" +FLATPAK_UPDATE_CMD="flatpak update --assumeyes" + +REQUIREMENTS="" +SYSTEM_PACKAGES_TO_INSTALL="" +INTEL_PACKAGES_TO_INSTALL="" +VMWARE_PACKAGES_TO_INSTALL="" +VBOX_PACKAGES_TO_INSTALL="" +HYPERV_PACKAGES_TO_INSTALL="" +VIRT_PACKAGES_TO_INSTALL="" +FONTS_TO_INSTALL="" +TERM_PACKAGES_TO_INSTALL="" +APP_PACKAGES_TO_INSTALL="" +DEV_PACKAGES_TO_INSTALL="" +GTK_PACKAGES_TO_INSTALL="" +QT_PACKAGES_TO_INSTALL="" +QT_PATCHES_TO_INSTALL="" +GNOME_PACKAGES_TO_INSTALL="" +GNOME_EXT_MGR_PKG="" +KDE_PACKAGES_TO_INSTALL="" +CINNAMON_PACKAGES_TO_INSTALL="" +XFCE_PACKAGES_TO_INSTALL="" +XFCE_MENU_LOGO="" +PACKAGES_TO_REMOVE="" TERMINAL_TO_INSTALL=none -GUI_TEXT_EDITOR="" #override from desktop specific script +GUI_TEXT_EDITOR="" -TEMP_DIR=/tmp/linux-setup -mkdir -p $TEMP_DIR +TEMP_DIR=$(mktemp -d) || { printf 'Failed to create temp directory\n' >&2; exit 1; } +trap 'rm -rf "$TEMP_DIR"' EXIT # arg1 = destination path, arg2 = source path copy_file() { - if [[ $2 == http* ]]; then - curl -f -o "$1" "$2?$(date +%s)" - curl_exit_status=$? - [[ $curl_exit_status != 0 ]] && >&2 echo -e "Error downloading $2" + local dest="$1" src="$2" + if [[ "$src" == http* ]]; then + curl -f -o "$dest" "$src?$(date +%s)" || { printf 'Error downloading %s\n' "$src" >&2; return 1; } else - cp -f "$2" "$1" + cp -f "$src" "$dest" || { printf 'Error copying %s\n' "$src" >&2; return 1; } fi } # arg1 = source path copy_content() { - if [[ $1 == http* ]]; then - curl -f "$1?$(date +%s)" - curl_exit_status=$? - [[ $curl_exit_status != 0 ]] && >&2 echo -e "Error downloading $1" + local src="$1" + if [[ "$src" == http* ]]; then + curl -f "$src?$(date +%s)" || { printf 'Error downloading %s\n' "$src" >&2; return 1; } else - cat "$1" + cat "$src" || { printf 'Error reading %s\n' "$src" >&2; return 1; } fi } refresh_package_sources() { - eval "$REFRESH_CMD" + eval "$REFRESH_CMD" || { printf 'Error refreshing package sources\n' >&2; return 1; } } update_packages() { - eval "$UPDATE_CMD" - command_exists flatpak && $FLATPAK_UPDATE_CMD + eval "$UPDATE_CMD" || { printf 'Error updating packages\n' >&2; return 1; } + if command_exists flatpak; then + eval "$FLATPAK_UPDATE_CMD" || printf 'Warning: flatpak update failed\n' >&2 + fi } install_pkgs() { - #doing in loop to avoid abort in case something is wrong - # shellcheck disable=SC2207 - pkgs=($(eval echo "$1")) - for i in "${pkgs[@]}"; do eval "$INSTALL_CMD $i"; done + # Install packages one by one to avoid aborting on individual failures + local pkgs + # shellcheck disable=SC2206 + pkgs=($1) + local pkg + for pkg in "${pkgs[@]}"; do + eval "$INSTALL_CMD $pkg" || printf 'Warning: Failed to install %s\n' "$pkg" >&2 + done } uninstall_pkgs() { - #doing in loop to avoid abort in case something is wrong - # shellcheck disable=SC2207 - pkgs=($(eval echo "$1")) - for i in "${pkgs[@]}"; do eval "$UNINSTALL_CMD $i"; done + # Uninstall packages one by one to avoid aborting on individual failures + local pkgs + # shellcheck disable=SC2206 + pkgs=($1) + local pkg + for pkg in "${pkgs[@]}"; do + eval "$UNINSTALL_CMD $pkg" || printf 'Warning: Failed to uninstall %s\n' "$pkg" >&2 + done } uninstall_only_pkgs() { - #doing in loop to avoid abort in case something is wrong - # shellcheck disable=SC2207 - pkgs=($(eval echo "$1")) - for i in "${pkgs[@]}"; do eval "$UNINSTALL_ONLY_CMD $i"; done + # Uninstall packages (without dependencies) one by one to avoid aborting on individual failures + local pkgs + # shellcheck disable=SC2206 + pkgs=($1) + local pkg + for pkg in "${pkgs[@]}"; do + eval "$UNINSTALL_ONLY_CMD $pkg" || printf 'Warning: Failed to uninstall %s\n' "$pkg" >&2 + done } debloat_pkgs() { - echo -e "Debloating..." - copy_file $TEMP_DIR/$DISTRO_TYPE.txt "${BASE_REPO_LOCATION}"debloat/$DISTRO_TYPE.txt - while read -r pkg; do + printf 'Debloating...\n' + local debloat_file="$TEMP_DIR/$DISTRO_TYPE.txt" + copy_file "$debloat_file" "${BASE_REPO_LOCATION}debloat/$DISTRO_TYPE.txt" || { printf 'Warning: Could not download debloat list\n' >&2; return; } + while IFS= read -r pkg; do + [[ -z "$pkg" || "$pkg" == \#* ]] && continue uninstall_pkgs "$pkg" - done <$TEMP_DIR/$DISTRO_TYPE.txt - rm -f $TEMP_DIR/$DISTRO_TYPE.txt + done < "$debloat_file" + rm -f "$debloat_file" - if [[ $PACKAGES_TO_REMOVE != "" ]]; then - echo -e "Removing additional packages..." + if [[ -n "$PACKAGES_TO_REMOVE" ]]; then + printf 'Removing additional packages...\n' uninstall_only_pkgs "$PACKAGES_TO_REMOVE" fi } # override with DISTRO_TYPE specific stuffs -echo -e "Executing common $DISTRO_TYPE specific script..." -copy_file $TEMP_DIR/"$DISTRO_TYPE".sh "${BASE_REPO_LOCATION}"distros/"$DISTRO_TYPE".sh -if [[ ! -f $TEMP_DIR/"$DISTRO_TYPE".sh ]]; then - >&2 echo "Error: $DISTRO_TYPE specific script not found!" +printf 'Executing common %s specific script...\n' "$DISTRO_TYPE" +copy_file "$TEMP_DIR/$DISTRO_TYPE.sh" "${BASE_REPO_LOCATION}distros/$DISTRO_TYPE.sh" || { printf 'Error: Failed to download %s specific script\n' "$DISTRO_TYPE" >&2; exit 3; } +if [[ ! -f "$TEMP_DIR/$DISTRO_TYPE.sh" ]]; then + printf 'Error: %s specific script not found!\n' "$DISTRO_TYPE" >&2 exit 3 fi # shellcheck disable=SC1090 -source $TEMP_DIR/"$DISTRO_TYPE".sh -rm -f $TEMP_DIR/"$DISTRO_TYPE".sh +source "$TEMP_DIR/$DISTRO_TYPE.sh" || { printf 'Error: Failed to source %s specific script\n' "$DISTRO_TYPE" >&2; exit 3; } +rm -f "$TEMP_DIR/$DISTRO_TYPE.sh" # desktop environment specific stuffs -copy_file $TEMP_DIR/"$DESKTOP".sh "${BASE_REPO_LOCATION}"desktop/"$DESKTOP".sh +copy_file "$TEMP_DIR/$DESKTOP.sh" "${BASE_REPO_LOCATION}desktop/$DESKTOP.sh" # shellcheck disable=SC1090 -[[ -f $TEMP_DIR/"$DESKTOP".sh ]] && source $TEMP_DIR/"$DESKTOP".sh -rm -f $TEMP_DIR/"$DESKTOP".sh +[[ -f "$TEMP_DIR/$DESKTOP.sh" ]] && source "$TEMP_DIR/$DESKTOP.sh" +rm -f "$TEMP_DIR/$DESKTOP.sh" # execute exact distro specic stuffs if exists e.g. linux mint, ubuntu, manjaro etc. Optional. -if [[ $DIST_ID != '' ]]; then - copy_file $TEMP_DIR/"$DIST_ID".sh "${BASE_REPO_LOCATION}"specific/"$DIST_ID".sh +if [[ -n "$DIST_ID" ]]; then + copy_file "$TEMP_DIR/$DIST_ID.sh" "${BASE_REPO_LOCATION}specific/$DIST_ID.sh" # shellcheck disable=SC1090 - [[ -f $TEMP_DIR/"$DIST_ID".sh ]] && source $TEMP_DIR/"$DIST_ID".sh - rm -f $TEMP_DIR/"$DIST_ID".sh + [[ -f "$TEMP_DIR/$DIST_ID.sh" ]] && source "$TEMP_DIR/$DIST_ID.sh" + rm -f "$TEMP_DIR/$DIST_ID.sh" fi setup_system() { install_pkgs "virt-what" - SYSTEM_TO_SETUP=$(sudo virt-what) + SYSTEM_TO_SETUP=$(sudo virt-what 2>/dev/null) - if [[ $SYSTEM_TO_SETUP != '' ]]; then - echo -e "SYSTEM=$SYSTEM_TO_SETUP" + if [[ -n "$SYSTEM_TO_SETUP" ]]; then + printf 'SYSTEM=%s\n' "$SYSTEM_TO_SETUP" - case $SYSTEM_TO_SETUP in + case "$SYSTEM_TO_SETUP" in vmware) install_pkgs "$VMWARE_PACKAGES_TO_INSTALL" - sudo systemctl enable --now vmtoolsd.service - #sudo systemctl disable --now vmware-vmblock-fuse.service + sudo systemctl enable --now vmtoolsd.service 2>/dev/null || true ;; virtualbox) install_pkgs "$VBOX_PACKAGES_TO_INSTALL" - sudo systemctl enable --now vboxservice.service + sudo systemctl enable --now vboxservice.service 2>/dev/null || true ;; hyperv) install_pkgs "$HYPERV_PACKAGES_TO_INSTALL" - sudo systemctl enable --now hv_{fcopy,kvp,vss}_daemon.service + sudo systemctl enable --now hv_{fcopy,kvp,vss}_daemon.service 2>/dev/null || true ;; qemu | kvm | xen | virt) @@ -208,300 +233,254 @@ setup_system() { ;; *) - echo "Ahh! Taking a note..." + printf 'Ahh! Taking a note...\n' ;; esac else # TODO detect bare metal - SYSTEM_TO_SETUP=intel - echo -e "SYSTEM=$SYSTEM_TO_SETUP" + SYSTEM_TO_SETUP=intel + printf 'SYSTEM=%s\n' "$SYSTEM_TO_SETUP" - case $SYSTEM_TO_SETUP in + case "$SYSTEM_TO_SETUP" in intel) install_pkgs "$INTEL_PACKAGES_TO_INSTALL" ;; *) - echo "Ahh! Taking a note..." + printf 'Ahh! Taking a note...\n' ;; - esac + esac fi install_pkgs "$SYSTEM_PACKAGES_TO_INSTALL" - echo -e "Tweaking some system stuffs..." + printf 'Tweaking some system stuffs...\n' sudo mkdir -p /etc/sysctl.d /etc/systemd/{journald.conf.d,coredump.conf.d} - copy_content "${BASE_REPO_LOCATION}"system/etc/sysctl.d/999-sysctl.conf | sudo tee /etc/sysctl.d/999-sysctl.conf - copy_content "${BASE_REPO_LOCATION}"system/etc/systemd/journald.conf.d/00-journal-size.conf | sudo tee /etc/systemd/journald.conf.d/00-journal-size.conf - sudo journalctl --rotate --vacuum-size=10M - copy_content "${BASE_REPO_LOCATION}"system/etc/systemd/coredump.conf.d/custom.conf | sudo tee /etc/systemd/coredump.conf.d/custom.conf + copy_content "${BASE_REPO_LOCATION}system/etc/sysctl.d/999-sysctl.conf" | sudo tee /etc/sysctl.d/999-sysctl.conf >/dev/null + copy_content "${BASE_REPO_LOCATION}system/etc/systemd/journald.conf.d/00-journal-size.conf" | sudo tee /etc/systemd/journald.conf.d/00-journal-size.conf >/dev/null + sudo journalctl --rotate --vacuum-size=10M 2>/dev/null || true + copy_content "${BASE_REPO_LOCATION}system/etc/systemd/coredump.conf.d/custom.conf" | sudo tee /etc/systemd/coredump.conf.d/custom.conf >/dev/null # env var mkdir -p ~/.config/environment.d - copy_file ~/.config/environment.d/10-defaults.conf "${BASE_REPO_LOCATION}"home/.config/environment.d/10-defaults.conf - - #mkdir -p ~/.config/systemd/user/service.d - #copy_file ~/.config/systemd/user/service.d/env.conf ${BASE_REPO_LOCATION}home/.config/systemd/user/service.d/env.conf - - profileAppend="$( - grep "~custom-setup~" ~/.profile >/dev/null 2>&1 - echo $? - )" - if [[ "${profileAppend}" -ne 0 ]]; then - copy_content "${BASE_REPO_LOCATION}"home/.profile >>~/.profile - fi + copy_file ~/.config/environment.d/10-defaults.conf "${BASE_REPO_LOCATION}home/.config/environment.d/10-defaults.conf" || true - xprofileAppend="$( - grep "~custom-setup~" ~/.xprofile >/dev/null 2>&1 - echo $? - )" - if [[ "${xprofileAppend}" -ne 0 ]]; then - copy_content "${BASE_REPO_LOCATION}"home/.xprofile >>~/.xprofile - fi - - xsessionrcAppend="$( - grep "~custom-setup~" ~/.xsessionrc >/dev/null 2>&1 - echo $? - )" - if [[ "${xsessionrcAppend}" -ne 0 ]]; then - copy_content "${BASE_REPO_LOCATION}"home/.xsessionrc >>~/.xsessionrc - fi + # Helper function for appending to config files + append_if_missing() { + local file="$1" marker="$2" content_source="$3" + if ! grep -q "$marker" "$file" 2>/dev/null; then + copy_content "$content_source" >> "$file" || printf 'Warning: Failed to append to %s\n' "$file" >&2 + fi + } - # DO NOT have .xinitrc for now due to some problems - #xinitrcAppend="$( - # grep "~custom-setup~" ~/.xinitrc >/dev/null 2>&1 - # echo $? - #)" - #if [[ "${xinitrcAppend}" -ne 0 ]]; then - # copy_content ${BASE_REPO_LOCATION}home/.xinitrc >>~/.xinitrc - #fi + append_if_missing ~/.profile "~custom-setup~" "${BASE_REPO_LOCATION}home/.profile" + append_if_missing ~/.xprofile "~custom-setup~" "${BASE_REPO_LOCATION}home/.xprofile" + append_if_missing ~/.xsessionrc "~custom-setup~" "${BASE_REPO_LOCATION}home/.xsessionrc" - echo -e "Setting up keyring..." + printf 'Setting up keyring...\n' mkdir -p ~/.local/share/keyrings/ - copy_file ~/.local/share/keyrings/Default_keyring.keyring "${BASE_REPO_LOCATION}"home/.local/share/keyrings/Default_keyring.keyring - copy_file ~/.local/share/keyrings/default "${BASE_REPO_LOCATION}"home/.local/share/keyrings/default - chmod og= ~/.local/share/keyrings/ - chmod og= ~/.local/share/keyrings/Default_keyring.keyring + copy_file ~/.local/share/keyrings/Default_keyring.keyring "${BASE_REPO_LOCATION}home/.local/share/keyrings/Default_keyring.keyring" || true + copy_file ~/.local/share/keyrings/default "${BASE_REPO_LOCATION}home/.local/share/keyrings/default" || true + chmod og= ~/.local/share/keyrings/ 2>/dev/null || true + chmod og= ~/.local/share/keyrings/Default_keyring.keyring 2>/dev/null || true - echo -e "Updating some sudo stuffs..." + printf 'Updating some sudo stuff...\n' sudo mkdir -p /etc/sudoers.d - echo -e Defaults:"$(whoami)" \!authenticate | sudo tee /etc/sudoers.d/99-custom + printf 'Defaults:%s !authenticate\n' "$(whoami)" | sudo tee /etc/sudoers.d/99-custom >/dev/null # autologin capability - sudo groupadd -r autologin - sudo gpasswd -a "$(whoami)" autologin + sudo groupadd -r autologin 2>/dev/null || true + sudo gpasswd -a "$(whoami)" autologin 2>/dev/null || true - systemctl is-enabled casper-md5check.service && sudo systemctl disable casper-md5check.service + systemctl is-enabled casper-md5check.service 2>/dev/null && sudo systemctl disable casper-md5check.service sudo systemctl daemon-reload } setup_font() { - echo -e "Installing fonts..." + printf 'Installing fonts...\n' install_pkgs "$FONTS_TO_INSTALL" - echo -e "Making font look better..." + printf 'Making font look better...\n' mkdir -p ~/.config/fontconfig/conf.d - copy_file ~/.config/fontconfig/fonts.conf "${BASE_REPO_LOCATION}"home/.config/fontconfig/fonts.conf - copy_file ~/.config/fontconfig/conf.d/20-no-embedded.conf "${BASE_REPO_LOCATION}"home/.config/fontconfig/conf.d/20-no-embedded.conf - copy_file ~/.Xresources "${BASE_REPO_LOCATION}"home/.Xresources - xrdb -merge ~/.Xresources + copy_file ~/.config/fontconfig/fonts.conf "${BASE_REPO_LOCATION}home/.config/fontconfig/fonts.conf" || true + copy_file ~/.config/fontconfig/conf.d/20-no-embedded.conf "${BASE_REPO_LOCATION}home/.config/fontconfig/conf.d/20-no-embedded.conf" || true + copy_file ~/.Xresources "${BASE_REPO_LOCATION}home/.Xresources" || true + xrdb -merge ~/.Xresources 2>/dev/null || true [[ -f /etc/profile.d/freetype2.sh ]] && sudo sed -i '/export FREETYPE_PROPERTIES=/s/^#//g' /etc/profile.d/freetype2.sh - sudo ln -s /usr/share/fontconfig/conf.avail/10-sub-pixel-rgb.conf /etc/fonts/conf.d/ - sudo ln -s /usr/share/fontconfig/conf.avail/10-hinting-slight.conf /etc/fonts/conf.d/ - sudo ln -s /usr/share/fontconfig/conf.avail/11-lcdfilter-default.conf /etc/fonts/conf.d/ - [[ -f /usr/share/fontconfig/conf.avail/10-nerd-font-symbols.conf ]] && sudo ln -s /usr/share/fontconfig/conf.avail/10-nerd-font-symbols.conf /etc/fonts/conf.d/ - if [[ $(fc-list | grep -i "JetBrainsMono Nerd") == "" ]]; then - echo -e "Installing Nerd Font manually as not found..." + sudo ln -sf /usr/share/fontconfig/conf.avail/10-sub-pixel-rgb.conf /etc/fonts/conf.d/ 2>/dev/null + sudo ln -sf /usr/share/fontconfig/conf.avail/10-hinting-slight.conf /etc/fonts/conf.d/ 2>/dev/null + sudo ln -sf /usr/share/fontconfig/conf.avail/11-lcdfilter-default.conf /etc/fonts/conf.d/ 2>/dev/null + [[ -f /usr/share/fontconfig/conf.avail/10-nerd-font-symbols.conf ]] && sudo ln -sf /usr/share/fontconfig/conf.avail/10-nerd-font-symbols.conf /etc/fonts/conf.d/ 2>/dev/null + if ! fc-list | grep -qi "JetBrainsMono Nerd"; then + printf 'Installing Nerd Font manually as not found...\n' mkdir -p ~/.local/bin - curl -fs https://ohmyposh.dev/install.sh | bash -s -- -d ~/.local/bin - ~/.local/bin/oh-my-posh font install JetBrainsMono + curl -fsS https://ohmyposh.dev/install.sh | bash -s -- -d ~/.local/bin || printf 'Warning: Failed to install oh-my-posh\n' >&2 + ~/.local/bin/oh-my-posh font install JetBrainsMono 2>/dev/null || printf 'Warning: Failed to install JetBrainsMono font\n' >&2 fi - sudo fc-cache -fv - fc-cache -fv + sudo fc-cache -fv >/dev/null || printf 'Warning: fc-cache failed\n' >&2 + fc-cache -fv >/dev/null || printf 'Warning: fc-cache failed\n' >&2 } setup_terminal() { - echo -e "Configuring shell stuffs..." + printf 'Configuring shell stuff...\n' install_pkgs "$TERM_PACKAGES_TO_INSTALL" if ! command_exists starship; then mkdir -p ~/.local/bin - curl -fsS https://starship.rs/install.sh | sh -s -- -y --bin-dir ~/.local/bin - fi - #starship preset no-nerd-font -o ~/.config/starship.toml - copy_file ~/.aliases "${BASE_REPO_LOCATION}"distros/$DISTRO_TYPE.aliases - bashrcAppend="$( - grep "~custom-setup~" ~/.bashrc >/dev/null 2>&1 - echo $? - )" - if [[ "${bashrcAppend}" -ne 0 ]]; then - copy_content "${BASE_REPO_LOCATION}"home/.bashrc >>~/.bashrc + curl -fsS https://starship.rs/install.sh | sh -s -- -y --bin-dir ~/.local/bin || printf 'Warning: starship installation failed\n' >&2 fi + copy_file ~/.aliases "${BASE_REPO_LOCATION}distros/$DISTRO_TYPE.aliases" || true + append_if_missing ~/.bashrc "~custom-setup~" "${BASE_REPO_LOCATION}home/.bashrc" # nano mkdir -p ~/.config/nano - copy_file ~/.config/nano/nanorc "${BASE_REPO_LOCATION}"home/.config/nano/nanorc + copy_file ~/.config/nano/nanorc "${BASE_REPO_LOCATION}home/.config/nano/nanorc" || true if [[ -d /usr/share/nano-syntax-highlighting/ ]]; then - nanorcAppend="$( - grep "nano-syntax-highlighting" ~/.config/nano/nanorc >/dev/null 2>&1 - echo $? - )" - if [[ "${nanorcAppend}" -ne 0 ]]; then - echo -e 'include "/usr/share/nano-syntax-highlighting/*.nanorc"' >>~/.config/nano/nanorc - fi + append_if_missing ~/.config/nano/nanorc "nano-syntax-highlighting" "include \"/usr/share/nano-syntax-highlighting/*.nanorc\"" fi # if fastfetch not found at this point fallback to neofetch, otherwise remove neofetch - if ! which fastfetch; then + if ! command_exists fastfetch; then install_pkgs neofetch else uninstall_pkgs neofetch fi - # fastfetch - #mkdir p ~/.config/fastfetch - #copy_file ~/.config/fastfetch/config.jsonc ${BASE_REPO_LOCATION}home/.config/fastfetch/config.jsonc - - echo -e "Installing terminal $TERMINAL_TO_INSTALL..." - case $TERMINAL_TO_INSTALL in + printf 'Installing terminal %s...\n' "$TERMINAL_TO_INSTALL" + case "$TERMINAL_TO_INSTALL" in alacritty) - install_pkgs $TERMINAL_TO_INSTALL + install_pkgs "$TERMINAL_TO_INSTALL" mkdir -p ~/.config/alacritty - copy_file ~/.config/alacritty/catppuccin-mocha.toml https://raw.githubusercontent.com/catppuccin/alacritty/main/catppuccin-mocha.toml - copy_file ~/.config/alacritty/alacritty.toml "${BASE_REPO_LOCATION}"home/.config/alacritty/alacritty.toml + copy_file ~/.config/alacritty/catppuccin-mocha.toml https://raw.githubusercontent.com/catppuccin/alacritty/main/catppuccin-mocha.toml || true + copy_file ~/.config/alacritty/alacritty.toml "${BASE_REPO_LOCATION}home/.config/alacritty/alacritty.toml" || true ;; kitty) - install_pkgs $TERMINAL_TO_INSTALL + install_pkgs "$TERMINAL_TO_INSTALL" mkdir -p ~/.config/kitty - copy_file ~/.config/kitty/mocha.conf https://raw.githubusercontent.com/catppuccin/kitty/main/themes/mocha.conf - copy_file ~/.config/kitty/kitty.conf "${BASE_REPO_LOCATION}"home/.config/kitty/kitty.conf + copy_file ~/.config/kitty/mocha.conf https://raw.githubusercontent.com/catppuccin/kitty/main/themes/mocha.conf || true + copy_file ~/.config/kitty/kitty.conf "${BASE_REPO_LOCATION}home/.config/kitty/kitty.conf" || true ;; wezterm) - install_pkgs $TERMINAL_TO_INSTALL + install_pkgs "$TERMINAL_TO_INSTALL" mkdir -p ~/.config/wezterm - copy_file ~/.config/wezterm/wezterm.lua "${BASE_REPO_LOCATION}"home/.config/wezterm/wezterm.lua + copy_file ~/.config/wezterm/wezterm.lua "${BASE_REPO_LOCATION}home/.config/wezterm/wezterm.lua" || true ;; *) - echo -e "No additional terminal installed..." + printf 'No additional terminal installed...\n' ;; esac # gnome terminal if command_exists gnome-terminal; then - tprofileid=$(gsettings get org.gnome.Terminal.ProfilesList default | tr -d "'") - copy_file $TEMP_DIR/gterm.dconf "${BASE_REPO_LOCATION}"desktop/gterm.dconf - sed -i "s/DEFAULT_PROFILE/$tprofileid/g" $TEMP_DIR/gterm.dconf - dconf load /org/gnome/terminal/ <$TEMP_DIR/gterm.dconf - rm -f $TEMP_DIR/gterm.dconf + tprofileid=$(gsettings get org.gnome.Terminal.ProfilesList default 2>/dev/null | tr -d "'" || echo "default") + copy_file "$TEMP_DIR/gterm.dconf" "${BASE_REPO_LOCATION}desktop/gterm.dconf" && { + sed -i "s/DEFAULT_PROFILE/$tprofileid/g" "$TEMP_DIR/gterm.dconf" + dconf load /org/gnome/terminal/ < "$TEMP_DIR/gterm.dconf" 2>/dev/null || printf 'Warning: Failed to load dconf settings\n' >&2 + rm -f "$TEMP_DIR/gterm.dconf" + } fi - - #source ~/.bashrc } setup_common_ui() { install_pkgs "$GTK_PACKAGES_TO_INSTALL" install_pkgs "$QT_PACKAGES_TO_INSTALL" - gtktheme=$(gsettings get org.gnome.desktop.interface gtk-theme | tr -d \'\") - echo -e "CURRENT_GTK_THEME=$gtktheme" - # shellcheck disable=SC2086 - # shellcheck disable=SC2143 + gtktheme=$(gsettings get org.gnome.desktop.interface gtk-theme 2>/dev/null | tr -d "'" || echo "") + printf 'CURRENT_GTK_THEME=%s\n' "$gtktheme" # make it dark - if [[ $gtktheme != '' && ! $(echo $gtktheme | grep -i dark) ]]; then - gsettings set org.gnome.desktop.interface gtk-theme "$gtktheme"-dark + if [[ -n "$gtktheme" && ! "$gtktheme" =~ -dark$ ]]; then + gsettings set org.gnome.desktop.interface gtk-theme "$gtktheme-dark" 2>/dev/null || true fi - copy_file $TEMP_DIR/common.dconf "${BASE_REPO_LOCATION}"desktop/common.dconf - dconf load / <$TEMP_DIR/common.dconf - rm -f $TEMP_DIR/common.dconf + copy_file "$TEMP_DIR/common.dconf" "${BASE_REPO_LOCATION}desktop/common.dconf" && { + dconf load / < "$TEMP_DIR/common.dconf" 2>/dev/null || printf 'Warning: Failed to load dconf settings\n' >&2 + rm -f "$TEMP_DIR/common.dconf" + } - mkdir -p ~/.config/gtk-{3,4}.0 + mkdir -p ~/.config/{gtk-3.0,gtk-4.0} if [[ ! -f ~/.config/gtk-3.0/settings.ini ]]; then - echo -e "[Settings]" >~/.config/gtk-3.0/settings.ini && echo -e "#gtk-application-prefer-dark-theme=true" >>~/.config/gtk-3.0/settings.ini + printf '[Settings]\n' > ~/.config/gtk-3.0/settings.ini + printf '#gtk-application-prefer-dark-theme=true\n' >> ~/.config/gtk-3.0/settings.ini fi if [[ ! -f ~/.config/gtk-4.0/settings.ini ]]; then - cp ~/.config/gtk-3.0/settings.ini ~/.config/gtk-4.0/ - echo -e "gtk-hint-font-metrics=1" >>~/.config/gtk-4.0/settings.ini + cp ~/.config/gtk-3.0/settings.ini ~/.config/gtk-4.0/ || true + printf 'gtk-hint-font-metrics=1\n' >> ~/.config/gtk-4.0/settings.ini fi mkdir -p ~/.local/share/gtksourceview-{3.0,4,5}/styles - copy_file ~/.local/share/gtksourceview-3.0/styles/mocha.xml https://raw.githubusercontent.com/catppuccin/xed/main/src/mocha.xml + copy_file ~/.local/share/gtksourceview-3.0/styles/mocha.xml https://raw.githubusercontent.com/catppuccin/xed/main/src/mocha.xml || true for i in ~/.local/share/gtksourceview-{4,5}/styles; do - cp -s -f ~/.local/share/gtksourceview-3.0/styles/mocha.xml "$i" + cp -sf ~/.local/share/gtksourceview-3.0/styles/mocha.xml "$i" 2>/dev/null || true done - echo -e "Setting up QT apps to look like GTK.." + printf 'Setting up QT apps to look like GTK...\n' mkdir -p ~/.config/Kvantum ~/.config/qt{5,6}ct - copy_file ~/.config/Kvantum/kvantum.kvconfig "${BASE_REPO_LOCATION}"home/.config/Kvantum/kvantum.kvconfig + copy_file ~/.config/Kvantum/kvantum.kvconfig "${BASE_REPO_LOCATION}home/.config/Kvantum/kvantum.kvconfig" || true for i in 5 6; do - copy_file ~/.config/qt${i}ct/qt${i}ct.conf "${BASE_REPO_LOCATION}"home/.config/qt${i}ct/qt${i}ct.conf + copy_file ~/.config/qt"${i}"ct/qt"${i}"ct.conf "${BASE_REPO_LOCATION}home/.config/qt${i}ct/qt${i}ct.conf" || true done - # wallpaper - #mkdir -p ~/.local/share/backgrounds - #copy_file ~/.local/share/backgrounds/wallpaper ${BASE_REPO_LOCATION}home/.local/share/backgrounds/wallpaper - if [[ -d /etc/lightdm ]]; then - echo -e "Configuring lightdm stuffs..." - grep -rl greeter-hide-users /etc/lightdm /usr/share/lightdm \ - | xargs sudo sed -i "/greeter-hide-users=true/c\greeter-hide-users=false - /greeter-hide-users = true/c\greeter-hide-users = false" + printf 'Configuring lightdm stuff...\n' + grep -rl greeter-hide-users /etc/lightdm /usr/share/lightdm 2>/dev/null | \ + xargs -r sudo sed -i "/greeter-hide-users=true/c\\greeter-hide-users=false" 2>/dev/null || true fi } setup_apps() { - echo -e "Installing some apps..." + printf 'Installing some apps...\n' install_pkgs "$APP_PACKAGES_TO_INSTALL" - echo -e "Installing some dev stuffs..." + printf 'Installing some dev stuff...\n' install_pkgs "$DEV_PACKAGES_TO_INSTALL" - #python -m pip install --user --upgrade pip # vlc mkdir -p ~/.config/vlc - copy_file ~/.config/vlc/vlcrc "${BASE_REPO_LOCATION}"home/.config/vlc/vlcrc + copy_file ~/.config/vlc/vlcrc "${BASE_REPO_LOCATION}home/.config/vlc/vlcrc" || true if command_exists yad; then - gsettings set yad.settings terminal "$CURRENT_TERMINAL"' -e "%s"' + gsettings set yad.settings terminal "$CURRENT_TERMINAL"' -e "%s"' 2>/dev/null || true fi - echo -e "Setting up file associations..." - copy_file ~/.config/mimeapps.list "${BASE_REPO_LOCATION}"home/.config/mimeapps.list - sed -i "s/DEFAULT_TEXT_EDITOR/$GUI_TEXT_EDITOR/g" ~/.config/mimeapps.list + printf 'Setting up file associations...\n' + copy_file ~/.config/mimeapps.list "${BASE_REPO_LOCATION}home/.config/mimeapps.list" || true + [[ -f ~/.config/mimeapps.list ]] && sed -i "s/DEFAULT_TEXT_EDITOR/$GUI_TEXT_EDITOR/g" ~/.config/mimeapps.list mkdir -p ~/.local/share/applications - ln -sf ~/.config/mimeapps.list ~/.local/share/applications/mimeapps.list + ln -sf ~/.config/mimeapps.list ~/.local/share/applications/mimeapps.list 2>/dev/null || true } debloat_pkgs refresh_package_sources -echo -e "Installing some needed stuffs..." +printf 'Installing required packages...\n' install_pkgs "$REQUIREMENTS" -[[ $(type -t setup_"$DISTRO_TYPE") == function ]] && setup_"$DISTRO_TYPE" +if [[ "$(type -t setup_"$DISTRO_TYPE")" == "function" ]]; then + setup_"$DISTRO_TYPE" +fi install_pkgs crudini -if [[ $(type -t setup_specific_"$DIST_ID") == function ]]; then - echo -e "Executing additional $DIST_ID specific script..." +if [[ "$(type -t setup_specific_"$DIST_ID")" == "function" ]]; then + printf 'Executing additional %s specific script...\n' "$DIST_ID" setup_specific_"$DIST_ID" fi update_packages setup_system setup_font setup_apps -[[ $(type -t setup_"$DESKTOP") == function ]] && setup_"$DESKTOP" +if [[ "$(type -t setup_"$DESKTOP")" == "function" ]]; then + setup_"$DESKTOP" +fi setup_common_ui -if [[ $(type -t setup_"$DISTRO_TYPE"_"$DESKTOP") == function ]]; then - echo -e "Executing additional $DISTRO_TYPE $DESKTOP specific script..." +if [[ "$(type -t setup_"$DISTRO_TYPE"_"$DESKTOP")" == "function" ]]; then + printf 'Executing additional %s %s specific script...\n' "$DISTRO_TYPE" "$DESKTOP" setup_"$DISTRO_TYPE"_"$DESKTOP" fi -if [[ $(type -t setup_specific_"$DIST_ID"_"$DESKTOP") == function ]]; then - echo -e "Executing additional $DIST_ID $DESKTOP specific script..." +if [[ "$(type -t setup_specific_"$DIST_ID"_"$DESKTOP")" == "function" ]]; then + printf 'Executing additional %s %s specific script...\n' "$DIST_ID" "$DESKTOP" setup_specific_"$DIST_ID"_"$DESKTOP" fi setup_terminal update_packages -alias reboot='sudo reboot' -echo -e "" -echo -e "Done...Reboot..." -#disown -ar +printf '\n%s\n' "Setup complete! Please reboot your system." + diff --git a/setup.sh b/setup.sh index f96e4e3..6f1223a 100644 --- a/setup.sh +++ b/setup.sh @@ -1,13 +1,20 @@ #!/bin/bash -# shellcheck disable=SC1091 -# shellcheck disable=SC2128 +# shellcheck disable=SC1091,SC2128 +set -o pipefail timestamp=$(date '+%Y-%m-%d-%H:%M:%S') -scriptDir=$(dirname -- "$(readlink -f -- "$BASH_SOURCE")") -if [[ -d "$scriptDir"/.git && -f "$scriptDir"/scripts/setup-main.sh ]]; then - echo -e "Running from local clone..." - . "$scriptDir"/scripts/setup-main.sh 2>&1 | tee ~/setup-"$timestamp".log +scriptDir=$(dirname -- "$(readlink -f -- "${BASH_SOURCE[0]}")") || { printf 'Error: Failed to determine script directory\n' >&2; exit 1; } + +if [[ -d "$scriptDir/.git" && -f "$scriptDir/scripts/setup-main.sh" ]]; then + printf 'Running from local clone...\n' + # shellcheck disable=SC1090 + source "$scriptDir/scripts/setup-main.sh" 2>&1 | tee ~/setup-"$timestamp".log else - echo -e "Running from remote on the fly..." - eval "$(curl -fsSL https://raw.githubusercontent.com/krish-gh/linux-setup/main/scripts/setup-main.sh?"$timestamp")" 2>&1 | tee ~/setup-"$timestamp".log + printf 'Running from remote sources...\n' + # Download and execute the main setup script + if ! curl -fsSL "https://raw.githubusercontent.com/krish-gh/linux-setup/main/scripts/setup-main.sh?$timestamp" | bash 2>&1 | tee ~/setup-"$timestamp".log; then + printf 'Error: Failed to download or execute setup script\n' >&2 + exit 1 + fi fi + From c3049ecf25ce2239e60f0b7f6bde8820dc250713 Mon Sep 17 00:00:00 2001 From: Krish G <2088089+krish-gh@users.noreply.github.com> Date: Sat, 21 Feb 2026 22:42:27 +0530 Subject: [PATCH 02/18] updated --- README.md | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 4f31eaf..5dd2569 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,18 @@ Automated post-installation setup script for Linux desktop environments. This pr - **Hardware Support**: Installs drivers for Intel, VMware, VirtualBox, Hyper-V, and QEMU - **System Customization**: Applies kernel parameters, journald, and core dump configurations +## Code Quality & Best Practices + +This project emphasizes reliability and security: + +- **Error Handling**: Comprehensive error checking on all critical operations with clear diagnostics +- **Secure Temp Files**: Uses `mktemp` for secure temporary directories with automatic cleanup via trap handlers +- **Safe Quoting**: Proper variable quoting throughout to prevent word splitting and glob expansion +- **Portable**: Uses `printf` instead of `echo -e` for better portability across shell implementations +- **Fail-Safe**: Non-critical failures don't halt the entire setup—the script continues gracefully +- **No eval**: Avoids dangerous `eval` for remote script execution; uses safe alternatives instead +- **Validation**: All shell scripts pass strict syntax validation with `bash -n` + ## Prerequisites - A supported Linux distribution (see [Supported Scenarios](#supported-scenario)) @@ -181,12 +193,15 @@ cat ~/setup-*.log tail -f ~/setup-*.log # Follow in real-time ``` +**Error Handling**: The script logs warnings for non-critical failures and continues execution. Check the log file to see if any operations failed. The setup log is timestamped so you can keep history of multiple runs. + ## Notes and Limitations -- **KDE Plasmi**: KDE's configuration system is complex and mostly UI-driven. The automation covers basic packages and themes only. Manual configuration of many settings is still required. +- **KDE Plasma**: KDE's configuration system is complex and mostly UI-driven. The automation covers basic packages and themes only. Manual configuration of many settings is still required. - **GDM Configuration**: Commented out in the main setup—uncomment `/desktop/gnome.sh` if you need to customize the login screen. -- **Waylan d/Xorg**: The script detects your current session; some settings may not apply if switching between Wayland and Xorg. -- **Interactive Setup**: The script includes interactive checks and may pause for confirmation on some steps. +- **Wayland/Xorg**: The script detects your current session; some settings may not apply if switching between Wayland and Xorg. +- **Error Recovery**: Some operations may fail gracefully (logged as warnings) and continue; check the setup log for details. +- **Package Availability**: Not all packages may be available in every distribution version; installation failures are logged but don't halt the setup. ## Requirements From 74ab7ac177a732dd9e5523b03105ab39634304fb Mon Sep 17 00:00:00 2001 From: Krish G <2088089+krish-gh@users.noreply.github.com> Date: Sat, 21 Feb 2026 22:47:58 +0530 Subject: [PATCH 03/18] updated --- desktop/cinnamon.sh | 48 ++++++++++++----------- desktop/kde.sh | 91 ++++++++++++++++++++----------------------- desktop/xfce.sh | 34 ++++++++-------- distros/debian.sh | 20 +++++----- distros/fedora.sh | 18 ++++----- distros/opensuse.sh | 12 +++--- specific/arch.sh | 2 +- specific/debian.sh | 2 +- specific/linuxmint.sh | 8 ++-- specific/neon.sh | 2 +- specific/ubuntu.sh | 2 +- 11 files changed, 116 insertions(+), 123 deletions(-) diff --git a/desktop/cinnamon.sh b/desktop/cinnamon.sh index 45c24a5..befe9d9 100644 --- a/desktop/cinnamon.sh +++ b/desktop/cinnamon.sh @@ -4,40 +4,42 @@ GUI_TEXT_EDITOR=xed.desktop setup_cinnamon() { - echo -e "Configuring cinnamon stuffs..." + printf 'Configuring Cinnamon stuff...\n' install_pkgs "$CINNAMON_PACKAGES_TO_INSTALL" - #mkdir -p ~/.local/share/xed/styles - #copy_file ~/.local/share/xed/styles/mocha.xml https://raw.githubusercontent.com/catppuccin/xed/main/src/mocha.xml - - copy_file "$TEMP_DIR"/cinnamon.dconf "${BASE_REPO_LOCATION}"desktop/cinnamon.dconf - dconf load / <"$TEMP_DIR"/cinnamon.dconf - rm -f "$TEMP_DIR"/cinnamon.dconf + copy_file "$TEMP_DIR/cinnamon.dconf" "${BASE_REPO_LOCATION}desktop/cinnamon.dconf" && { + dconf load / < "$TEMP_DIR/cinnamon.dconf" 2>/dev/null || printf 'Warning: Failed to load dconf settings\n' >&2 + rm -f "$TEMP_DIR/cinnamon.dconf" + } # pinned apps - gwlconfigfile=$(ls ~/.config/cinnamon/spices/grouped-window-list@cinnamon.org/*.json) - gwlconfig="$(jq '(."pinned-apps".value) |= [ "nemo.desktop", "xed.desktop", "org.gnome.Terminal.desktop", "firefox.desktop" ]' "$gwlconfigfile")" && - echo -E "${gwlconfig}" >"$gwlconfigfile" + gwlconfigfile=$(ls ~/.config/cinnamon/spices/grouped-window-list@cinnamon.org/*.json 2>/dev/null) + if [[ -n "$gwlconfigfile" ]]; then + gwlconfig="$(jq '(."pinned-apps".value) |= [ "nemo.desktop", "xed.desktop", "org.gnome.Terminal.desktop", "firefox.desktop" ]' "$gwlconfigfile")" && \ + printf '%s\n' "$gwlconfig" > "$gwlconfigfile" + fi # menu - mconfigfile=$(ls ~/.config/cinnamon/spices/menu@cinnamon.org/*.json) - mconfig="$(jq '(."popup-height".value) |= 600' "$mconfigfile")" && - echo -E "${mconfig}" >"$mconfigfile" + mconfigfile=$(ls ~/.config/cinnamon/spices/menu@cinnamon.org/*.json 2>/dev/null) + if [[ -n "$mconfigfile" ]]; then + mconfig="$(jq '(."popup-height".value) |= 600' "$mconfigfile")" && \ + printf '%s\n' "$mconfig" > "$mconfigfile" + fi } setup_cinnamon_theme() { - gsettings set org.gnome.desktop.interface gtk-theme Mint-Y-Dark - gsettings set org.gnome.desktop.interface icon-theme Mint-Y - gsettings set org.cinnamon.desktop.interface gtk-theme Mint-Y-Dark - gsettings set org.cinnamon.desktop.interface icon-theme Mint-Y - gsettings set org.cinnamon.theme name Mint-Y-Dark - sudo crudini --ini-options=nospace --set /etc/lightdm/slick-greeter.conf Greeter theme-name Mint-Y-Dark - sudo crudini --ini-options=nospace --set /etc/lightdm/slick-greeter.conf Greeter icon-theme-name Mint-Y + gsettings set org.gnome.desktop.interface gtk-theme Mint-Y-Dark 2>/dev/null || true + gsettings set org.gnome.desktop.interface icon-theme Mint-Y 2>/dev/null || true + gsettings set org.cinnamon.desktop.interface gtk-theme Mint-Y-Dark 2>/dev/null || true + gsettings set org.cinnamon.desktop.interface icon-theme Mint-Y 2>/dev/null || true + gsettings set org.cinnamon.theme name Mint-Y-Dark 2>/dev/null || true + sudo crudini --ini-options=nospace --set /etc/lightdm/slick-greeter.conf Greeter theme-name Mint-Y-Dark 2>/dev/null || true + sudo crudini --ini-options=nospace --set /etc/lightdm/slick-greeter.conf Greeter icon-theme-name Mint-Y 2>/dev/null || true } set_cinnamon_wallpaper() { - # shellcheck disable=SC2046 - gsettings set org.cinnamon.desktop.background picture-uri "file://$1" + # Set wallpaper for Cinnamon desktop + gsettings set org.cinnamon.desktop.background picture-uri "file://$1" 2>/dev/null || true } -echo -e "Done cinnamon.sh..." +printf 'Done cinnamon.sh...\n' diff --git a/desktop/kde.sh b/desktop/kde.sh index a370db1..61c579a 100644 --- a/desktop/kde.sh +++ b/desktop/kde.sh @@ -4,72 +4,65 @@ GUI_TEXT_EDITOR=org.kde.kwrite.desktop setup_kde() { - echo -e "Configuring kde stuffs..." + printf 'Configuring KDE Plasma stuff...\n' install_pkgs "$KDE_PACKAGES_TO_INSTALL" - # No need for qt theme in kde environment - #[[ -f ~/.config/environment.d/10-defaults.conf ]] && sed -i '/QT_QPA_PLATFORMTHEME/s/^/#/' ~/.config/environment.d/10-defaults.conf - #[[ -f ~/.profile ]] && sed -i '/QT_QPA_PLATFORMTHEME/s/^/#/' ~/.profile - #[[ -f ~/.xprofile ]] && sed -i '/QT_QPA_PLATFORMTHEME/s/^/#/' ~/.xprofile - #[[ -f ~/.config/systemd/user/service.d/env.conf ]] && sed -i '/QT_QPA_PLATFORMTHEME/s/^/#/' ~/.config/systemd/user/service.d/env.conf - KWRITECONFIG_CMD=kwriteconfig6 - ! command_exists kwriteconfig6 && KWRITECONFIG_CMD=kwriteconfig5 + if ! command_exists kwriteconfig6; then + KWRITECONFIG_CMD=kwriteconfig5 + fi # configs - lookandfeeltool -a org.kde.breezedark.desktop - kscreen-doctor output.1.scale.1.25 + lookandfeeltool -a org.kde.breezedark.desktop 2>/dev/null || printf 'Warning: Failed to set lookandfeel\n' >&2 + kscreen-doctor output.1.scale.1.25 2>/dev/null || true sudo mkdir -p /etc/sddm.conf.d - sudo $KWRITECONFIG_CMD --file /etc/sddm.conf.d/kde_settings.conf --group Theme --key Current breeze - sudo $KWRITECONFIG_CMD --file /etc/sddm.conf.d/kde_settings.conf --group Theme --key CursorTheme breeze_cursors + sudo "$KWRITECONFIG_CMD" --file /etc/sddm.conf.d/kde_settings.conf --group Theme --key Current breeze + sudo "$KWRITECONFIG_CMD" --file /etc/sddm.conf.d/kde_settings.conf --group Theme --key CursorTheme breeze_cursors sudo chmod -R +r /etc/sddm.conf.d/ - $KWRITECONFIG_CMD --file ~/.config/kdeglobals --group Sounds --key Enable false - $KWRITECONFIG_CMD --file ~/.config/kdeglobals --group KScreen --key ScaleFactor 1.25 - $KWRITECONFIG_CMD --file ~/.config/kwinrc --group Xwayland --key Scale 1.25 - #kwinoutputconfig="$(jq '(.[] | select(.name == "outputs") | .data | .[] | .scale) |= 1.25' ~/.config/kwinoutputconfig.json)" && \ - # echo -E "${kwinoutputconfig}" > ~/.config/kwinoutputconfig.json - $KWRITECONFIG_CMD --file ~/.config/plasmashellrc --group PlasmaViews --group "Panel 2" --group Defaults --key thickness 30 - $KWRITECONFIG_CMD --file ~/.config/plasma-org.kde.plasma.desktop-appletsrc --group Containments --group 2 --group Applets --group 5 --group Configuration --group General \ - --key launchers "preferred://filemanager,applications:org.kde.kwrite.desktop,applications:org.kde.konsole.desktop,preferred://browser" - $KWRITECONFIG_CMD --file ~/.config/kactivitymanagerd-pluginsrc --group Plugin-org.kde.ActivityManager.Resources.Scoring --key what-to-remember 2 - $KWRITECONFIG_CMD --file ~/.config/krunnerrc --group Plugins --key baloosearchEnabled false - $KWRITECONFIG_CMD --file ~/.config/baloofilerc --group "Basic Settings" --key Indexing-Enabled false + "$KWRITECONFIG_CMD" --file ~/.config/kdeglobals --group Sounds --key Enable false + "$KWRITECONFIG_CMD" --file ~/.config/kdeglobals --group KScreen --key ScaleFactor 1.25 + "$KWRITECONFIG_CMD" --file ~/.config/kwinrc --group Xwayland --key Scale 1.25 + "$KWRITECONFIG_CMD" --file ~/.config/plasmashellrc --group PlasmaViews --group "Panel 2" --group Defaults --key thickness 30 + "$KWRITECONFIG_CMD" --file ~/.config/plasma-org.kde.plasma.desktop-appletsrc --group Containments --group 2 --group Applets --group 5 --group Configuration --group General --key launchers "preferred://filemanager,applications:org.kde.kwrite.desktop,applications:org.kde.konsole.desktop,preferred://browser" + "$KWRITECONFIG_CMD" --file ~/.config/kactivitymanagerd-pluginsrc --group Plugin-org.kde.ActivityManager.Resources.Scoring --key what-to-remember 2 + "$KWRITECONFIG_CMD" --file ~/.config/krunnerrc --group Plugins --key baloosearchEnabled false + "$KWRITECONFIG_CMD" --file ~/.config/baloofilerc --group "Basic Settings" --key Indexing-Enabled false rm -f ~/.local/share/baloo/index - $KWRITECONFIG_CMD --file ~/.config/powerdevilrc --group AC --group Display --key TurnOffDisplayIdleTimeoutSec -1 - $KWRITECONFIG_CMD --file ~/.config/powerdevilrc --group AC --group Display --key TurnOffDisplayWhenIdle false + "$KWRITECONFIG_CMD" --file ~/.config/powerdevilrc --group AC --group Display --key TurnOffDisplayIdleTimeoutSec -1 + "$KWRITECONFIG_CMD" --file ~/.config/powerdevilrc --group AC --group Display --key TurnOffDisplayWhenIdle false # dolphin mkdir -p ~/.local/share/dolphin/view_properties/global - $KWRITECONFIG_CMD --file ~/.local/share/dolphin/view_properties/global/.directory --group Settings --key HiddenFilesShown true + "$KWRITECONFIG_CMD" --file ~/.local/share/dolphin/view_properties/global/.directory --group Settings --key HiddenFilesShown true # konsole - copy_file ~/.local/share/konsole/catppuccin-mocha.colorscheme https://raw.githubusercontent.com/catppuccin/konsole/main/themes/catppuccin-mocha.colorscheme - $KWRITECONFIG_CMD --file ~/.local/share/konsole/custom.profile --group Appearance --key ColorScheme catppuccin-mocha - $KWRITECONFIG_CMD --file ~/.local/share/konsole/custom.profile --group Appearance --key Font "JetBrainsMono Nerd Font,12" - $KWRITECONFIG_CMD --file ~/.local/share/konsole/custom.profile --group Appearance --key UseFontLineChararacters true - $KWRITECONFIG_CMD --file ~/.local/share/konsole/custom.profile --group General --key Name custom - $KWRITECONFIG_CMD --file ~/.local/share/konsole/custom.profile --group General --key TerminalColumns 120 - $KWRITECONFIG_CMD --file ~/.local/share/konsole/custom.profile --group General --key TerminalRows 36 - $KWRITECONFIG_CMD --file ~/.config/konsolerc --group "Desktop Entry" --key DefaultProfile custom.profile - $KWRITECONFIG_CMD --file ~/.config/konsolerc --group KonsoleWindow --key RememberWindowSize false - $KWRITECONFIG_CMD --file ~/.config/konsolerc --group KonsoleWindow --key UseSingleInstance true + copy_file ~/.local/share/konsole/catppuccin-mocha.colorscheme https://raw.githubusercontent.com/catppuccin/konsole/main/themes/catppuccin-mocha.colorscheme || true + "$KWRITECONFIG_CMD" --file ~/.local/share/konsole/custom.profile --group Appearance --key ColorScheme catppuccin-mocha + "$KWRITECONFIG_CMD" --file ~/.local/share/konsole/custom.profile --group Appearance --key Font "JetBrainsMono Nerd Font,12" + "$KWRITECONFIG_CMD" --file ~/.local/share/konsole/custom.profile --group Appearance --key UseFontLineChararacters true + "$KWRITECONFIG_CMD" --file ~/.local/share/konsole/custom.profile --group General --key Name custom + "$KWRITECONFIG_CMD" --file ~/.local/share/konsole/custom.profile --group General --key TerminalColumns 120 + "$KWRITECONFIG_CMD" --file ~/.local/share/konsole/custom.profile --group General --key TerminalRows 36 + "$KWRITECONFIG_CMD" --file ~/.config/konsolerc --group "Desktop Entry" --key DefaultProfile custom.profile + "$KWRITECONFIG_CMD" --file ~/.config/konsolerc --group KonsoleWindow --key RememberWindowSize false + "$KWRITECONFIG_CMD" --file ~/.config/konsolerc --group KonsoleWindow --key UseSingleInstance true # kate - $KWRITECONFIG_CMD --file ~/.config/katerc --group General --key "Close After Last" true - $KWRITECONFIG_CMD --file ~/.config/katerc --group General --key "Restore Window Configuration" false - $KWRITECONFIG_CMD --file ~/.config/katerc --group General --key "Save Meta Infos" false - $KWRITECONFIG_CMD --file ~/.config/katerc --group "KTextEditor Renderer" --key "Color Theme" "Catppuccin Mocha" - $KWRITECONFIG_CMD --file ~/.config/katerc --group "KTextEditor Renderer" --key "Auto Color Theme Selection" false - $KWRITECONFIG_CMD --file ~/.config/katerc --group "KTextEditor Renderer" --key "Text Font" "JetBrainsMono Nerd Font,12" + "$KWRITECONFIG_CMD" --file ~/.config/katerc --group General --key "Close After Last" true + "$KWRITECONFIG_CMD" --file ~/.config/katerc --group General --key "Restore Window Configuration" false + "$KWRITECONFIG_CMD" --file ~/.config/katerc --group General --key "Save Meta Infos" false + "$KWRITECONFIG_CMD" --file ~/.config/katerc --group "KTextEditor Renderer" --key "Color Theme" "Catppuccin Mocha" + "$KWRITECONFIG_CMD" --file ~/.config/katerc --group "KTextEditor Renderer" --key "Auto Color Theme Selection" false + "$KWRITECONFIG_CMD" --file ~/.config/katerc --group "KTextEditor Renderer" --key "Text Font" "JetBrainsMono Nerd Font,12" # kwrite - $KWRITECONFIG_CMD --file ~/.config/kwriterc --group General --key "Close After Last" true - $KWRITECONFIG_CMD --file ~/.config/kwriterc --group General --key "Restore Window Configuration" false - $KWRITECONFIG_CMD --file ~/.config/kwriterc --group General --key "Save Meta Infos" false - $KWRITECONFIG_CMD --file ~/.config/kwriterc --group "KTextEditor Renderer" --key "Color Theme" "Catppuccin Mocha" - $KWRITECONFIG_CMD --file ~/.config/kwriterc --group "KTextEditor Renderer" --key "Auto Color Theme Selection" false - $KWRITECONFIG_CMD --file ~/.config/kwriterc --group "KTextEditor Renderer" --key "Text Font" "JetBrainsMono Nerd Font,12" + "$KWRITECONFIG_CMD" --file ~/.config/kwriterc --group General --key "Close After Last" true + "$KWRITECONFIG_CMD" --file ~/.config/kwriterc --group General --key "Restore Window Configuration" false + "$KWRITECONFIG_CMD" --file ~/.config/kwriterc --group General --key "Save Meta Infos" false + "$KWRITECONFIG_CMD" --file ~/.config/kwriterc --group "KTextEditor Renderer" --key "Color Theme" "Catppuccin Mocha" + "$KWRITECONFIG_CMD" --file ~/.config/kwriterc --group "KTextEditor Renderer" --key "Auto Color Theme Selection" false + "$KWRITECONFIG_CMD" --file ~/.config/kwriterc --group "KTextEditor Renderer" --key "Text Font" "JetBrainsMono Nerd Font,12" } -echo -e "Done kde.sh..." +printf 'Done kde.sh...\n' diff --git a/desktop/xfce.sh b/desktop/xfce.sh index 8f550db..151bfba 100644 --- a/desktop/xfce.sh +++ b/desktop/xfce.sh @@ -4,7 +4,7 @@ GUI_TEXT_EDITOR=org.xfce.mousepad.desktop setup_xfce() { - echo -e "Configuring xfce stuffs..." + printf 'Configuring xfce stuffs...\n' install_pkgs "$XFCE_PACKAGES_TO_INSTALL" # config @@ -53,30 +53,31 @@ setup_xfce() { xfconf-query -c thunar-volman -v -n -p /automount-drives/enabled -t bool -s false xfconf-query -c thunar-volman -v -n -p /automount-media/enabled -t bool -s false - copy_file "$TEMP_DIR"/xfce.dconf "${BASE_REPO_LOCATION}"desktop/xfce.dconf - dconf load / <"$TEMP_DIR"/xfce.dconf - rm -f "$TEMP_DIR"/xfce.dconf + copy_file "$TEMP_DIR/xfce.dconf" "${BASE_REPO_LOCATION}desktop/xfce.dconf" && { + dconf load / < "$TEMP_DIR/xfce.dconf" 2>/dev/null || printf 'Warning: Failed to load dconf settings\n' >&2 + rm -f "$TEMP_DIR/xfce.dconf" + } } setup_xfce_panel() { - echo -e "Configuring xfce panel from scratch..." + printf 'Configuring xfce panel from scratch...\n' xfce4-panel --quit pkill xfconfd rm -rf ~/.config/xfce4/panel/launcher-* mkdir -p ~/.config/xfce4/panel/launcher-{2,3,4,5} - copy_file ~/.config/xfce4/panel/launcher-2/FileManager.desktop "${BASE_REPO_LOCATION}"home/.config/xfce4/panel/launcher-2/FileManager.desktop - copy_file ~/.config/xfce4/panel/launcher-3/TextEditor.desktop "${BASE_REPO_LOCATION}"home/.config/xfce4/panel/launcher-3/TextEditor.desktop - copy_file ~/.config/xfce4/panel/launcher-4/TerminalEmulator.desktop "${BASE_REPO_LOCATION}"home/.config/xfce4/panel/launcher-4/TerminalEmulator.desktop - copy_file ~/.config/xfce4/panel/launcher-5/WebBrowser.desktop "${BASE_REPO_LOCATION}"home/.config/xfce4/panel/launcher-5/WebBrowser.desktop - copy_file ~/.config/xfce4/panel/whiskermenu-1.rc "${BASE_REPO_LOCATION}"home/.config/xfce4/panel/whiskermenu-1.rc - copy_file ~/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-panel.xml "${BASE_REPO_LOCATION}"home/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-panel.xml - sed -i "s/DISTRO_LOGO/$XFCE_MENU_LOGO/g" ~/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-panel.xml - sed -i "s/DISTRO_LOGO/$XFCE_MENU_LOGO/g" ~/.config/xfce4/panel/whiskermenu-1.rc + copy_file ~/.config/xfce4/panel/launcher-2/FileManager.desktop "${BASE_REPO_LOCATION}home/.config/xfce4/panel/launcher-2/FileManager.desktop" + copy_file ~/.config/xfce4/panel/launcher-3/TextEditor.desktop "${BASE_REPO_LOCATION}home/.config/xfce4/panel/launcher-3/TextEditor.desktop" + copy_file ~/.config/xfce4/panel/launcher-4/TerminalEmulator.desktop "${BASE_REPO_LOCATION}home/.config/xfce4/panel/launcher-4/TerminalEmulator.desktop" + copy_file ~/.config/xfce4/panel/launcher-5/WebBrowser.desktop "${BASE_REPO_LOCATION}home/.config/xfce4/panel/launcher-5/WebBrowser.desktop" + copy_file ~/.config/xfce4/panel/whiskermenu-1.rc "${BASE_REPO_LOCATION}home/.config/xfce4/panel/whiskermenu-1.rc" + copy_file ~/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-panel.xml "${BASE_REPO_LOCATION}home/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-panel.xml" + sed -i "s/DISTRO_LOGO/${XFCE_MENU_LOGO}/g" ~/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-panel.xml + sed -i "s/DISTRO_LOGO/${XFCE_MENU_LOGO}/g" ~/.config/xfce4/panel/whiskermenu-1.rc xfce4-panel > /dev/null 2>&1 & disown } setup_xfce_theme() { - echo -e "Making xfce look better..." + printf 'Making xfce look better...\n' gsettings set org.gnome.desktop.interface gtk-theme Materia-dark gsettings set org.gnome.desktop.interface icon-theme Papirus-Dark xfconf-query -c xsettings -v -n -p /Net/ThemeName -t string -s Materia-dark @@ -87,8 +88,7 @@ setup_xfce_theme() { } set_xfce_wallpaper() { - # shellcheck disable=SC2046 - xfconf-query -c xfce4-desktop -p $(xfconf-query -c xfce4-desktop -l | grep "workspace0/last-image") -t string -s "$1" + xfconf-query -c xfce4-desktop -p "$(xfconf-query -c xfce4-desktop -l | grep 'workspace0/last-image')" -t string -s "$1" } -echo -e "Done xfce.sh..." +printf 'Done xfce.sh...\n' diff --git a/distros/debian.sh b/distros/debian.sh index 0c5ad76..6fa1c30 100644 --- a/distros/debian.sh +++ b/distros/debian.sh @@ -30,7 +30,7 @@ XFCE_MENU_LOGO="distributor-logo-debian" PACKAGES_TO_REMOVE="" setup_debian() { - echo -e "Setting up apt..." + printf 'Setting up apt...\n' install_pkgs "software-properties-common python3-launchpadlib nala gpg apt-transport-https" sudo apt-add-repository contrib -y @@ -41,20 +41,20 @@ setup_debian() { sudo mkdir -p -m 755 /etc/apt/keyrings # microsoft - wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor >packages.microsoft.gpg + wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg sudo install -D -o root -g root -m 644 packages.microsoft.gpg /etc/apt/keyrings/packages.microsoft.gpg - echo -e "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/packages.microsoft.gpg] https://packages.microsoft.com/repos/code stable main" | sudo tee /etc/apt/sources.list.d/vscode.list >/dev/null - echo -e "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/packages.microsoft.gpg] https://packages.microsoft.com/repos/edge stable main" | sudo tee /etc/apt/sources.list.d/microsoft-edge.list >/dev/null + printf "deb [arch=%s signed-by=/etc/apt/keyrings/packages.microsoft.gpg] https://packages.microsoft.com/repos/code stable main\n" "$(dpkg --print-architecture)" | sudo tee /etc/apt/sources.list.d/vscode.list >/dev/null + printf "deb [arch=%s signed-by=/etc/apt/keyrings/packages.microsoft.gpg] https://packages.microsoft.com/repos/edge stable main\n" "$(dpkg --print-architecture)" | sudo tee /etc/apt/sources.list.d/microsoft-edge.list >/dev/null rm -f packages.microsoft.gpg # google wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | gpg --dearmor | sudo tee /etc/apt/keyrings/google.gpg >/dev/null - echo -e "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/google.gpg] https://dl.google.com/linux/chrome/deb/ stable main" | sudo tee /etc/apt/sources.list.d/google-chrome.list >/dev/null + printf "deb [arch=%s signed-by=/etc/apt/keyrings/google.gpg] https://dl.google.com/linux/chrome/deb/ stable main\n" "$(dpkg --print-architecture)" | sudo tee /etc/apt/sources.list.d/google-chrome.list >/dev/null # github - wget -qO- https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo tee /etc/apt/keyrings/githubcli-archive-keyring.gpg >/dev/null && + wget -qO- https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo tee /etc/apt/keyrings/githubcli-archive-keyring.gpg >/dev/null && \ sudo chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg - echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list >/dev/null + printf "deb [arch=%s signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main\n" "$(dpkg --print-architecture)" | sudo tee /etc/apt/sources.list.d/github-cli.list >/dev/null rm -f .wget-hsts @@ -68,12 +68,12 @@ setup_debian() { # synaptic sudo mkdir -p /root/.synaptic/ - copy_file "$TEMP_DIR"/synaptic.conf "${BASE_REPO_LOCATION}"system/root/.synaptic/synaptic.conf - sudo mv -f "$TEMP_DIR"/synaptic.conf /root/.synaptic/ + copy_file "$TEMP_DIR/synaptic.conf" "${BASE_REPO_LOCATION}system/root/.synaptic/synaptic.conf" + sudo mv -f "$TEMP_DIR/synaptic.conf" /root/.synaptic/ } setup_debian_cinnamon() { setup_cinnamon_theme } -echo -e "Done debian.sh..." +printf 'Done debian.sh...\n' diff --git a/distros/fedora.sh b/distros/fedora.sh index 4f231ee..b6b1925 100644 --- a/distros/fedora.sh +++ b/distros/fedora.sh @@ -32,17 +32,15 @@ XFCE_MENU_LOGO="distributor-logo-fedora" PACKAGES_TO_REMOVE="" setup_fedora() { - echo -e "Updating dnf.conf..." + printf 'Updating dnf.conf...\n' sudo crudini --ini-options=nospace --set /etc/dnf/dnf.conf main max_parallel_downloads 10 sudo crudini --ini-options=nospace --set /etc/dnf/dnf.conf main fastestmirror True sudo crudini --ini-options=nospace --set /etc/dnf/dnf.conf main clean_requirements_on_remove True sudo crudini --ini-options=nospace --set /etc/dnf/dnf.conf main skip_if_unavailable True install_pkgs "fedora-workstation-repositories" - echo -e "Setting up RPM Fusion..." - # https://rpmfusion.org/Configuration - # shellcheck disable=SC2046 - sudo dnf install -y https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm + printf 'Setting up RPM Fusion...\n' + sudo dnf install -y "https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm" "https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm" sudo dnf config-manager --enable fedora-cisco-openh264 sudo dnf update -y @core sudo dnf update -y @multimedia --setopt="install_weak_deps=False" --exclude=PackageKit-gstreamer-plugin @@ -51,10 +49,10 @@ setup_fedora() { #sudo dnf swap mesa-va-drivers mesa-va-drivers-freeworld --allowerasing #sudo dnf swap mesa-vdpau-drivers mesa-vdpau-drivers-freeworld --allowerasing - echo -e "Disabling some not needed repos..." + printf 'Disabling some not needed repos...\n' sudo dnf config-manager --disable *PyCharm* *nvidia* *steam* - echo -e "Adding some needed repos..." + printf 'Adding some needed repos...\n' # google sudo dnf config-manager --enable google-chrome # microsoft @@ -64,8 +62,8 @@ setup_fedora() { sudo sed -i "/name=/c\name=microsoft-vscode" /etc/yum.repos.d/packages.microsoft.com_yumrepos_vscode.repo sudo sed -i "/name=/c\name=microsoft-edge" /etc/yum.repos.d/packages.microsoft.com_yumrepos_edge.repo - command_exists flatpak && flatpak remote-add --user --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo \ - && sudo flatpak remote-modify --disable fedora + command_exists flatpak && flatpak remote-add --user --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo && \ + sudo flatpak remote-modify --disable fedora #install_pkgs dnfdragora-gui @@ -87,4 +85,4 @@ setup_fedora_xfce() { setup_xfce_panel } -echo -e "Done fedora.sh..." +printf 'Done fedora.sh...\n' diff --git a/distros/opensuse.sh b/distros/opensuse.sh index b903496..883619e 100644 --- a/distros/opensuse.sh +++ b/distros/opensuse.sh @@ -34,28 +34,28 @@ PACKAGES_TO_REMOVE="icewm*" setup_opensuse() { #sudo zypper al totem - echo -e "Setting up repo and packman..." + printf 'Setting up repo and packman...\n' # https://en.opensuse.org/Additional_package_repositories # http://packman.links2linux.org/mirrors sudo zypper rr packman # shellcheck disable=SC2154 - if [[ $releasever == '' ]]; then + if [[ -z "$releasever" ]]; then install_pkgs openSUSE-repos-Tumbleweed sudo zypper ar -cfp 90 'http://mirror.karneval.cz/pub/linux/packman/suse/openSUSE_Tumbleweed/' packman else install_pkgs openSUSE-repos-Leap - sudo zypper ar -cfp 90 'http://mirror.karneval.cz/pub/linux/packman/suse/openSUSE_Leap_$releasever/' packman + sudo zypper ar -cfp 90 "http://mirror.karneval.cz/pub/linux/packman/suse/openSUSE_Leap_${releasever}/" packman fi refresh_package_sources sudo zypper dup --from packman --allow-vendor-change -y - echo -e "Installing some stuffs..." + printf 'Installing some stuffs...\n' install_pkgs "opi" opi codecs -n opi vscode -n refresh_package_sources - echo -e "Installing zypperoni for faster zypper download..." + printf 'Installing zypperoni for faster zypper download...\n' curl https://raw.githubusercontent.com/pavinjosdev/zypperoni/main/zypperoni | sudo tee /usr/bin/zypperoni >/dev/null sudo chmod 755 /usr/bin/zypperoni } @@ -71,4 +71,4 @@ setup_opensuse_xfce() { sudo crudini --ini-options=nospace --set /usr/share/lightdm/lightdm.conf.d/99-custom.conf SeatDefaults greeter-session slick-greeter } -echo -e "Done opensuse.sh..." +printf 'Done opensuse.sh...\n' diff --git a/specific/arch.sh b/specific/arch.sh index 0412efe..bbd5448 100644 --- a/specific/arch.sh +++ b/specific/arch.sh @@ -7,4 +7,4 @@ setup_specific_arch_xfce() { setup_xfce_panel } -echo -e "Done arch.sh..." +printf 'Done arch.sh...\n' diff --git a/specific/debian.sh b/specific/debian.sh index f934802..6d77665 100644 --- a/specific/debian.sh +++ b/specific/debian.sh @@ -10,4 +10,4 @@ setup_specific_debian_xfce() { setup_xfce_panel } -echo -e "Done debian.sh..." +printf 'Done debian.sh...\n' diff --git a/specific/linuxmint.sh b/specific/linuxmint.sh index 1788da8..62a74eb 100644 --- a/specific/linuxmint.sh +++ b/specific/linuxmint.sh @@ -9,9 +9,9 @@ setup_specific_linuxmint() { # just ensuring this meta package was not uninstalled, it will wait for confirmation if it was sudo apt-get install mint-meta-"$DESKTOP" install_pkgs "mint-meta-core mint-meta-codecs" - copy_file "$TEMP_DIR"/linuxmint.dconf "${BASE_REPO_LOCATION}"specific/linuxmint.dconf - dconf load / <"$TEMP_DIR"/linuxmint.dconf - rm -f "$TEMP_DIR"/linuxmint.dconf + copy_file "$TEMP_DIR/linuxmint.dconf" "${BASE_REPO_LOCATION}specific/linuxmint.dconf" + dconf load / < "$TEMP_DIR/linuxmint.dconf" 2>/dev/null || printf 'Warning: Failed to load dconf settings\n' >&2 + rm -f "$TEMP_DIR/linuxmint.dconf" } setup_specific_linuxmint_xfce() { @@ -22,4 +22,4 @@ setup_specific_linuxmint_xfce() { xfconf-query -c xfwm4 -v -n -p /general/theme -t string -s Mint-Y-Dark } -echo -e "Done linuxmint.sh..." +printf 'Done linuxmint.sh...\n' diff --git a/specific/neon.sh b/specific/neon.sh index 57ad458..fd2440b 100644 --- a/specific/neon.sh +++ b/specific/neon.sh @@ -5,4 +5,4 @@ setup_specific_neon() { sudo apt-get install neon-desktop neon-essentials-desktop ubuntu-minimal } -echo -e "Done neon.sh..." +printf 'Done neon.sh...\n' diff --git a/specific/ubuntu.sh b/specific/ubuntu.sh index 02751c2..dc1c513 100644 --- a/specific/ubuntu.sh +++ b/specific/ubuntu.sh @@ -12,4 +12,4 @@ setup_specific_ubuntu() { sudo apt-get install ubuntu-desktop-minimal } -echo -e "Done ubuntu.sh..." +printf 'Done ubuntu.sh...\n' From 79bdea54647574cadf7962f102251682ef4475df Mon Sep 17 00:00:00 2001 From: Krish G <2088089+krish-gh@users.noreply.github.com> Date: Sat, 21 Feb 2026 22:55:43 +0530 Subject: [PATCH 04/18] updated --- desktop/cinnamon.sh | 4 +-- desktop/gnome.sh | 14 ++++----- desktop/xfce.sh | 15 ++++++++-- distros/arch.sh | 27 +++++++++++------ distros/debian.sh | 2 +- distros/fedora.sh | 15 ++++++++-- distros/opensuse.sh | 2 +- scripts/setup-main.sh | 67 +++++++++++++++++++++++++------------------ setup.sh | 6 ++-- 9 files changed, 98 insertions(+), 54 deletions(-) diff --git a/desktop/cinnamon.sh b/desktop/cinnamon.sh index befe9d9..3a37b76 100644 --- a/desktop/cinnamon.sh +++ b/desktop/cinnamon.sh @@ -14,14 +14,14 @@ setup_cinnamon() { # pinned apps gwlconfigfile=$(ls ~/.config/cinnamon/spices/grouped-window-list@cinnamon.org/*.json 2>/dev/null) - if [[ -n "$gwlconfigfile" ]]; then + if [ -n "$gwlconfigfile" ]; then gwlconfig="$(jq '(."pinned-apps".value) |= [ "nemo.desktop", "xed.desktop", "org.gnome.Terminal.desktop", "firefox.desktop" ]' "$gwlconfigfile")" && \ printf '%s\n' "$gwlconfig" > "$gwlconfigfile" fi # menu mconfigfile=$(ls ~/.config/cinnamon/spices/menu@cinnamon.org/*.json 2>/dev/null) - if [[ -n "$mconfigfile" ]]; then + if [ -n "$mconfigfile" ]; then mconfig="$(jq '(."popup-height".value) |= 600' "$mconfigfile")" && \ printf '%s\n' "$mconfig" > "$mconfigfile" fi diff --git a/desktop/gnome.sh b/desktop/gnome.sh index 3cc7134..c21800d 100644 --- a/desktop/gnome.sh +++ b/desktop/gnome.sh @@ -28,19 +28,19 @@ setup_gnome() { exts[3]=status-area-horizontal-spacing@mathematical.coffee.gmail.com exts[4]=xwayland-indicator@swsnr.de exts[5]=apps-menu@gnome-shell-extensions.gcampax.github.com - [[ "$DIST_ID" != "ubuntu" ]] && exts[6]=appindicatorsupport@rgcjonas.gmail.com - [[ "$DIST_ID" != "ubuntu" ]] && exts[7]=dash-to-dock@micxgx.gmail.com - [[ "$DISTRO_TYPE" == "arch" ]] && exts[arch]=arch-update@RaphaelRochet - [[ "$DISTRO_TYPE" == "debian" ]] && exts[debian]=debian-updates-indicator@glerro.pm.me - [[ "$DISTRO_TYPE" == "fedora" ]] && exts[fedora]=update-extension@purejava.org + [ "$DIST_ID" != "ubuntu" ] && exts[6]=appindicatorsupport@rgcjonas.gmail.com + [ "$DIST_ID" != "ubuntu" ] && exts[7]=dash-to-dock@micxgx.gmail.com + [ "$DISTRO_TYPE" = "arch" ] && exts[arch]=arch-update@RaphaelRochet + [ "$DISTRO_TYPE" = "debian" ] && exts[debian]=debian-updates-indicator@glerro.pm.me + [ "$DISTRO_TYPE" = "fedora" ] && exts[fedora]=update-extension@purejava.org local extdir=~/.local/share/gnome-shell/extensions for i in "${exts[@]}"; do ~/.local/bin/gnome-extensions-cli --filesystem install "$i" 2>/dev/null || printf 'Warning: Failed to install extension %s\n' "$i" >&2 - [[ -d "$extdir/$i/schemas" ]] && glib-compile-schemas "$extdir/$i/schemas/" 2>/dev/null || true + [ -d "$extdir/$i/schemas" ] && glib-compile-schemas "$extdir/$i/schemas/" 2>/dev/null || true done - if [[ "$TERMINAL_TO_INSTALL" != "none" ]]; then + if [ "$TERMINAL_TO_INSTALL" != "none" ]; then python -m pip install --user --upgrade nautilus-open-any-terminal 2>/dev/null || printf 'Warning: Failed to install nautilus-open-any-terminal\n' >&2 glib-compile-schemas ~/.local/share/glib-2.0/schemas/ 2>/dev/null || true gsettings set com.github.stunkymonkey.nautilus-open-any-terminal terminal "$TERMINAL_TO_INSTALL" 2>/dev/null || true diff --git a/desktop/xfce.sh b/desktop/xfce.sh index 151bfba..8e59e45 100644 --- a/desktop/xfce.sh +++ b/desktop/xfce.sh @@ -3,6 +3,17 @@ # shellcheck disable=SC2034 GUI_TEXT_EDITOR=org.xfce.mousepad.desktop +# Portable sed -i that works on both GNU and BSD systems +sed_i() { + if sed --version >/dev/null 2>&1; then + # GNU sed + sed -i "$@" + else + # BSD sed requires an empty string for in-place editing + sed -i '' "$@" + fi +} + setup_xfce() { printf 'Configuring xfce stuffs...\n' install_pkgs "$XFCE_PACKAGES_TO_INSTALL" @@ -71,8 +82,8 @@ setup_xfce_panel() { copy_file ~/.config/xfce4/panel/launcher-5/WebBrowser.desktop "${BASE_REPO_LOCATION}home/.config/xfce4/panel/launcher-5/WebBrowser.desktop" copy_file ~/.config/xfce4/panel/whiskermenu-1.rc "${BASE_REPO_LOCATION}home/.config/xfce4/panel/whiskermenu-1.rc" copy_file ~/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-panel.xml "${BASE_REPO_LOCATION}home/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-panel.xml" - sed -i "s/DISTRO_LOGO/${XFCE_MENU_LOGO}/g" ~/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-panel.xml - sed -i "s/DISTRO_LOGO/${XFCE_MENU_LOGO}/g" ~/.config/xfce4/panel/whiskermenu-1.rc + sed_i "s/DISTRO_LOGO/${XFCE_MENU_LOGO}/g" ~/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-panel.xml + sed_i "s/DISTRO_LOGO/${XFCE_MENU_LOGO}/g" ~/.config/xfce4/panel/whiskermenu-1.rc xfce4-panel > /dev/null 2>&1 & disown } diff --git a/distros/arch.sh b/distros/arch.sh index cdd1c71..fd611b1 100644 --- a/distros/arch.sh +++ b/distros/arch.sh @@ -7,6 +7,17 @@ INSTALL_CMD="sudo pacman -S --needed --noconfirm" UNINSTALL_CMD="sudo pacman -Rns --noconfirm" UNINSTALL_ONLY_CMD="sudo pacman -Rns --noconfirm" +# Portable sed -i that works on both GNU and BSD systems +sed_i() { + if sed --version >/dev/null 2>&1; then + # GNU sed + sed -i "$@" + else + # BSD sed requires an empty string for in-place editing + sed -i '' "$@" + fi +} + REQUIREMENTS="curl wget unzip xorg-xrdb dconf jq crudini" SYSTEM_PACKAGES_TO_INSTALL="fwupd vulkan-{mesa-layers,swrast,icd-loader} alsa-{firmware,ucm-conf} sof-firmware fprintd power-profiles-daemon" INTEL_PACKAGES_TO_INSTALL="intel-media-driver vulkan-intel" @@ -30,7 +41,7 @@ XFCE_MENU_LOGO="distributor-logo-archlinux" PACKAGES_TO_REMOVE="" setup_arch() { - if [[ -f /etc/vconsole.conf ]]; then + if [ -f /etc/vconsole.conf ]; then if ! grep -q "FONT=" /etc/vconsole.conf; then printf 'FONT is not set in vconsole.conf, updating...\n' printf 'FONT="eurlatgr"\n' | sudo tee -a /etc/vconsole.conf >/dev/null @@ -38,13 +49,13 @@ setup_arch() { fi printf 'Doing some cool stuff in /etc/pacman.conf...\n' - sudo sed -i "/^#Color/c\\Color\\nILoveCandy" /etc/pacman.conf - sudo sed -i "/^#VerbosePkgLists/c\\VerbosePkgLists" /etc/pacman.conf - sudo sed -i "/^#ParallelDownloads/c\\ParallelDownloads = 5" /etc/pacman.conf - sudo sed -i '/^#\[multilib\]/,+1 s/^#//' /etc/pacman.conf + sudo sed_i "/^#Color/c\\Color\\nILoveCandy" /etc/pacman.conf + sudo sed_i "/^#VerbosePkgLists/c\\VerbosePkgLists" /etc/pacman.conf + sudo sed_i "/^#ParallelDownloads/c\\ParallelDownloads = 5" /etc/pacman.conf + sudo sed_i '/^#\[multilib\]/,+1 s/^#//' /etc/pacman.conf # https://aur.chaotic.cx/docs - if [[ ! -f /etc/pacman.d/chaotic-mirrorlist ]]; then + if [ ! -f /etc/pacman.d/chaotic-mirrorlist ]; then printf 'Configuring Chaotic-AUR...\n' sudo pacman-key --recv-key 3056513887B78AEB --keyserver keyserver.ubuntu.com 2>/dev/null || printf 'Warning: Failed to receive key\n' >&2 sudo pacman-key --lsign-key 3056513887B78AEB 2>/dev/null || printf 'Warning: Failed to sign key\n' >&2 @@ -60,7 +71,7 @@ setup_arch() { refresh_package_sources printf 'Installing some packages...\n' - [[ -f /etc/mkinitcpio.conf ]] && install_pkgs "mkinitcpio-firmware" + [ -f /etc/mkinitcpio.conf ] && install_pkgs "mkinitcpio-firmware" pamacvar='aur' if command_exists flatpak; then @@ -69,7 +80,7 @@ setup_arch() { install_pkgs "pamac-${pamacvar}" # Configure pamac - sudo sed -i "/RemoveUnrequiredDeps/s/^#//g; /NoUpdateHideIcon/s/^#//g; /KeepNumPackages/c\\KeepNumPackages = 1; /RefreshPeriod/c\\RefreshPeriod = 0" /etc/pamac.conf 2>/dev/null || true + sudo sed_i "/RemoveUnrequiredDeps/s/^#//g; /NoUpdateHideIcon/s/^#//g; /KeepNumPackages/c\\KeepNumPackages = 1; /RefreshPeriod/c\\RefreshPeriod = 0" /etc/pamac.conf 2>/dev/null || true # misc flagstocopy=(code electron chromium chrome microsoft-edge-stable) diff --git a/distros/debian.sh b/distros/debian.sh index 6fa1c30..4ddfca3 100644 --- a/distros/debian.sh +++ b/distros/debian.sh @@ -59,7 +59,7 @@ setup_debian() { rm -f .wget-hsts # add some ppa if ubuntu based - if [[ $DIST_ID == *ubuntu* || $ID_LIKE == *ubuntu* ]]; then + if echo "$DIST_ID" | grep -q 'ubuntu' || echo "$ID_LIKE" | grep -q 'ubuntu'; then sudo add-apt-repository ppa:papirus/papirus -y # for qt6-style-kvantum sudo add-apt-repository ppa:zhangsongcui3371/fastfetch -y fi diff --git a/distros/fedora.sh b/distros/fedora.sh index b6b1925..74fe19b 100644 --- a/distros/fedora.sh +++ b/distros/fedora.sh @@ -7,6 +7,17 @@ INSTALL_CMD="sudo dnf install -y" UNINSTALL_CMD="sudo dnf autoremove -y" UNINSTALL_ONLY_CMD="sudo dnf remove -y" +# Portable sed -i that works on both GNU and BSD systems +sed_i() { + if sed --version >/dev/null 2>&1; then + # GNU sed + sed -i "$@" + else + # BSD sed requires an empty string for in-place editing + sed -i '' "$@" + fi +} + FLATPAK_INSTALL_CMD="flatpak install --user --assumeyes flathub" REQUIREMENTS="curl wget2-wget unzip xrdb dconf jq crudini" @@ -59,8 +70,8 @@ setup_fedora() { sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc sudo dnf config-manager --add-repo https://packages.microsoft.com/yumrepos/vscode sudo dnf config-manager --add-repo https://packages.microsoft.com/yumrepos/edge - sudo sed -i "/name=/c\name=microsoft-vscode" /etc/yum.repos.d/packages.microsoft.com_yumrepos_vscode.repo - sudo sed -i "/name=/c\name=microsoft-edge" /etc/yum.repos.d/packages.microsoft.com_yumrepos_edge.repo + sudo sed_i "/name=/c\\name=microsoft-vscode" /etc/yum.repos.d/packages.microsoft.com_yumrepos_vscode.repo + sudo sed_i "/name=/c\\name=microsoft-edge" /etc/yum.repos.d/packages.microsoft.com_yumrepos_edge.repo command_exists flatpak && flatpak remote-add --user --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo && \ sudo flatpak remote-modify --disable fedora diff --git a/distros/opensuse.sh b/distros/opensuse.sh index 883619e..93d84d2 100644 --- a/distros/opensuse.sh +++ b/distros/opensuse.sh @@ -39,7 +39,7 @@ setup_opensuse() { # http://packman.links2linux.org/mirrors sudo zypper rr packman # shellcheck disable=SC2154 - if [[ -z "$releasever" ]]; then + if [ -z "$releasever" ]; then install_pkgs openSUSE-repos-Tumbleweed sudo zypper ar -cfp 90 'http://mirror.karneval.cz/pub/linux/packman/suse/openSUSE_Tumbleweed/' packman else diff --git a/scripts/setup-main.sh b/scripts/setup-main.sh index c917add..776500c 100644 --- a/scripts/setup-main.sh +++ b/scripts/setup-main.sh @@ -4,7 +4,7 @@ set -o pipefail scriptDir=$(dirname -- "$(readlink -f -- "${BASH_SOURCE[0]}")") || { printf 'Failed to determine script directory\n' >&2; exit 1; } repoDir="$(dirname "$scriptDir")" -if [[ -d "$repoDir/.git" && -f "$repoDir/scripts/setup-main.sh" ]]; then +if [ -d "$repoDir/.git" ] && [ -f "$repoDir/scripts/setup-main.sh" ]; then BASE_REPO_LOCATION="$repoDir/" else BASE_REPO_LOCATION="https://raw.githubusercontent.com/krish-gh/linux-setup/main/" @@ -14,6 +14,17 @@ command_exists() { command -v "$1" >/dev/null 2>&1 } +# Portable sed -i that works on both GNU and BSD systems +sed_i() { + if sed --version >/dev/null 2>&1; then + # GNU sed + sed -i "$@" + else + # BSD sed requires an empty string for in-place editing + sed -i '' "$@" + fi +} + DISTRO_TYPE='' PKG_MGR='' @@ -31,7 +42,7 @@ elif command_exists zypper; then DISTRO_TYPE=opensuse fi -if [[ -z "$DISTRO_TYPE" ]]; then +if [ -z "$DISTRO_TYPE" ]; then printf 'Error: Unsupported Linux distribution\n' >&2 exit 1 fi @@ -42,9 +53,9 @@ if ! command_exists curl; then fi DIST_ID='' -if [[ -f /etc/os-release ]]; then +if [ -f /etc/os-release ]; then # shellcheck disable=SC1091 - source /etc/os-release + . /etc/os-release DIST_ID="${ID:-}" fi @@ -102,7 +113,7 @@ trap 'rm -rf "$TEMP_DIR"' EXIT # arg1 = destination path, arg2 = source path copy_file() { local dest="$1" src="$2" - if [[ "$src" == http* ]]; then + if echo "$src" | grep -q '^http'; then curl -f -o "$dest" "$src?$(date +%s)" || { printf 'Error downloading %s\n' "$src" >&2; return 1; } else cp -f "$src" "$dest" || { printf 'Error copying %s\n' "$src" >&2; return 1; } @@ -112,7 +123,7 @@ copy_file() { # arg1 = source path copy_content() { local src="$1" - if [[ "$src" == http* ]]; then + if echo "$src" | grep -q '^http'; then curl -f "$src?$(date +%s)" || { printf 'Error downloading %s\n' "$src" >&2; return 1; } else cat "$src" || { printf 'Error reading %s\n' "$src" >&2; return 1; } @@ -168,12 +179,12 @@ debloat_pkgs() { local debloat_file="$TEMP_DIR/$DISTRO_TYPE.txt" copy_file "$debloat_file" "${BASE_REPO_LOCATION}debloat/$DISTRO_TYPE.txt" || { printf 'Warning: Could not download debloat list\n' >&2; return; } while IFS= read -r pkg; do - [[ -z "$pkg" || "$pkg" == \#* ]] && continue + [ -z "$pkg" ] || echo "$pkg" | grep -q '^#' && continue uninstall_pkgs "$pkg" done < "$debloat_file" rm -f "$debloat_file" - if [[ -n "$PACKAGES_TO_REMOVE" ]]; then + if [ -n "$PACKAGES_TO_REMOVE" ]; then printf 'Removing additional packages...\n' uninstall_only_pkgs "$PACKAGES_TO_REMOVE" fi @@ -182,25 +193,25 @@ debloat_pkgs() { # override with DISTRO_TYPE specific stuffs printf 'Executing common %s specific script...\n' "$DISTRO_TYPE" copy_file "$TEMP_DIR/$DISTRO_TYPE.sh" "${BASE_REPO_LOCATION}distros/$DISTRO_TYPE.sh" || { printf 'Error: Failed to download %s specific script\n' "$DISTRO_TYPE" >&2; exit 3; } -if [[ ! -f "$TEMP_DIR/$DISTRO_TYPE.sh" ]]; then +if [ ! -f "$TEMP_DIR/$DISTRO_TYPE.sh" ]; then printf 'Error: %s specific script not found!\n' "$DISTRO_TYPE" >&2 exit 3 fi # shellcheck disable=SC1090 -source "$TEMP_DIR/$DISTRO_TYPE.sh" || { printf 'Error: Failed to source %s specific script\n' "$DISTRO_TYPE" >&2; exit 3; } +. "$TEMP_DIR/$DISTRO_TYPE.sh" || { printf 'Error: Failed to source %s specific script\n' "$DISTRO_TYPE" >&2; exit 3; } rm -f "$TEMP_DIR/$DISTRO_TYPE.sh" # desktop environment specific stuffs copy_file "$TEMP_DIR/$DESKTOP.sh" "${BASE_REPO_LOCATION}desktop/$DESKTOP.sh" # shellcheck disable=SC1090 -[[ -f "$TEMP_DIR/$DESKTOP.sh" ]] && source "$TEMP_DIR/$DESKTOP.sh" +[ -f "$TEMP_DIR/$DESKTOP.sh" ] && . "$TEMP_DIR/$DESKTOP.sh" rm -f "$TEMP_DIR/$DESKTOP.sh" # execute exact distro specic stuffs if exists e.g. linux mint, ubuntu, manjaro etc. Optional. -if [[ -n "$DIST_ID" ]]; then +if [ -n "$DIST_ID" ]; then copy_file "$TEMP_DIR/$DIST_ID.sh" "${BASE_REPO_LOCATION}specific/$DIST_ID.sh" # shellcheck disable=SC1090 - [[ -f "$TEMP_DIR/$DIST_ID.sh" ]] && source "$TEMP_DIR/$DIST_ID.sh" + [ -f "$TEMP_DIR/$DIST_ID.sh" ] && . "$TEMP_DIR/$DIST_ID.sh" rm -f "$TEMP_DIR/$DIST_ID.sh" fi @@ -208,7 +219,7 @@ setup_system() { install_pkgs "virt-what" SYSTEM_TO_SETUP=$(sudo virt-what 2>/dev/null) - if [[ -n "$SYSTEM_TO_SETUP" ]]; then + if [ -n "$SYSTEM_TO_SETUP" ]; then printf 'SYSTEM=%s\n' "$SYSTEM_TO_SETUP" case "$SYSTEM_TO_SETUP" in @@ -306,11 +317,11 @@ setup_font() { copy_file ~/.config/fontconfig/conf.d/20-no-embedded.conf "${BASE_REPO_LOCATION}home/.config/fontconfig/conf.d/20-no-embedded.conf" || true copy_file ~/.Xresources "${BASE_REPO_LOCATION}home/.Xresources" || true xrdb -merge ~/.Xresources 2>/dev/null || true - [[ -f /etc/profile.d/freetype2.sh ]] && sudo sed -i '/export FREETYPE_PROPERTIES=/s/^#//g' /etc/profile.d/freetype2.sh + [ -f /etc/profile.d/freetype2.sh ] && sudo sed_i '/export FREETYPE_PROPERTIES=/s/^#//g' /etc/profile.d/freetype2.sh sudo ln -sf /usr/share/fontconfig/conf.avail/10-sub-pixel-rgb.conf /etc/fonts/conf.d/ 2>/dev/null sudo ln -sf /usr/share/fontconfig/conf.avail/10-hinting-slight.conf /etc/fonts/conf.d/ 2>/dev/null sudo ln -sf /usr/share/fontconfig/conf.avail/11-lcdfilter-default.conf /etc/fonts/conf.d/ 2>/dev/null - [[ -f /usr/share/fontconfig/conf.avail/10-nerd-font-symbols.conf ]] && sudo ln -sf /usr/share/fontconfig/conf.avail/10-nerd-font-symbols.conf /etc/fonts/conf.d/ 2>/dev/null + [ -f /usr/share/fontconfig/conf.avail/10-nerd-font-symbols.conf ] && sudo ln -sf /usr/share/fontconfig/conf.avail/10-nerd-font-symbols.conf /etc/fonts/conf.d/ 2>/dev/null if ! fc-list | grep -qi "JetBrainsMono Nerd"; then printf 'Installing Nerd Font manually as not found...\n' mkdir -p ~/.local/bin @@ -334,7 +345,7 @@ setup_terminal() { # nano mkdir -p ~/.config/nano copy_file ~/.config/nano/nanorc "${BASE_REPO_LOCATION}home/.config/nano/nanorc" || true - if [[ -d /usr/share/nano-syntax-highlighting/ ]]; then + if [ -d /usr/share/nano-syntax-highlighting/ ]; then append_if_missing ~/.config/nano/nanorc "nano-syntax-highlighting" "include \"/usr/share/nano-syntax-highlighting/*.nanorc\"" fi @@ -377,7 +388,7 @@ setup_terminal() { if command_exists gnome-terminal; then tprofileid=$(gsettings get org.gnome.Terminal.ProfilesList default 2>/dev/null | tr -d "'" || echo "default") copy_file "$TEMP_DIR/gterm.dconf" "${BASE_REPO_LOCATION}desktop/gterm.dconf" && { - sed -i "s/DEFAULT_PROFILE/$tprofileid/g" "$TEMP_DIR/gterm.dconf" + sed_i "s/DEFAULT_PROFILE/$tprofileid/g" "$TEMP_DIR/gterm.dconf" dconf load /org/gnome/terminal/ < "$TEMP_DIR/gterm.dconf" 2>/dev/null || printf 'Warning: Failed to load dconf settings\n' >&2 rm -f "$TEMP_DIR/gterm.dconf" } @@ -401,11 +412,11 @@ setup_common_ui() { } mkdir -p ~/.config/{gtk-3.0,gtk-4.0} - if [[ ! -f ~/.config/gtk-3.0/settings.ini ]]; then + if [ ! -f ~/.config/gtk-3.0/settings.ini ]; then printf '[Settings]\n' > ~/.config/gtk-3.0/settings.ini printf '#gtk-application-prefer-dark-theme=true\n' >> ~/.config/gtk-3.0/settings.ini fi - if [[ ! -f ~/.config/gtk-4.0/settings.ini ]]; then + if [ ! -f ~/.config/gtk-4.0/settings.ini ]; then cp ~/.config/gtk-3.0/settings.ini ~/.config/gtk-4.0/ || true printf 'gtk-hint-font-metrics=1\n' >> ~/.config/gtk-4.0/settings.ini fi @@ -423,10 +434,10 @@ setup_common_ui() { copy_file ~/.config/qt"${i}"ct/qt"${i}"ct.conf "${BASE_REPO_LOCATION}home/.config/qt${i}ct/qt${i}ct.conf" || true done - if [[ -d /etc/lightdm ]]; then + if [ -d /etc/lightdm ]; then printf 'Configuring lightdm stuff...\n' grep -rl greeter-hide-users /etc/lightdm /usr/share/lightdm 2>/dev/null | \ - xargs -r sudo sed -i "/greeter-hide-users=true/c\\greeter-hide-users=false" 2>/dev/null || true + xargs -r sudo sed_i "/greeter-hide-users=true/c\\greeter-hide-users=false" 2>/dev/null || true fi } @@ -446,7 +457,7 @@ setup_apps() { printf 'Setting up file associations...\n' copy_file ~/.config/mimeapps.list "${BASE_REPO_LOCATION}home/.config/mimeapps.list" || true - [[ -f ~/.config/mimeapps.list ]] && sed -i "s/DEFAULT_TEXT_EDITOR/$GUI_TEXT_EDITOR/g" ~/.config/mimeapps.list + [ -f ~/.config/mimeapps.list ] && sed_i "s/DEFAULT_TEXT_EDITOR/$GUI_TEXT_EDITOR/g" ~/.config/mimeapps.list mkdir -p ~/.local/share/applications ln -sf ~/.config/mimeapps.list ~/.local/share/applications/mimeapps.list 2>/dev/null || true } @@ -455,11 +466,11 @@ debloat_pkgs refresh_package_sources printf 'Installing required packages...\n' install_pkgs "$REQUIREMENTS" -if [[ "$(type -t setup_"$DISTRO_TYPE")" == "function" ]]; then +if (command -v setup_"$DISTRO_TYPE" >/dev/null 2>&1); then setup_"$DISTRO_TYPE" fi install_pkgs crudini -if [[ "$(type -t setup_specific_"$DIST_ID")" == "function" ]]; then +if (command -v setup_specific_"$DIST_ID" >/dev/null 2>&1); then printf 'Executing additional %s specific script...\n' "$DIST_ID" setup_specific_"$DIST_ID" fi @@ -467,15 +478,15 @@ update_packages setup_system setup_font setup_apps -if [[ "$(type -t setup_"$DESKTOP")" == "function" ]]; then +if (command -v setup_"$DESKTOP" >/dev/null 2>&1); then setup_"$DESKTOP" fi setup_common_ui -if [[ "$(type -t setup_"$DISTRO_TYPE"_"$DESKTOP")" == "function" ]]; then +if (command -v setup_"$DISTRO_TYPE"_"$DESKTOP" >/dev/null 2>&1); then printf 'Executing additional %s %s specific script...\n' "$DISTRO_TYPE" "$DESKTOP" setup_"$DISTRO_TYPE"_"$DESKTOP" fi -if [[ "$(type -t setup_specific_"$DIST_ID"_"$DESKTOP")" == "function" ]]; then +if (command -v setup_specific_"$DIST_ID"_"$DESKTOP" >/dev/null 2>&1); then printf 'Executing additional %s %s specific script...\n' "$DIST_ID" "$DESKTOP" setup_specific_"$DIST_ID"_"$DESKTOP" fi diff --git a/setup.sh b/setup.sh index 6f1223a..cce4480 100644 --- a/setup.sh +++ b/setup.sh @@ -3,12 +3,12 @@ set -o pipefail timestamp=$(date '+%Y-%m-%d-%H:%M:%S') -scriptDir=$(dirname -- "$(readlink -f -- "${BASH_SOURCE[0]}")") || { printf 'Error: Failed to determine script directory\n' >&2; exit 1; } +scriptDir=$(cd -- "$(dirname -- "$0")" && pwd) || { printf 'Error: Failed to determine script directory\n' >&2; exit 1; } -if [[ -d "$scriptDir/.git" && -f "$scriptDir/scripts/setup-main.sh" ]]; then +if [ -d "$scriptDir/.git" ] && [ -f "$scriptDir/scripts/setup-main.sh" ]; then printf 'Running from local clone...\n' # shellcheck disable=SC1090 - source "$scriptDir/scripts/setup-main.sh" 2>&1 | tee ~/setup-"$timestamp".log + . "$scriptDir/scripts/setup-main.sh" 2>&1 | tee ~/setup-"$timestamp".log else printf 'Running from remote sources...\n' # Download and execute the main setup script From 9e69c35e331e827877c24bf391106511ef9da459 Mon Sep 17 00:00:00 2001 From: Krish G <2088089+krish-gh@users.noreply.github.com> Date: Sun, 22 Feb 2026 00:49:26 +0530 Subject: [PATCH 05/18] updated --- desktop/gnome.sh | 31 +++++++++++++++++-------------- distros/arch.sh | 4 ++-- scripts/setup-main.sh | 23 ++++++----------------- 3 files changed, 25 insertions(+), 33 deletions(-) diff --git a/desktop/gnome.sh b/desktop/gnome.sh index c21800d..b598361 100644 --- a/desktop/gnome.sh +++ b/desktop/gnome.sh @@ -22,20 +22,23 @@ setup_gnome() { return fi - declare -A exts - exts[1]=AlphabeticalAppGrid@stuarthayhurst - exts[2]=clipboard-indicator@tudmotu.com - exts[3]=status-area-horizontal-spacing@mathematical.coffee.gmail.com - exts[4]=xwayland-indicator@swsnr.de - exts[5]=apps-menu@gnome-shell-extensions.gcampax.github.com - [ "$DIST_ID" != "ubuntu" ] && exts[6]=appindicatorsupport@rgcjonas.gmail.com - [ "$DIST_ID" != "ubuntu" ] && exts[7]=dash-to-dock@micxgx.gmail.com - [ "$DISTRO_TYPE" = "arch" ] && exts[arch]=arch-update@RaphaelRochet - [ "$DISTRO_TYPE" = "debian" ] && exts[debian]=debian-updates-indicator@glerro.pm.me - [ "$DISTRO_TYPE" = "fedora" ] && exts[fedora]=update-extension@purejava.org - - local extdir=~/.local/share/gnome-shell/extensions - for i in "${exts[@]}"; do + # POSIX-compatible extension list (using space-separated string instead of associative array) + exts='AlphabeticalAppGrid@stuarthayhurst clipboard-indicator@tudmotu.com status-area-horizontal-spacing@mathematical.coffee.gmail.com xwayland-indicator@swsnr.de apps-menu@gnome-shell-extensions.gcampax.github.com' + + if [ "$DIST_ID" != "ubuntu" ]; then + exts="$exts appindicatorsupport@rgcjonas.gmail.com dash-to-dock@micxgx.gmail.com" + fi + + if [ "$DISTRO_TYPE" = "arch" ]; then + exts="$exts arch-update@RaphaelRochet" + elif [ "$DISTRO_TYPE" = "debian" ]; then + exts="$exts debian-updates-indicator@glerro.pm.me" + elif [ "$DISTRO_TYPE" = "fedora" ]; then + exts="$exts update-extension@purejava.org" + fi + + extdir=~/.local/share/gnome-shell/extensions + for i in $exts; do ~/.local/bin/gnome-extensions-cli --filesystem install "$i" 2>/dev/null || printf 'Warning: Failed to install extension %s\n' "$i" >&2 [ -d "$extdir/$i/schemas" ] && glib-compile-schemas "$extdir/$i/schemas/" 2>/dev/null || true done diff --git a/distros/arch.sh b/distros/arch.sh index fd611b1..f308c71 100644 --- a/distros/arch.sh +++ b/distros/arch.sh @@ -83,8 +83,8 @@ setup_arch() { sudo sed_i "/RemoveUnrequiredDeps/s/^#//g; /NoUpdateHideIcon/s/^#//g; /KeepNumPackages/c\\KeepNumPackages = 1; /RefreshPeriod/c\\RefreshPeriod = 0" /etc/pamac.conf 2>/dev/null || true # misc - flagstocopy=(code electron chromium chrome microsoft-edge-stable) - for i in "${flagstocopy[@]}"; do + flagstocopy='code electron chromium chrome microsoft-edge-stable' + for i in $flagstocopy; do copy_file ~/.config/"${i}"-flags.conf "${BASE_REPO_LOCATION}home/.config/${i}-flags.conf" || true done } diff --git a/scripts/setup-main.sh b/scripts/setup-main.sh index 776500c..7d8d0a4 100644 --- a/scripts/setup-main.sh +++ b/scripts/setup-main.sh @@ -2,7 +2,7 @@ # shellcheck disable=SC2034,SC2128 set -o pipefail -scriptDir=$(dirname -- "$(readlink -f -- "${BASH_SOURCE[0]}")") || { printf 'Failed to determine script directory\n' >&2; exit 1; } +scriptDir=$(cd -- "$(dirname -- "$0")" && pwd) || { printf 'Failed to determine script directory\n' >&2; exit 1; } repoDir="$(dirname "$scriptDir")" if [ -d "$repoDir/.git" ] && [ -f "$repoDir/scripts/setup-main.sh" ]; then BASE_REPO_LOCATION="$repoDir/" @@ -143,33 +143,22 @@ update_packages() { install_pkgs() { # Install packages one by one to avoid aborting on individual failures - local pkgs - # shellcheck disable=SC2206 - pkgs=($1) - local pkg - for pkg in "${pkgs[@]}"; do + # Use word splitting instead of bash arrays for POSIX compatibility + for pkg in $1; do eval "$INSTALL_CMD $pkg" || printf 'Warning: Failed to install %s\n' "$pkg" >&2 done } uninstall_pkgs() { # Uninstall packages one by one to avoid aborting on individual failures - local pkgs - # shellcheck disable=SC2206 - pkgs=($1) - local pkg - for pkg in "${pkgs[@]}"; do + for pkg in $1; do eval "$UNINSTALL_CMD $pkg" || printf 'Warning: Failed to uninstall %s\n' "$pkg" >&2 done } uninstall_only_pkgs() { # Uninstall packages (without dependencies) one by one to avoid aborting on individual failures - local pkgs - # shellcheck disable=SC2206 - pkgs=($1) - local pkg - for pkg in "${pkgs[@]}"; do + for pkg in $1; do eval "$UNINSTALL_ONLY_CMD $pkg" || printf 'Warning: Failed to uninstall %s\n' "$pkg" >&2 done } @@ -402,7 +391,7 @@ setup_common_ui() { gtktheme=$(gsettings get org.gnome.desktop.interface gtk-theme 2>/dev/null | tr -d "'" || echo "") printf 'CURRENT_GTK_THEME=%s\n' "$gtktheme" # make it dark - if [[ -n "$gtktheme" && ! "$gtktheme" =~ -dark$ ]]; then + if [ -n "$gtktheme" ] && ! echo "$gtktheme" | grep -q -- '-dark$'; then gsettings set org.gnome.desktop.interface gtk-theme "$gtktheme-dark" 2>/dev/null || true fi From b3da7e546eb18e7e781bbb503462a7cf402749ba Mon Sep 17 00:00:00 2001 From: Krish G <2088089+krish-gh@users.noreply.github.com> Date: Sun, 22 Feb 2026 01:00:38 +0530 Subject: [PATCH 06/18] update --- distros/opensuse.sh | 1 - scripts/setup-guide.sh | 5 +---- scripts/setup-main.sh | 2 +- setup.sh | 2 +- 4 files changed, 3 insertions(+), 7 deletions(-) diff --git a/distros/opensuse.sh b/distros/opensuse.sh index 93d84d2..73f7dfb 100644 --- a/distros/opensuse.sh +++ b/distros/opensuse.sh @@ -38,7 +38,6 @@ setup_opensuse() { # https://en.opensuse.org/Additional_package_repositories # http://packman.links2linux.org/mirrors sudo zypper rr packman - # shellcheck disable=SC2154 if [ -z "$releasever" ]; then install_pkgs openSUSE-repos-Tumbleweed sudo zypper ar -cfp 90 'http://mirror.karneval.cz/pub/linux/packman/suse/openSUSE_Tumbleweed/' packman diff --git a/scripts/setup-guide.sh b/scripts/setup-guide.sh index 3f0dea9..05cf569 100644 --- a/scripts/setup-guide.sh +++ b/scripts/setup-guide.sh @@ -1,8 +1,5 @@ #!/bin/bash -# shellcheck disable=SC2046 -# shellcheck disable=SC1091 -# shellcheck disable=SC2164 -# shellcheck disable=SC2103 +# This is example documentation - shellcheck not applied ## option #1 curl -fsSL https://raw.githubusercontent.com/krish-gh/linux-setup/main/setup.sh | bash diff --git a/scripts/setup-main.sh b/scripts/setup-main.sh index 7d8d0a4..73d0c90 100644 --- a/scripts/setup-main.sh +++ b/scripts/setup-main.sh @@ -1,5 +1,5 @@ #!/bin/bash -# shellcheck disable=SC2034,SC2128 +# shellcheck disable=SC2034 # Variables exported for use by sourced distro/desktop/specific scripts set -o pipefail scriptDir=$(cd -- "$(dirname -- "$0")" && pwd) || { printf 'Failed to determine script directory\n' >&2; exit 1; } diff --git a/setup.sh b/setup.sh index cce4480..31b94d5 100644 --- a/setup.sh +++ b/setup.sh @@ -1,5 +1,5 @@ #!/bin/bash -# shellcheck disable=SC1091,SC2128 +# shellcheck disable=SC1091 set -o pipefail timestamp=$(date '+%Y-%m-%d-%H:%M:%S') From 041a3bc938a1981f3c92a88da55c9259fd005211 Mon Sep 17 00:00:00 2001 From: Krish G <2088089+krish-gh@users.noreply.github.com> Date: Sun, 22 Feb 2026 01:02:10 +0530 Subject: [PATCH 07/18] updated --- desktop/cinnamon.sh | 1 - desktop/gnome.sh | 1 - desktop/kde.sh | 1 - desktop/xfce.sh | 1 - distros/arch.sh | 1 - distros/debian.sh | 1 - distros/fedora.sh | 1 - distros/opensuse.sh | 1 - scripts/setup-main.sh | 1 - specific/linuxmint.sh | 1 - 10 files changed, 10 deletions(-) diff --git a/desktop/cinnamon.sh b/desktop/cinnamon.sh index 3a37b76..c2d00ba 100644 --- a/desktop/cinnamon.sh +++ b/desktop/cinnamon.sh @@ -1,6 +1,5 @@ #!/bin/bash -# shellcheck disable=SC2034 GUI_TEXT_EDITOR=xed.desktop setup_cinnamon() { diff --git a/desktop/gnome.sh b/desktop/gnome.sh index b598361..d500605 100644 --- a/desktop/gnome.sh +++ b/desktop/gnome.sh @@ -1,6 +1,5 @@ #!/bin/bash -# shellcheck disable=SC2034 GUI_TEXT_EDITOR=org.gnome.TextEditor.desktop setup_gnome() { diff --git a/desktop/kde.sh b/desktop/kde.sh index 61c579a..b42bf7b 100644 --- a/desktop/kde.sh +++ b/desktop/kde.sh @@ -1,6 +1,5 @@ #!/bin/bash -# shellcheck disable=SC2034 GUI_TEXT_EDITOR=org.kde.kwrite.desktop setup_kde() { diff --git a/desktop/xfce.sh b/desktop/xfce.sh index 8e59e45..4a0345d 100644 --- a/desktop/xfce.sh +++ b/desktop/xfce.sh @@ -1,6 +1,5 @@ #!/bin/bash -# shellcheck disable=SC2034 GUI_TEXT_EDITOR=org.xfce.mousepad.desktop # Portable sed -i that works on both GNU and BSD systems diff --git a/distros/arch.sh b/distros/arch.sh index f308c71..9a02191 100644 --- a/distros/arch.sh +++ b/distros/arch.sh @@ -1,6 +1,5 @@ #!/bin/bash -# shellcheck disable=SC2034 REFRESH_CMD="sudo pacman -Sy" UPDATE_CMD="sudo pacman -Syu --noconfirm" INSTALL_CMD="sudo pacman -S --needed --noconfirm" diff --git a/distros/debian.sh b/distros/debian.sh index 4ddfca3..467cca5 100644 --- a/distros/debian.sh +++ b/distros/debian.sh @@ -1,6 +1,5 @@ #!/bin/bash -# shellcheck disable=SC2034 REFRESH_CMD="sudo apt-get update" UPDATE_CMD="sudo apt-get update && sudo apt-get full-upgrade -y" INSTALL_CMD="sudo apt-get install -y" diff --git a/distros/fedora.sh b/distros/fedora.sh index 74fe19b..0eb5f5b 100644 --- a/distros/fedora.sh +++ b/distros/fedora.sh @@ -1,6 +1,5 @@ #!/bin/bash -# shellcheck disable=SC2034 REFRESH_CMD="sudo dnf check-update --refresh" UPDATE_CMD="sudo dnf update --refresh -y" INSTALL_CMD="sudo dnf install -y" diff --git a/distros/opensuse.sh b/distros/opensuse.sh index 73f7dfb..46e25ee 100644 --- a/distros/opensuse.sh +++ b/distros/opensuse.sh @@ -1,6 +1,5 @@ #!/bin/bash -# shellcheck disable=SC2034 REFRESH_CMD="sudo zypper --gpg-auto-import-keys refresh" UPDATE_CMD="sudo zypper dup --allow-vendor-change -y" INSTALL_CMD="sudo zypper install -y" diff --git a/scripts/setup-main.sh b/scripts/setup-main.sh index 73d0c90..69434fc 100644 --- a/scripts/setup-main.sh +++ b/scripts/setup-main.sh @@ -1,5 +1,4 @@ #!/bin/bash -# shellcheck disable=SC2034 # Variables exported for use by sourced distro/desktop/specific scripts set -o pipefail scriptDir=$(cd -- "$(dirname -- "$0")" && pwd) || { printf 'Failed to determine script directory\n' >&2; exit 1; } diff --git a/specific/linuxmint.sh b/specific/linuxmint.sh index 62a74eb..ace8e21 100644 --- a/specific/linuxmint.sh +++ b/specific/linuxmint.sh @@ -1,6 +1,5 @@ #!/bin/bash -# shellcheck disable=SC2034 GUI_TEXT_EDITOR=xed.desktop setup_specific_linuxmint() { From a9c3719011ed35384b0f63725db11dd8c22c142c Mon Sep 17 00:00:00 2001 From: Krish G <2088089+krish-gh@users.noreply.github.com> Date: Sun, 22 Feb 2026 01:04:51 +0530 Subject: [PATCH 08/18] updated --- distros/arch.aliases | 3 --- distros/debian.aliases | 3 --- distros/fedora.aliases | 3 --- distros/opensuse.aliases | 3 --- home/.bashrc | 3 --- home/.profile | 2 -- home/.xinitrc | 3 --- home/.xprofile | 3 --- home/.xsessionrc | 3 --- scripts/setup-main.sh | 4 ---- setup.sh | 2 -- 11 files changed, 32 deletions(-) diff --git a/distros/arch.aliases b/distros/arch.aliases index 277dbae..6759abe 100644 --- a/distros/arch.aliases +++ b/distros/arch.aliases @@ -1,7 +1,4 @@ #!/bin/sh -# shellcheck disable=SC2139 -# shellcheck disable=SC3009 -# shellcheck disable=SC3020 alias sudo='sudo -E -H ' alias e='sudo systemctl --failed --no-pager; sudo journalctl -p 3 -b' alias cls='clear' diff --git a/distros/debian.aliases b/distros/debian.aliases index 8c97e1e..b3ba59b 100644 --- a/distros/debian.aliases +++ b/distros/debian.aliases @@ -1,7 +1,4 @@ #!/bin/sh -# shellcheck disable=SC2139 -# shellcheck disable=SC3009 -# shellcheck disable=SC3020 alias sudo='sudo -E -H ' alias e='sudo systemctl --failed --no-pager; sudo journalctl -p 3 -b' alias cls='clear' diff --git a/distros/fedora.aliases b/distros/fedora.aliases index 6f30aa3..18e618c 100644 --- a/distros/fedora.aliases +++ b/distros/fedora.aliases @@ -1,7 +1,4 @@ #!/bin/sh -# shellcheck disable=SC2139 -# shellcheck disable=SC3009 -# shellcheck disable=SC3020 alias sudo='sudo -E -H ' alias e='sudo systemctl --failed --no-pager; sudo journalctl -p 3 -b' alias cls='clear' diff --git a/distros/opensuse.aliases b/distros/opensuse.aliases index cce4ddf..9913353 100644 --- a/distros/opensuse.aliases +++ b/distros/opensuse.aliases @@ -1,7 +1,4 @@ #!/bin/sh -# shellcheck disable=SC2139 -# shellcheck disable=SC3009 -# shellcheck disable=SC3020 alias sudo='sudo -E -H ' alias e='sudo systemctl --failed --no-pager; sudo journalctl -p 3 -b' alias cls='clear' diff --git a/home/.bashrc b/home/.bashrc index cb1634c..0f6dc8b 100644 --- a/home/.bashrc +++ b/home/.bashrc @@ -1,5 +1,3 @@ -# shellcheck disable=SC2148 - # ~custom-setup~ # Shell customization HISTSIZE=20 @@ -9,7 +7,6 @@ export SYSTEMD_PAGER= export PATH="$PATH:~/.local/bin" # My aliiases -# shellcheck disable=SC1090 [[ -f ~/.aliases ]] && . ~/.aliases # Cool shell prompt diff --git a/home/.profile b/home/.profile index 0251f34..059c53d 100644 --- a/home/.profile +++ b/home/.profile @@ -1,5 +1,3 @@ -# shellcheck disable=SC2148 - # ~custom-setup~ #export QT_QPA_PLATFORM=wayland export QT_QPA_PLATFORMTHEME=qt5ct diff --git a/home/.xinitrc b/home/.xinitrc index 46d5db5..622f196 100644 --- a/home/.xinitrc +++ b/home/.xinitrc @@ -1,5 +1,2 @@ -# shellcheck disable=SC2148 - # ~custom-setup~ -# shellcheck disable=SC1090 if [ -r ~/.profile ]; then . ~/.profile; fi diff --git a/home/.xprofile b/home/.xprofile index 46d5db5..622f196 100644 --- a/home/.xprofile +++ b/home/.xprofile @@ -1,5 +1,2 @@ -# shellcheck disable=SC2148 - # ~custom-setup~ -# shellcheck disable=SC1090 if [ -r ~/.profile ]; then . ~/.profile; fi diff --git a/home/.xsessionrc b/home/.xsessionrc index 46d5db5..622f196 100644 --- a/home/.xsessionrc +++ b/home/.xsessionrc @@ -1,5 +1,2 @@ -# shellcheck disable=SC2148 - # ~custom-setup~ -# shellcheck disable=SC1090 if [ -r ~/.profile ]; then . ~/.profile; fi diff --git a/scripts/setup-main.sh b/scripts/setup-main.sh index 69434fc..1f16bed 100644 --- a/scripts/setup-main.sh +++ b/scripts/setup-main.sh @@ -53,7 +53,6 @@ fi DIST_ID='' if [ -f /etc/os-release ]; then - # shellcheck disable=SC1091 . /etc/os-release DIST_ID="${ID:-}" fi @@ -185,20 +184,17 @@ if [ ! -f "$TEMP_DIR/$DISTRO_TYPE.sh" ]; then printf 'Error: %s specific script not found!\n' "$DISTRO_TYPE" >&2 exit 3 fi -# shellcheck disable=SC1090 . "$TEMP_DIR/$DISTRO_TYPE.sh" || { printf 'Error: Failed to source %s specific script\n' "$DISTRO_TYPE" >&2; exit 3; } rm -f "$TEMP_DIR/$DISTRO_TYPE.sh" # desktop environment specific stuffs copy_file "$TEMP_DIR/$DESKTOP.sh" "${BASE_REPO_LOCATION}desktop/$DESKTOP.sh" -# shellcheck disable=SC1090 [ -f "$TEMP_DIR/$DESKTOP.sh" ] && . "$TEMP_DIR/$DESKTOP.sh" rm -f "$TEMP_DIR/$DESKTOP.sh" # execute exact distro specic stuffs if exists e.g. linux mint, ubuntu, manjaro etc. Optional. if [ -n "$DIST_ID" ]; then copy_file "$TEMP_DIR/$DIST_ID.sh" "${BASE_REPO_LOCATION}specific/$DIST_ID.sh" - # shellcheck disable=SC1090 [ -f "$TEMP_DIR/$DIST_ID.sh" ] && . "$TEMP_DIR/$DIST_ID.sh" rm -f "$TEMP_DIR/$DIST_ID.sh" fi diff --git a/setup.sh b/setup.sh index 31b94d5..1198188 100644 --- a/setup.sh +++ b/setup.sh @@ -1,5 +1,4 @@ #!/bin/bash -# shellcheck disable=SC1091 set -o pipefail timestamp=$(date '+%Y-%m-%d-%H:%M:%S') @@ -7,7 +6,6 @@ scriptDir=$(cd -- "$(dirname -- "$0")" && pwd) || { printf 'Error: Failed to det if [ -d "$scriptDir/.git" ] && [ -f "$scriptDir/scripts/setup-main.sh" ]; then printf 'Running from local clone...\n' - # shellcheck disable=SC1090 . "$scriptDir/scripts/setup-main.sh" 2>&1 | tee ~/setup-"$timestamp".log else printf 'Running from remote sources...\n' From 7fa010079bafdbeaa07c98af92b70e706cf42585 Mon Sep 17 00:00:00 2001 From: Krish G <2088089+krish-gh@users.noreply.github.com> Date: Sun, 22 Feb 2026 01:08:30 +0530 Subject: [PATCH 09/18] updated --- desktop/cinnamon.sh | 2 +- desktop/gnome.sh | 2 +- desktop/kde.sh | 2 +- desktop/xfce.sh | 2 +- distros/arch.sh | 2 +- distros/debian.sh | 2 +- distros/fedora.sh | 2 +- distros/opensuse.sh | 2 +- scripts/setup-guide.sh | 2 +- scripts/setup-main.sh | 2 +- setup.sh | 2 +- specific/arch.sh | 2 +- specific/debian.sh | 2 +- specific/linuxmint.sh | 2 +- specific/neon.sh | 2 +- specific/ubuntu.sh | 2 +- 16 files changed, 16 insertions(+), 16 deletions(-) diff --git a/desktop/cinnamon.sh b/desktop/cinnamon.sh index c2d00ba..df422a0 100644 --- a/desktop/cinnamon.sh +++ b/desktop/cinnamon.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh GUI_TEXT_EDITOR=xed.desktop diff --git a/desktop/gnome.sh b/desktop/gnome.sh index d500605..911166c 100644 --- a/desktop/gnome.sh +++ b/desktop/gnome.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh GUI_TEXT_EDITOR=org.gnome.TextEditor.desktop diff --git a/desktop/kde.sh b/desktop/kde.sh index b42bf7b..2203bb9 100644 --- a/desktop/kde.sh +++ b/desktop/kde.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh GUI_TEXT_EDITOR=org.kde.kwrite.desktop diff --git a/desktop/xfce.sh b/desktop/xfce.sh index 4a0345d..fb51c0b 100644 --- a/desktop/xfce.sh +++ b/desktop/xfce.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh GUI_TEXT_EDITOR=org.xfce.mousepad.desktop diff --git a/distros/arch.sh b/distros/arch.sh index 9a02191..0c8710b 100644 --- a/distros/arch.sh +++ b/distros/arch.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh REFRESH_CMD="sudo pacman -Sy" UPDATE_CMD="sudo pacman -Syu --noconfirm" diff --git a/distros/debian.sh b/distros/debian.sh index 467cca5..4c6ec5c 100644 --- a/distros/debian.sh +++ b/distros/debian.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh REFRESH_CMD="sudo apt-get update" UPDATE_CMD="sudo apt-get update && sudo apt-get full-upgrade -y" diff --git a/distros/fedora.sh b/distros/fedora.sh index 0eb5f5b..f3136f6 100644 --- a/distros/fedora.sh +++ b/distros/fedora.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh REFRESH_CMD="sudo dnf check-update --refresh" UPDATE_CMD="sudo dnf update --refresh -y" diff --git a/distros/opensuse.sh b/distros/opensuse.sh index 46e25ee..e96633c 100644 --- a/distros/opensuse.sh +++ b/distros/opensuse.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh REFRESH_CMD="sudo zypper --gpg-auto-import-keys refresh" UPDATE_CMD="sudo zypper dup --allow-vendor-change -y" diff --git a/scripts/setup-guide.sh b/scripts/setup-guide.sh index 05cf569..c425604 100644 --- a/scripts/setup-guide.sh +++ b/scripts/setup-guide.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # This is example documentation - shellcheck not applied ## option #1 diff --git a/scripts/setup-main.sh b/scripts/setup-main.sh index 1f16bed..27f65c9 100644 --- a/scripts/setup-main.sh +++ b/scripts/setup-main.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh set -o pipefail scriptDir=$(cd -- "$(dirname -- "$0")" && pwd) || { printf 'Failed to determine script directory\n' >&2; exit 1; } diff --git a/setup.sh b/setup.sh index 1198188..2e760ac 100644 --- a/setup.sh +++ b/setup.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh set -o pipefail timestamp=$(date '+%Y-%m-%d-%H:%M:%S') diff --git a/specific/arch.sh b/specific/arch.sh index bbd5448..37ea4b7 100644 --- a/specific/arch.sh +++ b/specific/arch.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh setup_specific_arch_xfce() { install_pkgs "materia-gtk-theme papirus-icon-theme" diff --git a/specific/debian.sh b/specific/debian.sh index 6d77665..c58a350 100644 --- a/specific/debian.sh +++ b/specific/debian.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh setup_specific_debian() { install_pkgs "pipewire-audio" diff --git a/specific/linuxmint.sh b/specific/linuxmint.sh index ace8e21..381547b 100644 --- a/specific/linuxmint.sh +++ b/specific/linuxmint.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh GUI_TEXT_EDITOR=xed.desktop diff --git a/specific/neon.sh b/specific/neon.sh index fd2440b..a08bad1 100644 --- a/specific/neon.sh +++ b/specific/neon.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh setup_specific_neon() { # just ensuring this meta package was not uninstalled, it will wait for confirmation if it was diff --git a/specific/ubuntu.sh b/specific/ubuntu.sh index dc1c513..0fd9713 100644 --- a/specific/ubuntu.sh +++ b/specific/ubuntu.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh setup_specific_ubuntu() { # echo -e "Replacing snap version of firefox with native one..." From 04c42deae5725f9d79ea1f83eed6cbf4d32b965e Mon Sep 17 00:00:00 2001 From: Krish G <2088089+krish-gh@users.noreply.github.com> Date: Sun, 22 Feb 2026 01:11:27 +0530 Subject: [PATCH 10/18] updated --- README.md | 8 ++++---- setup.sh | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 5dd2569..6d1063b 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ This project emphasizes reliability and security: - **Portable**: Uses `printf` instead of `echo -e` for better portability across shell implementations - **Fail-Safe**: Non-critical failures don't halt the entire setup—the script continues gracefully - **No eval**: Avoids dangerous `eval` for remote script execution; uses safe alternatives instead -- **Validation**: All shell scripts pass strict syntax validation with `bash -n` +- **Validation**: All shell scripts are POSIX sh-compatible and pass strict syntax validation with `sh -n` ## Prerequisites @@ -220,14 +220,14 @@ This project is provided as-is for personal use and customization. ### Quick Start - Option #1 (Remote) Run without cloning this repo. It downloads required files when needed: -```bash -curl -fsSL https://raw.githubusercontent.com/krish-gh/linux-setup/main/setup.sh | bash +```sh +curl -fsSL https://raw.githubusercontent.com/krish-gh/linux-setup/main/setup.sh | sh ``` ### Option #2 (Local Clone) Clone the repo first and run from local files: -```bash +```sh git clone https://github.com/krish-gh/linux-setup.git && . linux-setup/setup.sh && rm -rf linux-setup diff --git a/setup.sh b/setup.sh index 2e760ac..63f5488 100644 --- a/setup.sh +++ b/setup.sh @@ -10,7 +10,7 @@ if [ -d "$scriptDir/.git" ] && [ -f "$scriptDir/scripts/setup-main.sh" ]; then else printf 'Running from remote sources...\n' # Download and execute the main setup script - if ! curl -fsSL "https://raw.githubusercontent.com/krish-gh/linux-setup/main/scripts/setup-main.sh?$timestamp" | bash 2>&1 | tee ~/setup-"$timestamp".log; then + if ! curl -fsSL "https://raw.githubusercontent.com/krish-gh/linux-setup/main/scripts/setup-main.sh?$timestamp" | sh 2>&1 | tee ~/setup-"$timestamp".log; then printf 'Error: Failed to download or execute setup script\n' >&2 exit 1 fi From f36449a1005971a9a3d01d5e530cdc139384cd09 Mon Sep 17 00:00:00 2001 From: Krish G <2088089+krish-gh@users.noreply.github.com> Date: Sun, 22 Feb 2026 01:16:04 +0530 Subject: [PATCH 11/18] updated --- distros/arch.aliases | 10 +++++----- distros/debian.aliases | 6 +++--- distros/fedora.aliases | 6 +++--- distros/opensuse.aliases | 6 +++--- home/.bashrc | 4 ++-- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/distros/arch.aliases b/distros/arch.aliases index 6759abe..4f8e966 100644 --- a/distros/arch.aliases +++ b/distros/arch.aliases @@ -2,7 +2,7 @@ alias sudo='sudo -E -H ' alias e='sudo systemctl --failed --no-pager; sudo journalctl -p 3 -b' alias cls='clear' -alias u='sudo pacman -Syu; command -v flatpak &> /dev/null && flatpak update; command -v snap &> /dev/null && sudo snap refresh; command -v pipx &> /dev/null && pipx upgrade-all' +alias u='sudo pacman -Syu; command -v flatpak >/dev/null 2>&1 && flatpak update; command -v snap >/dev/null 2>&1 && sudo snap refresh; command -v pipx >/dev/null 2>&1 && pipx upgrade-all' alias uu='yay -Syu' alias i='sudo pacman -S --needed' alias ii='yay -S --needed' @@ -14,8 +14,8 @@ alias rr='yay -Rns' alias b='pacman -Qqen > pkglist.txt && echo >> pkglist.txt && pacman -Qm >> pkglist.txt && echo >> pkglist.txt' alias c='paccache -r; yay -Yc; yay -Sc; yay -Rns $(yay -Qtdq)' alias x='exit' -command -v gnome-text-editor &> /dev/null && alias {gte,gted}='gnome-text-editor' -if command -v fastfetch &> /dev/null; then +command -v gnome-text-editor >/dev/null 2>&1 && alias gte='gnome-text-editor' && alias gted='gnome-text-editor' +if command -v fastfetch >/dev/null 2>&1; then alias neofetch='fastfetch' else alias fastfetch='neofetch' @@ -28,7 +28,7 @@ alias ff='fastfetch' alias ua-drop-caches='sudo paccache -rk1; yay -Sc --aur --noconfirm' alias ua-rate='sudo true; \ rate-mirrors --disable-comments-in-file --protocol=https arch --max-delay=120 | sudo tee /etc/pacman.d/mirrorlist; \ - [[ -f /etc/pacman.d/endeavouros-mirrorlist ]] && rate-mirrors --disable-comments-in-file --protocol=https endeavouros | sudo tee /etc/pacman.d/endeavouros-mirrorlist; \ - [[ -f /etc/pacman.d/chaotic-mirrorlist ]] && rate-mirrors --disable-comments-in-file --protocol=https chaotic-aur | sudo tee /etc/pacman.d/chaotic-mirrorlist; \ + [ -f /etc/pacman.d/endeavouros-mirrorlist ] && rate-mirrors --disable-comments-in-file --protocol=https endeavouros | sudo tee /etc/pacman.d/endeavouros-mirrorlist; \ + [ -f /etc/pacman.d/chaotic-mirrorlist ] && rate-mirrors --disable-comments-in-file --protocol=https chaotic-aur | sudo tee /etc/pacman.d/chaotic-mirrorlist; \ ua-drop-caches; yay -Syyu --noconfirm' diff --git a/distros/debian.aliases b/distros/debian.aliases index b3ba59b..b4fc596 100644 --- a/distros/debian.aliases +++ b/distros/debian.aliases @@ -2,7 +2,7 @@ alias sudo='sudo -E -H ' alias e='sudo systemctl --failed --no-pager; sudo journalctl -p 3 -b' alias cls='clear' -alias u='sudo apt update && sudo apt full-upgrade; command -v flatpak &> /dev/null && flatpak update; command -v snap &> /dev/null && sudo snap refresh; command -v pipx &> /dev/null && pipx upgrade-all' +alias u='sudo apt update && sudo apt full-upgrade; command -v flatpak >/dev/null 2>&1 && flatpak update; command -v snap >/dev/null 2>&1 && sudo snap refresh; command -v pipx >/dev/null 2>&1 && pipx upgrade-all' alias uu='sudo nala update && sudo nala upgrade' alias i='sudo apt install' alias ii='sudo nala install' @@ -15,8 +15,8 @@ alias b='apt list --installed | cut -d'/' -f1 | uniq > pkglist.txt' alias c='sudo apt autoremove && sudo apt autopurge && sudo apt clean' alias cc='sudo nala autoremove && sudo nala autopurge && sudo nala clean' alias x='exit' -command -v gnome-text-editor &> /dev/null && alias {gte,gted}='gnome-text-editor' -if command -v fastfetch &> /dev/null; then +command -v gnome-text-editor >/dev/null 2>&1 && alias gte='gnome-text-editor' && alias gted='gnome-text-editor' +if command -v fastfetch >/dev/null 2>&1; then alias neofetch='fastfetch' else alias fastfetch='neofetch' diff --git a/distros/fedora.aliases b/distros/fedora.aliases index 18e618c..594896a 100644 --- a/distros/fedora.aliases +++ b/distros/fedora.aliases @@ -2,7 +2,7 @@ alias sudo='sudo -E -H ' alias e='sudo systemctl --failed --no-pager; sudo journalctl -p 3 -b' alias cls='clear' -alias u='sudo dnf update --refresh; command -v flatpak &> /dev/null && flatpak update; command -v snap &> /dev/null && sudo snap refresh; command -v pipx &> /dev/null && pipx upgrade-all' +alias u='sudo dnf update --refresh; command -v flatpak >/dev/null 2>&1 && flatpak update; command -v snap >/dev/null 2>&1 && sudo snap refresh; command -v pipx >/dev/null 2>&1 && pipx upgrade-all' #alias uu='sudo dnf update --refresh' alias i='sudo dnf install' #alias ii='sudo dnf install' @@ -15,8 +15,8 @@ alias b='dnf list installed > pkglist.txt' alias c='sudo dnf clean all' alias cc='sudo dnf autoremove $(dnf repoquery --installonly --latest-limit=-1 -q)' alias x='exit' -command -v gnome-text-editor &> /dev/null && alias {gte,gted}='gnome-text-editor' -if command -v fastfetch &> /dev/null; then +command -v gnome-text-editor >/dev/null 2>&1 && alias gte='gnome-text-editor' && alias gted='gnome-text-editor' +if command -v fastfetch >/dev/null 2>&1; then alias neofetch='fastfetch' else alias fastfetch='neofetch' diff --git a/distros/opensuse.aliases b/distros/opensuse.aliases index 9913353..84dad38 100644 --- a/distros/opensuse.aliases +++ b/distros/opensuse.aliases @@ -2,7 +2,7 @@ alias sudo='sudo -E -H ' alias e='sudo systemctl --failed --no-pager; sudo journalctl -p 3 -b' alias cls='clear' -alias u='sudo zypper refresh && sudo zypper dup --allow-vendor-change; command -v flatpak &> /dev/null && flatpak update; command -v snap &> /dev/null && sudo snap refresh; command -v pipx &> /dev/null && pipx upgrade-all' +alias u='sudo zypper refresh && sudo zypper dup --allow-vendor-change; command -v flatpak >/dev/null 2>&1 && flatpak update; command -v snap >/dev/null 2>&1 && sudo snap refresh; command -v pipx >/dev/null 2>&1 && pipx upgrade-all' alias uu='sudo zypperoni ref && sudo zypperoni dup --allow-vendor-change' alias zu='(curl https://raw.githubusercontent.com/pavinjosdev/zypperoni/main/zypperoni | sudo tee /usr/bin/zypperoni > /dev/null) && sudo chmod 755 /usr/bin/zypperoni' alias i='sudo zypper install' @@ -16,8 +16,8 @@ alias b='zypper search --installed-only > pkglist.txt' alias c='zypper packages --orphaned && sudo zypper clean --all' alias cc='sudo zypper purge-kernels' alias x='exit' -command -v gnome-text-editor &> /dev/null && alias {gte,gted}='gnome-text-editor' -if command -v fastfetch &> /dev/null; then +command -v gnome-text-editor >/dev/null 2>&1 && alias gte='gnome-text-editor' && alias gted='gnome-text-editor' +if command -v fastfetch >/dev/null 2>&1; then alias neofetch='fastfetch' else alias fastfetch='neofetch' diff --git a/home/.bashrc b/home/.bashrc index 0f6dc8b..dbcfdf2 100644 --- a/home/.bashrc +++ b/home/.bashrc @@ -7,7 +7,7 @@ export SYSTEMD_PAGER= export PATH="$PATH:~/.local/bin" # My aliiases -[[ -f ~/.aliases ]] && . ~/.aliases +[ -f ~/.aliases ] && . ~/.aliases # Cool shell prompt -command -v starship &> /dev/null && eval "$(starship init bash)" +command -v starship >/dev/null 2>&1 && eval "$(starship init bash)" From 2de6e9db10456e7c4e64c33f875ea28851d883c5 Mon Sep 17 00:00:00 2001 From: Krish G <2088089+krish-gh@users.noreply.github.com> Date: Sun, 22 Feb 2026 01:28:23 +0530 Subject: [PATCH 12/18] updated --- desktop/gnome.sh | 2 +- scripts/setup-main.sh | 15 +++++++-------- setup.sh | 1 - 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/desktop/gnome.sh b/desktop/gnome.sh index 911166c..366d69f 100644 --- a/desktop/gnome.sh +++ b/desktop/gnome.sh @@ -8,7 +8,7 @@ setup_gnome() { printf 'Installing some extensions...\n' if command_exists flatpak; then - eval "$FLATPAK_INSTALL_CMD" com.mattjakeman.ExtensionManager || printf 'Warning: Failed to install extension manager\n' >&2 + sh -c "$FLATPAK_INSTALL_CMD com.mattjakeman.ExtensionManager" || printf 'Warning: Failed to install extension manager\n' >&2 else install_pkgs "$GNOME_EXT_MGR_PKG" fi diff --git a/scripts/setup-main.sh b/scripts/setup-main.sh index 27f65c9..8f4acc2 100644 --- a/scripts/setup-main.sh +++ b/scripts/setup-main.sh @@ -1,5 +1,4 @@ #!/bin/sh -set -o pipefail scriptDir=$(cd -- "$(dirname -- "$0")" && pwd) || { printf 'Failed to determine script directory\n' >&2; exit 1; } repoDir="$(dirname "$scriptDir")" @@ -57,7 +56,7 @@ if [ -f /etc/os-release ]; then DIST_ID="${ID:-}" fi -DESKTOP=$(printf '%s\n' "${XDG_CURRENT_DESKTOP##*:}" | tr '[:upper:]' '[:lower:]' | sed 's/^x-//') +DESKTOP=$(printf '%s\n' "$XDG_CURRENT_DESKTOP" | sed 's/.*://; s/^x-//; y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/') CURRENT_TERMINAL=$(ps -p "$PPID" -o comm= | sed 's/-$//') printf '#################################################################\n' @@ -129,13 +128,13 @@ copy_content() { } refresh_package_sources() { - eval "$REFRESH_CMD" || { printf 'Error refreshing package sources\n' >&2; return 1; } + sh -c "$REFRESH_CMD" || { printf 'Error refreshing package sources\n' >&2; return 1; } } update_packages() { - eval "$UPDATE_CMD" || { printf 'Error updating packages\n' >&2; return 1; } + sh -c "$UPDATE_CMD" || { printf 'Error updating packages\n' >&2; return 1; } if command_exists flatpak; then - eval "$FLATPAK_UPDATE_CMD" || printf 'Warning: flatpak update failed\n' >&2 + sh -c "$FLATPAK_UPDATE_CMD" || printf 'Warning: flatpak update failed\n' >&2 fi } @@ -143,21 +142,21 @@ install_pkgs() { # Install packages one by one to avoid aborting on individual failures # Use word splitting instead of bash arrays for POSIX compatibility for pkg in $1; do - eval "$INSTALL_CMD $pkg" || printf 'Warning: Failed to install %s\n' "$pkg" >&2 + sh -c "$INSTALL_CMD $pkg" || printf 'Warning: Failed to install %s\n' "$pkg" >&2 done } uninstall_pkgs() { # Uninstall packages one by one to avoid aborting on individual failures for pkg in $1; do - eval "$UNINSTALL_CMD $pkg" || printf 'Warning: Failed to uninstall %s\n' "$pkg" >&2 + sh -c "$UNINSTALL_CMD $pkg" || printf 'Warning: Failed to uninstall %s\n' "$pkg" >&2 done } uninstall_only_pkgs() { # Uninstall packages (without dependencies) one by one to avoid aborting on individual failures for pkg in $1; do - eval "$UNINSTALL_ONLY_CMD $pkg" || printf 'Warning: Failed to uninstall %s\n' "$pkg" >&2 + sh -c "$UNINSTALL_ONLY_CMD $pkg" || printf 'Warning: Failed to uninstall %s\n' "$pkg" >&2 done } diff --git a/setup.sh b/setup.sh index 63f5488..3fa3dd7 100644 --- a/setup.sh +++ b/setup.sh @@ -1,5 +1,4 @@ #!/bin/sh -set -o pipefail timestamp=$(date '+%Y-%m-%d-%H:%M:%S') scriptDir=$(cd -- "$(dirname -- "$0")" && pwd) || { printf 'Error: Failed to determine script directory\n' >&2; exit 1; } From 386077a47e1d3aabacf45ef6798d636c7d7ea2be Mon Sep 17 00:00:00 2001 From: Krish G <2088089+krish-gh@users.noreply.github.com> Date: Sun, 22 Feb 2026 09:11:13 +0530 Subject: [PATCH 13/18] updated --- README.md | 163 +++++++++++++++++++++++++++++++----------------------- 1 file changed, 93 insertions(+), 70 deletions(-) diff --git a/README.md b/README.md index 6d1063b..fc8000a 100644 --- a/README.md +++ b/README.md @@ -30,25 +30,21 @@ This project emphasizes reliability and security: ## Prerequisites -- A supported Linux distribution (see [Supported Scenarios](#supported-scenario)) +- A supported Linux distribution (see [Supported Scenarios](#supported-scenarios)) - Sudo access for system-level configuration - Internet connection to download packages and resources - `curl` command-line tool (required) -## Supported scenario +## Supported Scenarios -> **_NOTE:_** KDE's config system is all over the places and many things are only possible from UI. So, I could automate only few things. That's one of the reasons I don't like KDE. +> **_NOTE:_** KDE Plasma configuration is complex due to its scattered configuration system. The setup automates package installation and basic theming only; many settings require manual configuration through the System Settings GUI. -| Distrution Type | Specific | Desktop Environment | -| --------------- | ----------------------- | -------------------------- | -| Arch | Arch | Gnome, KDE, Cinnamon, XFCE | -| | EndeavourOS | Gnome, KDE, Cinnamon | -| Debian | Debian | Gnome, XFCE | -| | Ubuntu | Gnome | -| | Mint | Cinnamon, XFCE | -| | LMDE | Cinnamon | -| Fedora | Fedora (Non-Silverblue) | Gnome, KDE, Cinnamon, XFCE | -| OpenSUSE | Tumbleweed, Leap | Gnome, KDE, Cinnamon, XFCE | +| Distribution Type | Specific Variant | Desktop Environment | +| --- | --- | --- | +| **Arch-based** | Arch Linux, EndeavourOS | GNOME, KDE, Cinnamon, XFCE | +| **Debian-based** | Debian, Ubuntu, Linux Mint, LMDE | GNOME, Cinnamon, XFCE | +| **Fedora** | Fedora (non-Silverblue) | GNOME, KDE, Cinnamon, XFCE | +| **OpenSUSE** | Tumbleweed, Leap | GNOME, KDE, Cinnamon, XFCE | ## Project Structure @@ -102,19 +98,40 @@ Distribution-specific setup and package lists. Each distro has: ### `/home` User home directory configuration files and templates: -- `.bashrc` - Bash initialization (custom functions, sourcing from .aliases) -- `.profile` - Shell login profile environment setup -- `.xinitrc` - X11 initialization (for startx) + +**Shell & X11:** +- `.bashrc` - Bash initialization with custom functions and aliases +- `.profile` - Shell login profile and environment variables +- `.xinitrc` - X11 initialization for startx - `.xprofile` - X11 session startup profile - `.xsessionrc` - X11 session configuration -- `.Xresources` - X11 resource database (font DPI, colors, etc.) -- `.config/` - Desktop environment and application configs -- `.local/` - User-local binaries and data files -- `.config/fontconfig/fonts.conf` - Font rendering configuration -- `.config/nano/nanorc` - Nano editor configuration -- `.config/alacritty/alacritty.toml` - Alacritty terminal emulator config -- `.config/kitty/kitty.conf` - Kitty terminal emulator config -- `.local/share/keyrings/` - GNOME Keyring files +- `.Xresources` - X11 resource database (font DPI, colors) + +**Terminal Emulators:** +- `.config/alacritty/alacritty.toml` - Alacritty terminal configuration and themes +- `.config/kitty/kitty.conf` - Kitty terminal configuration +- `.config/wezterm/wezterm.lua` - WezTerm terminal configuration (Lua-based) + +**System & App Configs:** +- `.config/fontconfig/fonts.conf` - Font rendering and hinting configuration +- `.config/nano/nanorc` - Nano editor configuration with syntax highlighting +- `.config/fastfetch/config.jsonc` - System info display configuration +- `.config/mimeapps.list` - Default applications for file types +- `.config/xfce4/` - XFCE-specific panel and window manager settings +- `.config/Kvantum/` - KDE Qt application theming +- `.config/qt5ct/` & `.config/qt6ct/` - Qt5/Qt6 theme configuration +- `.config/vlc/` - VLC media player preferences +- `.config/environment.d/` - User environment variables +- `.config/systemd/` - User systemd service configurations + +**Application Flags:** +- `.config/chrome-flags.conf`, `.config/chromium-flags.conf` - Chromium-based browser flags +- `.config/code-flags.conf` - Visual Studio Code startup flags +- `.config/electron-flags.conf` - Electron application flags +- `.config/microsoft-edge-stable-flags.conf` - Microsoft Edge flags + +**User Data:** +- `.local/share/keyrings/` - GNOME Keyring files and SSH key storage ### `/specific` Fine-grained, distro-version specific configurations: @@ -126,17 +143,17 @@ Fine-grained, distro-version specific configurations: - `neon.sh` - KDE Neon-specific setup hooks ### `/system` -System-level configuration files (require sudo): +System-level configuration files for machine-wide settings (require sudo to apply): -**Kernel and System Parameters:** -- `etc/sysctl.d/999-sysctl.conf` - Kernel parameters (network, memory, security) +**Kernel and Sysctl Parameters:** +- `etc/sysctl.d/999-sysctl.conf` - Kernel tuning (network performance, memory management, security hardening) **Systemd Services:** -- `etc/systemd/journald.conf.d/00-journal-size.conf` - Journal size and retention policy -- `etc/systemd/coredump.conf.d/custom.conf` - Core dump handling configuration +- `etc/systemd/journald.conf.d/00-journal-size.conf` - Journal storage policy and size limits +- `etc/systemd/coredump.conf.d/custom.conf` - Core dump handling and storage configuration -**Display Manager:** -- `etc/dconf/db/gdm.d/95-gdm-settings` - GNOME Display Manager (GDM) login screen settings +**Display Manager (GNOME GDM):** +- `etc/dconf/db/gdm.d/95-gdm-settings` - Login screen appearance and behavior (currently commented out in main setup) ## Customization @@ -144,72 +161,78 @@ System-level configuration files (require sudo): To customize which packages are installed/removed: -1. **For your specific distribution**, edit `/distros/{arch,debian,fedora,opensuse}.sh`: - - Modify `*_PACKAGES_TO_INSTALL` variables to add/remove packages - - Update `UNINSTALL_CMD` options for removal behavior +1. **General distribution packages** - Edit `/distros/{arch,debian,fedora,opensuse}.sh`: + - Modify category variables like `*_PACKAGES_TO_INSTALL` to add/remove packages + - Adjust package manager command options in `INSTALL_CMD`, `REMOVE_CMD`, etc. -2. **For debloating**, edit `/debloat/{arch,debian,fedora,opensuse}.txt`: - - Add or remove one package name per line - - Comment out lines starting with `#` to skip removal +2. **Debloat lists** - Edit `/debloat/{arch,debian,fedora,opensuse}.txt`: + - One package name per line to remove during setup + - Prefix with `#` to comment out and skip removal of specific packages -3. **For your specific distro version**, edit `/specific/{arch,debian,ubuntu,linuxmint,neon}.sh`: - - Add distro-specific hooks and configurations - - Override variables from `/distros` scripts if needed +3. **Version-specific configurations** - Edit `/specific/{arch,debian,ubuntu,linuxmint,neon}.sh`: + - Add distro-variant hooks before or after main installation + - Override or append to variables from `/distros` for custom behavior ### Customizing Desktop Environment Settings Edit the relevant dconf file in `/desktop/`: -- **GNOME**: Modify `gnome.dconf` (keybindings, schema settings, appearance) -- **XFCE**: Modify `xfce.dconf` (panel, window manager, workspace) -- **Cinnamon**: Modify `cinnamon.dconf` (animations, themes, effects) -- **Common**: Modify `common.dconf` (settings applied to all DEs) +- **GNOME**: Modify `gnome.dconf` for keybindings, workspaces, appearance, and extensions +- **XFCE**: Modify `xfce.dconf` for panel layout, window manager behavior, and workspaces +- **Cinnamon**: Modify `cinnamon.dconf` for animations, panel settings, and theme effects +- **KDE**: `kde.sh` handles automatable settings (KDE config is mostly UI-driven) +- **Common**: Modify `common.dconf` for settings applied across all desktop environments +- **GNOME Terminal**: Edit `gterm.dconf` for color schemes and terminal appearance +- **Linux Mint**: Edit `linuxmint.dconf` for Mint-specific settings -DConf files use a simple key=value format. See [DConf documentation](https://wiki.gnome.org/Projects/dconf) for details. +DConf files use `key=value` format (one setting per line). See [DConf documentation](https://wiki.gnome.org/Projects/dconf) for schema details and valid value types. ### Terminal Emulator Configuration -Configure terminal theme and appearance: +Configure your preferred terminal emulator: -- **Alacritty** (`.config/alacritty/alacritty.toml`): Edit for font, colors, padding -- **Kitty** (`.config/kitty/kitty.conf`): Edit for font, opacity, keybindings -- **WezTerm** (`.config/wezterm/wezterm.lua`): Configure with Lua scripting +- **Alacritty** (`.config/alacritty/alacritty.toml`): TOML format for font, colors, window padding, and opacity +- **Kitty** (`.config/kitty/kitty.conf`): INI format for fonts, keybindings, colors, and transparency +- **WezTerm** (`.config/wezterm/wezterm.lua`): Lua scripting for full terminal customization -Themes are downloaded from upstream projects (Catppuccin by default). +Color themes are automatically downloaded from upstream projects (Catppuccin Mocha by default). Customize fonts, enable ligatures, and adjust colors by editing the appropriate config file. ### Shell Aliases and Functions -Customize `/distros/{distro}.aliases` to add your own shell aliases sourced at login. +Distribution-specific aliases are defined in `/distros/{distro}.aliases` and automatically sourced by `.bashrc`. Add your own custom aliases to these files or directly to `.bashrc`. ## Logging and Debugging -The setup script creates a log file in your home directory for each run: -``` -~/setup-2026-02-21-14:30:45.log -``` - -View the log: +**Log File Location:** Each run creates a timestamped log in your home directory: ```bash -cat ~/setup-*.log -tail -f ~/setup-*.log # Follow in real-time +ls -la ~/setup-*.log # List all setup logs +cat ~/setup-*.log # View latest log +tail -100 ~/setup-*.log # View last 100 lines +tail -f ~/setup-*.log # Follow in real-time (for actively running setup) ``` -**Error Handling**: The script logs warnings for non-critical failures and continues execution. Check the log file to see if any operations failed. The setup log is timestamped so you can keep history of multiple runs. +**Error Handling:** The script: +- Logs all warnings and non-critical failures without stopping the setup +- Continues executing subsequent steps even if some operations fail +- Timestamps logs so you can compare multiple runs and track changes over time +- Check the log file if unexpected behavior occurs or if some packages didn't install ## Notes and Limitations -- **KDE Plasma**: KDE's configuration system is complex and mostly UI-driven. The automation covers basic packages and themes only. Manual configuration of many settings is still required. -- **GDM Configuration**: Commented out in the main setup—uncomment `/desktop/gnome.sh` if you need to customize the login screen. -- **Wayland/Xorg**: The script detects your current session; some settings may not apply if switching between Wayland and Xorg. -- **Error Recovery**: Some operations may fail gracefully (logged as warnings) and continue; check the setup log for details. -- **Package Availability**: Not all packages may be available in every distribution version; installation failures are logged but don't halt the setup. +- **KDE Plasma**: KDE's configuration is mostly UI-driven (`~/.config/kdedefaults/`). Automation handles only packages, themes, and a few key settings. Many customizations require manual configuration through the System Settings GUI. +- **GDM Login Screen**: GNOME Display Manager configuration is intentionally commented out in the main setup. Uncomment the relevant section in `setup-main.sh` if you want to customize the login screen. +- **Wayland vs Xorg**: The script auto-detects your session type. Some settings (especially DE-specific dconf values) may not apply correctly when switching between Wayland and Xorg—re-run the setup after switching. +- **Error Recovery**: Non-critical failures are logged as warnings and don't stop the setup. Check the setup log to identify which operations failed. +- **Package Availability**: Package availability varies across distro versions. Installation failures are logged but ignore; the setup continues with remaining packages. +- **File Conflicts**: If customization files exist before setup, they may be overwritten. Back up important configs in `.config/` before running the setup. ## Requirements -- **Supported Distributions**: Arch, Debian, Fedora, OpenSUSE (and their derivatives) -- **Sudo Access**: Required for system-level configuration -- **Internet Connection**: Needed for downloading packages and resources -- **curl**: Required for downloading remote files -- **jq**: JSON parser (installed during setup if not present) +- **Supported Distributions**: Arch, Debian, Fedora, OpenSUSE (and official derivatives) +- **Sudo Access**: Required for system-level package installation and configuration +- **Internet Connection**: Essential for downloading packages, themes, and fonts +- **curl**: Command-line tool for downloading remote scripts and packages +- **jq**: JSON query tool (auto-installed during setup if missing) +- **bash or sh**: POSIX-compatible shell (script is compatible with both) ## License From 08fbdf5064afb2f9320711c55edfa16cea69e3a4 Mon Sep 17 00:00:00 2001 From: Krish G <2088089+krish-gh@users.noreply.github.com> Date: Mon, 23 Feb 2026 00:00:06 +0530 Subject: [PATCH 14/18] Refactor setup scripts --- desktop/gnome.sh | 2 +- scripts/setup-main.sh | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/desktop/gnome.sh b/desktop/gnome.sh index 366d69f..e46e8a6 100644 --- a/desktop/gnome.sh +++ b/desktop/gnome.sh @@ -56,7 +56,7 @@ setup_gnome() { set_gnome_wallpaper() { # Set both light and dark wallpaper - local wallpaper_uri="file://$1" + wallpaper_uri="file://$1" gsettings set org.gnome.desktop.background picture-uri "$wallpaper_uri" 2>/dev/null || true gsettings set org.gnome.desktop.background picture-uri-dark "$wallpaper_uri" 2>/dev/null || true } diff --git a/scripts/setup-main.sh b/scripts/setup-main.sh index 8f4acc2..124ad2b 100644 --- a/scripts/setup-main.sh +++ b/scripts/setup-main.sh @@ -329,7 +329,9 @@ setup_terminal() { mkdir -p ~/.config/nano copy_file ~/.config/nano/nanorc "${BASE_REPO_LOCATION}home/.config/nano/nanorc" || true if [ -d /usr/share/nano-syntax-highlighting/ ]; then - append_if_missing ~/.config/nano/nanorc "nano-syntax-highlighting" "include \"/usr/share/nano-syntax-highlighting/*.nanorc\"" + if ! grep -q "nano-syntax-highlighting" ~/.config/nano/nanorc 2>/dev/null; then + printf '%s\n' 'include "/usr/share/nano-syntax-highlighting/*.nanorc"' >> ~/.config/nano/nanorc + fi fi # if fastfetch not found at this point fallback to neofetch, otherwise remove neofetch @@ -419,8 +421,10 @@ setup_common_ui() { if [ -d /etc/lightdm ]; then printf 'Configuring lightdm stuff...\n' - grep -rl greeter-hide-users /etc/lightdm /usr/share/lightdm 2>/dev/null | \ - xargs -r sudo sed_i "/greeter-hide-users=true/c\\greeter-hide-users=false" 2>/dev/null || true + lightdm_files=$(grep -rl greeter-hide-users /etc/lightdm /usr/share/lightdm 2>/dev/null) || true + if [ -n "$lightdm_files" ]; then + printf '%s\n' "$lightdm_files" | xargs sudo sed_i "/greeter-hide-users=true/c\\greeter-hide-users=false" 2>/dev/null || true + fi fi } From adf219f411526d7fcf15b6eb8c19493abee1ad82 Mon Sep 17 00:00:00 2001 From: Krish G <2088089+krish-gh@users.noreply.github.com> Date: Mon, 23 Feb 2026 00:10:02 +0530 Subject: [PATCH 15/18] Fix typos in README and update setup command in setup-guide.sh to use 'sh' instead of 'bash' --- README.md | 4 ++-- scripts/setup-guide.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index fc8000a..6f63212 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ This project emphasizes reliability and security: - **Secure Temp Files**: Uses `mktemp` for secure temporary directories with automatic cleanup via trap handlers - **Safe Quoting**: Proper variable quoting throughout to prevent word splitting and glob expansion - **Portable**: Uses `printf` instead of `echo -e` for better portability across shell implementations -- **Fail-Safe**: Non-critical failures don't halt the entire setup—the script continues gracefully +- **Fail-Safe**: Non-critical failures don't halt the entire setup--the script continues gracefully - **No eval**: Avoids dangerous `eval` for remote script execution; uses safe alternatives instead - **Validation**: All shell scripts are POSIX sh-compatible and pass strict syntax validation with `sh -n` @@ -220,7 +220,7 @@ tail -f ~/setup-*.log # Follow in real-time (for actively running se - **KDE Plasma**: KDE's configuration is mostly UI-driven (`~/.config/kdedefaults/`). Automation handles only packages, themes, and a few key settings. Many customizations require manual configuration through the System Settings GUI. - **GDM Login Screen**: GNOME Display Manager configuration is intentionally commented out in the main setup. Uncomment the relevant section in `setup-main.sh` if you want to customize the login screen. -- **Wayland vs Xorg**: The script auto-detects your session type. Some settings (especially DE-specific dconf values) may not apply correctly when switching between Wayland and Xorg—re-run the setup after switching. +- **Wayland vs Xorg**: The script auto-detects your session type. Some settings (especially DE-specific dconf values) may not apply correctly when switching between Wayland and Xorg--re-run the setup after switching. - **Error Recovery**: Non-critical failures are logged as warnings and don't stop the setup. Check the setup log to identify which operations failed. - **Package Availability**: Package availability varies across distro versions. Installation failures are logged but ignore; the setup continues with remaining packages. - **File Conflicts**: If customization files exist before setup, they may be overwritten. Back up important configs in `.config/` before running the setup. diff --git a/scripts/setup-guide.sh b/scripts/setup-guide.sh index c425604..36ee0f4 100644 --- a/scripts/setup-guide.sh +++ b/scripts/setup-guide.sh @@ -2,7 +2,7 @@ # This is example documentation - shellcheck not applied ## option #1 -curl -fsSL https://raw.githubusercontent.com/krish-gh/linux-setup/main/setup.sh | bash +curl -fsSL https://raw.githubusercontent.com/krish-gh/linux-setup/main/setup.sh | sh ## option #2 git clone https://github.com/krish-gh/linux-setup.git && From df467d9f2eda8bf446b5c1b75e0349142a4e2cd5 Mon Sep 17 00:00:00 2001 From: Krish G <2088089+krish-gh@users.noreply.github.com> Date: Mon, 23 Feb 2026 00:21:53 +0530 Subject: [PATCH 16/18] Refactor package installation lists in various distro scripts for clarity and consistency, and update directory creation commands in setup scripts to use explicit paths. --- desktop/xfce.sh | 2 +- distros/arch.sh | 14 +++++++------- distros/debian.sh | 14 +++++++------- distros/fedora.sh | 18 +++++++++--------- distros/opensuse.sh | 14 +++++++------- scripts/setup-main.sh | 16 +++++++++------- 6 files changed, 40 insertions(+), 38 deletions(-) diff --git a/desktop/xfce.sh b/desktop/xfce.sh index fb51c0b..a1c712d 100644 --- a/desktop/xfce.sh +++ b/desktop/xfce.sh @@ -74,7 +74,7 @@ setup_xfce_panel() { xfce4-panel --quit pkill xfconfd rm -rf ~/.config/xfce4/panel/launcher-* - mkdir -p ~/.config/xfce4/panel/launcher-{2,3,4,5} + mkdir -p ~/.config/xfce4/panel/launcher-2 ~/.config/xfce4/panel/launcher-3 ~/.config/xfce4/panel/launcher-4 ~/.config/xfce4/panel/launcher-5 copy_file ~/.config/xfce4/panel/launcher-2/FileManager.desktop "${BASE_REPO_LOCATION}home/.config/xfce4/panel/launcher-2/FileManager.desktop" copy_file ~/.config/xfce4/panel/launcher-3/TextEditor.desktop "${BASE_REPO_LOCATION}home/.config/xfce4/panel/launcher-3/TextEditor.desktop" copy_file ~/.config/xfce4/panel/launcher-4/TerminalEmulator.desktop "${BASE_REPO_LOCATION}home/.config/xfce4/panel/launcher-4/TerminalEmulator.desktop" diff --git a/distros/arch.sh b/distros/arch.sh index 0c8710b..709dd04 100644 --- a/distros/arch.sh +++ b/distros/arch.sh @@ -18,23 +18,23 @@ sed_i() { } REQUIREMENTS="curl wget unzip xorg-xrdb dconf jq crudini" -SYSTEM_PACKAGES_TO_INSTALL="fwupd vulkan-{mesa-layers,swrast,icd-loader} alsa-{firmware,ucm-conf} sof-firmware fprintd power-profiles-daemon" +SYSTEM_PACKAGES_TO_INSTALL="fwupd vulkan-mesa-layers vulkan-swrast vulkan-icd-loader alsa-firmware alsa-ucm-conf sof-firmware fprintd power-profiles-daemon" INTEL_PACKAGES_TO_INSTALL="intel-media-driver vulkan-intel" VMWARE_PACKAGES_TO_INSTALL="gtkmm gtkmm3 open-vm-tools" VBOX_PACKAGES_TO_INSTALL="virtualbox-guest-utils" HYPERV_PACKAGES_TO_INSTALL="hyperv" VIRT_PACKAGES_TO_INSTALL="qemu-guest-agent" -FONTS_TO_INSTALL="noto-fonts{,-emoji} ttf-{liberation,dejavu,droid,roboto,ubuntu-font-family,jetbrains-mono-nerd}" +FONTS_TO_INSTALL="noto-fonts noto-fonts-emoji ttf-liberation ttf-dejavu ttf-droid ttf-roboto ttf-ubuntu-font-family ttf-jetbrains-mono-nerd" TERM_PACKAGES_TO_INSTALL="bash-completion nano-syntax-highlighting starship fastfetch" -APP_PACKAGES_TO_INSTALL="pacman-contrib firefox{,-i18n-en-gb,-i18n-en-us} gnome-keyring seahorse vlc onboard yay rate-mirrors reflector-simple" +APP_PACKAGES_TO_INSTALL="pacman-contrib firefox firefox-i18n-en-gb firefox-i18n-en-us gnome-keyring seahorse vlc onboard yay rate-mirrors reflector-simple" DEV_PACKAGES_TO_INSTALL="git base-devel python-pip shfmt diffutils meld github-cli visual-studio-code-bin" GTK_PACKAGES_TO_INSTALL="xdg-desktop-portal-gtk gnome-themes-extra" -QT_PACKAGES_TO_INSTALL="qt{5,6}-wayland" -QT_PATCHES_TO_INSTALL="kvantum-qt5 qt{5,6}ct" -GNOME_PACKAGES_TO_INSTALL="gnome-{menus,tweaks,terminal,text-editor} evolution-data-server python-nautilus python-pipx $QT_PATCHES_TO_INSTALL" +QT_PACKAGES_TO_INSTALL="qt5-wayland qt6-wayland" +QT_PATCHES_TO_INSTALL="kvantum-qt5 qt5ct qt6ct" +GNOME_PACKAGES_TO_INSTALL="gnome-menus gnome-tweaks gnome-terminal gnome-text-editor evolution-data-server python-nautilus python-pipx $QT_PATCHES_TO_INSTALL" GNOME_EXT_MGR_PKG="extension-manager" KDE_PACKAGES_TO_INSTALL="plasma-meta gwenview kcalc kfind kwrite okular spectacle" -CINNAMON_PACKAGES_TO_INSTALL="x-apps nemo-emblems nemo-fileroller nemo-preview nemo-python xviewer{,-plugins} mint-{themes,y-icons} $QT_PATCHES_TO_INSTALL" +CINNAMON_PACKAGES_TO_INSTALL="x-apps nemo-emblems nemo-fileroller nemo-preview nemo-python xviewer xviewer-plugins mint-themes mint-y-icons $QT_PATCHES_TO_INSTALL" XFCE_PACKAGES_TO_INSTALL="xfce4 xfce4-whiskermenu-plugin xfce4-clipman-plugin xfce4-screenshooter xfce4-taskmanager light-locker lightdm-slick-greeter lightdm-settings $QT_PATCHES_TO_INSTALL" XFCE_MENU_LOGO="distributor-logo-archlinux" PACKAGES_TO_REMOVE="" diff --git a/distros/debian.sh b/distros/debian.sh index 4c6ec5c..70b92af 100644 --- a/distros/debian.sh +++ b/distros/debian.sh @@ -7,23 +7,23 @@ UNINSTALL_CMD="sudo apt-get purge --ignore-missing --auto-remove -y" UNINSTALL_ONLY_CMD="sudo apt-get purge --ignore-missing -y" REQUIREMENTS="curl wget unzip dconf-cli jq crudini" -SYSTEM_PACKAGES_TO_INSTALL="fwupd mesa-vulkan-drivers alsa-{firmware-loaders,ucm-conf} firmware-sof-signed fprintd libpam-fprintd power-profiles-daemon" +SYSTEM_PACKAGES_TO_INSTALL="fwupd mesa-vulkan-drivers alsa-firmware-loaders alsa-ucm-conf firmware-sof-signed fprintd libpam-fprintd power-profiles-daemon" INTEL_PACKAGES_TO_INSTALL="intel-media-va-driver-non-free va-driver-all" VMWARE_PACKAGES_TO_INSTALL="open-vm-tools-desktop" VBOX_PACKAGES_TO_INSTALL="virtualbox-guest-x11" HYPERV_PACKAGES_TO_INSTALL="hyperv-daemons" VIRT_PACKAGES_TO_INSTALL="qemu-guest-agent" -FONTS_TO_INSTALL="fonts-{recommended,noto-core,noto-ui-core,noto-color-emoji,jetbrains-mono}" +FONTS_TO_INSTALL="fonts-recommended fonts-noto-core fonts-noto-ui-core fonts-noto-color-emoji fonts-jetbrains-mono" TERM_PACKAGES_TO_INSTALL="bash-completion nano starship fastfetch" -APP_PACKAGES_TO_INSTALL="firefox{,-locale-en*,-l10n-en*} w{american,british} gnome-keyring seahorse vlc onboard" +APP_PACKAGES_TO_INSTALL="firefox firefox-locale-en-gb firefox-locale-en-us firefox-l10n-en-gb firefox-l10n-en-us wamerican wbritish gnome-keyring seahorse vlc onboard" DEV_PACKAGES_TO_INSTALL="git build-essential python3-pip shfmt diffutils meld gh code" -GTK_PACKAGES_TO_INSTALL="xdg-desktop-portal-gtk gnome-themes-extra{,-data}" +GTK_PACKAGES_TO_INSTALL="xdg-desktop-portal-gtk gnome-themes-extra gnome-themes-extra-data" QT_PACKAGES_TO_INSTALL="qtwayland5 qt6-wayland" -QT_PATCHES_TO_INSTALL="qt{5,6}-style-kvantum{,-themes} qt{5,6}ct" -GNOME_PACKAGES_TO_INSTALL="gnome-{menus,tweaks,terminal,text-editor} evolution-data-server python3-nautilus pipx $QT_PATCHES_TO_INSTALL" +QT_PATCHES_TO_INSTALL="qt5-style-kvantum qt5-style-kvantum-themes qt6-style-kvantum qt6-style-kvantum-themes qt5ct qt6ct" +GNOME_PACKAGES_TO_INSTALL="gnome-menus gnome-tweaks gnome-terminal gnome-text-editor evolution-data-server python3-nautilus pipx $QT_PATCHES_TO_INSTALL" GNOME_EXT_MGR_PKG="gnome-shell-extension-manager" KDE_PACKAGES_TO_INSTALL="kde-plasma-desktop gwenview kcalc kfind kwrite okular kde-spectacle" -CINNAMON_PACKAGES_TO_INSTALL="xed xreader xviewer{,-plugins} mint-{themes,y-icons} $QT_PATCHES_TO_INSTALL" +CINNAMON_PACKAGES_TO_INSTALL="xed xreader xviewer xviewer-plugins mint-themes mint-y-icons $QT_PATCHES_TO_INSTALL" XFCE_PACKAGES_TO_INSTALL="xfce4 xfce4-whiskermenu-plugin xfce4-clipman-plugin xfce4-screenshooter xfce4-taskmanager light-locker slick-greeter $QT_PATCHES_TO_INSTALL" XFCE_MENU_LOGO="distributor-logo-debian" PACKAGES_TO_REMOVE="" diff --git a/distros/fedora.sh b/distros/fedora.sh index f3136f6..19cb8dc 100644 --- a/distros/fedora.sh +++ b/distros/fedora.sh @@ -20,23 +20,23 @@ sed_i() { FLATPAK_INSTALL_CMD="flatpak install --user --assumeyes flathub" REQUIREMENTS="curl wget2-wget unzip xrdb dconf jq crudini" -SYSTEM_PACKAGES_TO_INSTALL="fwupd-efi fuse mesa-vulkan-drivers vulkan-loader alsa-{firmware,ucm,sof-firmware} fprintd fprintd-pam power-profiles-daemon" +SYSTEM_PACKAGES_TO_INSTALL="fwupd-efi fuse mesa-vulkan-drivers vulkan-loader alsa-firmware alsa-ucm alsa-sof-firmware fprintd fprintd-pam power-profiles-daemon" INTEL_PACKAGES_TO_INSTALL="intel-media-driver" VMWARE_PACKAGES_TO_INSTALL="open-vm-tools-desktop" VBOX_PACKAGES_TO_INSTALL="virtualbox-guest-additions" -HYPERV_PACKAGES_TO_INSTALL="hyperv-{daemons,tools}" +HYPERV_PACKAGES_TO_INSTALL="hyperv-daemons hyperv-tools" VIRT_PACKAGES_TO_INSTALL="qemu-guest-agent" -FONTS_TO_INSTALL="{liberation,google-noto}-fonts-common google-noto-{emoji,color-emoji}-fonts jetbrains-mono-fonts" +FONTS_TO_INSTALL="liberation-fonts-common google-noto-fonts-common google-noto-emoji-fonts google-noto-color-emoji-fonts jetbrains-mono-fonts" TERM_PACKAGES_TO_INSTALL="bash-completion nano starship fastfetch" -APP_PACKAGES_TO_INSTALL="firefox{,-langpacks} mozilla-openh264 gnome-keyring seahorse vlc onboard" +APP_PACKAGES_TO_INSTALL="firefox firefox-langpacks mozilla-openh264 gnome-keyring seahorse vlc onboard" DEV_PACKAGES_TO_INSTALL="git make automake gcc gcc-c++ python3-pip shfmt diffutils meld gh code" GTK_PACKAGES_TO_INSTALL="xdg-desktop-portal-gtk gnome-themes-extra" -QT_PACKAGES_TO_INSTALL="qt{5,6}-qtwayland" -QT_PATCHES_TO_INSTALL="kvantum{,-qt5} qt{5,6}ct" -GNOME_PACKAGES_TO_INSTALL="gnome-{menus,tweaks,terminal,text-editor} evolution-data-server nautilus-python pipx $QT_PATCHES_TO_INSTALL" +QT_PACKAGES_TO_INSTALL="qt5-qtwayland qt6-qtwayland" +QT_PATCHES_TO_INSTALL="kvantum kvantum-qt5 qt5ct qt6ct" +GNOME_PACKAGES_TO_INSTALL="gnome-menus gnome-tweaks gnome-terminal gnome-text-editor evolution-data-server nautilus-python pipx $QT_PATCHES_TO_INSTALL" GNOME_EXT_MGR_PKG="" -KDE_PACKAGES_TO_INSTALL="plasma-workspace{,-x11} gwenview kate kcalc kfind kwrite okular spectacle" -CINNAMON_PACKAGES_TO_INSTALL="xed xreader xviewer{,-plugins} nemo-emblems nemo-fileroller nemo-preview nemo-python mint-{themes,y-icons} $QT_PATCHES_TO_INSTALL" +KDE_PACKAGES_TO_INSTALL="plasma-workspace plasma-workspace-x11 gwenview kate kcalc kfind kwrite okular spectacle" +CINNAMON_PACKAGES_TO_INSTALL="xed xreader xviewer xviewer-plugins nemo-emblems nemo-fileroller nemo-preview nemo-python mint-themes mint-y-icons $QT_PATCHES_TO_INSTALL" XFCE_PACKAGES_TO_INSTALL="xfce4-whiskermenu-plugin xfce4-clipman-plugin xfce4-screenshooter xfce4-taskmanager light-locker slick-greeter $QT_PATCHES_TO_INSTALL" XFCE_MENU_LOGO="distributor-logo-fedora" PACKAGES_TO_REMOVE="" diff --git a/distros/opensuse.sh b/distros/opensuse.sh index e96633c..704d964 100644 --- a/distros/opensuse.sh +++ b/distros/opensuse.sh @@ -10,24 +10,24 @@ FLATPAK_INSTALL_CMD="sudo flatpak install --assumeyes flathub" FLATPAK_UPDATE_CMD="sudo flatpak update --assumeyes" REQUIREMENTS="curl wget unzip xrdb dconf jq crudini" -SYSTEM_PACKAGES_TO_INSTALL="fwupd Mesa-vulkan-{device-select,overlay} alsa-{firmware,ucm-conf} sof-firmware fprintd fprintd-pam power-profiles-daemon at-spi2-core" +SYSTEM_PACKAGES_TO_INSTALL="fwupd Mesa-vulkan-device-select Mesa-vulkan-overlay alsa-firmware alsa-ucm-conf sof-firmware fprintd fprintd-pam power-profiles-daemon at-spi2-core" INTEL_PACKAGES_TO_INSTALL="intel-media-driver" VMWARE_PACKAGES_TO_INSTALL="open-vm-tools-desktop" VBOX_PACKAGES_TO_INSTALL="virtualbox-guest-tools" HYPERV_PACKAGES_TO_INSTALL="" VIRT_PACKAGES_TO_INSTALL="qemu-guest-agent" -FONTS_TO_INSTALL="{liberation,dejavu,ubuntu}-fonts google-noto-{coloremoji,sans,serif,sans-mono}-fonts google-roboto-fonts jetbrains-mono-fonts" +FONTS_TO_INSTALL="liberation-fonts dejavu-fonts ubuntu-fonts google-noto-coloremoji-fonts google-noto-sans-fonts google-noto-serif-fonts google-noto-sans-mono-fonts google-roboto-fonts jetbrains-mono-fonts" TERM_PACKAGES_TO_INSTALL="bash-completion nano starship fastfetch" -APP_PACKAGES_TO_INSTALL="MozillaFirefox{,-translations-common} mozilla-openh264 gnome-keyring seahorse vlc onboard" +APP_PACKAGES_TO_INSTALL="MozillaFirefox MozillaFirefox-translations-common mozilla-openh264 gnome-keyring seahorse vlc onboard" DEV_PACKAGES_TO_INSTALL="git patterns-devel-base-devel_basis python3-pip shfmt diffutils meld gh" GTK_PACKAGES_TO_INSTALL="xdg-desktop-portal-gtk gnome-themes-extra" QT_PACKAGES_TO_INSTALL="qt6-wayland" -QT_PATCHES_TO_INSTALL="kvantum-{manager,qt5,qt6,themes} qt{5,6}ct" -GNOME_PACKAGES_TO_INSTALL="gnome-{menus,tweaks,terminal,text-editor} evolution-data-server python3-nautilus python3-pipx $QT_PATCHES_TO_INSTALL" +QT_PATCHES_TO_INSTALL="kvantum-manager kvantum-qt5 kvantum-qt6 kvantum-themes qt5ct qt6ct" +GNOME_PACKAGES_TO_INSTALL="gnome-menus gnome-tweaks gnome-terminal gnome-text-editor evolution-data-server python3-nautilus python3-pipx $QT_PATCHES_TO_INSTALL" GNOME_EXT_MGR_PKG="extension-manager" KDE_PACKAGES_TO_INSTALL="patterns-kde-kde_plasma gwenview kcalc kfind kwrite okular spectacle" -CINNAMON_PACKAGES_TO_INSTALL="patterns-cinnamon-cinnamon{,_basis} xed xreader xviewer metatheme-mint-common mint-y-icon-theme $QT_PATCHES_TO_INSTALL" -XFCE_PACKAGES_TO_INSTALL="patterns-xfce-xfce{,_basis} xfce4-whiskermenu-plugin xfce4-clipman-plugin xfce4-screenshooter xfce4-taskmanager light-locker lightdm-slick-greeter $QT_PATCHES_TO_INSTALL" +CINNAMON_PACKAGES_TO_INSTALL="patterns-cinnamon-cinnamon patterns-cinnamon-cinnamon_basis xed xreader xviewer metatheme-mint-common mint-y-icon-theme $QT_PATCHES_TO_INSTALL" +XFCE_PACKAGES_TO_INSTALL="patterns-xfce-xfce patterns-xfce-xfce_basis xfce4-whiskermenu-plugin xfce4-clipman-plugin xfce4-screenshooter xfce4-taskmanager light-locker lightdm-slick-greeter $QT_PATCHES_TO_INSTALL" XFCE_MENU_LOGO="xfce4-button-opensuse" PACKAGES_TO_REMOVE="icewm*" diff --git a/scripts/setup-main.sh b/scripts/setup-main.sh index 124ad2b..829f069 100644 --- a/scripts/setup-main.sh +++ b/scripts/setup-main.sh @@ -219,7 +219,9 @@ setup_system() { hyperv) install_pkgs "$HYPERV_PACKAGES_TO_INSTALL" - sudo systemctl enable --now hv_{fcopy,kvp,vss}_daemon.service 2>/dev/null || true + for _svc in hv_fcopy_daemon hv_kvp_daemon hv_vss_daemon; do + sudo systemctl enable --now "${_svc}.service" 2>/dev/null || true + done ;; qemu | kvm | xen | virt) @@ -250,7 +252,7 @@ setup_system() { install_pkgs "$SYSTEM_PACKAGES_TO_INSTALL" printf 'Tweaking some system stuffs...\n' - sudo mkdir -p /etc/sysctl.d /etc/systemd/{journald.conf.d,coredump.conf.d} + sudo mkdir -p /etc/sysctl.d /etc/systemd/journald.conf.d /etc/systemd/coredump.conf.d copy_content "${BASE_REPO_LOCATION}system/etc/sysctl.d/999-sysctl.conf" | sudo tee /etc/sysctl.d/999-sysctl.conf >/dev/null copy_content "${BASE_REPO_LOCATION}system/etc/systemd/journald.conf.d/00-journal-size.conf" | sudo tee /etc/systemd/journald.conf.d/00-journal-size.conf >/dev/null sudo journalctl --rotate --vacuum-size=10M 2>/dev/null || true @@ -396,7 +398,7 @@ setup_common_ui() { rm -f "$TEMP_DIR/common.dconf" } - mkdir -p ~/.config/{gtk-3.0,gtk-4.0} + mkdir -p ~/.config/gtk-3.0 ~/.config/gtk-4.0 if [ ! -f ~/.config/gtk-3.0/settings.ini ]; then printf '[Settings]\n' > ~/.config/gtk-3.0/settings.ini printf '#gtk-application-prefer-dark-theme=true\n' >> ~/.config/gtk-3.0/settings.ini @@ -406,14 +408,14 @@ setup_common_ui() { printf 'gtk-hint-font-metrics=1\n' >> ~/.config/gtk-4.0/settings.ini fi - mkdir -p ~/.local/share/gtksourceview-{3.0,4,5}/styles + mkdir -p ~/.local/share/gtksourceview-3.0/styles ~/.local/share/gtksourceview-4/styles ~/.local/share/gtksourceview-5/styles copy_file ~/.local/share/gtksourceview-3.0/styles/mocha.xml https://raw.githubusercontent.com/catppuccin/xed/main/src/mocha.xml || true - for i in ~/.local/share/gtksourceview-{4,5}/styles; do - cp -sf ~/.local/share/gtksourceview-3.0/styles/mocha.xml "$i" 2>/dev/null || true + for _gv in ~/.local/share/gtksourceview-4/styles ~/.local/share/gtksourceview-5/styles; do + cp -sf ~/.local/share/gtksourceview-3.0/styles/mocha.xml "$_gv" 2>/dev/null || true done printf 'Setting up QT apps to look like GTK...\n' - mkdir -p ~/.config/Kvantum ~/.config/qt{5,6}ct + mkdir -p ~/.config/Kvantum ~/.config/qt5ct ~/.config/qt6ct copy_file ~/.config/Kvantum/kvantum.kvconfig "${BASE_REPO_LOCATION}home/.config/Kvantum/kvantum.kvconfig" || true for i in 5 6; do copy_file ~/.config/qt"${i}"ct/qt"${i}"ct.conf "${BASE_REPO_LOCATION}home/.config/qt${i}ct/qt${i}ct.conf" || true From b98b7e34f927d1f840d58d9e0126ecac9d5023f1 Mon Sep 17 00:00:00 2001 From: Krish G <2088089+krish-gh@users.noreply.github.com> Date: Mon, 23 Feb 2026 00:27:03 +0530 Subject: [PATCH 17/18] Remove portable sed function from xfce.sh, arch.sh, and fedora.sh for cleaner scripts --- desktop/xfce.sh | 11 ----------- distros/arch.sh | 11 ----------- distros/fedora.sh | 11 ----------- 3 files changed, 33 deletions(-) diff --git a/desktop/xfce.sh b/desktop/xfce.sh index a1c712d..c8731f4 100644 --- a/desktop/xfce.sh +++ b/desktop/xfce.sh @@ -2,17 +2,6 @@ GUI_TEXT_EDITOR=org.xfce.mousepad.desktop -# Portable sed -i that works on both GNU and BSD systems -sed_i() { - if sed --version >/dev/null 2>&1; then - # GNU sed - sed -i "$@" - else - # BSD sed requires an empty string for in-place editing - sed -i '' "$@" - fi -} - setup_xfce() { printf 'Configuring xfce stuffs...\n' install_pkgs "$XFCE_PACKAGES_TO_INSTALL" diff --git a/distros/arch.sh b/distros/arch.sh index 709dd04..0b5b8fa 100644 --- a/distros/arch.sh +++ b/distros/arch.sh @@ -6,17 +6,6 @@ INSTALL_CMD="sudo pacman -S --needed --noconfirm" UNINSTALL_CMD="sudo pacman -Rns --noconfirm" UNINSTALL_ONLY_CMD="sudo pacman -Rns --noconfirm" -# Portable sed -i that works on both GNU and BSD systems -sed_i() { - if sed --version >/dev/null 2>&1; then - # GNU sed - sed -i "$@" - else - # BSD sed requires an empty string for in-place editing - sed -i '' "$@" - fi -} - REQUIREMENTS="curl wget unzip xorg-xrdb dconf jq crudini" SYSTEM_PACKAGES_TO_INSTALL="fwupd vulkan-mesa-layers vulkan-swrast vulkan-icd-loader alsa-firmware alsa-ucm-conf sof-firmware fprintd power-profiles-daemon" INTEL_PACKAGES_TO_INSTALL="intel-media-driver vulkan-intel" diff --git a/distros/fedora.sh b/distros/fedora.sh index 19cb8dc..8828669 100644 --- a/distros/fedora.sh +++ b/distros/fedora.sh @@ -6,17 +6,6 @@ INSTALL_CMD="sudo dnf install -y" UNINSTALL_CMD="sudo dnf autoremove -y" UNINSTALL_ONLY_CMD="sudo dnf remove -y" -# Portable sed -i that works on both GNU and BSD systems -sed_i() { - if sed --version >/dev/null 2>&1; then - # GNU sed - sed -i "$@" - else - # BSD sed requires an empty string for in-place editing - sed -i '' "$@" - fi -} - FLATPAK_INSTALL_CMD="flatpak install --user --assumeyes flathub" REQUIREMENTS="curl wget2-wget unzip xrdb dconf jq crudini" From 3b21b6da9c9f3fa7f9bc91d87e0eb5b81415e8f0 Mon Sep 17 00:00:00 2001 From: Krish G <2088089+krish-gh@users.noreply.github.com> Date: Mon, 23 Feb 2026 00:37:42 +0530 Subject: [PATCH 18/18] Reintroduce portable sed function for compatibility with GNU and BSD systems --- scripts/setup-main.sh | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/scripts/setup-main.sh b/scripts/setup-main.sh index 829f069..582f802 100644 --- a/scripts/setup-main.sh +++ b/scripts/setup-main.sh @@ -12,17 +12,6 @@ command_exists() { command -v "$1" >/dev/null 2>&1 } -# Portable sed -i that works on both GNU and BSD systems -sed_i() { - if sed --version >/dev/null 2>&1; then - # GNU sed - sed -i "$@" - else - # BSD sed requires an empty string for in-place editing - sed -i '' "$@" - fi -} - DISTRO_TYPE='' PKG_MGR='' @@ -107,6 +96,18 @@ GUI_TEXT_EDITOR="" TEMP_DIR=$(mktemp -d) || { printf 'Failed to create temp directory\n' >&2; exit 1; } trap 'rm -rf "$TEMP_DIR"' EXIT +# Portable sed -i that works on both GNU and BSD systems +sed_i() { + if sed --version >/dev/null 2>&1; then + # GNU sed + sed -i "$@" + else + # BSD sed requires an empty string for in-place editing + sed -i '' "$@" + fi +} +export -f sed_i + # arg1 = destination path, arg2 = source path copy_file() { local dest="$1" src="$2"