Admin/Windows/Cygwin/setup_server
author wenzelm
Sat, 28 Nov 2020 16:25:29 +0100
changeset 72759 bd5ee3148132
parent 71385 06bb82e7af2a
permissions -rwxr-xr-x
more antiquotations (reverting 4df341249348);
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
68268
38b4d4f39434 setup server directory for Cygwin quasi-mirror;
wenzelm
parents:
diff changeset
     1
#!/usr/bin/env bash
38b4d4f39434 setup server directory for Cygwin quasi-mirror;
wenzelm
parents:
diff changeset
     2
38b4d4f39434 setup server directory for Cygwin quasi-mirror;
wenzelm
parents:
diff changeset
     3
CYGWIN_MAIN="https://cygwin.com"
38b4d4f39434 setup server directory for Cygwin quasi-mirror;
wenzelm
parents:
diff changeset
     4
CYGWIN_MIRROR="https://ftp.eq.uc.pt/software/pc/prog/cygwin"
38b4d4f39434 setup server directory for Cygwin quasi-mirror;
wenzelm
parents:
diff changeset
     5
38b4d4f39434 setup server directory for Cygwin quasi-mirror;
wenzelm
parents:
diff changeset
     6
function fail()
38b4d4f39434 setup server directory for Cygwin quasi-mirror;
wenzelm
parents:
diff changeset
     7
{
38b4d4f39434 setup server directory for Cygwin quasi-mirror;
wenzelm
parents:
diff changeset
     8
  echo "$1" >&2
38b4d4f39434 setup server directory for Cygwin quasi-mirror;
wenzelm
parents:
diff changeset
     9
  exit 2
38b4d4f39434 setup server directory for Cygwin quasi-mirror;
wenzelm
parents:
diff changeset
    10
}
38b4d4f39434 setup server directory for Cygwin quasi-mirror;
wenzelm
parents:
diff changeset
    11
38b4d4f39434 setup server directory for Cygwin quasi-mirror;
wenzelm
parents:
diff changeset
    12
function download()
38b4d4f39434 setup server directory for Cygwin quasi-mirror;
wenzelm
parents:
diff changeset
    13
{
38b4d4f39434 setup server directory for Cygwin quasi-mirror;
wenzelm
parents:
diff changeset
    14
  local URL="$1"
38b4d4f39434 setup server directory for Cygwin quasi-mirror;
wenzelm
parents:
diff changeset
    15
  local DIR="${2:-.}"
38b4d4f39434 setup server directory for Cygwin quasi-mirror;
wenzelm
parents:
diff changeset
    16
  mkdir -p "$DIR" || fail "Cannot create directory: \"$DIR\""
38b4d4f39434 setup server directory for Cygwin quasi-mirror;
wenzelm
parents:
diff changeset
    17
  echo "Downloading $URL ..."
38b4d4f39434 setup server directory for Cygwin quasi-mirror;
wenzelm
parents:
diff changeset
    18
  curl --fail --silent "$URL" > "$DIR"/"$(basename "$URL")" || fail "FAILED"
38b4d4f39434 setup server directory for Cygwin quasi-mirror;
wenzelm
parents:
diff changeset
    19
}
38b4d4f39434 setup server directory for Cygwin quasi-mirror;
wenzelm
parents:
diff changeset
    20
38b4d4f39434 setup server directory for Cygwin quasi-mirror;
wenzelm
parents:
diff changeset
    21
download "$CYGWIN_MAIN/setup-x86_64.exe"
38b4d4f39434 setup server directory for Cygwin quasi-mirror;
wenzelm
parents:
diff changeset
    22
download "$CYGWIN_MIRROR/x86_64/setup.xz" "x86_64"
38b4d4f39434 setup server directory for Cygwin quasi-mirror;
wenzelm
parents:
diff changeset
    23
download "$CYGWIN_MIRROR/x86_64/setup.xz.sig" "x86_64"