#!/usr/bin/bash
#   Copyright (C) 2013  Red Hat, Inc.
#   Copyright (C) 2015  Till Maas
#   Copyright (C) 2016  Ben Rosser
#   Copyright (C) 2019  Nicolas Chauvet
#
#   This program is free software: you can redistribute it and/or modify
#   it under the terms of the GNU General Public License as published by
#   the Free Software Foundation, either version 3 of the License, or
#   (at your option) any later version.
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with this program.  If not, see <http://www.gnu.org/licenses/>.

# Abort on errors
set -e

url=$(cat .git/config |awk '/url/ {print $3}')
if [[ "${url}" =~ "fedoraproject" ]] ;then
baseurl=https://src.fedoraproject.org/repo/pkgs rfpkg-base $@
else
namespace=$(echo ${url} | awk -F '/' '{print $(NF-1)}')
baseurl=https://pkgs.rpmfusion.org/repo/pkgs/${namespace} rfpkg-base $@
fi
