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
### program config file.
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
### config to dotfile // save
Implement the reverse.
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,
# f for file
_INSTRUCTIONS="u dotfiles
d ${HOME}/.config/alacritty dotfiles/dotconfig/alacritty
d ${HOME}/.config/eww dotfiles/dotconfig/eww
d ${HOME}/.config/hypr dotfiles/dotconfig/hypr
d ${HOME}/.config/nvim dotfiles/dotconfig/nvim
d ${HOME}/.config/gotop dotfiles/dotconfig/gotop
d ${HOME}/.config/waybar dotfiles/dotconfig/waybar
d ${HOME}/.config/conky dotfiles/dotconfig/conky
f ${HOME}/.bashrc dotfiles/dotscripts/bash/.bashrc
f ${HOME}/.bash_profile dotfiles/dotscripts/bash/.bash_profile
d ${HOME}/.local/bin dotfiles/dotlocal/bin
d /etc/ly dotfiles/dotetc/ly
f /etc/makepkg.conf dotfiles/dotetc/makepkg.conf
f /etc/pacman.conf dotfiles/dotetc/makepkg.conf
f /etc/doas.conf dotfiles/dotetc/doas.conf"
_INSTRUCTIONS="uu dotfiles
du ${HOME}/.config/alacritty dotfiles/dotconfig/alacritty
du ${HOME}/.config/eww dotfiles/dotconfig/eww
du ${HOME}/.config/hypr dotfiles/dotconfig/hypr
du ${HOME}/.config/nvim dotfiles/dotconfig/nvim
du ${HOME}/.config/gotop dotfiles/dotconfig/gotop
du ${HOME}/.config/waybar dotfiles/dotconfig/waybar
du ${HOME}/.config/conky dotfiles/dotconfig/conky
fu ${HOME}/.bashrc dotfiles/dotscripts/bash/.bashrc
fu ${HOME}/.bash_profile dotfiles/dotscripts/bash/.bash_profile
du ${HOME}/.local/bin dotfiles/dotlocal/bin
dr /etc/ly dotfiles/dotetc/ly
fr /etc/makepkg.conf dotfiles/dotetc/makepkg.conf
fr /etc/pacman.conf dotfiles/dotetc/pacman.conf
fr /etc/doas.conf dotfiles/dotetc/doas.conf"
# Use `git pull ~/Documents/git/${<repos>}` for u -> OK
# Use `install -Dm644 <file_name> <dest>` for f -> OK

View file

@ -11,27 +11,38 @@ CONFIG_PATH="./config"
#echo "$_GIT_FOLDER"
#echo "$_INSTRUCTIONS"
while VAR= read -r line;
do
order="$(echo $line | cut -d ' ' -f 1)"
operand_1="$(echo $line | cut -d ' ' -f 2)"
operand_2="$(echo $line | cut -d ' ' -f 3)"
function deploy {
if [ "$order" = "d" ]
then
cp -Rf ${_GIT_FOLDER}/${operand_2}/* ${operand_1}
elif [ "$order" = "f" ]
then
install -Dm644 ${_GIT_FOLDER}/${operand_2} ${operand_1}
elif [ "$order" = "u" ]
then
cd "${_GIT_FOLDER}/${operand_1}"
git pull
cd -
else
echo "Err, $order uknown"
echo ".. ${order} ${operand_1} ${operand_2} ..";
fi
while VAR= read -r line;
do
order="$(echo $line | cut -d ' ' -f 1)"
operand_1="$(echo $line | cut -d ' ' -f 2)"
operand_2="$(echo $line | cut -d ' ' -f 3)"
if [ "$order" = "du" ]
then
cp -Rf ${_GIT_FOLDER}/${operand_2}/* ${operand_1}
elif [ "$order" = "fu" ]
then
install -Dm644 ${_GIT_FOLDER}/${operand_2} ${operand_1}
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
cd "${_GIT_FOLDER}/${operand_1}"
git pull
cd -
else
echo "Err, $order uknown"
echo ".. ${order} ${operand_1} ${operand_2} ..";
fi
done <<< "$_INSTRUCTIONS"
done <<< "$_INSTRUCTIONS"
}
deploy