build.sh/git-build.sh
2020-04-17 22:17:57 -04:00

26 lines
611 B
Bash
Executable File

#/bin/bash
# This script can now self-update! \o/
BASEDIR="$HOME/.git-build"
for project in $BASEDIR/*.source; do
p_name="$(basename $project .source)"
p_dir="$BASEDIR/.$p_name"
if [ ! -d $p_dir ]; then
git clone "$(cat $BASEDIR/$p_name.source)" "$p_dir"
if [ -f $BASEDIR/$p_name.branch ]; then
cd $p_dir
git checkout "$(cat $BASEDIR/$p_name.branch)"
fi
fi
if [ ! -d $p_dir ]; then
echo "ERROR: could not create repo for project $project"
exit 1
fi
cd "$p_dir"
if ! git diff --quiet remotes/origin/HEAD; then
git pull
fi
GITBUILDDIR="$BASEDIR" eval "$BASEDIR/$p_name $p_name"
done