diff --git a/startdev.sh b/startdev.sh index 5fb2f1b2b..5aad12ad8 100755 --- a/startdev.sh +++ b/startdev.sh @@ -11,32 +11,31 @@ get_latest_release() { grep -oP '"tag_name": "\K[^"]*' | head -n 1) if [ -z "$latest_release" ]; then - echo "Error fetching release data" >&2 + printf "%b\n" "Error fetching release data" >&2 return 1 fi - echo "$latest_release" + printf "%b\n" "$latest_release" } # Function to redirect to the latest pre-release version redirect_to_latest_pre_release() { - local latest_release latest_release=$(get_latest_release) if [ -n "$latest_release" ]; then url="https://github.com/ChrisTitusTech/linutil/releases/download/$latest_release/linutil" else - echo 'Unable to determine latest pre-release version.' >&2 - echo "Using latest Full Release" + printf "%b\n" 'Unable to determine latest pre-release version.' >&2 + printf "%b\n" "Using latest Full Release" url="https://github.com/ChrisTitusTech/linutil/releases/latest/download/linutil" fi addArch - echo "Using URL: $url" # Log the URL being used + printf "%b\n" "Using URL: $url" } check() { - local exit_code=$1 - local message=$2 + exit_code=$1 + message=$2 - if [ $exit_code -ne 0 ]; then + if [ "$exit_code" -ne 0 ]; then printf "%b\n" "${RED}ERROR: $message${RC}" exit 1 fi @@ -63,16 +62,16 @@ redirect_to_latest_pre_release TMPFILE=$(mktemp) check $? "Creating the temporary file" -echo "Downloading linutil from $url" # Log the download attempt -curl -fsL $url -o $TMPFILE +printf "%b\n" "Downloading linutil from $url" +curl -fsL "$url" -o "$TMPFILE" check $? "Downloading linutil" -chmod +x $TMPFILE +chmod +x "$TMPFILE" check $? "Making linutil executable" "$TMPFILE" check $? "Executing linutil" -rm -f $TMPFILE +rm -f "$TMPFILE" check $? "Deleting the temporary file" } # End of wrapping diff --git a/tabs/applications-setup/setup-flatpak.sh b/tabs/applications-setup/setup-flatpak.sh index 5a1cf60f0..66f8a8030 100644 --- a/tabs/applications-setup/setup-flatpak.sh +++ b/tabs/applications-setup/setup-flatpak.sh @@ -51,7 +51,7 @@ setup_flatpak() { if command -v flatpak >/dev/null 2>&1; then if ! flatpak remotes | grep -q "flathub"; then printf "%b\n" "${YELLOW}Detected Flatpak package manager but Flathub remote is not added. Would you like to add it? (y/n)${RC}" - read add_remote + read -r add_remote case "$add_remote" in [Yy]*) printf "%b\n" "Adding Flathub remote..." @@ -71,14 +71,14 @@ setup_flatpak() { # So in case the user wants to use a GUI siftware manager they can setup it here if [ "$DE" = "GNOME" ]; then printf "%b\n" "${YELLOW}Detected GNOME desktop environment. Would you like to install GNOME Software plugin for Flatpak? (y/n)${RC}" - read install_gnome + read -r install_gnome if [ "$install_gnome" = "y" ] || [ "$install_gnome" = "Y" ]; then "$ESCALATION_TOOL" "$PACKAGER" install -y gnome-software-plugin-flatpak fi # Useful for Debian KDE spin as well elif [ "$DE" = "KDE" ]; then printf "%b\n" "${YELLOW}Detected KDE desktop environment. Would you like to install KDE Plasma Discover backend for Flatpak? (y/n)${RC}" - read install_kde + read -r install_kde if [ "$install_kde" = "y" ] || [ "$install_kde" = "Y" ]; then "$ESCALATION_TOOL" "$PACKAGER" install -y plasma-discover-backend-flatpak fi diff --git a/tabs/system-setup/9-auto-mount.sh b/tabs/system-setup/auto-mount.sh similarity index 100% rename from tabs/system-setup/9-auto-mount.sh rename to tabs/system-setup/auto-mount.sh diff --git a/tabs/system-setup/1-compile-setup.sh b/tabs/system-setup/compile-setup.sh similarity index 100% rename from tabs/system-setup/1-compile-setup.sh rename to tabs/system-setup/compile-setup.sh diff --git a/tabs/system-setup/2-gaming-setup.sh b/tabs/system-setup/gaming-setup.sh similarity index 100% rename from tabs/system-setup/2-gaming-setup.sh rename to tabs/system-setup/gaming-setup.sh diff --git a/tabs/system-setup/3-global-theme.sh b/tabs/system-setup/global-theme.sh similarity index 100% rename from tabs/system-setup/3-global-theme.sh rename to tabs/system-setup/global-theme.sh diff --git a/tabs/system-setup/4-remove-snaps.sh b/tabs/system-setup/remove-snaps.sh similarity index 100% rename from tabs/system-setup/4-remove-snaps.sh rename to tabs/system-setup/remove-snaps.sh diff --git a/tabs/system-setup/tab_data.toml b/tabs/system-setup/tab_data.toml index 96a76664b..22612d94d 100644 --- a/tabs/system-setup/tab_data.toml +++ b/tabs/system-setup/tab_data.toml @@ -1,4 +1,5 @@ name = "System Setup" +multi_selectable = false [[data]] name = "Arch Linux" @@ -56,16 +57,16 @@ script = "fedora/virtualization.sh" [[data]] name = "Auto Mount Drive" -script = "9-auto-mount.sh" +script = "auto-mount.sh" [[data]] name = "Build Prerequisites" description = "This script is designed to handle the installation of various software dependencies across different Linux distributions" -script = "1-compile-setup.sh" +script = "compile-setup.sh" [[data]] name = "Docker Setup" -script = "6-docker-setup.sh" +script = "docker-setup.sh" [[data]] name = "Full System Cleanup" @@ -79,22 +80,22 @@ script = "system-update.sh" [[data]] name = "Gaming Dependencies" description = "This script is designed to handle the installation of gaming dependencies across different Linux distributions" -script = "2-gaming-setup.sh" +script = "gaming-setup.sh" [[data]] name = "Global Theme" description = "This script is designed to handle the installation and configuration of global theming" -script = "3-global-theme.sh" +script = "global-theme.sh" [[data]] name = "Grub Theme Setup" -script = "7-grub-theme.sh" +script = "grub-theme.sh" [[data]] name = "Remove Snaps" description = "This script is designed to remove snap" -script = "4-remove-snaps.sh" +script = "remove-snaps.sh" [[data]] name = "SSH-Samba Setup" -script = "5-samba-ssh-setup.sh" +script = "samba-ssh-setup.sh" diff --git a/tabs/utils/auto-login.sh b/tabs/utils/auto-login.sh index 59bb626b1..5437c4f88 100644 --- a/tabs/utils/auto-login.sh +++ b/tabs/utils/auto-login.sh @@ -16,7 +16,7 @@ list_sessions() { printf "%b\n" "9) i3 (i3.desktop)" printf "%b\n" "10) Custom session" printf "%b\n" "Enter your choice [1-10]: " - read session_choice + read -r session_choice case "$session_choice" in 1) session="gnome.desktop" ;; @@ -126,7 +126,7 @@ configure_or_remove_autologin() { printf "%b\n" "1) Add autologin" printf "%b\n" "2) Remove autologin" printf "%b\n" "Enter your choice [1-2]: " - read action_choice + read -r action_choice if [ "$action_choice" = "1" ]; then printf "%b\n" "Choose the display manager to configure:" @@ -135,7 +135,7 @@ configure_or_remove_autologin() { printf "%b\n" "3) SDDM" printf "%b\n" "4) LXDM" printf "%b\n" "Enter your choice [1-4]: " - read choice + read -r choice case "$choice" in 1) configure_lightdm ;; @@ -151,7 +151,7 @@ configure_or_remove_autologin() { printf "%b\n" "3) SDDM" printf "%b\n" "4) LXDM" printf "%b\n" "Enter your choice [1-4]: " - read choice + read -r choice case "$choice" in 1) remove_lightdm_autologin ;; diff --git a/tabs/utils/bluetooth-control.sh b/tabs/utils/bluetooth-control.sh index 8ad2e8134..01fd5c320 100644 --- a/tabs/utils/bluetooth-control.sh +++ b/tabs/utils/bluetooth-control.sh @@ -99,7 +99,7 @@ prompt_for_mac() { done printf "0. Exit to main menu\n" printf "%s\n" "$prompt_msg" - read choice + read -r choice # Validate the choice if echo "$choice" | grep -qE '^[0-9]+$' && [ "$choice" -le "$((i - 1))" ] && [ "$choice" -gt 0 ]; then diff --git a/tabs/utils/monitor-control/set_brightness.sh b/tabs/utils/monitor-control/set_brightness.sh index ab97b70a0..bd3b3d557 100644 --- a/tabs/utils/monitor-control/set_brightness.sh +++ b/tabs/utils/monitor-control/set_brightness.sh @@ -21,7 +21,7 @@ adjust_monitor_brightness() { done printf "Enter the number of the monitor (or 'q' to quit): " - read monitor_choice + read -r monitor_choice if [ "$monitor_choice" = "q" ]; then printf "%b\n" "${RED}Exiting...${RC}" @@ -31,14 +31,14 @@ adjust_monitor_brightness() { if ! echo "$monitor_choice" | grep -qE '^[0-9]+$'; then printf "%b\n" "${RED}Invalid selection. Please try again.${RC}" printf "Press [Enter] to continue..." - read dummy + read -r dummy continue fi if [ "$monitor_choice" -lt 1 ] || [ "$monitor_choice" -gt "$#" ]; then printf "%b\n" "${RED}Invalid selection. Please try again.${RC}" printf "Press [Enter] to continue..." - read dummy + read -r dummy continue fi @@ -51,7 +51,7 @@ adjust_monitor_brightness() { while true; do printf "Enter the new brightness value as a percentage (10 to 100, or 'q' to quit): " - read new_brightness_percentage + read -r new_brightness_percentage if [ "$new_brightness_percentage" = "q" ]; then printf "%b\n" "${RED}Exiting...${RC}" @@ -68,7 +68,7 @@ adjust_monitor_brightness() { new_brightness=$(awk "BEGIN {printf \"%.2f\", $new_brightness_percentage / 100}") printf "Set brightness for $monitor_name to $new_brightness_percentage%? (y/n): " - read confirm + read -r confirm if [ "$confirm" = "y" ] || [ "$confirm" = "Y" ]; then printf "%b\n" "${GREEN}Setting brightness for $monitor_name to $new_brightness_percentage%${RC}" execute_command "xrandr --output $monitor_name --brightness $new_brightness" diff --git a/tabs/utils/ollama.sh b/tabs/utils/ollama.sh index f93cc7416..64f825bfa 100644 --- a/tabs/utils/ollama.sh +++ b/tabs/utils/ollama.sh @@ -54,7 +54,7 @@ display_models() { # Function to select model based on user input select_model() { - local choice="$1" + choice="$1" case $choice in 1) printf "%b\n" "llama3.1";; 2) printf "%b\n" "llama3.1:70b";; diff --git a/tabs/utils/ssh.sh b/tabs/utils/ssh.sh index aa6988899..6fbe0128b 100644 --- a/tabs/utils/ssh.sh +++ b/tabs/utils/ssh.sh @@ -219,7 +219,7 @@ show_menu() { main() { while true; do show_menu - read choice + read -r choice case $choice in 1) ask_for_host_details ;; 2) show_available_hosts && printf "%b\n" "Enter the alias of the host to connect to: " && read -r host_alias; ssh $host_alias ;; diff --git a/tabs/utils/user-account-manager/delete_user.sh b/tabs/utils/user-account-manager/delete_user.sh index ef1a59c49..e776a063f 100755 --- a/tabs/utils/user-account-manager/delete_user.sh +++ b/tabs/utils/user-account-manager/delete_user.sh @@ -13,7 +13,7 @@ username=$(promptUsername "" "non-root") || exit 1 if [ "$username" = "$USER" ]; then printf "%b\n" "${RED}Cannot delete the current user${RC}" printf "%b\n" "${RED}Press [Enter] to continue...${RC}" - read dummy + read -r dummy return fi diff --git a/tabs/utils/wifi-control.sh b/tabs/utils/wifi-control.sh index 71abcce51..295031bcc 100755 --- a/tabs/utils/wifi-control.sh +++ b/tabs/utils/wifi-control.sh @@ -46,7 +46,7 @@ main_menu() { printf "6. Remove a WiFi connection\n" printf "0. Exit\n" printf "Choose an option: " - read choice + read -r choice case $choice in 1) wifi_on ;; @@ -132,13 +132,13 @@ prompt_for_network() { printf "0. Exit to main menu\n" printf "%s" "$prompt_msg" - read choice + read -r choice if [ "$choice" -ge 1 ] && [ "$choice" -lt "$i" ]; then ssid=$(sed -n "${choice}p" "$temp_file" | awk -F: '{print $1}') if [ "$action" = "connect" ]; then printf "Enter password for SSID %s: " "$ssid" - read password + read -r password printf "\n" nmcli dev wifi connect "$ssid" password "$password" && { printf "%b\n" "${GREEN}$success_msg${RC}"