✨ scripts(install, utils): update scripts for colorshell + remove personal dots
This commit is contained in:
-122
@@ -1,122 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
source ./utils.sh
|
||||
|
||||
Check_current_dir() {
|
||||
if ! [[ -f ./utils.sh ]]; then
|
||||
Send_log warn "Looks like you're not in the repository directory!\nPlease run this script from the repo to avoid problems."
|
||||
Send_log "Exiting"
|
||||
sleep .5
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
Clean_local() {
|
||||
Send_log "info" "Cleaning current repo dotfiles..."
|
||||
for dir in ${config_dirs[@]}; do
|
||||
if [[ -d "./$dir" ]]; then
|
||||
rm -rf ./$dir
|
||||
fi
|
||||
done
|
||||
|
||||
Send_log "info" "Cleaning wallpapers..."
|
||||
rm -rf ./wallpapers
|
||||
|
||||
echo "Done cleaning."
|
||||
}
|
||||
|
||||
Update_local() {
|
||||
for dir in ${config_dirs[@]}; do
|
||||
if [[ -d "$XDG_CONFIG_HOME/$dir" ]]; then
|
||||
Send_log "Copying ${dir^}"
|
||||
cp -r $XDG_CONFIG_HOME/$dir ./$dir
|
||||
else
|
||||
Send_log "warn" "Looks like the ~/.config/$dir dir is in fault! Skipping it..."
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ -d "$HOME/wallpapers" ]]; then
|
||||
Send_log "Copying wallpapers"
|
||||
mkdir -p ./wallpapers
|
||||
cp -rf $HOME/wallpapers/* ./wallpapers
|
||||
else
|
||||
Send_log warn "Wallpapers dir could not be found in $HOME, skipping..."
|
||||
fi
|
||||
|
||||
printf "\nDone updating local repo!\n"
|
||||
}
|
||||
|
||||
Update_remote() {
|
||||
echo "Git status:"
|
||||
git status
|
||||
echo "Please type one of the dotfiles you want to push now(only one dir):"
|
||||
ls --color=auto -d -- */
|
||||
printf "Directory: "
|
||||
read chosen_dir
|
||||
if [[ -d $chosen_dir ]]; then
|
||||
git add $chosen_dir
|
||||
echo -n "Would you like to add more dirs to queue? [y/n] "
|
||||
read add_more_dirs
|
||||
if [[ $add_more_dirs =~ y ]]; then
|
||||
Update_remote
|
||||
else
|
||||
echo "Fine then! What will be the commit message? (You can use emojis by typing its name between colons, e.g.: ´:tada:´)"
|
||||
read commit_message
|
||||
echo "Committing your changes..."
|
||||
git commit -m "$commit_message"
|
||||
echo -n "Done! Do you want to push changes now? If not, you'll be redirected to pre-commit process. [y/n] "
|
||||
read push_changes
|
||||
if [[ $push_changes =~ y ]]; then
|
||||
git push
|
||||
echo "Done pushing!!"
|
||||
else
|
||||
Update_remote
|
||||
fi
|
||||
fi
|
||||
else
|
||||
echo "Looks like this directory does not exist! Try taking a look at the dir list."
|
||||
Update_remote
|
||||
fi
|
||||
|
||||
|
||||
}
|
||||
|
||||
Check_current_dir
|
||||
|
||||
Print_header
|
||||
|
||||
printf "\n"
|
||||
echo "!!WARNING!! Running this script may override all data in current repo with host configurations."
|
||||
echo "This script is intended to be used only by retrozinndev/Hyprland-Dots repo owner"
|
||||
printf "\n"
|
||||
|
||||
echo "Please run this script in it's current directory to avoid problems."
|
||||
echo "Tip: Press Ctrl + C to stop script at any time"
|
||||
|
||||
printf "\n"
|
||||
|
||||
echo -n "Do you want to 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
|
||||
|
||||
echo -n "Would you like to commit to remote? (You will be prompted for each directory and commit messages) [y/n] "
|
||||
read answer
|
||||
|
||||
if [[ $answer =~ y ]]; then
|
||||
Update_remote
|
||||
echo "Looks like it's done! Have a great day!"
|
||||
else
|
||||
echo "Ok, work's finished here! Have a great day!"
|
||||
fi
|
||||
|
||||
env git status
|
||||
|
||||
exit 0
|
||||
Reference in New Issue
Block a user