Commit 4be28b39 authored by Thomas Haller's avatar Thomas Haller
Browse files

contrib/rpm: fix logic in build.sh about specifying source

When the user neither specifies SOURCE or SOURCE_FROM_GIT,
we first want to detect a tarball in the current directory,
and as second fallback to SOURCE_FROM_GIT=1.

If either SOURCE or SOURCE_FROM_GIT is set, we want to do
that and not detect anything.

The logic was wrong.
parent 5617cd4e
......@@ -106,20 +106,16 @@ SOURCE="$(abs_path "$SOURCE")" || die "invalid \$SOURCE argument"
if [ -n "$SOURCE" ]; then
[[ "$SOURCE_FROM_GIT" == 1 ]] && die "Cannot set both \$SOURCE and \$SOURCE_FROM_GIT=1"
SOURCE_FROM_GIT=0
elif [[ "$SOURCE_FROM_GIT" != "0" ]]; then
SOURCE="$GITDIR/NetworkManager-${VERSION}.tar."*
if [ -f "$SOURCE" ]; then
SOURCE_FROM_GIT=0
else
elif [[ "$SOURCE_FROM_GIT" != "1" ]]; then
SOURCE="$(ls -1 "$GITDIR/NetworkManager-${VERSION}.tar."* 2>/dev/null | head -n1)"
if [[ -z "$SOURCE" ]]; then
[[ "$SOURCE_FROM_GIT" == "0" ]] && die "Either set \$SOURCE or set \$SOURCE_FROM_GIT=1"
SOURCE_FROM_GIT=1
SOURCE=
else
SOURCE_FROM_GIT=0
fi
fi
if [[ -z "$SOURCE" && "$SOURCE_FROM_GIT" == "0" ]]; then
die "Either set \$SOURCE or set \$SOURCE_FROM_GIT=1"
fi
SOURCE_NETWORKMANAGER_CONF="$(abs_path "$SOURCE_NETWORKMANAGER_CONF" "$SCRIPTDIR/NetworkManager.conf")" || die "invalid \$SOURCE_NETWORKMANAGER_CONF argument"
SOURCE_CONFIG_SERVER="$(abs_path "$SOURCE_CONFIG_SERVER" "$SCRIPTDIR/00-server.conf")" || die "invalid \$SOURCE_CONFIG_SERVER argument"
SOURCE_CONFIG_CONNECTIVITY_FEDORA="$(abs_path "$SOURCE_CONFIG_CONNECTIVITY_FEDORA" "$SCRIPTDIR/20-connectivity-fedora.conf")" || die "invalid \$SOURCE_CONFIG_CONNECTIVITY_FEDORA argument"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment