dotfiles
dotfiles copied to clipboard
bootstrap.sh bug: if bootstrap pulls a new bootstrap, syncing continues with old bootstrap -> bad things happen
Previously, if bootstrap.sh had been changed in the origin repo,
the syncing would continue using the old bootstrap.sh. This can
cause problems such as the following: Say you have added a new
LICENSE file and an appropriate exclusion in the rsync of bootstraph.sh.
When a user does source bootstrap.sh
the new LICENSE file and
bootstrap.sh file get pulled but the syncing continues with the old
bootstrap which doesn't have the exclusion, thus giving you a LICENSE
file in your ~. This commit gives a basic solution of exiting if the
bootstrap.sh file has changed after the git pull
.
Ideally, this could be automated because there isn't any real reason the user should be bothered. I just wasn't sure how to implement it.
I have an idea.
There's a small issue with my code because $BASH_SOURCE
gives the relative path which is useless after the cd
. Not sure how to write this yet. It could be hardcoded with the name of the script but that's just lazy.
EDIT: so there's this command called basename
.... Commit incoming.
As far as I'm concerned, this code is ready. It will require user intervention in case of a new bootstrap.sh file, but it's better than bootstrapping a current repo with an non-current bootstrap.