Skip to content
Snippets Groups Projects
download_obs_packages.sh 1.25 KiB
Newer Older
  • Learn to ignore specific revisions
  • hluk's avatar
    hluk committed
    #!/bin/bash
    # Download packages from openSUSE Build Service.
    version=$1
    
    hluk's avatar
    hluk committed
    rpm_version=$2
    user=${3:-"lukho"}
    project=${4:-"copyq"}
    
    base_url="https://download.opensuse.org/repositories/home:/"
    
    hluk's avatar
    hluk committed
    url=$base_url$user:/$project
    
    
    xdeb="-1_amd64.deb"
    xdeb_i386="-1_i386.deb"
    
    xrpm=".x86_64.rpm"
    
    pkg="${project}_${version}"
    pkg_deb="amd64/${pkg}${xdeb}"
    pkg_deb_i386="i386/${pkg}${xdeb_i386}"
    pkg_rpm="x86_64/${project}-${version}-${rpm_version}${xrpm}"
    
    hluk's avatar
    hluk committed
    pkg_rpm_lp15="x86_64/${project}-${version}-lp152.${rpm_version}${xrpm}"
    
    hluk's avatar
    hluk committed
    failed=""
    
    hluk's avatar
    hluk committed
    
    die () {
        echo "ERROR: $*"
        exit 1
    }
    
    
    hluk's avatar
    hluk committed
    fetch_package () {
        name=$1
        package_url=$2
        wget -c "$package_url" -O "$name" || failed="$failed\n$package_url"
    }
    
    
    hluk's avatar
    hluk committed
    if [ -z "$version" ]; then
        die "First argument must be version package version!"
    fi
    
    
    fetch_package "${pkg}_openSUSE_Tumbleweed${xrpm}" "$url/openSUSE_Tumbleweed/${pkg_rpm}"
    
    hluk's avatar
    hluk committed
    fetch_package "${pkg}_openSUSE_Leap_15.2${xrpm}"  "$url/openSUSE_Leap_15.2/${pkg_rpm_lp15}"
    
    fetch_package "${pkg}_Debian_9.0${xdeb_i386}"     "$url/Debian_9.0/${pkg_deb_i386}"
    fetch_package "${pkg}_Debian_9.0${xdeb}"          "$url/Debian_9.0/${pkg_deb}"
    
    hluk's avatar
    hluk committed
    fetch_package "${pkg}_Debian_10${xdeb}"           "$url/Debian_10/${pkg_deb}"
    
    hluk's avatar
    hluk committed
    
    if [ -n "$failed" ]; then
        echo -e "Failed packages:$failed"
        exit 2
    fi
    
    hluk's avatar
    hluk committed