refactor: setup script

This commit is contained in:
hesam-init 2024-07-10 19:50:33 +03:30
parent e8ec398c9e
commit d567f45628
10 changed files with 59 additions and 47 deletions

View file

@ -1,6 +1,6 @@
#!/bin/bash
source ../utils/main.sh
source ../utils/init.sh
DOWNLOAD_URL="https://github.com/MatsuriDayo/nekoray/releases/download/3.26/nekoray-3.26-2023-12-09-linux64.zip"
FILE_NAME="nekoray.zip"

View file

@ -1,17 +0,0 @@
#!/bin/bash
source ../utils/main.sh
FONTS_DIR="../configs/host/ui/fonts"
install_ttf_fonts() {
sudo cp *.ttf /usr/share/fonts/TTF
sudo fc-cache -f -v
log "Fonts installed successfully!"
}
check_sudo
cd $FONTS_DIR
install_ttf_fonts

View file

@ -1,6 +1,6 @@
#!/bin/bash
create_symlinks() {
create_links() {
local source_dir=$1
local target_dir=$2
@ -17,7 +17,7 @@ create_symlinks() {
done
}
delete_symlinks() {
delete_links() {
local source_dir=$1
local target_dir=$2

View file

@ -1,10 +1,17 @@
#!/bin/bash
source ../utils/main.sh
source ./.scripts/utils/init.sh
UPDATE_PKGS=false
CLEAR_CACHE=false
DISABLE_GRUB_MENU=false
TTF_FONTS_DIR="./host/ui/fonts/TTF"
display_help() {
echo "Usage: [-i | -f] [-h]"
echo " -i Full install"
echo " -f Install host fonts"
}
declare -A PACKAGES=(
["VOID_REPOS"]="void-repo-multilib void-repo-nonfree"
@ -110,13 +117,39 @@ disable_grub_menu() {
fi
}
check_sudo
install_ttf_fonts() {
sudo cp $TTF_FONTS_DIR/* /usr/share/fonts/TTF
sudo fc-cache -f -v
update_system
clear_pkgs_cache
install_pkgs
add_user_to_groups
enable_services
disable_grub_menu
log "Fonts installed successfully!"
}
log "Setup is done, please log out and log in"
while getopts "sfh" opt; do
case $opt in
s)
check_sudo
update_system
clear_pkgs_cache
install_pkgs
add_user_to_groups
enable_services
disable_grub_menu
log "Setup is done, please log out and log in"
;;
f)
check_sudo
install_ttf_fonts
;;
h)
display_help
exit 0
;;
esac
done
if [[ $# -eq 0 ]]; then
display_help
fi

32
stow.sh
View file

@ -1,7 +1,7 @@
#!/bin/bash
source ./.scripts/utils/main.sh
source ./.scripts/utils/helpers.sh
source ./.scripts/utils/init.sh
source ./.scripts/utils/_links.sh
DOTS_CONFIG_DIR="$(pwd)/linux-configs"
DOTFILES_DIR="$DOTS_CONFIG_DIR/dotfiles"
@ -31,36 +31,36 @@ create_target_dir() {
stow() {
create_target_dir
create_symlinks $SHELL_DIR ~
create_links $SHELL_DIR ~
log "Shell stowed successfully!"
create_symlinks $EDITOR_DIR ~
create_links $EDITOR_DIR ~
log "Editor stowed successfully!"
create_symlinks $DOTFILES_DIR ~/.config
create_links $DOTFILES_DIR ~/.config
log "Dotfiles stowed successfully!"
create_symlinks $HYPRLAND_DIR ~/.config
create_links $HYPRLAND_DIR ~/.config
log "Hyprland stowed successfully!"
create_symlinks $SHORTCUTS_DIR ~/.local/share/applications
create_links $SHORTCUTS_DIR ~/.local/share/applications
log "Shortcuts stowed successfully!"
create_symlinks $UTILS_DIR ~
create_links $UTILS_DIR ~
log "Utilities stowed successfully!"
}
unstow() {
delete_symlinks $SHELL_DIR ~
delete_symlinks $DOTFILES_DIR ~/.config
delete_symlinks $HYPRLAND_DIR ~/.config
delete_symlinks $SHORTCUTS_DIR ~/.local/share/applications
delete_symlinks $UTILS_DIR ~
delete_links $SHELL_DIR ~
delete_links $DOTFILES_DIR ~/.config
delete_links $HYPRLAND_DIR ~/.config
delete_links $SHORTCUTS_DIR ~/.local/share/applications
delete_links $UTILS_DIR ~
log "All configs ustowed successfully !"
}
while getopts "ps" opt; do
while getopts "ush" opt; do
case $opt in
s)
stow
@ -72,10 +72,6 @@ while getopts "ps" opt; do
display_help
exit 0
;;
\?)
display_help
exit 1
;;
esac
done