forked from Shinonome/dots-hyprland
Add warning_rsync() for #2133
This commit is contained in:
@@ -12,6 +12,12 @@ function backup_configs(){
|
|||||||
rsync -av --progress "$HOME/.local/" "$backup_dir/local_backup/"
|
rsync -av --progress "$HOME/.local/" "$backup_dir/local_backup/"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function warning_rsync(){
|
||||||
|
printf "${STY_YELLOW}"
|
||||||
|
printf "The commands using rsync will overwrite the destination when it exists already.\n"
|
||||||
|
printf "${STY_RESET}"
|
||||||
|
}
|
||||||
|
|
||||||
function ask_backup_configs(){
|
function ask_backup_configs(){
|
||||||
printf "${STY_RED}"
|
printf "${STY_RED}"
|
||||||
printf "Would you like to create a backup for \"$XDG_CONFIG_HOME\" and \"$HOME/.local/\" folders?\n[y/N]: "
|
printf "Would you like to create a backup for \"$XDG_CONFIG_HOME\" and \"$HOME/.local/\" folders?\n[y/N]: "
|
||||||
@@ -50,8 +56,8 @@ case $SKIP_MISCCONF in
|
|||||||
for i in $(find .config/ -mindepth 1 -maxdepth 1 ! -name 'fish' ! -name 'hypr' -exec basename {} \;); do
|
for i in $(find .config/ -mindepth 1 -maxdepth 1 ! -name 'fish' ! -name 'hypr' -exec basename {} \;); do
|
||||||
# i=".config/$i"
|
# i=".config/$i"
|
||||||
echo "[$0]: Found target: .config/$i"
|
echo "[$0]: Found target: .config/$i"
|
||||||
if [ -d ".config/$i" ];then v rsync -av --delete ".config/$i/" "$XDG_CONFIG_HOME/$i/"
|
if [ -d ".config/$i" ];then warning_rsync; v rsync -av --delete ".config/$i/" "$XDG_CONFIG_HOME/$i/"
|
||||||
elif [ -f ".config/$i" ];then v rsync -av ".config/$i" "$XDG_CONFIG_HOME/$i"
|
elif [ -f ".config/$i" ];then warning_rsync; v rsync -av ".config/$i" "$XDG_CONFIG_HOME/$i"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
;;
|
;;
|
||||||
@@ -60,7 +66,7 @@ esac
|
|||||||
case $SKIP_FISH in
|
case $SKIP_FISH in
|
||||||
true) sleep 0;;
|
true) sleep 0;;
|
||||||
*)
|
*)
|
||||||
v rsync -av --delete .config/fish/ "$XDG_CONFIG_HOME"/fish/
|
warning_rsync; v rsync -av --delete .config/fish/ "$XDG_CONFIG_HOME"/fish/
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
@@ -73,7 +79,7 @@ arg_excludes+=(--exclude '/hyprland.conf')
|
|||||||
case $SKIP_HYPRLAND in
|
case $SKIP_HYPRLAND in
|
||||||
true) sleep 0;;
|
true) sleep 0;;
|
||||||
*)
|
*)
|
||||||
v rsync -av --delete "${arg_excludes[@]}" .config/hypr/ "$XDG_CONFIG_HOME"/hypr/
|
warning_rsync; v rsync -av --delete "${arg_excludes[@]}" .config/hypr/ "$XDG_CONFIG_HOME"/hypr/
|
||||||
t="$XDG_CONFIG_HOME/hypr/hyprland.conf"
|
t="$XDG_CONFIG_HOME/hypr/hyprland.conf"
|
||||||
if [ -f $t ];then
|
if [ -f $t ];then
|
||||||
echo -e "${STY_BLUE}[$0]: \"$t\" already exists.${STY_RESET}"
|
echo -e "${STY_BLUE}[$0]: \"$t\" already exists.${STY_RESET}"
|
||||||
@@ -110,7 +116,7 @@ case $SKIP_HYPRLAND in
|
|||||||
echo -e "${STY_BLUE}[$0]: \"$t\" already exists, will not do anything.${STY_RESET}"
|
echo -e "${STY_BLUE}[$0]: \"$t\" already exists, will not do anything.${STY_RESET}"
|
||||||
else
|
else
|
||||||
echo -e "${STY_YELLOW}[$0]: \"$t\" does not exist yet.${STY_RESET}"
|
echo -e "${STY_YELLOW}[$0]: \"$t\" does not exist yet.${STY_RESET}"
|
||||||
v rsync -av --delete .config/hypr/custom/ $t/
|
warning_rsync; v rsync -av --delete .config/hypr/custom/ $t/
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
@@ -120,8 +126,8 @@ declare -a arg_excludes=()
|
|||||||
# some foldes (eg. .local/bin) should be processed separately to avoid `--delete' for rsync,
|
# some foldes (eg. .local/bin) should be processed separately to avoid `--delete' for rsync,
|
||||||
# since the files here come from different places, not only about one program.
|
# since the files here come from different places, not only about one program.
|
||||||
# v rsync -av ".local/bin/" "$XDG_BIN_HOME" # No longer needed since scripts are no longer in ~/.local/bin
|
# v rsync -av ".local/bin/" "$XDG_BIN_HOME" # No longer needed since scripts are no longer in ~/.local/bin
|
||||||
v rsync -av ".local/share/icons/" "${XDG_DATA_HOME:-$HOME/.local/share}"/icons/
|
warning_rsync; v rsync -av ".local/share/icons/" "${XDG_DATA_HOME:-$HOME/.local/share}"/icons/
|
||||||
v rsync -av ".local/share/konsole/" "${XDG_DATA_HOME:-$HOME/.local/share}"/konsole/
|
warning_rsync; v rsync -av ".local/share/konsole/" "${XDG_DATA_HOME:-$HOME/.local/share}"/konsole/
|
||||||
|
|
||||||
# Prevent hyprland from not fully loaded
|
# Prevent hyprland from not fully loaded
|
||||||
sleep 1
|
sleep 1
|
||||||
|
|||||||
Reference in New Issue
Block a user