Skip to content

Commit

Permalink
update :3
Browse files Browse the repository at this point in the history
  • Loading branch information
elmerginez committed Jan 23, 2024
1 parent 00d63e1 commit 9612aa9
Show file tree
Hide file tree
Showing 7 changed files with 107 additions and 120 deletions.
Binary file not shown.
Binary file not shown.
Binary file removed extrawalls/gdmwall.jpg
Binary file not shown.
Binary file removed extrawalls/wallpaperflare.com_wallpaper (11).jpg
Binary file not shown.
Binary file removed extrawalls/wallpaperflare.com_wallpaper (16).jpg
Binary file not shown.
210 changes: 101 additions & 109 deletions installer
Original file line number Diff line number Diff line change
@@ -1,192 +1,184 @@
#!/usr/bin/env bash

CRE=$(tput setaf 1)
CYE=$(tput setaf 3)
CGR=$(tput setaf 2)
CBL=$(tput setaf 4)
BLD=$(tput bold)
CNC=$(tput sgr0)
# Define text colors
RED=$(tput setaf 1)
YELLOW=$(tput setaf 3)
GREEN=$(tput setaf 2)
BLUE=$(tput setaf 4)
BOLD=$(tput bold)
RESET=$(tput sgr0)

# Define success message with green color
OK='\n\033[0;32m OK...\033[0m'

logo () {
local text="${1:?}"
echo -en "
# Function to display a stylized logo
logo() {
local text="${1:?}"
echo -en "
███████╗██╗░░░░░███╗░░░███╗███████╗██████╗░
██╔════╝██║░░░░░████╗░████║██╔════╝██╔══██╗
█████╗░░██║░░░░░██╔████╔██║█████╗░░██████╔╝
██╔══╝░░██║░░░░░██║╚██╔╝██║██╔══╝░░██╔══██╗
███████╗███████╗██║░╚═╝░██║███████╗██║░░██║
╚══════╝╚══════╝╚═╝░░░░░╚═╝╚══════╝╚═╝░░╚═╝
SCRIPT\n\n"
printf ' %s [%s%s %s%s %s]%s\n\n' "${CRE}" "${CNC}" "${CYE}" "${text}" "${CNC}" "${CRE}" "${CNC}"
printf ' %s [%s%s %s%s %s]%s\n\n' "${RED}" "${RESET}" "${YELLOW}" "${text}" "${RESET}" "${RED}" "${RESET}"
sleep 2
}

# Check if the script is run as root
if [ "$(id -u)" = 0 ]; then
echo "This script MUST NOT be run as root user."
exit 1
fi

# Display welcome message
logo "Welcome! ${USER}"
printf '%sThis script will install needed dependencies and copy my dotfiles to your bspwm setup.%s\n\nThis installer script does NOT change any configuration of your system.\nIts just a script that copies and moves my dotfiles to your ~/.config directory\n\n' "${CRE}" "${CNC}"
printf '%sThis script will install needed dependencies and copy my dotfiles to your bspwm setup.%s\n\nThis installer script does NOT change any configuration of your system.\nIts just a script that copies and moves my dotfiles to your ~/.config directory\n\n' "${RED}" "${RESET}"
sleep 5

# Ask for user confirmation to continue
while true; do
read -rp " Do you wish to continue? [Yy/Nn]: " yn
case $yn in
[Yy]* ) break;;
[Nn]* ) exit;;
* ) printf " Error: just write 'y' or 'n'\n\n";;
esac
done
clear

read -rp " Do you wish to continue? [Yy/Nn]: " yn
case $yn in
[Yy]* ) break;;
[Nn]* ) exit;;
* ) printf " Error: just write 'y' or 'n'\n\n";;
esac
done
clear

# Display logo for installing needed packages
logo "Installing needed packages..."

dependencias=(base-devel pacman-contrib bspwm polybar sxhkd alacritty dunst rofi lsd jq polkit-gnome playerctl mpd ncmpcpp ranger mpc picom feh ueberzug maim pamixer libwebp webp-pixbuf-loader xorg-xprop xorg-xkill papirus-icon-theme ttf-jetbrains-mono ttf-jetbrains-mono-nerd ttf-terminus-nerd ttf-inconsolata ttf-joypixels zsh neofetch)
# List of dependencies
dependencies=(base-devel pacman-contrib bspwm polybar sxhkd alacritty dunst rofi lsd jq polkit-gnome playerctl mpd ncmpcpp ranger mpc picom feh ueberzug maim pamixer libwebp webp-pixbuf-loader xorg-xprop xorg-xkill papirus-icon-theme ttf-jetbrains-mono ttf-jetbrains-mono-nerd ttf-terminus-nerd ttf-inconsolata ttf-joypixels zsh neofetch)

