#!/bin/bash # Verify ~/bin exists [ ! -d $HOME/bin ] && mkdir $HOME/bin # Add ~/bin to $PATH grep "\$HOME/bin" $HOME/.bashrc > /dev/null [[ $? != 0 ]] && echo "PATH=\"$PATH:/$HOME/bin\"" >> $HOME/.bashrc && echo "Successfully setup ~/bin in the \$PATH. Please restart your session, or run: source ~/.bashrc" # Wait for git-build.sh to stop running SECONDS=0 while [[ $SECONDS < 60 ]]; do if [ ! -f $GITBUILDDIR/.LOCK ]; then # Copy the script cp git-build.sh $HOME/bin exit 0 fi sleep 1 SECONDS=$(( SECONDS + 1 )) done echo "The auto-updated script has timed out!" exit 1