build.sh/git-build.sh

22 lines
508 B
Bash
Executable File

#/bin/bash
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"
GITBUILDDIR="$BASEDIR" eval "$BASEDIR/$p_name $p_name"
done