# Function to check if a package is installed
is_installed() {
pacman -Qi $1 &> /dev/null
return $?
pacman -Qi "$1" &> /dev/null
return $?
}

printf "%s%sChecking for required packages...%s\n" "${BLD}" "${CBL}" "${CNC}"
for paquete in "${dependencias[@]}"
do
if ! is_installed $paquete; then
sudo pacman -S $paquete --noconfirm
printf "\n"
else
printf '%s%s is already installed on your system!%s\n' "${CGR}" "$paquete" "${CNC}"
sleep 1
fi
# Print message for checking required packages
printf "%s%sChecking for required packages...%s\n" "${BOLD}" "${BLUE}" "${RESET}"

# Loop through dependencies and install if needed
for package in "${dependencies[@]}"; do
if ! is_installed "$package"; then
sudo pacman -S "$package" --noconfirm
printf "\n"
else
printf '%s%s is already installed on your system!%s\n' "${GREEN}" "$package" "${RESET}"
sleep 1
fi
done
sleep 2
clear

# Display logo for checking if yay is installed
logo "Checking if yay is installed"

if ! command -v yay &>/dev/null; then
printf "%s%sError YAY is not installed%s\n" "${BLD}" "${CRE}" "${CNC}"
sleep 1
printf "%s%sInstalling YAY..%s\n\n" "${BLD}" "${CYE}" "${CNC}"
sleep 1
git clone https://aur.archlinux.org/yay.git
cd yay
makepkg -si
cd $HOME
rm -rf yay
else
printf "%s%sYAY is already installed on your system%s\n" "${BLD}" "${CGR}" "${CNC}"
fi
# Check if yay is installed, if not, install it
if ! command -v yay &> /dev/null; then
printf "%s%sError YAY is not installed%s\n" "${BOLD}" "${RED}" "${RESET}"
sleep 1
printf "%s%sInstalling YAY..%s\n\n" "${BOLD}" "${YELLOW}" "${RESET}"
sleep 1
git clone https://aur.archlinux.org/yay.git
cd yay || exit
makepkg -si
cd "$HOME" || exit
rm -rf yay
else
printf "%s%sYAY is already installed on your system%s\n" "${BOLD}" "${GREEN}" "${RESET}"
fi
sleep 2
clear



logo "Cloning Rice!"
# Display logo for cloning dotfiles
logo "Cloning DotFiles!"
[ -d ~/arch-dotfiles ] && rm -rf ~/arch-dotfiles
printf "Cloning rice from https://github.com/elmerginez/arch-dotfiles.git\n\n"
cd $HOME
git clone --depth=1 https://github.com/elmerginez/arch-dotfiles.git
sleep 2
clear

logo "Backup your files"
printf "Backup files will be stored in %s%s%s/.zBackupConfig%s \n\n" "${BLD}" "${CRE}" "$HOME" "${CNC}"
sleep 5

if [ ! -d "$HOME/.zBackupConfig" ]; then
mkdir -p "${HOME}"/.zBackupConfig
fi

