Run on clone AND update
This commit is contained in:
parent
89628d2b43
commit
2092f45303
14
git-build.sh
14
git-build.sh
|
@ -8,6 +8,13 @@
|
||||||
|
|
||||||
BASEDIR="$HOME/.git-build"
|
BASEDIR="$HOME/.git-build"
|
||||||
|
|
||||||
|
run() {
|
||||||
|
p_name="$1"
|
||||||
|
echo "[$p_name] RUN"
|
||||||
|
# Run in background and redirect output to $p_name.log
|
||||||
|
(GITBUILDDIR="$BASEDIR" nohup $BASEDIR/$p_name $p_name > $BASEDIR/$p_name.log 2> $BASEDIR/$p_name.err) &
|
||||||
|
}
|
||||||
|
|
||||||
# So scripts can know we're still running (for autoupdater)
|
# So scripts can know we're still running (for autoupdater)
|
||||||
touch $BASEDIR/.LOCK
|
touch $BASEDIR/.LOCK
|
||||||
|
|
||||||
|
@ -22,12 +29,13 @@ for project in $BASEDIR/*.source; do
|
||||||
# Don't forget the git submodules!
|
# Don't forget the git submodules!
|
||||||
git clone --recursive "$source" "$p_dir"
|
git clone --recursive "$source" "$p_dir"
|
||||||
[[ $? != 0 ]] && echo "[$p_name] CLONE FAILED" && exit 1
|
[[ $? != 0 ]] && echo "[$p_name] CLONE FAILED" && exit 1
|
||||||
|
cd $p_dir
|
||||||
if [[ "$p_branch" != "master" ]]; then
|
if [[ "$p_branch" != "master" ]]; then
|
||||||
cd $p_dir
|
|
||||||
echo "[$p_name] CHECKOUT BRANCH $p_branch"
|
echo "[$p_name] CHECKOUT BRANCH $p_branch"
|
||||||
git checkout "$p_branch"
|
git checkout "$p_branch"
|
||||||
[[ $? != 0 ]] && echo "[$p_name] CHECKOUT FAILED" && exit 1
|
[[ $? != 0 ]] && echo "[$p_name] CHECKOUT FAILED" && exit 1
|
||||||
fi
|
fi
|
||||||
|
run $p_name
|
||||||
fi
|
fi
|
||||||
cd "$p_dir"
|
cd "$p_dir"
|
||||||
# Refresh remote before comparing with local
|
# Refresh remote before comparing with local
|
||||||
|
@ -38,10 +46,8 @@ for project in $BASEDIR/*.source; do
|
||||||
# Update all submodules, for now only when the main repo changed (TODO)
|
# Update all submodules, for now only when the main repo changed (TODO)
|
||||||
git pull --quiet --recurse-submodules
|
git pull --quiet --recurse-submodules
|
||||||
[[ $? != 0 ]] && echo "[$p_name] PULL FAILED" && exit 1
|
[[ $? != 0 ]] && echo "[$p_name] PULL FAILED" && exit 1
|
||||||
echo "[$p_name] RUN"
|
run $p_name
|
||||||
fi
|
fi
|
||||||
# Run in background and redirect output to $p_name.log
|
|
||||||
(GITBUILDDIR="$BASEDIR" nohup $BASEDIR/$p_name $p_name > $BASEDIR/$p_name.log 2> $BASEDIR/$p_name.err) &
|
|
||||||
done
|
done
|
||||||
|
|
||||||
rm $BASEDIR/.LOCK
|
rm $BASEDIR/.LOCK
|
||||||
|
|
Loading…
Reference in New Issue