refactor: fonts installer shell

This commit is contained in:
hesam-init 2024-03-22 00:01:45 +03:30
parent 8d78918ae1
commit 1202c0fc93
14 changed files with 30 additions and 23 deletions

View file

@ -1,10 +1,17 @@
#!/bin/bash
install_ttf_font() {
source ./utils.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!"
}
cd ../host/ui/fonts
check_sudo
install_ttf_font
cd $FONTS_DIR
install_ttf_fonts

View file

@ -26,13 +26,6 @@ declare SERVICES=(
exec 1> >(tee "../hyprland_setup_log")
check_sudo() {
if [ "$(id -u)" != 0 ]; then
echo "Please run the script with sudo."
exit 1
fi
}
check() {
if [ "$1" != 0 ]; then
echo "$2 error : $1" | tee -a ../hyprland_setup_log

View file

@ -6,3 +6,10 @@ log() {
echo -e "\n$message"
}
check_sudo() {
if [ "$(id -u)" != 0 ]; then
echo "Please run the script with sudo."
exit 1
fi
}

26
stow.sh
View file

@ -2,11 +2,11 @@
source ./scripts/utils.sh
configs_dir="$(pwd)/configs"
dotfiles_dir="$configs_dir/dotfiles"
shell_dir="$configs_dir/shell"
shortcuts_dir="$configs_dir/shortcuts"
hyprland_dir="$configs_dir/hyprland"
CONFIGS_DIR="$(pwd)/configs"
DOTFILES_DIR="$CONFIGS_DIR/dotfiles"
SHELL_DIR="$CONFIGS_DIR/shell"
SHORTCUTS_DIR="$CONFIGS_DIR/shortcuts"
HYPRLAND_DIR="$CONFIGS_DIR/hyprland"
display_help() {
echo "Usage: [-s | -u] [-h]"
@ -57,20 +57,20 @@ create_target_dir() {
}
stow_shortcuts() {
create_symlinks $shortcuts_dir ~/.local/share/applications
create_symlinks $SHORTCUTS_DIR ~/.local/share/applications
log "Shortcuts stowed successfully!"
}
stow_dotfiles() {
create_symlinks $dotfiles_dir ~/.config
create_symlinks $shell_dir ~/
create_symlinks $DOTFILES_DIR ~/.config
create_symlinks $SHELL_DIR ~/
log "Dotfiles stowed successfully!"
}
stow_hyprland() {
create_symlinks $hyprland_dir ~/.config
create_symlinks $HYPRLAND_DIR ~/.config
log "Hyprland stowed successfully!"
}
@ -83,7 +83,7 @@ stow() {
}
unstow_shell() {
for config in $shell_dir/.*; do
for config in $SHELL_DIR/.*; do
if [ -f $config ]; then
local file_name=$(basename $config)
local target_file=~/$file_name
@ -111,9 +111,9 @@ unstow_shell() {
unstow() {
unstow_shell
delete_symlinks $dotfiles_dir ~/.config
delete_symlinks $shortcuts_dir ~/.local/share/applications
delete_symlinks $hyprland_dir ~/.config
delete_symlinks $DOTFILES_DIR ~/.config
delete_symlinks $SHORTCUTS_DIR ~/.local/share/applications
delete_symlinks $HYPRLAND_DIR ~/.config
log "All configs ustowed successfully !"
}