forked from eclipse-cbi/dockerfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fetch_dockertools
executable file
·21 lines (19 loc) · 1.15 KB
/
fetch_dockertools
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/bash
# Bash strict-mode
set -o errexit
set -o nounset
set -o pipefail
SCRIPT_FOLDER="$(dirname "$(readlink -f "${0}")")"
DOCKERTOOLS_PATH="${DOCKERTOOLS_PATH:-"${SCRIPT_FOLDER}/.dockertools"}"
if [[ -d "${DOCKERTOOLS_PATH}" ]]; then
git -C "${DOCKERTOOLS_PATH}" fetch -f --no-tags --progress --depth 1 https://github.com/eclipse-cbi/dockertools.git +refs/heads/master:refs/remotes/origin/master
git -C "${DOCKERTOOLS_PATH}" checkout -f "$(git -C "${DOCKERTOOLS_PATH}" rev-parse refs/remotes/origin/master)"
else
git init "${DOCKERTOOLS_PATH}"
git -C "${DOCKERTOOLS_PATH}" fetch --no-tags --progress --depth 1 https://github.com/eclipse-cbi/dockertools.git +refs/heads/master:refs/remotes/origin/master
git -C "${DOCKERTOOLS_PATH}" config remote.origin.url https://github.com/eclipse-cbi/dockertools.git
git -C "${DOCKERTOOLS_PATH}" config --add remote.origin.fetch +refs/heads/master:refs/remotes/origin/master
git -C "${DOCKERTOOLS_PATH}" config core.sparsecheckout true
git -C "${DOCKERTOOLS_PATH}" config advice.detachedHead false
git -C "${DOCKERTOOLS_PATH}" checkout -f "$(git -C "${DOCKERTOOLS_PATH}" rev-parse refs/remotes/origin/master)"
fi