mirror of
https://git.icinga.com/packaging/rpm-icingaweb2.git
synced 2025-07-28 08:24:08 +02:00
get_snapshot: Add UPSTREAM_GIT_NOREPO to forbid any repo interaction
This commit is contained in:
parent
df902f3daf
commit
445f7bdcfa
40
get_snapshot
40
get_snapshot
@ -31,27 +31,29 @@ workdir=`pwd`
|
|||||||
|
|
||||||
set -x
|
set -x
|
||||||
|
|
||||||
if [ -d "${PROJECT}.git/" ]; then
|
if [ -z "$UPSTREAM_GIT_NOREPO" ]; then
|
||||||
cd "${PROJECT}.git"
|
if [ -d "${PROJECT}.git/" ]; then
|
||||||
if [ ! -d .git ]; then
|
cd "${PROJECT}.git"
|
||||||
echo "This is not a GIT repository: $(pwd)" >&2
|
if [ ! -d .git ]; then
|
||||||
|
echo "This is not a GIT repository: $(pwd)" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [ -z "$UPSTREAM_GIT_NOUPDATE" ]; then
|
||||||
|
if [ "$(git config remote.origin.url)" != "${UPSTREAM_GIT_URL}" ]; then
|
||||||
|
git remote set-url origin "${UPSTREAM_GIT_URL}"
|
||||||
|
fi
|
||||||
|
git fetch origin -p
|
||||||
|
git checkout -f "${UPSTREAM_GIT_BRANCH}"
|
||||||
|
git reset --hard "origin/${UPSTREAM_GIT_BRANCH}"
|
||||||
|
fi
|
||||||
|
git clean -fdx
|
||||||
|
elif [ -z "$UPSTREAM_GIT_NOUPDATE" ]; then
|
||||||
|
git clone -b "${UPSTREAM_GIT_BRANCH}" "${UPSTREAM_GIT_URL}" "${PROJECT}.git/"
|
||||||
|
cd "${PROJECT}.git"
|
||||||
|
else
|
||||||
|
echo "Missing '${PROJECT}.git' directory!" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
if [ -z "$UPSTREAM_GIT_NOUPDATE" ]; then
|
|
||||||
if [ "$(git config remote.origin.url)" != "${UPSTREAM_GIT_URL}" ]; then
|
|
||||||
git remote set-url origin "${UPSTREAM_GIT_URL}"
|
|
||||||
fi
|
|
||||||
git fetch origin -p
|
|
||||||
git checkout -f "${UPSTREAM_GIT_BRANCH}"
|
|
||||||
git reset --hard "origin/${UPSTREAM_GIT_BRANCH}"
|
|
||||||
fi
|
|
||||||
git clean -fdx
|
|
||||||
elif [ -z "$UPSTREAM_GIT_NOUPDATE" ]; then
|
|
||||||
git clone -b "${UPSTREAM_GIT_BRANCH}" "${UPSTREAM_GIT_URL}" "${PROJECT}.git/"
|
|
||||||
cd "${PROJECT}.git"
|
|
||||||
else
|
|
||||||
echo "Missing '${PROJECT}.git' directory!" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
git_version=$(git describe --tags "${UPSTREAM_GIT_BRANCH}")
|
git_version=$(git describe --tags "${UPSTREAM_GIT_BRANCH}")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user