Incorporate colors into current scripts

This commit is contained in:
nnyyxxxx 2024-09-16 22:44:20 -04:00
parent d81e3afeec
commit c1c60aae7b
12 changed files with 84 additions and 83 deletions

View File

@ -3,7 +3,7 @@
. ../common-script.sh . ../common-script.sh
setupAlacritty() { setupAlacritty() {
echo "Install Alacritty if not already installed..." printf "%b\n" "${YELLOW}Install Alacritty if not already installed...${RC}"
if ! command_exists alacritty; then if ! command_exists alacritty; then
case ${PACKAGER} in case ${PACKAGER} in
pacman) pacman)
@ -14,18 +14,19 @@ setupAlacritty() {
;; ;;
esac esac
else else
echo "alacritty is already installed." printf "%b\n" "${RED}alacritty is already installed.${RC}"
fi fi
} }
setupAlacrittyConfig() { setupAlacrittyConfig() {
echo "Copy alacritty config files" printf "%b\n" "${YELLOW}Copy alacritty config files${RC}"
if [ -d "${HOME}/.config/alacritty" ] && [ ! -d "${HOME}/.config/alacritty-bak" ]; then if [ -d "${HOME}/.config/alacritty" ] && [ ! -d "${HOME}/.config/alacritty-bak" ]; then
cp -r "${HOME}/.config/alacritty" "${HOME}/.config/alacritty-bak" cp -r "${HOME}/.config/alacritty" "${HOME}/.config/alacritty-bak"
fi fi
mkdir -p "${HOME}/.config/alacritty/" mkdir -p "${HOME}/.config/alacritty/"
curl -sSLo "${HOME}/.config/alacritty/alacritty.toml" "https://github.com/ChrisTitusTech/dwm-titus/raw/main/config/alacritty/alacritty.toml" curl -sSLo "${HOME}/.config/alacritty/alacritty.toml" "https://github.com/ChrisTitusTech/dwm-titus/raw/main/config/alacritty/alacritty.toml"
curl -sSLo "${HOME}/.config/alacritty/nordic.toml" "https://github.com/ChrisTitusTech/dwm-titus/raw/main/config/alacritty/nordic.toml" curl -sSLo "${HOME}/.config/alacritty/nordic.toml" "https://github.com/ChrisTitusTech/dwm-titus/raw/main/config/alacritty/nordic.toml"
printf "%b\n" "${GREEN}Alacritty configuration files copied.${RC}"
} }
checkEnv checkEnv

View File

