-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathorchestrate.sh
More file actions
executable file
·51 lines (38 loc) · 1.69 KB
/
Copy pathorchestrate.sh
File metadata and controls
executable file
·51 lines (38 loc) · 1.69 KB
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
#!/bin/sh
# See LICENSE file for copyright and license details.
# Orchestration of incremental updates
# Make sure these correlate to lib/config.py
AMPROLLA_UPDATE="${AMPROLLA_UPDATE:-/home/amprolla/amprolla/amprolla_update.py}"
REPO_ROOT="${REPO_ROOT:-/home/amprolla/amprolla}"
AMPROLLA_LOCK="/run/lock/amprolla.lock"
RSYNC_URL="mirror@pkgmaster.devuan.org:/home/mirror/"
[ -f "${AMPROLLA_LOCK}" ] || {
[ -d "${REPO_ROOT}/merged-staging" ] || mkdir "${REPO_ROOT}/merged-staging"
[ -d "${REPO_ROOT}/merged-production" ] || mkdir "${REPO_ROOT}/merged-production"
ln -snf "$REPO_ROOT"/merged-staging "$REPO_ROOT"/merged
# The break call is temporary to catch unhandled exceptions in the testing phase
python3 "$AMPROLLA_UPDATE" || {
ln -snf "$REPO_ROOT"/merged-production "$REPO_ROOT"/merged
}
printf "rsyncing volatile to production... "
rsync --delete -raX "$REPO_ROOT"/merged-volatile/* "$REPO_ROOT"/merged-production
echo "done!"
ln -snf "$REPO_ROOT"/merged-production "$REPO_ROOT"/merged
printf "rsyncing volatile to staging... "
rsync --delete -raX "$REPO_ROOT"/merged-volatile/* "$REPO_ROOT"/merged-staging
echo "done!"
printf "rsyncing production to pkgmaster... "
rsync --delete -raX \
"$REPO_ROOT"/merged-production/ "${RSYNC_URL}/merged"
echo "done!"
# handle obsolete package logs
cat "$REPO_ROOT"/log/*-oldpackages.txt | sort | uniq > "$REPO_ROOT"/log/oldpackages.txt
_logfiles="libsystemd bannedpackages"
mkdir -p "$REPO_ROOT"/log/t
for i in $_logfiles; do
sort "$REPO_ROOT/log/${i}.txt" | uniq > "$REPO_ROOT/log/t/${i}.txt"
done
cp -f "$REPO_ROOT"/log/t/*.txt "$REPO_ROOT"/log/
rsync "$REPO_ROOT"/log/t/*.txt ${RSYNC_URL}
rsync "$REPO_ROOT"/log/oldpackages.txt "$REPO_ROOT"/log/amprolla.txt ${RSYNC_URL}
}