Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make shell scripts more interactive #532

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 28 additions & 16 deletions tabs/applications-setup/alacritty-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,46 @@
. ../common-script.sh

installAlacritty() {
printf "%b\n" "${YELLOW}Installing Alacritty...${RC}"
if ! command_exists alacritty; then
case "$PACKAGER" in
pacman)
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm alacritty
;;
*)
"$ESCALATION_TOOL" "$PACKAGER" install -y alacritty
;;
esac
printf "%b" "${YELLOW}Do you want to install Alacritty? (Y/n): ${RC}"
read -r install_choice
if [ "$install_choice" != "n" ] && [ "$install_choice" != "N" ]; then
printf "%b\n" "${YELLOW}Installing Alacritty...${RC}"
if ! command_exists alacritty; then
case "$PACKAGER" in
pacman)
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm alacritty
;;
*)
"$ESCALATION_TOOL" "$PACKAGER" install -y alacritty
;;
esac
else
printf "%b\n" "${GREEN}Alacritty is already installed.${RC}"
fi
else
printf "%b\n" "${GREEN}Alacritty is already installed.${RC}"
printf "%b\n" "${GREEN}Skipping Alacritty installation.${RC}"
fi
}

setupAlacrittyConfig() {
printf "%b\n" "${YELLOW}Copy alacritty config files${RC}"
if [ -d "${HOME}/.config/alacritty" ] && [ ! -d "${HOME}/.config/alacritty-bak" ]; then
cp -r "${HOME}/.config/alacritty" "${HOME}/.config/alacritty-bak"
printf "%b" "${YELLOW}Do you want to backup existing configuration files? (Y/n): ${RC}"
read -r backup_choice
if [ "$backup_choice" != "n" ] && [ "$backup_choice" != "N" ]; then
printf "%b\n" "${YELLOW}Backing up existing Alacritty config files...${RC}"
if [ -d "${HOME}/.config/alacritty" ] && [ ! -d "${HOME}/.config/alacritty-bak" ]; then
cp -r "${HOME}/.config/alacritty" "${HOME}/.config/alacritty-bak"
fi
printf "%b\n" "${GREEN}Alacritty configuration files backed up.${RC}"
else
printf "%b\n" "${GREEN}Skipping backup of Alacritty configuration files.${RC}"
fi
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/keybinds.toml" "https://github.com/ChrisTitusTech/dwm-titus/raw/main/config/alacritty/keybinds.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
checkEscalationTool
installAlacritty
setupAlacrittyConfig
setupAlacrittyConfig
14 changes: 10 additions & 4 deletions tabs/applications-setup/bottles-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,16 @@
. ../common-script.sh

install_bottles() {
printf "%b\n" "${YELLOW}Installing Bottles...${RC}"
. ./setup-flatpak.sh
flatpak install -y flathub com.usebottles.bottles
printf "%b\n" "${GREEN}Bottles installed successfully. Restart the system to apply changes...${RC}"
printf "%b" "${YELLOW}Do you want to install Bottles? (Y/n): ${RC}"
read -r install_choice
if [ "$install_choice" != "n" ] && [ "$install_choice" != "N" ]; then
printf "%b\n" "${YELLOW}Installing Bottles...${RC}"
. ./setup-flatpak.sh
flatpak install -y flathub com.usebottles.bottles
printf "%b\n" "${GREEN}Bottles installed successfully.${RC}"
else
printf "%b\n" "${GREEN}Skipping Bottles installation.${RC}"
fi
}

checkEnv
Expand Down
41 changes: 27 additions & 14 deletions tabs/applications-setup/fastfetch-setup.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,38 @@
. ../common-script.sh

installFastfetch() {
printf "%b\n" "${YELLOW}Installing Fastfetch...${RC}"
if ! command_exists fastfetch; then
case "$PACKAGER" in
pacman)
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm fastfetch
;;
*)
"$ESCALATION_TOOL" "$PACKAGER" install -y fastfetch
;;
esac
printf "%b" "${YELLOW}Do you want to install Fastfetch? (Y/n): ${RC}"
read -r install_choice
if [ "$install_choice" != "n" ] && [ "$install_choice" != "N" ]; then
printf "%b\n" "${YELLOW}Installing Fastfetch...${RC}"
if ! command_exists fastfetch; then
case "$PACKAGER" in
pacman)
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm fastfetch
;;
*)
"$ESCALATION_TOOL" "$PACKAGER" install -y fastfetch
;;
esac
else
printf "%b\n" "${GREEN}Fastfetch is already installed.${RC}"
fi
else
printf "%b\n" "${GREEN}Fastfetch is already installed.${RC}"
printf "%b\n" "${GREEN}Skipping Fastfetch installation.${RC}"
fi
}

