Add hook.sh

This commit is contained in:
Stephan Raabe 2023-12-07 21:32:32 +01:00
parent 140dc369ed
commit 38106f68d4
8 changed files with 133 additions and 31 deletions

18
.install/hook.sh Executable file
View File

@ -0,0 +1,18 @@
# ------------------------------------------------------
# Copy dotfiles
# ------------------------------------------------------
if [ -f ~/dotfiles-versions/hook.sh ]; then
cat <<"EOF"
_ _ _
| | | | ___ ___ | | __
| |_| |/ _ \ / _ \| |/ /
| _ | (_) | (_) | <
|_| |_|\___/ \___/|_|\_\
EOF
echo "The script has detected a hook.sh script."
if gum confirm "Do you want to run the script now?"; then
source ~/dotfiles-versions/hook.sh
echo "hook.sh executed!"
fi
fi

View File

@ -3,21 +3,51 @@
# ------------------------------------------------------
if [ ! $mode == "dev" ]; then
if [ -d ~/dotfiles-versions/$version/alacritty ]; then
_installSymLink alacritty ~/.config/alacritty ~/dotfiles/alacritty/ ~/.config
fi
if [ -d ~/dotfiles-versions/$version/vim ]; then
_installSymLink vim ~/.config/vim ~/dotfiles/vim/ ~/.config
fi
if [ -d ~/dotfiles-versions/$version/nvim ]; then
_installSymLink nvim ~/.config/nvim ~/dotfiles/nvim/ ~/.config
fi
if [ -d ~/dotfiles-versions/$version/starship ]; then
_installSymLink starship ~/.config/starship.toml ~/dotfiles/starship/starship.toml ~/.config/starship.toml
fi
if [ -d ~/dotfiles-versions/$version/rofi ]; then
_installSymLink rofi ~/.config/rofi ~/dotfiles/rofi/ ~/.config
fi
if [ -d ~/dotfiles-versions/$version/dunst ]; then
_installSymLink dunst ~/.config/dunst ~/dotfiles/dunst/ ~/.config
fi
if [ -d ~/dotfiles-versions/$version/hypr ]; then
_installSymLink hypr ~/.config/hypr ~/dotfiles/hypr/ ~/.config
fi
if [ -d ~/dotfiles-versions/$version/waybar ]; then
_installSymLink waybar ~/.config/waybar ~/dotfiles/waybar/ ~/.config
fi
if [ -d ~/dotfiles-versions/$version/swaylock ]; then
_installSymLink swaylock ~/.config/swaylock ~/dotfiles/swaylock/ ~/.config
fi
if [ -d ~/dotfiles-versions/$version/wlogout ]; then
_installSymLink wlogout ~/.config/wlogout ~/dotfiles/wlogout/ ~/.config
fi
if [ -d ~/dotfiles-versions/$version/swappy ]; then
_installSymLink swappy ~/.config/swappy ~/dotfiles/swappy/ ~/.config
fi
if [ -d ~/dotfiles-versions/$version/gtk ]; then
_installSymLink .gtkrc-2.0 ~/.gtkrc-2.0 ~/dotfiles/gtk/.gtkrc-2.0 ~/.gtkrc-2.0
fi
if [ -d ~/dotfiles-versions/$version/gtk ]; then
_installSymLink .Xresources ~/.Xresources ~/dotfiles/gtk/.Xresources ~/.Xresources
fi
if [ -d ~/dotfiles-versions/$version/gtk ]; then
_installSymLink gtk-3.0 ~/.config/gtk-3.0 ~/dotfiles/gtk/gtk-3.0/ ~/.config/
fi
if [ -d ~/dotfiles-versions/$version/gtk ]; then
_installSymLink gtk-4.0 ~/.config/gtk-4.0 ~/dotfiles/gtk/gtk-4.0/ ~/.config/
fi
else
echo "Skipped: DEV MODE!"
fi

View File

