gluon/scripts/update.sh
Christof Schulze afa3e89890 scripts/update.sh: add verbose error message when commit cannot be found (#1794)
This displays the branch, repo and commitID that was attempted to update to but
failed. Users then can compare this output to the configuration they meant to
activate in modules and hopefully better find their typos.
2019-08-21 23:48:06 +02:00

29 lines
580 B
Bash
Executable File

#!/bin/bash
set -e
. scripts/modules.sh
GLUONDIR="$(pwd)"
for module in $GLUON_MODULES; do
echo "--- Updating module '$module' ---"
var=$(echo "$module" | tr '[:lower:]/' '[:upper:]_')
eval repo=\${${var}_REPO}
eval branch=\${${var}_BRANCH}
eval commit=\${${var}_COMMIT}
mkdir -p "$GLUONDIR/$module"
cd "$GLUONDIR/$module"
git init
if ! git branch -f base "$commit" 2>/dev/null; then
git fetch "$repo" "$branch"
git branch -f base "$commit" || {
echo "unable to find commit \"$commit\" on branch \"$branch\" in repo \"$repo\"." >&2
exit 1
}
fi
done