Skip to content

Instantly share code, notes, and snippets.

@rudimusmaximus
Last active January 25, 2024 23:09
Show Gist options
  • Save rudimusmaximus/cbb877cb5797b00d7fbb9ddc88e7f8b9 to your computer and use it in GitHub Desktop.
Save rudimusmaximus/cbb877cb5797b00d7fbb9ddc88e7f8b9 to your computer and use it in GitHub Desktop.
Installs a bare repo into .cfg folder in home. The repo has my dot files for bash customizations. See repo for notes.
#!/bin/bash
echo "rudimusmaximus says, hi there. Creating bare repo clone of configDotFiles.git into $HOME/.cfg"
git clone --bare https://github.com/rudimusmaximus/configDotFiles.git $HOME/.cfg
function config {
/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME $@
}
mkdir -p .cfg-backup
config checkout
if [ $? = 0 ]; then
echo "Checked out config from bare clone of configDotFiles in $HOME/.cfg";
else
echo "Ok. Moving offending files."
echo "Pre-existing dot files were moved to the .cfg-backup directory. Running config checkout again.";
config checkout 2>&1 | egrep "\s+\." | awk {'print $1'} | xargs -I{} mv {} .cfg-backup/{}
fi;
config checkout
echo "Checked out config from bare clone of configDotFiles in $HOME/.cfg";
config config status.showUntrackedFiles no
echo "Turned off showing untracked files"
echo "Stop tracking .extra file"
config update-index --assume-unchanged .extra
echo "The .extra file is now downloaded but will not be tracked for future changes."
echo "Finished."
echo "We're using the curl-and-pipe method to run the install, so there is no script file to delete after execution. The script runs in memory and terminates when it's done, leaving no trace on the disk."
echo "Enjoy!"
@rudimusmaximus
Copy link
Author

updated again, no need for self delete. see echo at end of script.

@rudimusmaximus
Copy link
Author

rudimusmaximus commented Jan 25, 2024

special handling for .extra file (stop tracking for user to make private local machine changes)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment