Updated the install script

This commit is contained in:
2025-02-08 17:46:47 +00:00
parent da4c3b7fa8
commit 1184d859eb
8 changed files with 123 additions and 36 deletions

54
home/.bashrc Normal file
View File

@@ -0,0 +1,54 @@
export EDITOR="vim"
export PS1="\n[\[\e[37m\]\u\[\e[0m\]@\[\e[37;2m\]\h\[\e[0m\]] \[\e[1m\]\w \[\e[0;2m\]J:\[\e[0m\]\j\n\$ "
extract() {
if [ -f $1 ]; then
case $1 in
*.tar.bz2) tar xjf $1 ;;
*.tar.gz) tar xzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) unrar e $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xf $1 ;;
*.tbz2) tar xjf $1 ;;
*.tgz) tar xzf $1 ;;
*.zip) unzip $1 ;;
*.Z) uncompress $1 ;;
*.7z) 7z x $1 ;;
*) echo "'$1' cannot be extracted via extract()" ;;
esac
else
echo "'$1' is not a valid file"
fi
}
# Commands that should be applied only for interactive shells.
[[ $- == *i* ]] || return
HISTFILESIZE=100000
HISTSIZE=10000
shopt -s histappend
shopt -s checkwinsize
shopt -s extglob
# shopt -s globstar
# shopt -s checkjobs
alias l='ls -alh'
alias ls='ls --color=auto'
alias grep='grep --color=auto'
alias ll='ls -lhi'
alias ta='tmux attach'
alias t='tmux'
alias v='nvim'
alias cat="bat"
set completion-ignore-case On
# Use bash-completion, if available
[[ $PS1 && -f /usr/share/bash-completion/bash_completion ]] &&
. /usr/share/bash-completion/bash_completion
export OFLAGS="--ozone-platform-hint=auto"
export PATH=$PATH:/home/trude/.local/bin

View File

@@ -17,59 +17,72 @@ echo "####################"
echo -e "${CYAN}Running on: ${PURPLE}$OSTYPE${NC}"
echo
# Update repositories
# Detect package managers and update repositories
if [[ "$OSTYPE" == "darwin"* ]]; then
if command -v brew >/dev/null 2>&1; then
if ! command -v brew >/dev/null 2>&1; then
echo -e "${YELLOW}[+] Installing Homebrew...${NC}"
chsh -s /bin/bash # Switch to bash (optional)
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi
pkg_manager="brew"
echo -e "${YELLOW}[+] Updating Homebrew repositories...${NC}"
brew update
else
echo -e "${YELLOW}[i] Brew is not installed. Skipping update on macOS.${NC}"
fi
else
if [ -f /etc/os-release ]; then
. /etc/os-release
if [[ "$ID_LIKE" == *debian* || "$ID" == "debian" || "$ID" == "ubuntu" ]]; then
elif command -v apt >/dev/null 2>&1; then
pkg_manager="apt"
echo -e "${YELLOW}[+] Updating APT repositories...${NC}"
sudo apt update
elif [[ "$ID" == "fedora" ]]; then
elif command -v dnf >/dev/null 2>&1; then
pkg_manager="dnf"
echo -e "${YELLOW}[+] Updating DNF repositories...${NC}"
sudo dnf update
elif [[ "$ID" == "arch" ]]; then
elif command -v pacman >/dev/null 2>&1; then
pkg_manager="pacman"
echo -e "${YELLOW}[+] Updating PACMAN repositories...${NC}"
sudo pacman -Sy
else
echo -e "${RED}[E] Distribution not recognized for repository update.${NC}"
fi
else
echo -e "${RED}[E] /etc/os-release not found. Skipping repository update.${NC}"
fi
else
echo -e "${RED}[E] No supported package manager found. Exiting...${NC}"
exit 1
fi
# Check if git is installed
if ! git --version &>/dev/null; then
echo -e "${YELLOW}[+] Installing GIT...${NC}"
sudo apt install -y git
# Install Programs
programs=(neovim curl git bat)
for prog in "${programs[@]}"; do
echo -e "${YELLOW}[+] Installing ${prog}...${NC}"
case $pkg_manager in
brew)
brew install "$prog"
;;
apt)
sudo apt install -y "$prog"
;;
dnf)
sudo dnf install -y "$prog"
;;
pacman)
sudo pacman -S --noconfirm "$prog"
;;
esac
if [ $? -ne 0 ]; then
echo -e "${RED}[E] Error installing GIT. Exiting...${NC}"
exit 1
echo -e "${RED}[E] Error installing ${prog}.${NC}"
else
echo -e "${GREEN}[I] ${prog} installed successfully.${NC}"
fi
else
echo -e "${GREEN}[I] GIT is already installed.${NC}"
fi
done
# Clone Dotfiles if not already present
cd $HOME/dotfiles
if [ $(pwd) != "$HOME/dotfiles" ]; then
echo -e "${YELLOW}[+] Cloning Dotfiles repository...${NC}"
echo -e "${YELLOW}[+] Cloning dotfiles repository...${NC}"
git clone https://github.com/TrudeEH/dotfiles --depth 1
if [ $? -ne 0 ]; then
echo -e "${RED}[E] Error cloning Dotfiles repository. Exiting...${NC}"
echo -e "${RED}[E] Error cloning dotfiles repository. Exiting...${NC}"
exit 2
fi
cd dotfiles
echo -e "${GREEN}[I] Dotfiles repository cloned successfully.${NC}"
echo -e "${GREEN}[I] dotfiles repository cloned successfully.${NC}"
else
echo -e "${GREEN}[I] Dotfiles repository already present.${NC}"
echo -e "${GREEN}[I] dotfiles repository already present.${NC}"
fi
# Copy files
@@ -81,6 +94,26 @@ else
echo -e "${GREEN}[I] Dotfiles installed successfully.${NC}"
fi
# Install fonts
echo -e "${YELLOW}[+] Installing fonts...${NC}"
if [[ "$OSTYPE" == "darwin"* ]]; then
cp -rf $HOME/dotfiles/fonts/* $HOME/Library/Fonts/
if [ $? -ne 0 ]; then
echo -e "${RED}[E] Error installing fonts.${NC}"
else
echo -e "${GREEN}[I] Fonts installed successfully.${NC}"
fi
else
mkdir -p $HOME/.local/share/fonts
cp -rf $HOME/dotfiles/fonts/* $HOME/.local/share/fonts/
if [ $? -ne 0 ]; then
echo -e "${RED}[E] Error installing fonts.${NC}"
else
fc-cache -fv $HOME/.local/share/fonts
echo -e "${GREEN}[I] Fonts installed successfully.${NC}"
fi
fi
# Load Dconf (GNOME settings)
if [[ "$OSTYPE" != "darwin"* ]]; then
echo -e "${YELLOW}[+] Loading Dconf settings...${NC}"