@ -10,7 +10,7 @@ makeDWM() {
} }
setupDWM() { setupDWM() {
echo "Installing DWM-Titus if not already installed" printf "%b\n" "${YELLOW}Installing DWM-Titus if not already installed${RC}"
case "$PACKAGER" in # Install pre-Requisites case "$PACKAGER" in # Install pre-Requisites
pacman) pacman)
$ESCALATION_TOOL "$PACKAGER" -S --needed --noconfirm base-devel libx11 libxinerama libxft imlib2 libxcb $ESCALATION_TOOL "$PACKAGER" -S --needed --noconfirm base-devel libx11 libxinerama libxft imlib2 libxcb
@ -23,7 +23,7 @@ setupDWM() {
$ESCALATION_TOOL "$PACKAGER" install -y libX11-devel libXinerama-devel libXft-devel imlib2-devel libxcb-devel $ESCALATION_TOOL "$PACKAGER" install -y libX11-devel libXinerama-devel libXft-devel imlib2-devel libxcb-devel
;; ;;
*) *)
echo "Unsupported package manager: $PACKAGER" printf "%b\n" "${RED}Unsupported package manager: $PACKAGER${RC}"
exit 1 exit 1
;; ;;
esac esac
@ -37,56 +37,56 @@ install_nerd_font() {
# Check if Meslo Nerd-font is already installed # Check if Meslo Nerd-font is already installed
if [ -n "$FONT_INSTALLED" ]; then if [ -n "$FONT_INSTALLED" ]; then
echo "Meslo Nerd-fonts are already installed." printf "%b\n" "${RED}Meslo Nerd-fonts are already installed.${RC}"
return 0 return 0
fi fi
echo "Installing Meslo Nerd-fonts" printf "%b\n" "${YELLOW}Installing Meslo Nerd-fonts${RC}"
# Create the fonts directory if it doesn't exist # Create the fonts directory if it doesn't exist
if [ ! -d "$FONT_DIR" ]; then if [ ! -d "$FONT_DIR" ]; then
mkdir -p "$FONT_DIR" || { mkdir -p "$FONT_DIR" || {
echo "Failed to create directory: $FONT_DIR" printf "%b\n" "${RED}Failed to create directory: $FONT_DIR${RC}"
return 1 return 1
} }
else else
echo "$FONT_DIR exists, skipping creation." printf "%b\n" "${GREEN}$FONT_DIR exists, skipping creation.${RC}"
fi fi
# Check if the font zip file already exists # Check if the font zip file already exists
if [ ! -f "$FONT_ZIP" ]; then if [ ! -f "$FONT_ZIP" ]; then
# Download the font zip file # Download the font zip file
curl -sSLo "$FONT_ZIP" "$FONT_URL" || { curl -sSLo "$FONT_ZIP" "$FONT_URL" || {
echo "Failed to download Meslo Nerd-fonts from $FONT_URL" printf "%b\n" "${RED}Failed to download Meslo Nerd-fonts from $FONT_URL${RC}"
return 1 return 1
} }
else else
echo "Meslo.zip already exists in $FONT_DIR, skipping download." printf "%b\n" "${GREEN}Meslo.zip already exists in $FONT_DIR, skipping download.${RC}"
fi fi
# Unzip the font file if it hasn't been unzipped yet # Unzip the font file if it hasn't been unzipped yet
if [ ! -d "$FONT_DIR/Meslo" ]; then if [ ! -d "$FONT_DIR/Meslo" ]; then
unzip "$FONT_ZIP" -d "$FONT_DIR" || { unzip "$FONT_ZIP" -d "$FONT_DIR" || {
echo "Failed to unzip $FONT_ZIP" printf "%b\n" "${RED}Failed to unzip $FONT_ZIP${RC}"
return 1 return 1
} }
else else
echo "Meslo font files already unzipped in $FONT_DIR, skipping unzip." printf "%b\n" "${GREEN}Meslo font files already unzipped in $FONT_DIR, skipping unzip.${RC}"
fi fi
# Remove the zip file # Remove the zip file
rm "$FONT_ZIP" || { rm "$FONT_ZIP" || {
echo "Failed to remove $FONT_ZIP" printf "%b\n" "${RED}Failed to remove $FONT_ZIP${RC}"
return 1 return 1
} }
# Rebuild the font cache # Rebuild the font cache
fc-cache -fv || { fc-cache -fv || {
echo "Failed to rebuild font cache" printf "%b\n" "${RED}Failed to rebuild font cache${RC}"
return 1 return 1
} }
echo "Meslo Nerd-fonts installed successfully" printf "%b\n" "${GREEN}Meslo Nerd-fonts installed successfully${RC}"
} }
picom_animations() { picom_animations() {
@ -94,33 +94,33 @@ picom_animations() {
mkdir -p ~/build mkdir -p ~/build
if [ ! -d ~/build/picom ]; then if [ ! -d ~/build/picom ]; then
if ! git clone https://github.com/FT-Labs/picom.git ~/build/picom; then if ! git clone https://github.com/FT-Labs/picom.git ~/build/picom; then
echo "Failed to clone the repository" printf "%b\n" "${RED}Failed to clone the repository${RC}"
return 1 return 1
fi fi
else else
echo "Repository already exists, skipping clone" printf "%b\n" "${GREEN}Repository already exists, skipping clone${RC}"
fi fi
cd ~/build/picom || { echo "Failed to change directory to picom"; return 1; } cd ~/build/picom || { printf "%b\n" "${RED}Failed to change directory to picom${RC}"; return 1; }
# Build the project # Build the project
if ! meson setup --buildtype=release build; then if ! meson setup --buildtype=release build; then
echo "Meson setup failed" printf "%b\n" "${RED}Meson setup failed${RC}"
return 1 return 1
fi fi
if ! ninja -C build; then if ! ninja -C build; then
echo "Ninja build failed" printf "%b\n" "${RED}Ninja build failed${RC}"
return 1 return 1
fi fi
# Install the built binary # Install the built binary
if ! $ESCALATION_TOOL ninja -C build install; then if ! $ESCALATION_TOOL ninja -C build install; then
echo "Failed to install the built binary" printf "%b\n" "${RED}Failed to install the built binary${RC}"
return 1 return 1
fi fi
echo "Picom animations installed successfully" printf "%b\n" "${GREEN}Picom animations installed successfully${RC}"
} }
clone_config_folders() { clone_config_folders() {
@ -135,9 +135,9 @@ clone_config_folders() {
# Clone the directory to ~/.config/ # Clone the directory to ~/.config/
if [ -d "$dir" ]; then if [ -d "$dir" ]; then
cp -r "$dir" ~/.config/ cp -r "$dir" ~/.config/
echo "Cloned $dir_name to ~/.config/" printf "%b\n" "${GREEN}Cloned $dir_name to ~/.config/${RC}"
else else
echo "Directory $dir_name does not exist, skipping" printf "%b\n" "${RED}Directory $dir_name does not exist, skipping${RC}"
fi fi
done done
} }
@ -149,9 +149,9 @@ configure_backgrounds() {
# Check if the ~/Pictures directory exists # Check if the ~/Pictures directory exists
if [ ! -d "~/Pictures" ]; then if [ ! -d "~/Pictures" ]; then
# If it doesn't exist, print an error message and return with a status of 1 (indicating failure) # If it doesn't exist, print an error message and return with a status of 1 (indicating failure)
echo "Pictures directory does not exist" printf "%b\n" "${RED}Pictures directory does not exist${RC}"
mkdir ~/Pictures mkdir ~/Pictures
echo "Directory was created in Home folder" printf "%b\n" "${GREEN}Directory was created in Home folder${RC}"
fi fi
# Check if the backgrounds directory (BG_DIR) exists # Check if the backgrounds directory (BG_DIR) exists
@ -159,21 +159,21 @@ configure_backgrounds() {
# If the backgrounds directory doesn't exist, attempt to clone a repository containing backgrounds # If the backgrounds directory doesn't exist, attempt to clone a repository containing backgrounds
if ! git clone https://github.com/ChrisTitusTech/nord-background.git ~/Pictures; then if ! git clone https://github.com/ChrisTitusTech/nord-background.git ~/Pictures; then
# If the git clone command fails, print an error message and return with a status of 1 # If the git clone command fails, print an error message and return with a status of 1
echo "Failed to clone the repository" printf "%b\n" "${RED}Failed to clone the repository${RC}"
return 1 return 1
fi fi
# Rename the cloned directory to 'backgrounds' # Rename the cloned directory to 'backgrounds'
mv ~/Pictures/nord-background ~/Pictures/backgrounds mv ~/Pictures/nord-background ~/Pictures/backgrounds
# Print a success message indicating that the backgrounds have been downloaded # Print a success message indicating that the backgrounds have been downloaded
echo "Downloaded desktop backgrounds to $BG_DIR" printf "%b\n" "${GREEN}Downloaded desktop backgrounds to $BG_DIR${RC}"
else else
# If the backgrounds directory already exists, print a message indicating that the download is being skipped # If the backgrounds directory already exists, print a message indicating that the download is being skipped
echo "Path $BG_DIR exists for desktop backgrounds, skipping download of backgrounds" printf "%b\n" "${RED}Path $BG_DIR exists for desktop backgrounds, skipping download of backgrounds${RC}"
fi fi
} }
setupDisplayManager() { setupDisplayManager() {
echo "Setting up Xorg" printf "%b\n" "${YELLOW}Setting up Xorg${RC}"
case "$PACKAGER" in case "$PACKAGER" in
pacman) pacman)
$ESCALATION_TOOL "$PACKAGER" -S --needed --noconfirm xorg-xinit xorg-server $ESCALATION_TOOL "$PACKAGER" -S --needed --noconfirm xorg-xinit xorg-server
@ -185,12 +185,12 @@ setupDisplayManager() {
$ESCALATION_TOOL "$PACKAGER" install -y xorg-x11-xinit xorg-x11-server-Xorg $ESCALATION_TOOL "$PACKAGER" install -y xorg-x11-xinit xorg-x11-server-Xorg
;; ;;
*) *)
echo "Unsupported package manager: $PACKAGER" printf "%b\n" "${RED}Unsupported package manager: $PACKAGER${RC}"
exit 1 exit 1
;; ;;
esac esac
echo "Xorg installed successfully" printf "%b\n" "${GREEN}Xorg installed successfully${RC}"
echo "Setting up Display Manager" printf "%b\n" "${YELLOW}Setting up Display Manager${RC}"
currentdm="none" currentdm="none"
for dm in gdm sddm lightdm; do for dm in gdm sddm lightdm; do
if systemctl is-active --quiet "$dm.service"; then if systemctl is-active --quiet "$dm.service"; then
@ -198,10 +198,10 @@ setupDisplayManager() {
break break
fi fi
done done
echo "Current display manager: $currentdm" printf "%b\n" "${GREEN}Current display manager: $currentdm${RC}"
if [ "$currentdm" = "none" ]; then if [ "$currentdm" = "none" ]; then
DM="sddm" DM="sddm"
echo "No display manager found, installing $DM" printf "%b\n" "${YELLOW}No display manager found, installing $DM${RC}"
case "$PACKAGER" in case "$PACKAGER" in
pacman) pacman)
$ESCALATION_TOOL "$PACKAGER" -S --needed --noconfirm "$DM" $ESCALATION_TOOL "$PACKAGER" -S --needed --noconfirm "$DM"
@ -213,11 +213,11 @@ setupDisplayManager() {
$ESCALATION_TOOL "$PACKAGER" install -y "$DM" $ESCALATION_TOOL "$PACKAGER" install -y "$DM"
;; ;;
*) *)
echo "Unsupported package manager: $PACKAGER" printf "%b\n" "${RED}Unsupported package manager: $PACKAGER${RC}"
exit 1 exit 1
;; ;;
esac esac
echo "$DM installed successfully" printf "%b\n" "${GREEN}$DM installed successfully${RC}"
systemctl enable "$DM" systemctl enable "$DM"
# Prompt user for auto-login # Prompt user for auto-login
@ -226,7 +226,7 @@ setupDisplayManager() {
read -r answer read -r answer
case "$answer" in case "$answer" in
[Yy]*) [Yy]*)
echo "Configuring SDDM for autologin" printf "%b\n" "${YELLOW}Configuring SDDM for autologin${RC}"
SDDM_CONF="/etc/sddm.conf" SDDM_CONF="/etc/sddm.conf"
if [ ! -f "$SDDM_CONF" ]; then if [ ! -f "$SDDM_CONF" ]; then
echo "[Autologin]" | $ESCALATION_TOOL tee -a "$SDDM_CONF" echo "[Autologin]" | $ESCALATION_TOOL tee -a "$SDDM_CONF"
@ -240,24 +240,24 @@ setupDisplayManager() {
echo "User=$USER" | $ESCALATION_TOOL tee -a "$SDDM_CONF" echo "User=$USER" | $ESCALATION_TOOL tee -a "$SDDM_CONF"
echo "Session=dwm" | $ESCALATION_TOOL tee -a "$SDDM_CONF" echo "Session=dwm" | $ESCALATION_TOOL tee -a "$SDDM_CONF"
fi fi
echo "Checking if autologin group exists" printf "%b\n" "{YELLOW}Checking if autologin group exists${RC}"
if ! getent group autologin > /dev/null; then if ! getent group autologin > /dev/null; then
echo "Creating autologin group" printf "%b\n" "${YELLOW}Creating autologin group${RC}"
$ESCALATION_TOOL groupadd autologin $ESCALATION_TOOL groupadd autologin
else else
echo "Autologin group already exists" printf "%b\n" "${RED}Autologin group already exists${RC}"
fi fi
echo "Adding user with UID 1000 to autologin group" printf "%b\n" "${YELLOW}Adding user with UID 1000 to autologin group${RC}"
USER_UID_1000=$(getent passwd 1000 | cut -d: -f1) USER_UID_1000=$(getent passwd 1000 | cut -d: -f1)
if [ -n "$USER_UID_1000" ]; then if [ -n "$USER_UID_1000" ]; then
$ESCALATION_TOOL usermod -aG autologin "$USER_UID_1000" $ESCALATION_TOOL usermod -aG autologin "$USER_UID_1000"
echo "User $USER_UID_1000 added to autologin group" printf "%b\n" "${GREEN}User $USER_UID_1000 added to autologin group${RC}"
else else
echo "No user with UID 1000 found - Auto login not possible" printf "%b\n" "${RED}No user with UID 1000 found - Auto login not possible${RC}"
fi fi
;; ;;
*) *)
echo "Auto-login configuration skipped" printf "%b\n" "${GREEN}Auto-login configuration skipped${RC}"
;; ;;
esac esac
fi fi
@ -270,16 +270,16 @@ install_slstatus() {
printf "Do you want to install slstatus? (y/N): " # using printf instead of 'echo' to avoid newline, -n flag for 'echo' is not supported in POSIX printf "Do you want to install slstatus? (y/N): " # using printf instead of 'echo' to avoid newline, -n flag for 'echo' is not supported in POSIX
read -r response # -r flag to prevent backslashes from being interpreted read -r response # -r flag to prevent backslashes from being interpreted
if [ "$response" = "y" ] || [ "$response" = "Y" ]; then if [ "$response" = "y" ] || [ "$response" = "Y" ]; then
echo "Installing slstatus" printf "%b\n" "${YELLOW}Installing slstatus${RC}"
cd "$HOME/dwm-titus/slstatus" || { echo "Failed to change directory to slstatus"; return 1; } cd "$HOME/dwm-titus/slstatus" || { echo "Failed to change directory to slstatus"; return 1; }
if $ESCALATION_TOOL make clean install; then if $ESCALATION_TOOL make clean install; then
echo "slstatus installed successfully" printf "%b\n" "${GREEN}slstatus installed successfully${RC}"
else else
echo "Failed to install slstatus" printf "%b\n" "${RED}Failed to install slstatus${RC}"
return 1 return 1
fi fi
else else
echo "Skipping slstatus installation" printf "%b\n" "${GREEN}Skipping slstatus installation${RC}"
fi fi
cd "$HOME" cd "$HOME"
} }

