-
Notifications
You must be signed in to change notification settings - Fork 0
/
publish-queued
executable file
·56 lines (51 loc) · 1.39 KB
/
publish-queued
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
#!/usr/bin/bash
# Publish yum repos from a list
# echo, exit on error/undefined vars
set -xeu
basedir=$HOME/result
cachedir="$HOME/rpmcache.vm7"
needsync=0
if [ -s "$HOME/rpm-publish-queue" ]; then
packages=$(/usr/bin/sort "$HOME/rpm-publish-queue")
# Sign queued packages
for package in $packages; do
if [ -f "$basedir/$package" ]; then
echo "Signing $package"
case "$package" in
*vm/6*)
$HOME/bin/sign-with vm6 "$basedir/$package"
;;
*vm/7*)
$HOME/bin/sign-with vm7 "$basedir/$package"
;;
*)
echo "Something went wrong, couldn't detect which key to sign with."
;;
esac
fi
done
exit 0
# Create metadata for all modified package dirs
repos=$(for package in $packages; do dirname "$package" | /usr/bin/uniq; done)
echo $repos
for repo in $repos; do
fullrepo="$basedir/$repo"
echo "Working on $fullrepo"
# Clean up old packages
#rm $(repomanage --keep=2 --old "$fullrepo")
if [ -d "$fullrepo" ]; then
cd "$fullrepo"
$HOME/bin/del-broken-links
/usr/bin/createrepo -q -c "$cachedir/$repo" "$fullrepo"
need_sync=1
else
echo "$fullrepo does not exist."
fi
done
fi
# Empty the queue
/usr/bin/flock "$HOME/rpm-publish-queue" -c 'echo -n > "$HOME/rpm-publish-queue"'
# Should we sync?
if [ "$needsync" -eq 1 ]; then
$HOME/bin/rsync-vm7.sh
fi