my-git-build/git-build

25 lines
493 B
Bash
Executable File

#!/bin/bash
# Verify ~/bin exists
[ ! -d $HOME/bin ] && mkdir $HOME/bin
# Add ~/bin to $PATH
grep "\$HOME/bin" $HOME/.bashrc > /dev/null
[[ $? != 0 ]] && PATH="$PATH:/$HOME/bin"
# Wait for git-build.sh to stop running
SECONDS=0
# TODO: make timeout configurable
echo test
while [[ $SECONDS < 60 ]]; do
if [ ! -f $GITBUILDDIR/.LOCK ]; then
# Copy the script
cp git-build.sh $HOME/bin
exit 0
fi
sleep 5
SECONDS=$(( SECONDS + 5 ))
done
echo "The auto-updated script has timed out!"