@ -10,7 +10,6 @@ cat <<"EOF"
| . \ __/ |_| | |_) | (_) | (_| | | | (_| |
|_|\_\___|\__, |_.__/ \___/ \__,_|_| \__,_|
|___/
EOF
echo -e "${NONE}"

View File

@ -33,5 +33,8 @@ if [[ $(_isFolderEmpty ~/dotfiles-versions/$version/) == 0 ]] ;then
echo "Execution of rsync -a -I --exclude-from=.install/excludes.txt . ~/dotfiles-versions/$version/ is required."
exit
fi
if [ ! -f ~/dotfiles-versions/hook.sh ]; then
# cp .install/templates/hook.sh ~/dotfiles-versions/
fi
echo "dotfiles $version successfully prepared in ~/dotfiles-versions/$version/"
echo ""

View File

@ -3,21 +3,51 @@
# ------------------------------------------------------
if [ ! $mode == "dev" ]; then
if [ -d ~/dotfiles-versions/$version/alacritty ]; then
_installSymLink alacritty ~/.config/alacritty ~/dotfiles/alacritty/ ~/.config
fi
if [ -d ~/dotfiles-versions/$version/vim ]; then
_installSymLink vim ~/.config/vim ~/dotfiles/vim/ ~/.config
fi
if [ -d ~/dotfiles-versions/$version/nvim ]; then
_installSymLink nvim ~/.config/nvim ~/dotfiles/nvim/ ~/.config
fi
if [ -d ~/dotfiles-versions/$version/starship ]; then
_installSymLink starship ~/.config/starship.toml ~/dotfiles/starship/starship.toml ~/.config/starship.toml
fi
if [ -d ~/dotfiles-versions/$version/rofi ]; then
_installSymLink rofi ~/.config/rofi ~/dotfiles/rofi/ ~/.config
fi
if [ -d ~/dotfiles-versions/$version/dunst ]; then
_installSymLink dunst ~/.config/dunst ~/dotfiles/dunst/ ~/.config
fi
if [ -d ~/dotfiles-versions/$version/qtile ]; then
_installSymLink qtile ~/.config/qtile ~/dotfiles/qtile/ ~/.config
fi
if [ -d ~/dotfiles-versions/$version/polybar ]; then
_installSymLink polybar ~/.config/polybar ~/dotfiles/polybar/ ~/.config
fi
if [ -d ~/dotfiles-versions/$version/picom ]; then
_installSymLink picom ~/.config/picom ~/dotfiles/picom/ ~/.config
fi
if [ -d ~/dotfiles-versions/$version/qtile ]; then
_installSymLink .xinitrc ~/.xinitrc ~/dotfiles/qtile/.xinitrc ~/.xinitrc
fi
if [ -d ~/dotfiles-versions/$version/swaylock ]; then
_installSymLink swaylock ~/.config/swaylock ~/dotfiles/swaylock/ ~/.config
fi
if [ -d ~/dotfiles-versions/$version/swappy ]; then
_installSymLink swappy ~/.config/swappy ~/dotfiles/swappy/ ~/.config
fi
if [ -d ~/dotfiles-versions/$version/gtk ]; then
_installSymLink .gtkrc-2.0 ~/.gtkrc-2.0 ~/dotfiles/gtk/.gtkrc-2.0 ~/.gtkrc-2.0
fi
if [ -d ~/dotfiles-versions/$version/gtk ]; then
_installSymLink .Xresources ~/.Xresources ~/dotfiles/gtk/.Xresources ~/.Xresources
fi
if [ -d ~/dotfiles-versions/$version/gtk ]; then
_installSymLink gtk-3.0 ~/.config/gtk-3.0 ~/dotfiles/gtk/gtk-3.0/ ~/.config/
fi
else
echo "Skipped: DEV MODE!"
fi

3
.install/templates/hook.sh Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash
rm -rf ~/dotfiles-versions/$version/vim/
rm -rf ~/dotfiles-versions/$version/nvim/

View File

@ -93,6 +93,24 @@ cd dotfiles-2.6
You can also use the dotfiles installer script to download and install the latest release: https://gitlab.com/stephan-raabe/installer
## Installation Hook
The installation script will prepare the configuration files in a folder ~/dotfiles-versions/[version] before copying into the final destination in ~/dotfiles
If you want to modify the installation files just before the copy procedure starts, you can create a file hook.sh in the folder ~/dotfiles-versions
You can delete folders and files or update existing configurations.
```
#!/bin/bash
rm -rf ~/dotfiles-versions/$version/vim/
rm -rf ~/dotfiles-versions/$version/nvim/
```
This script will for example remove the vim and nvim folder before the installation. The symbolic link will not be created because the source folder doesn't exits.
You can find a template in .install/templates/hook.sh
## Hyprland & NVIDIA
There is no official Hyprland support for Nvidia hardware. However, you might make it work properly following this page.

View File

@ -51,6 +51,7 @@ source .install/issue.sh
source .install/restore.sh
source .install/vm.sh
source .install/keyboard.sh
source .install/hook.sh
source .install/copy.sh
source .install/config-folder.sh
source .install/init-pywal.sh