summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2016-04-01 15:54:06 +0200
committerThomas Haller <thaller@redhat.com>2016-04-01 15:54:06 +0200
commit4be28b3916e737b2e140512735f81d641b5dc121 (patch)
tree2b15d26f3821be8f813f639b80d4bb946b774654 /contrib
parent5617cd4e6177694d342582c36077fabdc5248e48 (diff)
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.
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/fedora/rpm/build.sh16
1 files changed, 6 insertions, 10 deletions
diff --git a/contrib/fedora/rpm/build.sh b/contrib/fedora/rpm/build.sh
index f216d63f24..6da1ade3c1 100755
--- a/contrib/fedora/rpm/build.sh
+++ b/contrib/fedora/rpm/build.sh
@@ -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"