refactor repeated code

This commit is contained in:
guruswarupa 2024-07-24 16:40:15 +05:30
parent 9aff333778
commit bc9bee0bc9
3 changed files with 8 additions and 35 deletions

View File

@ -1,14 +1,5 @@
#!/bin/sh -e
RC='\033[0m'
RED='\033[31m'
YELLOW='\033[33m'
GREEN='\033[32m'
command_exists() {
which $1 >/dev/null 2>&1
}
checkEnv() {
checkCommandRequirements 'curl groups sudo'
checkPackageManager 'apt-get dnf pacman zypper nix-env'

View File

@ -1,14 +1,5 @@
#!/bin/sh -e
RC='\033[0m'
RED='\033[31m'
YELLOW='\033[33m'
GREEN='\033[32m'
command_exists() {
which $1 >/dev/null 2>&1
}
checkEnv() {
checkCommandRequirements 'curl groups sudo'
checkPackageManager 'apt-get dnf pacman zypper nix-env'
@ -20,14 +11,14 @@ setupKitty() {
echo "Install Kitty if not already installed..."
if ! command_exists kitty; then
case ${PACKAGER} in
pacman)
sudo ${PACKAGER} -S --noconfirm kitty
pacman)
sudo $"{PACKAGER}" -S --noconfirm kitty
;;
nix-env)
sudo ${PACKAGER} -iA nixos.kitty
sudo $"{PACKAGER}" -iA nixos.kitty
;;
*)
sudo ${PACKAGER} install -y kitty
sudo "${PACKAGER}" install -y kitty
;;
esac
else
@ -35,11 +26,11 @@ setupKitty() {
fi
echo "Copy Kitty config files"
if [ -d "${HOME}/.config/kitty" ]; then
cp -r ${HOME}/.config/kitty ${HOME}/.config/kitty-bak
cp -r "${HOME}"/.config/kitty "${HOME}"/.config/kitty-bak
fi
mkdir -p ${HOME}/.config/kitty/
wget -O ${HOME}/.config/kitty/kitty.conf https://github.com/ChrisTitusTech/dwm-titus/raw/main/config/kitty/kitty.conf
wget -O ${HOME}/.config/kitty/nord.conf https://github.com/ChrisTitusTech/dwm-titus/raw/main/config/kitty/nord.conf
mkdir -p "${HOME}"/.config/kitty/
wget -O "${HOME}"/.config/kitty/kitty.conf https://github.com/ChrisTitusTech/dwm-titus/raw/main/config/kitty/kitty.conf
wget -O "${HOME}"/.config/kitty/nord.conf https://github.com/ChrisTitusTech/dwm-titus/raw/main/config/kitty/nord.conf
}
checkEnv

View File

@ -1,14 +1,5 @@
#!/bin/sh -e
RC='\033[0m'
RED='\033[31m'
YELLOW='\033[33m'
GREEN='\033[32m'
command_exists() {
which "$1" >/dev/null 2>&1
}
checkEnv() {
checkCommandRequirements 'curl groups sudo'
checkPackageManager 'apt-get dnf pacman zypper nix-env'