Skip to content

Commit d6be12d

Browse files
committed
Add fix
1 parent f6904fd commit d6be12d

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

devops/build/packaging/deb/build-deb.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ export CBDB_FULL_VERSION=$VERSION
109109

110110
# Set version if not provided
111111
if [ -z "${VERSION}" ]; then
112-
export CBDB_FULL_VERSION=$(./getversion | cut -d'-' -f 1 | cut -d'+' -f 1)
112+
export CBDB_FULL_VERSION=$(./getversion 2>/dev/null | cut -d'-' -f 1 | cut -d'+' -f 1 || echo "unknown")
113113
fi
114114

115115
if [[ ! $CBDB_FULL_VERSION =~ ^[0-9] ]]; then
@@ -127,13 +127,20 @@ fi
127127
# Detect OS distribution (e.g., ubuntu22.04, debian12)
128128
if [ -z ${OS_DISTRO+x} ]; then
129129
if [ -f /etc/os-release ]; then
130+
# Temporarily disable unbound variable check for sourcing os-release
131+
set +u
130132
. /etc/os-release
131-
OS_DISTRO=$(echo "${ID}${VERSION_ID}" | tr '[:upper:]' '[:lower:]')
133+
set -u
134+
# Ensure ID and VERSION_ID are set before using them
135+
OS_DISTRO=$(echo "${ID:-unknown}${VERSION_ID:-}" | tr '[:upper:]' '[:lower:]')
132136
else
133137
OS_DISTRO="unknown"
134138
fi
135139
fi
136140

141+
# Ensure OS_DISTRO is exported and not empty
142+
export OS_DISTRO=${OS_DISTRO:-unknown}
143+
137144
export CBDB_PKG_VERSION=${CBDB_FULL_VERSION}-${BUILD_NUMBER}-${OS_DISTRO}
138145

139146
# Check if required commands are available

0 commit comments

Comments
 (0)