amprolla

devuan's apt repo merger
git clone https://git.parazyd.org/amprolla
Log | Files | Refs | README | LICENSE

orchestrate.sh (1735B)


      1 #!/bin/sh
      2 # See LICENSE file for copyright and license details.
      3 
      4 # Orchestration of incremental updates
      5 
      6 # Make sure these correlate to lib/config.py
      7 AMPROLLA_UPDATE="${AMPROLLA_UPDATE:-/home/amprolla/amprolla/amprolla_update.py}"
      8 REPO_ROOT="${REPO_ROOT:-/home/amprolla/amprolla}"
      9 AMPROLLA_LOCK="/run/lock/amprolla.lock"
     10 RSYNC_URL="mirror@pkgmaster.devuan.org:/home/mirror/"
     11 
     12 [ -f "${AMPROLLA_LOCK}" ] || {
     13 
     14 [ -d "${REPO_ROOT}/merged-staging" ] || mkdir "${REPO_ROOT}/merged-staging"
     15 [ -d "${REPO_ROOT}/merged-production" ] || mkdir "${REPO_ROOT}/merged-production"
     16 
     17 
     18 ln -snf "$REPO_ROOT"/merged-staging "$REPO_ROOT"/merged
     19 # The break call is temporary to catch unhandled exceptions in the testing phase
     20 python3 "$AMPROLLA_UPDATE" || {
     21 	ln -snf "$REPO_ROOT"/merged-production "$REPO_ROOT"/merged
     22 }
     23 
     24 printf "rsyncing volatile to production... "
     25 rsync --delete -raX "$REPO_ROOT"/merged-volatile/* "$REPO_ROOT"/merged-production
     26 echo "done!"
     27 
     28 ln -snf "$REPO_ROOT"/merged-production "$REPO_ROOT"/merged
     29 
     30 printf "rsyncing volatile to staging... "
     31 rsync --delete -raX "$REPO_ROOT"/merged-volatile/* "$REPO_ROOT"/merged-staging
     32 echo "done!"
     33 
     34 printf "rsyncing production to pkgmaster... "
     35 rsync --delete -raX \
     36 	"$REPO_ROOT"/merged-production/ "${RSYNC_URL}/merged"
     37 echo "done!"
     38 
     39 # handle obsolete package logs
     40 cat "$REPO_ROOT"/log/*-oldpackages.txt | sort | uniq > "$REPO_ROOT"/log/oldpackages.txt
     41 
     42 _logfiles="libsystemd bannedpackages"
     43 mkdir -p "$REPO_ROOT"/log/t
     44 for i in $_logfiles; do
     45 	sort "$REPO_ROOT/log/${i}.txt" | uniq > "$REPO_ROOT/log/t/${i}.txt"
     46 done
     47 cp -f "$REPO_ROOT"/log/t/*.txt "$REPO_ROOT"/log/
     48 
     49 rsync "$REPO_ROOT"/log/t/*.txt ${RSYNC_URL}
     50 rsync "$REPO_ROOT"/log/oldpackages.txt "$REPO_ROOT"/log/amprolla.txt ${RSYNC_URL}
     51 }