[ -d ~/.config/bspwm ] && mv ~/.config/bspwm ~/.zBackupConfig/bspwm-backup-"$(date +%Y.%m.%d-%H.%M.%S)"
[ -d ~/.config/termite ] && mv ~/.config/termite ~/.zBackupConfig/termite-backup-"$(date +%Y.%m.%d-%H.%M.%S)"
[ -d ~/.config/alacritty ] && mv ~/.config/alacritty ~/.zBackupConfig/alacritty-backup-"$(date +%Y.%m.%d-%H.%M.%S)"
[ -d ~/.config/picom ] && mv ~/.config/picom ~/.zBackupConfig/picom-backup-"$(date +%Y.%m.%d-%H.%M.%S)"
[ -d ~/.config/rofi ] && mv ~/.config/rofi ~/.zBackupConfig/rofi-backup-"$(date +%Y.%m.%d-%H.%M.%S)"
[ -d ~/.config/eww ] && mv ~/.config/eww ~/.zBackupConfig/eww-backup-"$(date +%Y.%m.%d-%H.%M.%S)"
[ -d ~/.config/sxhkd ] && mv ~/.config/sxhkd ~/.zBackupConfig/sxhkd-backup-"$(date +%Y.%m.%d-%H.%M.%S)"
[ -d ~/.config/dunst ] && mv ~/.config/dunst ~/.zBackupConfig/dunst-backup-"$(date +%Y.%m.%d-%H.%M.%S)"
[ -d ~/.config/gtk-3.0 ] && mv ~/.config/gtk-3.0 ~/.zBackupConfig/gtk-3.0-backup-"$(date +%Y.%m.%d-%H.%M.%S)"
[ -d ~/.config/polybar ] && mv ~/.config/polybar ~/.zBackupConfig/polybar-backup-"$(date +%Y.%m.%d-%H.%M.%S)"
[ -d ~/.config/mpd ] && mv ~/.config/mpd ~/.zBackupConfig/mpd-backup-"$(date +%Y.%m.%d-%H.%M.%S)"
[ -d ~/.config/ncmpcpp ] && mv ~/.config/ncmpcpp ~/.zBackupConfig/ncmpcpp-backup-"$(date +%Y.%m.%d-%H.%M.%S)"
[ -d ~/.config/nvim ] && mv ~/.config/nvim ~/.zBackupConfig/nvim-backup-"$(date +%Y.%m.%d-%H.%M.%S)"
[ -d ~/.config/ranger ] && mv ~/.config/ranger ~/.zBackupConfig/ranger-backup-"$(date +%Y.%m.%d-%H.%M.%S)"
[ -d ~/.config/zsh ] && mv ~/.config/zsh ~/.zBackupConfig/zsh-backup-"$(date +%Y.%m.%d-%H.%M.%S)"

[ -f ~/.zshrc ] && mv ~/.zshrc ~/.zBackupConfig/.zshrc-backup-"$(date +%Y.%m.%d-%H.%M.%S)"

printf "%s%sDone!!%s\n" "${BLD}" "${CGR}" "${CNC}"
printf "Cloning dotfiles from https://github.com/elmerginez/arch-dotfiles.git\n\n"
cd "$HOME" || exit
git clone --depth 1 https://github.com/elmerginez/arch-dotfiles.git
sleep 2
clear

# Display logo for copying config
logo "Copying Config..."
printf "Copying files to respective directories..\n"

