Skip to content

Commit

Permalink
alacritty setup
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisTitusTech committed Jul 15, 2024
1 parent 1a05d87 commit fef89ef
Show file tree
Hide file tree
Showing 8 changed files with 159 additions and 7 deletions.
59 changes: 59 additions & 0 deletions src/commands/common-script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#!/bin/sh -e

RC='\033[0m'
RED='\033[31m'
YELLOW='\033[33m'
GREEN='\033[32m'

command_exists() {
which $1 >/dev/null 2>&1
}

checkEnv() {
## Check for requirements.
REQUIREMENTS='curl groups sudo'
for req in ${REQUIREMENTS}; do
if ! command_exists ${req}; then
echo "${RED}To run me, you need: ${REQUIREMENTS}${RC}"
exit 1
fi
done

## Check Package Handler
PACKAGEMANAGER='apt-get dnf pacman zypper'
for pgm in ${PACKAGEMANAGER}; do
if command_exists ${pgm}; then
PACKAGER=${pgm}
echo "Using ${pgm}"
break
fi
done

if [ -z "${PACKAGER}" ]; then
echo "${RED}Can't find a supported package manager${RC}"
exit 1
fi

## Check SuperUser Group
SUPERUSERGROUP='wheel sudo root'
for sug in ${SUPERUSERGROUP}; do
if groups | grep -q ${sug}; then
SUGROUP=${sug}
echo "Super user group ${SUGROUP}"
break
fi
done

## Check if member of the sudo group.
if ! groups | grep -q ${SUGROUP}; then
echo "${RED}You need to be a member of the sudo group to run me!${RC}"
exit 1
fi

DTYPE="unknown" # Default to unknown
# Use /etc/os-release for modern distro identification
if [ -f /etc/os-release ]; then
. /etc/os-release
DTYPE=$ID
fi
}
85 changes: 85 additions & 0 deletions src/commands/dotfiles/alacritty-setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
#!/bin/sh -e

RC='\033[0m'
RED='\033[31m'
YELLOW='\033[33m'
GREEN='\033[32m'

command_exists() {
which $1 >/dev/null 2>&1
}

checkEnv() {
## Check for requirements.
REQUIREMENTS='curl groups sudo'
for req in ${REQUIREMENTS}; do
if ! command_exists ${req}; then
echo "${RED}To run me, you need: ${REQUIREMENTS}${RC}"
exit 1
fi
done

## Check Package Handler
PACKAGEMANAGER='apt-get dnf pacman zypper'
for pgm in ${PACKAGEMANAGER}; do
if command_exists ${pgm}; then
PACKAGER=${pgm}
echo "Using ${pgm}"
break
fi
done

if [ -z "${PACKAGER}" ]; then
echo "${RED}Can't find a supported package manager${RC}"
exit 1
fi

## Check SuperUser Group
SUPERUSERGROUP='wheel sudo root'
for sug in ${SUPERUSERGROUP}; do
if groups | grep -q ${sug}; then
SUGROUP=${sug}
echo "Super user group ${SUGROUP}"
break
fi
done

## Check if member of the sudo group.
if ! groups | grep -q ${SUGROUP}; then
echo "${RED}You need to be a member of the sudo group to run me!${RC}"
exit 1
fi

DTYPE="unknown" # Default to unknown
# Use /etc/os-release for modern distro identification
if [ -f /etc/os-release ]; then
. /etc/os-release
DTYPE=$ID
fi
}

setupAlacritty() {
echo "Install Alacritty if not already installed..."
if ! command_exists alacritty; then
case ${PACKAGER} in
pacman)
sudo ${PACKAGER} -S --noconfirm alacritty
;;
*)
sudo ${PACKAGER} install -y alacritty
;;
esac
else
echo "alacritty is already installed."
fi
echo "Copy alacritty config files"
if [ -d "${HOME}/.config/alacritty" ]; then
cp -r "${HOME}/.config/alacritty" "${HOME}/.config/alacritty-bak"
fi
mkdir -p "${HOME}/.config/alacritty/"
wget -O "${HOME}/.config/alacritty/alacritty.toml" "https://github.com/ChrisTitusTech/dwm-titus/raw/main/config/alacritty/alacritty.toml"
wget -O "${HOME}/.config/alacritty/nordic.toml" "https://github.com/ChrisTitusTech/dwm-titus/raw/main/config/alacritty/nordic.toml"
}

checkEnv
setupAlacritty
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/sh
#!/bin/sh -e

RC='\033[0m'
RED='\033[31m'
YELLOW='\033[33m'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/sh
#!/bin/sh -e

RC='\033[0m'
RED='\033[31m'
YELLOW='\033[33m'
Expand Down
3 changes: 2 additions & 1 deletion src/commands/system-setup/1-compile-setup.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/sh
#!/bin/sh -e

RC='\033[0m'
RED='\033[31m'
YELLOW='\033[33m'
Expand Down
2 changes: 1 addition & 1 deletion src/commands/system-setup/2-gaming-setup.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/sh -e

RC='\e[0m'
RED='\e[31m'
Expand Down
3 changes: 2 additions & 1 deletion src/commands/system-update.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/sh
#!/bin/sh -e

RC='\033[0m'
RED='\033[31m'
YELLOW='\033[33m'
Expand Down
8 changes: 6 additions & 2 deletions src/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,17 @@ impl CustomList {
name: "Titus Dotfiles",
command: ""
} => {
ListNode {
name: "Alacritty Setup",
command: include_str!("commands/dotfiles/alacritty-setup.sh"),
},
ListNode {
name: "Kitty Setup",
command: include_str!("commands/kitty-setup.sh"),
command: include_str!("commands/dotfiles/kitty-setup.sh"),
},
ListNode {
name: "Rofi Setup",
command: include_str!("commands/rofi-setup.sh"),
command: include_str!("commands/dotfiles/rofi-setup.sh"),
},
}
});
Expand Down

0 comments on commit fef89ef

Please sign in to comment.