Skip to content

Commit

Permalink
Use Arch variale, fix invalid download url
Browse files Browse the repository at this point in the history
  • Loading branch information
pbrisbin committed Dec 2, 2013
1 parent 470397d commit 7e5d476
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions doc/downgrade.8.md
Expand Up @@ -29,6 +29,9 @@ Where `$caches` is the list of all `CacheDir`s as defined in

## ENVIRONMENT VARIABLES

*ARCH*
Target architecture. Default is determined by `uname -m`.

*PACMAN*
The pacman command. Default is *pacman*.

Expand Down
4 changes: 3 additions & 1 deletion downgrade
Expand Up @@ -38,7 +38,7 @@ prompt_to_ignore() {

search_packages() {
((NOARM)) || \
curl --fail --silent --data "arch=$(uname -m)" \
curl --fail --silent --data "arch=$ARCH" \
--data-urlencode "pkgname=$1" "$ARM_URL/exact" | cut -d '|' -f 5

((NOCACHE)) || \
Expand All @@ -63,6 +63,7 @@ install_pkg() {

if [[ "$pkg" == 'http://'* ]]; then
url="$pkg"
url="${url/\/undefined\///$ARCH/}"
pkg="${url##*/}"

curl --silent "$url" > "$pkg"
Expand All @@ -71,6 +72,7 @@ install_pkg() {
[[ -f "$pkg" ]] && sudo "$PACMAN" -U "$pkg"
}

ARCH=${ARCH:-$(uname -m)}
PACMAN="${PACMAN:-pacman}"
PACMAN_CONF="${PACMAN_CONF:-/etc/pacman.conf}"
ARM_URL="${ARM_URL:-http://repo-arm.archlinuxcn.org}"
Expand Down

0 comments on commit 7e5d476

Please sign in to comment.