if [ ! -d $HOME/.config ]; then
mkdir -p $HOME/.config
cp -Rf $HOME/arch-dotfiles/config/* $HOME/.config/
# Copy configuration files to the appropriate directories
if [ ! -d "$HOME/.config" ]; then
mkdir -p "$HOME/.config"
cp -Rf "$HOME/arch-dotfiles/config/"* "$HOME/.config/"
else
cp -Rf $HOME/arch-dotfiles/config/* $HOME/.config/
cp -Rf "$HOME/arch-dotfiles/config/"* "$HOME/.config/"
fi

if [ ! -d $HOME/.local/bin ]; then
mkdir -p $HOME/.local/bin
cp -Rf $HOME/arch-dotfiles/misc/bin/* $HOME/.local/bin/
# Copy binary files
if [ ! -d "$HOME/.local/bin" ]; then
mkdir -p "$HOME/.local/bin"
cp -Rf "$HOME/arch-dotfiles/misc/bin/"* "$HOME/.local/bin/"
else
cp -Rf $HOME/arch-dotfiles/misc/bin/* $HOME/.local/bin/
cp -Rf "$HOME/arch-dotfiles/misc/bin/"* "$HOME/.local/bin/"
fi

if [ ! -d $HOME/.local/share/applications ]; then
mkdir -p $HOME/.local/share/applications
cp -Rf $HOME/arch-dotfiles/misc/applications/* $HOME/.local/share/applications/
# Copy applications files
if [ ! -d "$HOME/.local/share/applications" ]; then
mkdir -p "$HOME/.local/share/applications"
cp -Rf "$HOME/arch-dotfiles/misc/applications/"* "$HOME/.local/share/applications/"
else
cp -Rf $HOME/arch-dotfiles/misc/applications/* $HOME/.local/share/applications/
cp -Rf "$HOME/arch-dotfiles/misc/applications/"* "$HOME/.local/share/applications/"
fi

if [ ! -d $HOME/.local/share/asciiart ]; then
mkdir -p $HOME/.local/share/asciiart
cp -Rf $HOME/arch-dotfiles/misc/asciiart/* $HOME/.local/share/asciiart/
# Copy ASCII art files
if [ ! -d "$HOME/.local/share/asciiart" ]; then
mkdir -p "$HOME/.local/share/asciiart"
cp -Rf "$HOME/arch-dotfiles/misc/asciiart/"* "$HOME/.local/share/asciiart/"
else
cp -Rf $HOME/arch-dotfiles/misc/asciiart/* $HOME/.local/share/asciiart/
cp -Rf "$HOME/arch-dotfiles/misc/asciiart/"* "$HOME/.local/share/asciiart/"
fi

if [ ! -d $HOME/.local/share/fonts ]; then
mkdir -p $HOME/.local/share/fonts
cp -Rf $HOME/arch-dotfiles/misc/fonts/* $HOME/.local/share/fonts/
# Copy font files
if [ ! -d "$HOME/.local/share/fonts" ]; then
mkdir -p "$HOME/.local/share/fonts"
cp -Rf "$HOME/arch-dotfiles/misc/fonts/"* "$HOME/.local/share/fonts/"
else
cp -Rf $HOME/arch-dotfiles/misc/fonts/* $HOME/.local/share/fonts/
cp -Rf "$HOME/arch-dotfiles/misc/fonts/"* "$HOME/.local/share/fonts/"
fi

cp -f $HOME/arch-dotfiles/home/.zshrc $HOME
# Copy the main zshrc file
cp -f "$HOME/arch-dotfiles/home/.zshrc" "$HOME"

printf "%s%sFiles copied succesfully!!%s\n" "${BLD}" "${CGR}" "${CNC}"
printf "%s%sFiles copied successfully!!%s\n" "${BOLD}" "${GREEN}" "${RESET}"
sleep 2
clear

# Display logo for installing packages from AUR
logo "Installing needed packages from AUR"
yay -S nerd-fonts-cozette-ttf scientifica-font --removemake --cleanafter
sleep 2
clear

# Display logo for reloading fonts
logo "Reloading fonts.."
fc-cache -rv >/dev/null 2>&1
printf "%s%sFonts reloaded succesfully!%s\n" "${BLD}" "${CGR}" "${CNC}"
printf "%s%sFonts reloaded successfully!%s\n" "${BOLD}" "${GREEN}" "${RESET}"
sleep 2
clear

# Display logo for enabling MPD service
logo "Enabling MPD service"
systemctl --user enable mpd.service
systemctl --user start mpd.service
printf "%s%sDone!!%s\n" "${BLD}" "${CGR}" "${CNC}"
printf "%s%sDone!!%s\n" "${BOLD}" "${GREEN}" "${RESET}"
sleep 2
clear

print
# Final message
logo "Installation finished"
printf "%s%sPlease reboot, then select bspwm in your login manager and log in.%s\n\n" "${BLD}" "${CRE}" "${CNC}"
printf "%s%sPlease reboot, then select bspwm in your login manager and log in.%s\n\n" "${BOLD}" "${RED}" "${RESET}"
chsh -s /usr/bin/zsh
zsh
17 changes: 6 additions & 11 deletions misc/asciiart/zshelmer
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,12 @@ initializeANSI

cat << EOF
${boldon}${redfbright} ███████╗░██████╗██╗░░██╗  ███████╗██╗░░░░░███╗░░░███╗███████╗██████╗░
${boldon}${redfbright} ╚════██║██╔════╝██║░░██║  ██╔════╝██║░░░░░████╗░████║██╔════╝██╔══██╗
${boldon}${redfbright} ░░███╔═╝╚█████╗░███████║  █████╗░░██║░░░░░██╔████╔██║█████╗░░██████╔╝
${boldon}${redfbright} ██╔══╝░░░╚═══██╗██╔══██║  ██╔══╝░░██║░░░░░██║╚██╔╝██║██╔══╝░░██╔══██╗
${boldon}${redfbright} ███████╗██████╔╝██║░░██║  ███████╗███████╗██║░╚═╝░██║███████╗██║░░██║
${boldon}${redfbright} ╚══════╝╚═════╝░╚═╝░░╚═╝  ╚══════╝╚══════╝╚═╝░░░░░╚═╝╚══════╝╚═╝░░╚═╝
${boldon}${purplefbright} ███████╗██╗░░░░░███╗░░░███╗███████╗██████╗░
${boldon}${purplefbright} ██╔════╝██║░░░░░████╗░████║██╔════╝██╔══██╗
${boldon}${purplefbright} █████╗░░██║░░░░░██╔████╔██║█████╗░░██████╔╝
${boldon}${purplefbright} ██╔══╝░░██║░░░░░██║╚██╔╝██║██╔══╝░░██╔══██╗
${boldon}${purplefbright} ███████╗███████╗██║░╚═╝░██║███████╗██║░░██║
${boldon}${purplefbright} ╚══════╝╚══════╝╚═╝░░░░░╚═╝╚══════╝╚═╝░░╚═╝
${reset}
EOF

0 comments on commit 9612aa9

Please sign in to comment.