The heuristic to check whether or not we're inside of a git checkout
or a tarball isn't working properly.
This commit changes it to use git rev-parse --is-inside-git-dir which
is pretty specifically designed for this use case.
Closes: https://gitlab.freedesktop.org/plymouth/plymouth/-/issues/232
#!/bin/sh
exec 3>&2 2> /dev/null
-SRCDIR=$(dirname "$0")
+SRCDIR=$(dirname "$0")/..
cd "$SRCDIR"
CWD=$(realpath "$PWD")
-TOPLEVEL_WORKING_DIR=$(realpath "$(git rev-parse --show-toplevel)")
-SCRIPTDIR=${SRCDIR#"${TOPLEVEL_WORKING_DIR}/"}
exec 2>&3
# If it's not from a git checkout, assume it's from a tarball
-if [ "${TOPLEVEL_WORKING_DIR}/${SCRIPTDIR}" != "$CWD" ]; then
+if ! git rev-parse --is-inside-git-dir > /dev/null 2>&1; then
VERSION_FROM_DIR_NAME=$(basename "$CWD" | sed -n 's/^plymouth-\([^-]*\)$/\1/p')
if [ -n "$VERSION_FROM_DIR_NAME" ]; then