View File

@ -3,7 +3,7 @@
. ../common-script.sh . ../common-script.sh
setupFastfetch() { setupFastfetch() {
echo "Installing Fastfetch if not already installed..." printf "%b\n" "${YELLOW}Installing Fastfetch if not already installed...${RC}"
if ! command_exists fastfetch; then if ! command_exists fastfetch; then
case ${PACKAGER} in case ${PACKAGER} in
pacman) pacman)
@ -14,12 +14,12 @@ setupFastfetch() {
;; ;;
esac esac
else else
echo "Fastfetch is already installed." printf "%b\n" "${GREEN}Fastfetch is already installed.${RC}"
fi fi
} }
setupFastfetchConfig() { setupFastfetchConfig() {
echo "Copying Fastfetch config files..." printf "%b\n" "${YELLOW}Copying Fastfetch config files...${RC}"
if [ -d "${HOME}/.config/fastfetch" ] && [ ! -d "${HOME}/.config/fastfetch-bak" ]; then if [ -d "${HOME}/.config/fastfetch" ] && [ ! -d "${HOME}/.config/fastfetch-bak" ]; then
cp -r "${HOME}/.config/fastfetch" "${HOME}/.config/fastfetch-bak" cp -r "${HOME}/.config/fastfetch" "${HOME}/.config/fastfetch-bak"
fi fi

View File

@ -3,7 +3,7 @@
. ../common-script.sh . ../common-script.sh
setupKitty() { setupKitty() {
echo "Install Kitty if not already installed..." printf "%b\n" "${YELLOW}Install Kitty if not already installed...${RC}"
if ! command_exists kitty; then if ! command_exists kitty; then
case ${PACKAGER} in case ${PACKAGER} in
pacman) pacman)
@ -14,12 +14,12 @@ setupKitty() {
;; ;;
esac esac
else else
echo "Kitty is already installed." printf "%b\n" "${GREEN}Kitty is already installed.${RC}"
fi fi
} }
setupKittyConfig() { setupKittyConfig() {
echo "Copy Kitty config files" printf "%b\n" "${YELLOW}Copy Kitty config files${RC}"
if [ -d "${HOME}/.config/kitty" ] && [ ! -d "${HOME}/.config/kitty-bak" ]; then if [ -d "${HOME}/.config/kitty" ] && [ ! -d "${HOME}/.config/kitty-bak" ]; then
cp -r "${HOME}/.config/kitty" "${HOME}/.config/kitty-bak" cp -r "${HOME}/.config/kitty" "${HOME}/.config/kitty-bak"
fi fi

View File

@ -14,7 +14,7 @@ cloneMyBash() {
} }
installDepend() { installDepend() {
echo "Install mybash if not already installed" printf "%b\n" "${YELLOW}Install mybash if not already installed${RC}"
case "$PACKAGER" in case "$PACKAGER" in
pacman) pacman)
$ESCALATION_TOOL "$PACKAGER" -S --needed --noconfirm bash bash-completion tar bat tree unzip fontconfig $ESCALATION_TOOL "$PACKAGER" -S --needed --noconfirm bash bash-completion tar bat tree unzip fontconfig
@ -39,9 +39,9 @@ installFont() {
# Check to see if the MesloLGS Nerd Font is installed (Change this to whatever font you would like) # Check to see if the MesloLGS Nerd Font is installed (Change this to whatever font you would like)
FONT_NAME="MesloLGS Nerd Font Mono" FONT_NAME="MesloLGS Nerd Font Mono"
if fc-list :family | grep -iq "$FONT_NAME"; then if fc-list :family | grep -iq "$FONT_NAME"; then
echo "Font '$FONT_NAME' is installed." printf "%b\n" "${GREEN}Font '$FONT_NAME' is installed.${RC}"
else else
echo "Installing font '$FONT_NAME'" printf "%b\n" "${YELLOW}Installing font '$FONT_NAME'${RC}"
# Change this URL to correspond with the correct font # Change this URL to correspond with the correct font
FONT_URL="https://github.com/ryanoasis/nerd-fonts/releases/latest/download/Meslo.zip" FONT_URL="https://github.com/ryanoasis/nerd-fonts/releases/latest/download/Meslo.zip"
FONT_DIR="$HOME/.local/share/fonts" FONT_DIR="$HOME/.local/share/fonts"
@ -52,13 +52,13 @@ installFont() {
mv "${TEMP_DIR}"/*.ttf "$FONT_DIR"/"$FONT_NAME" mv "${TEMP_DIR}"/*.ttf "$FONT_DIR"/"$FONT_NAME"
fc-cache -fv fc-cache -fv
rm -rf "${TEMP_DIR}" rm -rf "${TEMP_DIR}"
echo "'$FONT_NAME' installed successfully." printf "%b\n" "${GREEN}'$FONT_NAME' installed successfully.${RC}"
fi fi
} }
installStarshipAndFzf() { installStarshipAndFzf() {
if command_exists starship; then if command_exists starship; then
echo "Starship already installed" printf "%b\n" "${GREEN}Starship already installed${RC}"
return return
fi fi
@ -67,7 +67,7 @@ installStarshipAndFzf() {
exit 1 exit 1
fi fi
if command_exists fzf; then if command_exists fzf; then
echo "Fzf already installed" printf "%b\n" "${GREEN}Fzf already installed${RC}"
else else
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
$ESCALATION_TOOL ~/.fzf/install $ESCALATION_TOOL ~/.fzf/install
@ -76,7 +76,7 @@ installStarshipAndFzf() {
installZoxide() { installZoxide() {
if command_exists zoxide; then if command_exists zoxide; then
echo "Zoxide already installed" printf "%b\n" "${GREEN}Zoxide already installed${RC}"
return return
fi fi

View File

@ -14,7 +14,7 @@ cloneNeovim() {
} }
setupNeovim() { setupNeovim() {
echo "Install Neovim if not already installed" printf "%b\n" "${YELLOW}Install Neovim if not already installed${RC}"
case "$PACKAGER" in case "$PACKAGER" in
pacman) pacman)
$ESCALATION_TOOL "$PACKAGER" -S --needed --noconfirm neovim ripgrep fzf python-virtualenv luarocks go shellcheck $ESCALATION_TOOL "$PACKAGER" -S --needed --noconfirm neovim ripgrep fzf python-virtualenv luarocks go shellcheck

View File

@ -3,7 +3,7 @@
. ../common-script.sh . ../common-script.sh
setupRofi() { setupRofi() {
echo "Install Rofi if not already installed..." printf "%b\n" "${YELLOW}Install Rofi if not already installed...${RC}"
if ! command_exists rofi; then if ! command_exists rofi; then
case "$PACKAGER" in case "$PACKAGER" in
pacman) pacman)
@ -14,12 +14,12 @@ setupRofi() {
;; ;;
esac esac
else else
echo "Rofi is already installed." printf "%b\n" "${GREEN}Rofi is already installed.${RC}"
fi fi
} }
setupRofiConfig() { setupRofiConfig() {
echo "Copy Rofi config files" printf "%b\n" "${YELLOW}Copy Rofi config files${RC}"
if [ -d "$HOME/.config/rofi" ] && [ ! -d "$HOME/.config/rofi-bak" ]; then if [ -d "$HOME/.config/rofi" ] && [ ! -d "$HOME/.config/rofi-bak" ]; then
cp -r "$HOME/.config/rofi" "$HOME/.config/rofi-bak" cp -r "$HOME/.config/rofi" "$HOME/.config/rofi-bak"
fi fi

View File

@ -4,7 +4,7 @@
# Function to install zsh # Function to install zsh
install_zsh() { install_zsh() {
echo "Install ZSH if not already installed..." printf "%b\n" "${YELLOW}Install ZSH if not already installed...${RC}"
if ! command_exists zsh; then if ! command_exists zsh; then
case "$PACKAGER" in case "$PACKAGER" in
pacman) pacman)
@ -15,7 +15,7 @@ install_zsh() {
;; ;;
esac esac
else else
echo "ZSH is already installed." printf "%b\n" "${GREEN}ZSH is already installed.${RC}"
fi fi
} }

View File

@ -1,11 +1,11 @@
#!/bin/bash #!/bin/bash
# Search for possible Diablo II Resurrected folder locations # Search for possible Diablo II Resurrected folder locations
echo "Searching for Diablo II Resurrected folders..." printf "%b\n" "${YELLOW}Searching for Diablo II Resurrected folders...${RC}"
possible_paths=$(find $HOME -type d -path "*/drive_c/Program Files (x86)/Diablo II Resurrected" 2>/dev/null) possible_paths=$(find $HOME -type d -path "*/drive_c/Program Files (x86)/Diablo II Resurrected" 2>/dev/null)
if [ -z "$possible_paths" ]; then if [ -z "$possible_paths" ]; then
echo "Error: No Diablo II Resurrected folders found." printf "%b\n" "${RED}Error: No Diablo II Resurrected folders found.${RC}"
exit 1 exit 1
fi fi
@ -23,7 +23,7 @@ print_menu() {
if ((start + max_display > total)); then start=$((total - max_display)); fi if ((start + max_display > total)); then start=$((total - max_display)); fi
if ((start < 0)); then start=0; fi if ((start < 0)); then start=0; fi
echo "Please select the Diablo II: Resurrected installation path:" printf "%b\n" "${YELLOW}Please select the Diablo II: Resurrected installation path:${RC}"
for i in $(seq 0 $((max_display - 1))); do for i in $(seq 0 $((max_display - 1))); do
if ((i + start >= total)); then break; fi if ((i + start >= total)); then break; fi
if [ $((i + start)) -eq $selected ]; then if [ $((i + start)) -eq $selected ]; then
@ -84,17 +84,17 @@ mods_path="$d2r_path/mods"
mkdir -p "$mods_path" mkdir -p "$mods_path"
# Download the latest release # Download the latest release
echo "Downloading the latest loot filter..." printf "%b\n" "${YELLOW}Downloading the latest loot filter...${RC}"
curl -sSLo /tmp/lootfilter.zip https://github.com/ChrisTitusTech/d2r-loot-filter/releases/latest/download/lootfilter.zip curl -sSLo /tmp/lootfilter.zip https://github.com/ChrisTitusTech/d2r-loot-filter/releases/latest/download/lootfilter.zip
# Extract the contents to the mods folder # Extract the contents to the mods folder
echo "Extracting loot filter to $mods_path..." printf "%b\n" "${YELLOW}Extracting loot filter to $mods_path...${RC}"
unzip -q -o /tmp/lootfilter.zip -d "$mods_path" unzip -q -o /tmp/lootfilter.zip -d "$mods_path"
# Clean up # Clean up
rm /tmp/lootfilter.zip rm /tmp/lootfilter.zip
echo "Loot filter installed successfully in $mods_path" printf "%b\n" "${GREEN}Loot filter installed successfully in $mods_path${RC}"
# Add instructions for setting launch options # Add instructions for setting launch options
echo echo

View File

@ -21,22 +21,22 @@ installPkg() {
configureUFW() { configureUFW() {
printf "%b\n" "${GREEN}Using Chris Titus Recommended Firewall Rules${RC}" printf "%b\n" "${GREEN}Using Chris Titus Recommended Firewall Rules${RC}"
echo "Disabling UFW" printf "%b\n" "${YELLOW}Disabling UFW${RC}"
$ESCALATION_TOOL ufw disable $ESCALATION_TOOL ufw disable
echo "Limiting port 22/tcp (UFW)" printf "%b\n" "${YELLOW}Limiting port 22/tcp (UFW)${RC}"
$ESCALATION_TOOL ufw limit 22/tcp $ESCALATION_TOOL ufw limit 22/tcp
echo "Allowing port 80/tcp (UFW)" printf "%b\n" "${YELLOW}Allowing port 80/tcp (UFW)${RC}"
$ESCALATION_TOOL ufw allow 80/tcp $ESCALATION_TOOL ufw allow 80/tcp
echo "Allowing port 443/tcp (UFW)" printf "%b\n" "${YELLO}Allowing port 443/tcp (UFW)${RC}"
$ESCALATION_TOOL ufw allow 443/tcp $ESCALATION_TOOL ufw allow 443/tcp
echo "Denying Incoming Packets by Default(UFW)" printf "%b\n" "${YELLOW}Denying Incoming Packets by Default(UFW)${RC}"
$ESCALATION_TOOL ufw default deny incoming $ESCALATION_TOOL ufw default deny incoming
echo "Allowing Outcoming Packets by Default(UFW)" printf "%b\n" "${YELLOW}Allowing Outcoming Packets by Default(UFW)${RC}"
$ESCALATION_TOOL ufw default allow outgoing $ESCALATION_TOOL ufw default allow outgoing
$ESCALATION_TOOL ufw enable $ESCALATION_TOOL ufw enable

View File

@ -13,7 +13,7 @@ installDepend() {
echo "Include = /etc/pacman.d/mirrorlist" | $ESCALATION_TOOL tee -a /etc/pacman.conf echo "Include = /etc/pacman.d/mirrorlist" | $ESCALATION_TOOL tee -a /etc/pacman.conf
$ESCALATION_TOOL "$PACKAGER" -Syu $ESCALATION_TOOL "$PACKAGER" -Syu
else else
echo "Multilib is already enabled." printf "%b\n" "${GREEN}Multilib is already enabled.${RC}"
fi fi
$AUR_HELPER -S --needed --noconfirm "$DEPENDENCIES" $AUR_HELPER -S --needed --noconfirm "$DEPENDENCIES"
;; ;;

View File

@ -20,7 +20,7 @@ removeSnaps() {
$ESCALATION_TOOL ${PACKAGER} remove snapd $ESCALATION_TOOL ${PACKAGER} remove snapd
;; ;;
*) *)
echo "Removing snapd not implemented for this package manager" printf "%b\n" "${RED}Removing snapd not implemented for this package manager${RC}"
;; ;;
esac esac
} }