From 41817c333c4d5cdfe701b3a6c79f51b2c50727b0 Mon Sep 17 00:00:00 2001 From: Nyx <144965845+nnyyxxxx@users.noreply.github.com> Date: Wed, 18 Sep 2024 20:40:05 -0400 Subject: [PATCH] Replace echos with printf in system-setup (#483) Co-authored-by: nnyyxxxx Co-authored-by: Chris Titus --- tabs/system-setup/5-samba-ssh-setup.sh | 8 ++++---- tabs/system-setup/6-docker-setup.sh | 2 +- tabs/system-setup/arch/paru-setup.sh | 8 ++++---- tabs/system-setup/arch/yay-setup.sh | 8 ++++---- tabs/system-setup/fedora/rpm-fusion-setup.sh | 8 ++++---- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/tabs/system-setup/5-samba-ssh-setup.sh b/tabs/system-setup/5-samba-ssh-setup.sh index ddd43c994..7e22f2624 100755 --- a/tabs/system-setup/5-samba-ssh-setup.sh +++ b/tabs/system-setup/5-samba-ssh-setup.sh @@ -86,20 +86,20 @@ setup_samba() { $ESCALATION_TOOL chmod -R 0777 "$SHARED_DIR" # Add a new Samba user - echo "Enter Samba username: " + printf "Enter Samba username: " read -r SAMBA_USER # Loop until the passwords match while true; do - echo "Enter Samba password: " + printf "Enter Samba password: " stty -echo read -r SAMBA_PASSWORD stty echo - echo "Confirm Samba password: " + printf "Confirm Samba password: " stty -echo read SAMBA_PASSWORD_CONFIRM stty echo - echo "" + printf "\n" if [ "$SAMBA_PASSWORD" = "$SAMBA_PASSWORD_CONFIRM" ]; then printf "%b\n" "${GREEN}Passwords match.${RC}" break diff --git a/tabs/system-setup/6-docker-setup.sh b/tabs/system-setup/6-docker-setup.sh index 43e8a5079..6a5a14d3a 100755 --- a/tabs/system-setup/6-docker-setup.sh +++ b/tabs/system-setup/6-docker-setup.sh @@ -16,7 +16,7 @@ choose_installation() { 1) INSTALL_DOCKER=1; INSTALL_COMPOSE=0 ;; 2) INSTALL_DOCKER=0; INSTALL_COMPOSE=1 ;; 3) INSTALL_DOCKER=1; INSTALL_COMPOSE=1 ;; - *) echo "Invalid choice. Exiting."; exit 1 ;; + *) printf "%b\n" "${RED}Invalid choice. Exiting.${RC}"; exit 1 ;; esac } diff --git a/tabs/system-setup/arch/paru-setup.sh b/tabs/system-setup/arch/paru-setup.sh index 490935157..05b78c80c 100755 --- a/tabs/system-setup/arch/paru-setup.sh +++ b/tabs/system-setup/arch/paru-setup.sh @@ -6,17 +6,17 @@ installDepend() { case "$PACKAGER" in pacman) if ! command_exists paru; then - echo "Installing paru as AUR helper..." + printf "%b\n" "${YELLOW}Installing paru as AUR helper...${RC}" $ESCALATION_TOOL "$PACKAGER" -S --needed --noconfirm base-devel cd /opt && $ESCALATION_TOOL git clone https://aur.archlinux.org/paru.git && $ESCALATION_TOOL chown -R "$USER": ./paru cd paru && makepkg --noconfirm -si - echo "Paru installed" + printf "%b\n" "${GREEN}Paru installed${RC}" else - echo "Paru already installed" + printf "%b\n" "${GREEN}Paru already installed${RC}" fi ;; *) - echo "Unsupported package manager: $PACKAGER" + printf "%b\n" "${RED}Unsupported package manager: $PACKAGER${RC}" ;; esac } diff --git a/tabs/system-setup/arch/yay-setup.sh b/tabs/system-setup/arch/yay-setup.sh index 4fd561736..f7f9fa6aa 100755 --- a/tabs/system-setup/arch/yay-setup.sh +++ b/tabs/system-setup/arch/yay-setup.sh @@ -6,17 +6,17 @@ installDepend() { case "$PACKAGER" in pacman) if ! command_exists yay; then - echo "Installing yay as AUR helper..." + printf "%b\n" "${YELLOW}Installing yay as AUR helper...${RC}" $ESCALATION_TOOL "$PACKAGER" -S --needed --noconfirm base-devel cd /opt && $ESCALATION_TOOL git clone https://aur.archlinux.org/yay-bin.git && $ESCALATION_TOOL chown -R "$USER": ./yay-bin cd yay-bin && makepkg --noconfirm -si - echo "Yay installed" + printf "%b\n" "${GREEN}Yay installed${RC}" else - echo "Aur helper already installed" + printf "%b\n" "${GREEN}Aur helper already installed${RC}" fi ;; *) - echo "Unsupported package manager: $PACKAGER" + printf "%b\n" "${RED}Unsupported package manager: $PACKAGER${RC}" ;; esac } diff --git a/tabs/system-setup/fedora/rpm-fusion-setup.sh b/tabs/system-setup/fedora/rpm-fusion-setup.sh index 7fb052ea4..e73bc0013 100644 --- a/tabs/system-setup/fedora/rpm-fusion-setup.sh +++ b/tabs/system-setup/fedora/rpm-fusion-setup.sh @@ -8,16 +8,16 @@ installRPMFusion() { case "$PACKAGER" in dnf) if [ ! -e /etc/yum.repos.d/rpmfusion-free.repo ] || [ ! -e /etc/yum.repos.d/rpmfusion-nonfree.repo ]; then - echo "Installing RPM Fusion..." + printf "%b\n" "${YELLOW}Installing RPM Fusion...${RC}" "$ESCALATION_TOOL" "$PACKAGER" install 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 "$ESCALATION_TOOL" "$PACKAGER" config-manager --enable fedora-cisco-openh264 - echo "RPM Fusion installed" + printf "%b\n" "${GREEN}RPM Fusion installed${RC}" else - echo "RPM Fusion already installed" + printf "%b\n" "${GREEN}RPM Fusion already installed${RC}" fi ;; *) - echo "Unsupported distribution: $DTYPE" + printf "%b\n" "${RED}Unsupported distribution: $DTYPE${RC}" ;; esac }