add fu fr du dr uu and correct a little the config file.

This commit is contained in:
statzitz 2024-08-27 11:55:43 +02:00
parent 7884c4bbc4
commit f73d04544e
3 changed files with 53 additions and 51 deletions

View file

@ -4,24 +4,15 @@ Use it to save in ~/Documents/git/dotfiles/dotconfig your config files.
## TODO ## TODO
### program config file. ### config to dotfile // save
Implement in _INSTRUCTIONS_
- fu for user file copy
- fr for root file copy (use doas)
- du for user directory copy
- dr for root firectory copy (use doas)
Rename u by uu, for update user.
### dotfiles to config
make as function dotfiles to config
### config to dotfile
Implement the reverse. Implement the reverse.
make as function config to dotfiles. make as function config to dotfiles.
### make a -h flag.
it will says
`save_config [-h] {deploy|save}`

View file

@ -8,21 +8,21 @@ _GIT_FOLDER="${HOME}/Documents/git"
# d for directory, # d for directory,
# f for file # f for file
_INSTRUCTIONS="u dotfiles _INSTRUCTIONS="uu dotfiles
d ${HOME}/.config/alacritty dotfiles/dotconfig/alacritty du ${HOME}/.config/alacritty dotfiles/dotconfig/alacritty
d ${HOME}/.config/eww dotfiles/dotconfig/eww du ${HOME}/.config/eww dotfiles/dotconfig/eww
d ${HOME}/.config/hypr dotfiles/dotconfig/hypr du ${HOME}/.config/hypr dotfiles/dotconfig/hypr
d ${HOME}/.config/nvim dotfiles/dotconfig/nvim du ${HOME}/.config/nvim dotfiles/dotconfig/nvim
d ${HOME}/.config/gotop dotfiles/dotconfig/gotop du ${HOME}/.config/gotop dotfiles/dotconfig/gotop
d ${HOME}/.config/waybar dotfiles/dotconfig/waybar du ${HOME}/.config/waybar dotfiles/dotconfig/waybar
d ${HOME}/.config/conky dotfiles/dotconfig/conky du ${HOME}/.config/conky dotfiles/dotconfig/conky
f ${HOME}/.bashrc dotfiles/dotscripts/bash/.bashrc fu ${HOME}/.bashrc dotfiles/dotscripts/bash/.bashrc
f ${HOME}/.bash_profile dotfiles/dotscripts/bash/.bash_profile fu ${HOME}/.bash_profile dotfiles/dotscripts/bash/.bash_profile
d ${HOME}/.local/bin dotfiles/dotlocal/bin du ${HOME}/.local/bin dotfiles/dotlocal/bin
d /etc/ly dotfiles/dotetc/ly dr /etc/ly dotfiles/dotetc/ly
f /etc/makepkg.conf dotfiles/dotetc/makepkg.conf fr /etc/makepkg.conf dotfiles/dotetc/makepkg.conf
f /etc/pacman.conf dotfiles/dotetc/makepkg.conf fr /etc/pacman.conf dotfiles/dotetc/pacman.conf
f /etc/doas.conf dotfiles/dotetc/doas.conf" fr /etc/doas.conf dotfiles/dotetc/doas.conf"
# Use `git pull ~/Documents/git/${<repos>}` for u -> OK # Use `git pull ~/Documents/git/${<repos>}` for u -> OK
# Use `install -Dm644 <file_name> <dest>` for f -> OK # Use `install -Dm644 <file_name> <dest>` for f -> OK

View file

@ -11,19 +11,27 @@ CONFIG_PATH="./config"
#echo "$_GIT_FOLDER" #echo "$_GIT_FOLDER"
#echo "$_INSTRUCTIONS" #echo "$_INSTRUCTIONS"
while VAR= read -r line; function deploy {
do
while VAR= read -r line;
do
order="$(echo $line | cut -d ' ' -f 1)" order="$(echo $line | cut -d ' ' -f 1)"
operand_1="$(echo $line | cut -d ' ' -f 2)" operand_1="$(echo $line | cut -d ' ' -f 2)"
operand_2="$(echo $line | cut -d ' ' -f 3)" operand_2="$(echo $line | cut -d ' ' -f 3)"
if [ "$order" = "d" ] if [ "$order" = "du" ]
then then
cp -Rf ${_GIT_FOLDER}/${operand_2}/* ${operand_1} cp -Rf ${_GIT_FOLDER}/${operand_2}/* ${operand_1}
elif [ "$order" = "f" ] elif [ "$order" = "fu" ]
then then
install -Dm644 ${_GIT_FOLDER}/${operand_2} ${operand_1} install -Dm644 ${_GIT_FOLDER}/${operand_2} ${operand_1}
elif [ "$order" = "u" ] elif [ "$order" = "dr" ]
then
doas cp -Rf ${_GIT_FOLDER}/${operand_2}/* ${operand_1}
elif [ "$order" = "fr" ]
then
doas install -Dm644 ${_GIT_FOLDER}/${operand_2} ${operand_1}
elif [ "$order" = "uu" ]
then then
cd "${_GIT_FOLDER}/${operand_1}" cd "${_GIT_FOLDER}/${operand_1}"
git pull git pull
@ -34,4 +42,7 @@ do
fi fi
done <<< "$_INSTRUCTIONS" done <<< "$_INSTRUCTIONS"
}
deploy