File tree 2 files changed +14
-2
lines changed
2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change 30
30
esac
31
31
done
32
32
33
+ PI_GEN_REPO=${PI_GEN_REPO:- https:// github.com/ RPi-Distro/ pi-gen}
34
+
33
35
# Ensure that the configuration file is an absolute path
34
36
if test -x /usr/bin/realpath; then
35
37
CONFIG_FILE=$( realpath -s " $CONFIG_FILE " || realpath " $CONFIG_FILE " )
@@ -55,7 +57,11 @@ exit 1
55
57
fi
56
58
57
59
# Ensure the Git Hash is recorded before entering the docker container
58
- GIT_HASH=${GIT_HASH:- " $( git rev-parse HEAD) " }
60
+ if [ -d " ${DIR} " /.git ]; then
61
+ GIT_HASH=${GIT_HASH:- $(git rev-parse HEAD)}
62
+ else
63
+ GIT_HASH=$( git ls-remote --tags " ${PI_GEN_REPO} " | grep $( basename " ${DIR} " | cut -d' -' -f3-) | awk ' {print $1}' )
64
+ fi
59
65
60
66
CONTAINER_EXISTS=$( ${DOCKER} ps -a --filter name=" ${CONTAINER_NAME} " -q)
61
67
CONTAINER_RUNNING=$( ${DOCKER} ps --filter name=" ${CONTAINER_NAME} " -q)
Original file line number Diff line number Diff line change @@ -179,7 +179,13 @@ export KEYBOARD_LAYOUT="${KEYBOARD_LAYOUT:-English (UK)}"
179
179
180
180
export TIMEZONE_DEFAULT=" ${TIMEZONE_DEFAULT:- Europe/ London} "
181
181
182
- export GIT_HASH=${GIT_HASH:- " $( git rev-parse HEAD) " }
182
+ if [ -z " ${GIT_HASH} " ]; then
183
+ if [ -d " ${BASE_DIR} " /.git ]; then
184
+ export GIT_HASH=${GIT_HASH:- $(git rev-parse HEAD)}
185
+ else
186
+ export GIT_HASH=$( git ls-remote --tags " ${PI_GEN_REPO} " | grep $( basename " ${BASE_DIR} " | cut -d' -' -f3-) | awk ' {print $1}' )
187
+ fi
188
+ fi
183
189
184
190
export CLEAN
185
191
export IMG_NAME
You can’t perform that action at this time.
0 commit comments