Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion build-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ do
esac
done

PI_GEN_REPO=${PI_GEN_REPO:-https://github.com/RPi-Distro/pi-gen}

# Ensure that the configuration file is an absolute path
if test -x /usr/bin/realpath; then
CONFIG_FILE=$(realpath -s "$CONFIG_FILE" || realpath "$CONFIG_FILE")
Expand All @@ -55,7 +57,11 @@ exit 1
fi

# Ensure the Git Hash is recorded before entering the docker container
GIT_HASH=${GIT_HASH:-"$(git rev-parse HEAD)"}
if [ -d "${DIR}"/.git ]; then
GIT_HASH=${GIT_HASH:-$(git rev-parse HEAD)}
else
GIT_HASH=$(git ls-remote --tags "${PI_GEN_REPO}" | grep $(basename "${DIR}" | cut -d'-' -f3-) | awk '{print $1}')
fi

CONTAINER_EXISTS=$(${DOCKER} ps -a --filter name="${CONTAINER_NAME}" -q)
CONTAINER_RUNNING=$(${DOCKER} ps --filter name="${CONTAINER_NAME}" -q)
Expand Down
8 changes: 7 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,13 @@ export KEYBOARD_LAYOUT="${KEYBOARD_LAYOUT:-English (UK)}"

export TIMEZONE_DEFAULT="${TIMEZONE_DEFAULT:-Europe/London}"

export GIT_HASH=${GIT_HASH:-"$(git rev-parse HEAD)"}
if [ -z "${GIT_HASH}" ]; then
if [ -d "${BASE_DIR}"/.git ]; then
export GIT_HASH=${GIT_HASH:-$(git rev-parse HEAD)}
else
export GIT_HASH=$(git ls-remote --tags "${PI_GEN_REPO}" | grep $(basename "${BASE_DIR}" | cut -d'-' -f3-) | awk '{print $1}')
fi
fi

export CLEAN
export IMG_NAME
Expand Down