File: download_obs_packages.sh

package info (click to toggle)
copyq 3.7.3-1~bpo9+1
  • links: PTS, VCS
  • area: main
  • in suites: stretch-backports
  • size: 10,480 kB
  • sloc: cpp: 51,894; sh: 734; python: 211; xml: 57; makefile: 34
file content (51 lines) | stat: -rwxr-xr-x 1,525 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/bash
# Download packages from openSUSE Build Service.
version=$1
rpm_version=$2
user=${3:-"lukho"}
project=${4:-"copyq"}

base_url="http://download.opensuse.org/repositories/home:/"
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}"
pkg_rpm_lp15="x86_64/${project}-${version}-lp150.${rpm_version}${xrpm}"

failed=""

die () {
    echo "ERROR: $*"
    exit 1
}

fetch_package () {
    name=$1
    package_url=$2
    wget -c "$package_url" -O "$name" || failed="$failed\n$package_url"
}

if [ -z "$version" ]; then
    die "First argument must be version package version!"
fi

fetch_package "${pkg}_openSUSE_Tumbleweed${xrpm}" "$url/openSUSE_Tumbleweed/${pkg_rpm}"
fetch_package "${pkg}_openSUSE_Leap_15.0${xrpm}"  "$url/openSUSE_Leap_15.0/${pkg_rpm_lp15}"
fetch_package "${pkg}_Fedora_28${xrpm}"           "$url/Fedora_28/${pkg_rpm}"
fetch_package "${pkg}_Fedora_29${xrpm}"           "$url/Fedora_29/${pkg_rpm}"
fetch_package "${pkg}_Debian_8.0${xdeb_i386}"     "$url/Debian_8.0/${pkg_deb_i386}"
fetch_package "${pkg}_Debian_8.0${xdeb}"          "$url/Debian_8.0/${pkg_deb}"
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}"

if [ -n "$failed" ]; then
    echo -e "Failed packages:$failed"
    exit 2
fi