chamesle

chamesle.org: the site of Chamesle, a small Linux distribution
git clone https://github.com/tortr-rs/chamesle
Log | Files | Refs | README

upload.sh (1952B)


      1 #!/bin/sh
      2 # upload the repo and the isos to sourceforge (needs your ssh key on sourceforge)
      3 #   tools/repo/upload.sh            everything
      4 #   tools/repo/upload.sh core       the index and what the editions use (~2G), the rest can follow later
      5 #   tools/repo/upload.sh iso        just the isos
      6 #   tools/repo/upload.sh publish    what tools/repo/merge-index.sh made: the new index and packages, nothing else
      7 # run it again if it stops, it carries on where it was
      8 set -eu
      9 cd "$(dirname "$0")/../.."
     10 DEST=${DEST:-torter@frs.sourceforge.net:/home/frs/project/chameslerepos}
     11 R=work/repo/x86_64
     12 
     13 case "${1:-}" in
     14 iso)
     15     ;;
     16 publish)
     17     # the packages first, then the index that names them: never an index pointing at files that aren't there yet
     18     rsync -av --partial --progress -e ssh --exclude Packages.adb work/publish/x86_64/ "$DEST/x86_64/"
     19     rsync -av --partial --progress -e ssh work/publish/x86_64/Packages.adb "$DEST/x86_64/"
     20     exit 0
     21     ;;
     22 core)
     23     # names from the editions' package lists plus everything they pull in, then their files
     24     list=$(mktemp)
     25     python3 - "$R" work/repo/first.list tools/pkg > "$list" <<'EOF'
     26 import os, re, sys
     27 repo, first, pkgs = sys.argv[1:]
     28 names = set(open(first).read().split()) | set(os.listdir(pkgs))
     29 for f in sorted(os.listdir(repo)):
     30     if f == "Packages.adb" or re.sub(r"-[^-]+-r[0-9]+\.apk$", "", f) in names:
     31         print(f)
     32 EOF
     33     rsync -av --partial --progress -e ssh --files-from="$list" "$R/" "$DEST/x86_64/"
     34     rm -f "$list"
     35     ;;
     36 *)
     37     # with only a few packages here this would empty the repo on sourceforge
     38     [ "$(ls "$R" | grep -c '\.apk$')" -gt 10000 ] || { echo "upload: $R isn't a full copy of the repo, use publish" >&2; exit 1; }
     39     # --delete-after: versions the sync replaced go from sourceforge too
     40     rsync -av --partial --progress --delete-after -e ssh "$R/" "$DEST/x86_64/"
     41     ;;
     42 esac
     43 rsync -av --partial --progress -e ssh out/*.iso out/*.iso.sha256 "$DEST/iso/"