summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2016-04-01 15:54:06 +0200
committerBeniamino Galvani <bgalvani@redhat.com>2016-04-04 14:56:21 +0200
commit73e683580b77287c8a193ecc003b2062beefab21 (patch)
tree8db39fc8c27c14aa17a0335ef2ba5a095757d9e8
parentca3a1a5863e090ce46dbf3c31bc7a620926767c9 (diff)
downloadNetworkManager-bg/th/unmanaged-external-down-bgo763236.tar.gz
contrib/rpm: fix logic in build.sh about specifying sourcebg/th/unmanaged-external-down-bgo763236
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.
-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"