setupFastfetchConfig() {
printf "%b\n" "${YELLOW}Copying Fastfetch config files...${RC}"
if [ -d "${HOME}/.config/fastfetch" ] && [ ! -d "${HOME}/.config/fastfetch-bak" ]; then
cp -r "${HOME}/.config/fastfetch" "${HOME}/.config/fastfetch-bak"
printf "%b" "${YELLOW}Do you want to backup existing Fastfetch configuration files? (Y/n): ${RC}"
read -r backup_choice
if [ "$backup_choice" != "n" ] && [ "$backup_choice" != "N" ]; then
printf "%b\n" "${YELLOW}Backing up existing Fastfetch configuration files...${RC}"
if [ -d "${HOME}/.config/fastfetch" ] && [ ! -d "${HOME}/.config/fastfetch-bak" ]; then
cp -r "${HOME}/.config/fastfetch" "${HOME}/.config/fastfetch-bak"
fi
printf "%b\n" "${GREEN}Fastfetch configuration files backed up.${RC}"
else
printf "%b\n" "${GREEN}Skipping backup of Fastfetch configuration files.${RC}"
fi
mkdir -p "${HOME}/.config/fastfetch/"
curl -sSLo "${HOME}/.config/fastfetch/config.jsonc" https://raw.githubusercontent.com/ChrisTitusTech/mybash/main/config.jsonc
Expand Down
41 changes: 27 additions & 14 deletions tabs/applications-setup/kitty-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,38 @@
. ../common-script.sh

installKitty() {
printf "%b\n" "${YELLOW}Install Kitty if not already installed...${RC}"
if ! command_exists kitty; then
case "$PACKAGER" in
pacman)
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm kitty
;;
*)
"$ESCALATION_TOOL" "$PACKAGER" install -y kitty
;;
esac
printf "%b" "${YELLOW}Do you want to install Kitty? (Y/n): ${RC}"
read -r install_choice
if [ "$install_choice" != "n" ] && [ "$install_choice" != "N" ]; then
printf "%b\n" "${YELLOW}Installing Kitty...${RC}"
if ! command_exists kitty; then
case "$PACKAGER" in
pacman)
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm kitty
;;
*)
"$ESCALATION_TOOL" "$PACKAGER" install -y kitty
;;
esac
else
printf "%b\n" "${GREEN}Kitty is already installed.${RC}"
fi
else
printf "%b\n" "${GREEN}Kitty is already installed.${RC}"
printf "%b\n" "${GREEN}Skipping Kitty installation.${RC}"
fi
}

setupKittyConfig() {
printf "%b\n" "${YELLOW}Copying Kitty configuration files...${RC}"
if [ -d "${HOME}/.config/kitty" ] && [ ! -d "${HOME}/.config/kitty-bak" ]; then
cp -r "${HOME}/.config/kitty" "${HOME}/.config/kitty-bak"
printf "%b" "${YELLOW}Do you want to backup existing Kitty configuration files? (Y/n): ${RC}"
read -r backup_choice
if [ "$backup_choice" != "n" ] && [ "$backup_choice" != "N" ]; then
printf "%b\n" "${YELLOW}Backing up existing Kitty configuration files...${RC}"
if [ -d "${HOME}/.config/kitty" ] && [ ! -d "${HOME}/.config/kitty-bak" ]; then
cp -r "${HOME}/.config/kitty" "${HOME}/.config/kitty-bak"
fi
printf "%b\n" "${GREEN}Kitty configuration files backed up.${RC}"
else
printf "%b\n" "${GREEN}Skipping backup of Kitty configuration files.${RC}"
fi
mkdir -p "${HOME}/.config/kitty/"
curl -sSLo "${HOME}/.config/kitty/kitty.conf" https://github.com/ChrisTitusTech/dwm-titus/raw/main/config/kitty/kitty.conf
Expand Down
4 changes: 2 additions & 2 deletions tabs/system-setup/auto-mount.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
select_drive() {
clear
printf "%b\n" "Available drives and partitions:"
lsblk -o NAME,SIZE,FSTYPE,MOUNTPOINT,LABEL,UUID | grep -v 'loop' # list all non-loop devices
lsblk -o NAME,SIZE,FSTYPE,MOUNTPOINT,LABEL,UUID | grep -v 'loop' | more # list all non-loop devices
printf "\n"
printf "%b\n" "Enter the drive/partition name (e.g., sda1, sdb1): "
printf "%b" "Enter the drive/partition name (e.g., sda1, sdb1): "
read -r drive_name
# Check if the input is valid
if lsblk | grep -q "${drive_name}"; then
Expand Down
Loading