update installer

This commit is contained in:
sankalp committed 2024-01-30 16:57:40 +05:45
1 parent 8ad7917c4f
commit 93ae89163e
4 files changed
+343 -223

No files matched your search

Executable
+340
View File
@@ -0,0 +1,340 @@
#!/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)
backup_folder=~/.RiceBackup
date=$(date +%Y%m%d-%H%M%S)
log_file=installer_log.txt
# Function to log message
log() {
echo "$(date '+%Y-%m-%d %H:%M:%S') $1" | tee -a "$log_file"
}
# Redirect stdout and stderr to the log file
exec > >(tee -a "$log_file") 2>&1
# Function to display logo
logo () {
local text="${1:?}"
echo -en "
#####################################
# #
# @author : 00xZ4CKX #
#  GitHub : @S4NKALP #
#  Developer : Sankalp Tharu #
# 﫥 Copyright : Sankalp Tharu #
# #
#####################################
"
printf ' %s [%s%s %s%s %s]%s\n\n' "${CRE}" "${CNC}" "${CYE}" "${text}" "${CNC}" "${CRE}" "${CNC}"
}
########## ---------- You must not run this as root ---------- ##########
if [ "$(id -u)" = 0 ]; then
echo "This script MUST NOT be run as root user."
exit 1
fi
########## ---------- Welcome ---------- ##########
logo "Welcome!"
printf '%s%sThis script will check if you have the necessary dependencies, and if not, it will install them. Then, it will clone the RICE in your HOME directory.\nAfter that, it will create a secure backup of your files, and then copy the new files to your computer.\nYou will be prompted for your root password to install missing dependencies and/or to switch to zsh shell if its not your default.It will generate log file.\n\nThis script doesnt have the potential power to break your system, it only copies files from my repository to your HOME directory.%s\n\n' "${BLD}" "${CRE}" "${CNC}"
while true; do
read -rp " Do you wish to continue? [y/N]: " yn
case $yn in
[Yy]* ) break;;
[Nn]* ) exit;;
* ) printf " Error: just write 'y' or 'n'\n\n";;
esac
done
clear
########## ---------- Install packages ---------- ##########
logo "Installing needed packages.."
dependencias=(
hyprland
fnm
keyb
rofi-file-browser-extended-git
imv
brightnessctl
yazi
waybar
playerctl
wf-recorder
kvantum
swaylock-effects-git
qt5ct
qt6ct
nwg-look
mpv-mpris
pacman-contrib
swayidle
pavucontrol
pamixer
file-roller
alsa-utils
linux-headers
less
wlroots
thunar
thunar-volman
thunar-archive-plugin
udiskie
mtpfs
jmtpfs
gvfs-gphoto2
gvfs-mtp
rofi-lbonn-wayland-git
network-manager-applet
lsd
cava
geany
geany-plugin
swaync
tumbler
unzip
zip
unrar
polkit-gnome
xdg-user-dirs
clipshit
swww
kitty
imagemagick
bluez
bluez-utils
grim
slurp
jq
zathura
zathura-pdf-mupdf
yt-dlp
ffmpegthumbnailer
xdotool
wmctrl
zsh
lazygit
xdg-desktop-portal-gtk
gtk-engine-murrine
lxappearance
xsel
bc
sddm
adobe-source-code-pro-fonts
ttf-fira-code
ttf-jetbrains-mono-nerd
ttf-jetbrains-mono
noto-fonts-emoji
ttf-droid
otf-font-awesome
ttf-cascadia-code-nerd
ttf-bitstream-vera
ttf-croscore
ttf-dejavu
ttf-ibm-plex
ttf-liberation
noto-fonts
gnu-free-fonts
)
is_installed() {
paru -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
paru -S "$paquete" --noconfirm
printf "\n"
else
printf '%s%s is already installed on your system!%s\n' "${CGR}" "$paquete" "${CNC}"
sleep 1
fi
done
sleep 3
clear
########## ---------- Preparing Folders ---------- ##########
# Check if the file user-dirs.dirs does not exist in ~/.config
if [ ! -e "$HOME/.config/user-dirs.dirs" ]; then
xdg-user-dirs-update
echo "Creating xdg-user-dirs"
fi
sleep 2
clear
########## ---------- Cloning the Rice! ---------- ##########
logo "Downloading dotfiles"
repo_url="https://github.com/S4NKALP/hyprland"
repo_dir="$HOME/dotfiles"
# Checks if the repository directory already exists and if so, deletes it
if [ -d "$repo_dir" ]; then
printf "Removing existing dotfiles repository\n"
rm -rf "$repo_dir"
fi
# Clona el repositorio
printf "Cloning dotfiles from %s\n" "$repo_url"
git clone --depth=1 "$repo_url" "$repo_dir"
sleep 2
clear
########## ---------- Backup files ---------- ##########
logo "Backup files"
printf "Backup files will be stored in %s%s%s/.RiceBackup%s \n\n" "${BLD}" "${CRE}" "$HOME" "${CNC}"
sleep 10
if [ ! -d "$backup_folder" ]; then
mkdir -p "$backup_folder"
fi
for folder in BetterDiscord cava geany hypr keyb kitty Kvantum lazygit lsd mpv neofetch nvim qimgv qt5ct qt6ct rofi starship swaylock swaync Thunar VSCodium waybar yazi zathura zsh; do
if [ -d "$HOME/.config/$folder" ]; then
mv "$HOME/.config/$folder" "$backup_folder/${folder}_$date"
echo "$folder folder backed up successfully at $backup_folder/${folder}_$date"
else
echo "The folder $folder does not exist in $HOME/.config/"
fi
done
[ -f ~/.zshrc ] && mv ~/.zshrc ~/.RiceBackup/.zshrc-backup-"$(date +%Y.%m.%d-%H.%M.%S)"
printf "%s%sDone!!%s\n\n" "${BLD}" "${CGR}" "${CNC}"
sleep 5
########## ---------- Copy the Rice! ---------- ##########
logo "Installing dotfiles.."
printf "Copying files to respective directories..\n"
[ ! -d ~/.config ] && mkdir -p ~/.config
[ ! -d ~/.local/bin ] && mkdir -p ~/.local/bin
[ ! -d ~/Pictures/wallpapers ] && mkdir -p ~/Pictures/wallpapers
for archivos in ~/dotfiles/config/*; do
cp -R "${archivos}" ~/.config/
if [ $? -eq 0 ]; then
printf "%s%s%s folder copied succesfully!%s\n" "${BLD}" "${CGR}" "${archivos}" "${CNC}"
sleep 1
else
printf "%s%s%s failed to been copied, you must copy it manually%s\n" "${BLD}" "${CRE}" "${archivos}" "${CNC}"
sleep 1
fi
done
for archivos in ~/dotfiles/misc/bin/*; do
cp -R "${archivos}" ~/.local/bin/
if [ $? -eq 0 ]; then
printf "%s%s%s file copied succesfully!%s\n" "${BLD}" "${CGR}" "${archivos}" "${CNC}"
sleep 1
else
printf "%s%s%s failed to been copied, you must copy it manually%s\n" "${BLD}" "${CRE}" "${archivos}" "${CNC}"
sleep 1
fi
done
for archivos in ~/dotfiles/misc/.zshenv; do
cp -R "${archivos}" ~/
if [ $? -eq 0 ]; then
printf "%s%s%s file copied succesfully!%s\n" "${BLD}" "${CGR}" "${archivos}" "${CNC}"
sleep 1
else
printf "%s%s%s failed to been copied, you must copy it manually%s\n" "${BLD}" "${CRE}" "${archivos}" "${CNC}"
sleep 1
fi
done
for archivos in ~/dotfiles/wallpapers/*; do
cp -R "${archivos}" ~/Pictures/wallpapers
if [ $? -eq 0 ]; then
printf "%s%s%s file copied succesfully!%s\n" "${BLD}" "${CGR}" "${archivos}" "${CNC}"
sleep 1
else
printf "%s%s%s failed to been copied, you must copy it manually%s\n" "${BLD}" "${CRE}" "${archivos}" "${CNC}"
sleep 1
fi
done
printf "%s%sFiles copied succesfully!!%s\n" "${BLD}" "${CGR}" "${CNC}"
sleep 3
########## ---------- Enabling Bluetooth service ---------- ##########
logo "Enabling bluetooth service"
# Check if the bluetooth service is enabled
if systemctl is-enabled --quiet bluetooth.service; then
printf "\n%s%sDisabling and stopping the Bluetooth service%s\n" "${BLD}" "${CBL}" "${CNC}"
sudo systemctl stop bluetooth.service
sudo systemctl disable bluetooth.service
fi
printf "\n%s%sEnabling bluetooth service%s\n" "${BLD}" "${CYE}" "${CNC}"
sudo systemctl enable --now bluetooth.service
printf "%s%sDone!!%s\n\n" "${BLD}" "${CGR}" "${CNC}"
sleep 2
########## --------- Enabling Sddm service ---------- ##########
logo "Enabling sddm service"
# Chech if the sddm service is enabled
if systemctl is-enabled --quiet sddm.service; then
printf "\n%s%sDisabling and stopping the SDDM service%s\n" "${BLD}" "${CBL}" "${CNC}"
sudo systemctl stop sddm.service
sudo systemctl disable sddm.service
fi
printf "\n%s%sEnabling sddm service%s\n" "${BLD}" "${CYE}" "${CNC}"
sudo systemctl enable sddm
printf "%s%sDone!!%s\n\n" "${BLD}" "${CGR}" "${CNC}"
sleep 2
########## --------- Installing GTK THMES ---------- ##########
logo "Installing GTK THMES"
git clone https://github.com/Fausto-Korpsvart/Tokyo-Night-GTK-Theme.git
sudo cp -r Tokyo-Night-GTK-Theme/themes/Tokyonight-Dark-BL-LB /usr/share/themes/
sudo cp -r Tokyo-Night-GTK-Theme/icons/Tokyonight-Dark /usr/share/icons/
sudo tar -xf "assets/Bibata-Modern-Ice.tar.xz" -C /usr/share/icons/
########## --------- Changing shell to zsh ---------- ##########
logo "Changing default shell to zsh"
if [[ $SHELL != "/usr/bin/zsh" ]]; then
printf "\n%s%sChanging your shell to zsh. Your root password is needed.%s\n\n" "${BLD}" "${CYE}" "${CNC}"
# Change the shell to zsh
chsh -s /usr/bin/zsh
printf "%s%sShell changed to zsh. Please reboot.%s\n\n" "${BLD}" "${CGR}" "${CNC}"
else
printf "%s%sYour shell is already zsh\nGood bye! installation finished, now reboot%s\n" "${BLD}" "${CGR}" "${CNC}"
fi
zsh
+3 -5
View File
@@ -14,14 +14,12 @@ git clone https://aur.archlinux.org/paru-bin.git
* makepkg -Si
> **Warning**
>
> DO NOT blindly run this. Backup your dots beforehand.
<b> Installing automatically</b>
```
git clone https://github.com/S4NKALP/hyprland
curl https://raw.githubusercontent.com/S4NKALP/hyprland/main/Installer.sh -o $HOME/Installer.sh
chmod +x Installer.sh
./Installer
```
<details>
-218
View File
@@ -1,218 +0,0 @@
#!/usr/bin/env bash
#the main packages
install_stage=(
hyprland
fnm
keyb
rofi-file-browser-extended-git
imv
brightnessctl
yazi
waybar
playerctl
wf-recorder
kvantum
swaylock-effects-git
qt5ct
qt6ct
nwg-look
mpv-mpris
pacman-contrib
swayidle
pavucontrol
pamixer
file-roller
alsa-utils
linux-headers
less
wlroots
thunar
thunar-volman
thunar-archive-plugin
udiskie
mtpfs
jmtpfs
gvfs-gphoto2
gvfs-mtp
rofi-lbonn-wayland-git
network-manager-applet
lsd
cava
geany
geany-plugin
swaync
tumbler
unzip
zip
unrar
polkit-gnome
xdg-user-dirs
clipshit
swww
kitty
imagemagick
bluez
bluez-utils
grim
slurp
jq
zathura
zathura-pdf-mupdf
yt-dlp
ffmpegthumbnailer
xdotool
wmctrl
zsh
lazygit
xdg-desktop-portal-gtk
gtk-engine-murrine
lxappearance
xsel
bc
sddm
adobe-source-code-pro-fonts
ttf-fira-code
ttf-jetbrains-mono-nerd
ttf-jetbrains-mono
noto-fonts-emoji
ttf-droid
otf-font-awesome
ttf-cascadia-code-nerd
ttf-bitstream-vera
ttf-croscore
ttf-dejavu
ttf-ibm-plex
ttf-liberation
noto-fonts
gnu-free-fonts
)
# set some colors
CNT="[\e[1;36mNOTE\e[0m]"
COK="[\e[1;32mOK\e[0m]"
CER="[\e[1;31mERROR\e[0m]"
CAT="[\e[1;37mATTENTION\e[0m]"
CWR="[\e[1;35mWARNING\e[0m]"
CAC="[\e[1;33mACTION\e[0m]"
INSTLOG="install.log"
# Function to display the script logo
show_logo() {
echo -en "
#####################################
# #
# @author : 00xZ4CKX #
#  GitHub : @S4NKALP #
#  Developer : Sankalp Tharu #
# 﫥 Copyright : Sankalp Tharu #
# #
#####################################
Warning! Please do Backup before going ahead. Do at your own risk.
"
}
# function that would show a progress bar to the user
show_progress() {
while ps | grep $1 &> /dev/null;
do
echo -n "."
sleep 2
done
echo -en "Done!\n"
sleep 2
}
# function that will test for a package and if not found it will attempt to install it
install_software() {
# First lets see if the package is there
if paru -Q $1 &>> /dev/null ; then
echo -e "$COK - $1 is already installed."
else
# no package found so installing
echo -en "$CNT - Now installing $1 ."
paru -S --noconfirm $1 &>> $INSTLOG &
show_progress $!
# test to make sure package installed
if paru -Q $1 &>> /dev/null ; then
echo -e "\e[1A\e[K$COK - $1 was installed."
else
# if this is hit then a package is missing, exit to review log
echo -e "\e[1A\e[K$CER - $1 install had failed, please check the install.log"
exit
fi
fi
}
# clear the screen
clear
# Display the logo
show_logo
sleep 1
# let the user know that we will use sudo
echo -e "$CNT - This script will run some commands that require sudo. You will be prompted to enter your password.
If you are worried about entering your password then you may want to review the content of the script."
sleep 1
# give the user an option to exit out
read -rep $'[\e[1;33mACTION\e[0m] - Would you like to continue with the install (y,n) ' CONTINST
if [[ $CONTINST == "Y" || $CONTINST == "y" ]]; then
echo -e "$CNT - Setup starting..."
else
echo -e "$CNT - This script will now exit, no changes were made to your system."
exit
fi
### Install all of the above pacakges ####
read -rep $'[\e[1;33mACTION\e[0m] - Would you like to install the packages? (y,n) ' INST
if [[ $INST == "Y" || $INST == "y" ]]; then
# Stage 1 - main components
echo -e "$CNT - Installing main components, this may take a while..."
for SOFTWR in ${install_stage[@]}; do
install_software $SOFTWR
done
# Start the bluetooth service
echo -e "$CNT - Starting the Bluetooth Service..."
sudo systemctl enable --now bluetooth.service &>> $INSTLOG
sleep 2
# Enable the sddm login manager service
echo -e "$CNT - Enabling the SDDM Service..."
sudo systemctl enable sddm &>> $INSTLOG
sleep 2
fi
### Copy Config Files ###
read -rep $'[\e[1;33mACTION\e[0m] - Would you like to copy config files? (y,n) ' CFG
if [[ $CFG == "Y" || $CFG == "y" ]]; then
echo -e "$CNT - Copying config files..."
# copying wallpapers
cp -r wallpapers ~/Pictures
cp -r config/* ~/.config
mkdir -p ~/.local
cp -r misc/bin ~/.local
cp -r misc/.zshenv ~/
# giving permissions
chmod +x ~/.config/hypr/scripts/*
# installing gtk themes
git clone https://github.com/Fausto-Korpsvart/Tokyo-Night-GTK-Theme.git
sudo cp -r Tokyo-Night-GTK-Theme/themes/Tokyonight-Dark-BL-LB /usr/share/themes/
sudo cp -r Tokyo-Night-GTK-Theme/icons/Tokyonight-Dark /usr/share/icons/
sudo tar -xf "assets/Bibata-Modern-Ice.tar.xz" -C /usr/share/icons/
echo -e "$CNT - Copying successful!"
fi
Regular → Executable
View File
File mode changed.