📦 build(sync-config): remove from-the-script remote push feature
using git manually is better sometimes
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
source ./utils.sh
|
||||
|
||||
outdir="./config"
|
||||
|
||||
Clean_local() {
|
||||
Send_log "info" "Cleaning local config..."
|
||||
for dir in ${config_dirs[@]}; do
|
||||
rm -rf $outdir/$dir
|
||||
done
|
||||
}
|
||||
|
||||
Update_local() {
|
||||
mkdir -p $outdir
|
||||
for dir in ${config_dirs[@]}; do
|
||||
if [[ -d "$XDG_CONFIG_HOME/$dir" ]] || [[ -f "$XDG_CONFIG_HOME/$dir" ]]; then
|
||||
Send_log "Copying ${dir^}"
|
||||
mkdir -p `dirname "$outdir/$dir"`
|
||||
cp -r $XDG_CONFIG_HOME/$dir $outdir/$dir
|
||||
else
|
||||
Send_log "warn" "Looks like the ${dir^} dir is in fault! Skipping..."
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
Check_current_dir
|
||||
Print_header
|
||||
|
||||
printf "\n"
|
||||
echo "!!WARNING!! Running this script may override all configuration data in current repo with host ones."
|
||||
echo "This script is intended to be used only by the repository owner"
|
||||
printf "\n"
|
||||
|
||||
echo "Please run this script in it's current directory to avoid issues"
|
||||
echo "Tip: Press ^C([Ctrl] + [C]) to stop script at any time"
|
||||
|
||||
printf "\n"
|
||||
|
||||
echo -n "Update local repository with host configurations? [y/n] "
|
||||
read answer
|
||||
if ! [[ $answer =~ y ]]; then
|
||||
Send_log "Exiting"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
printf "\n"
|
||||
|
||||
Clean_local
|
||||
Update_local
|
||||
|
||||
if command -v git > /dev/null 2>&1; then
|
||||
git status
|
||||
fi
|
||||
|
||||
exit 0
|
||||
Reference in New Issue
Block a user