aboutsummaryrefslogtreecommitdiff
path: root/cmd/sync-files.sh
blob: 54b1e97dbc536a039a143d0369b7c06585fd90e7 (plain)
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
52
53
54
55
56
57
58
#!/bin/sh
set -e

CMD_DIR="$(realpath $(dirname $0))"
PROJ_DIR="$(realpath $CMD_DIR/..)"

MIRROR="${MIRROR:=ftp://ftp.slackware.com/pub/slackware/slackware64-14.2}"

echo "Fetching CHECKSUMS.md5"
wget --continue "$MIRROR/CHECKSUMS.md5"
wget --continue "$MIRROR/CHECKSUMS.md5.asc"

# verify
gpg2 --verify-files CHECKSUMS.md5.asc

echo "fetching packages"
for pkg in source/*/*; do
  echo "$pkg"
  grep $pkg CHECKSUMS.md5 | \
      grep -v SlackBuild | \
      tr -s " " | \
      cut -f2 -d " " | \
      while read -r line;
      do
        mkdir -p $(echo "$line" | rev | cut -d'/' -f2- | rev)
        echo "url: $MIRROR/$line"
        sleep 1
        wget -c -O "$line" "$MIRROR/$line"
      done
done

for pkg in patches/source/*; do
  echo "$pkg"
  grep $pkg CHECKSUMS.md5 | \
      grep -v SlackBuild | \
      tr -s " " | \
      cut -f2 -d " " | \
      while read -r line;
      do
        mkdir -p $(echo "$line" | rev | cut -d'/' -f2- | rev)
        echo "url: $MIRROR/$line"
        sleep 1
        wget -c -O "$line" "$MIRROR/$line"
      done
done

for pkg in $(find . -name '*.info' | xargs -n1 dirname); do
  (
    echo "$pkg"
    cd "$pkg"
    source ./*.info
    wget -c "$DOWNLOAD"
  )
done

echo "verify checksums..."
tail +13 CHECKSUMS.md5 | grep -v SlackBuild | md5sum --check --ignore-missing --quiet -
tail +13 CHECKSUMS_MUSLACK.md5 | md5sum --check --ignore-missing --quiet -