1 |
#!/bin/sh |
2 |
|
3 |
# To the extent possible under law, the author(s) have dedicated all |
4 |
# copyright and related and neighboring rights to this software to the |
5 |
# public domain worldwide. |
6 |
# This software is distributed without any warranty. |
7 |
|
8 |
# You should have received a copy of the CC0 Public Domain Dedication |
9 |
# along with this software. |
10 |
# If not, see <http://creativecommons.org/publicdomain/zero/1.0/>. |
11 |
|
12 |
. /etc/mgasoft.conf |
13 |
|
14 |
function check_softname() |
15 |
{ |
16 |
local softname="$1" |
17 |
test -n "$softname" || return 1 |
18 |
echo "$softname" | fgrep -q .. && return 1 |
19 |
echo "$softname" | fgrep -q / && return 1 |
20 |
return 0 |
21 |
} |
22 |
|
23 |
function check_softrel() |
24 |
{ |
25 |
check_softname $@ |
26 |
} |
27 |
|
28 |
function update_infos() |
29 |
{ |
30 |
pushd $pubinfodir > /dev/null || exit 3 |
31 |
svn up -q |
32 |
popd > /dev/null || exit 3 |
33 |
} |
34 |
|
35 |
function publish() |
36 |
{ |
37 |
local softname="$1" |
38 |
local softrel="$2" |
39 |
check_softname "$softname" || return 1 |
40 |
check_softrel "$softrel" || return 1 |
41 |
pushd "$pubmirrordir/$softname" > /dev/null || exit 3 |
42 |
mgasoft tar "$softname" "$softrel" |
43 |
#TODO: sign file |
44 |
#TODO: upload to binrepo |
45 |
#TODO: update sha1sum in pubinfodir |
46 |
popd > /dev/null || exit 3 |
47 |
} |
48 |
|
49 |
update_infos |
50 |
pushd "$pubinfodir" > /dev/null |
51 |
for softname in * |
52 |
do |
53 |
pushd "$softname" > /dev/null || exit 3 |
54 |
for rel in * |
55 |
do |
56 |
if ! [ -d "$pubmirrordir/$softname" ] |
57 |
then |
58 |
mkdir "$pubmirrordir/$softname" |
59 |
fi |
60 |
if ! [ -f "$pubmirrordir/$softname/$softname-$rel.tar.xz" ] |
61 |
then |
62 |
publish "$softname" "$rel" |
63 |
fi |
64 |
done |
65 |
popd > /dev/null || exit 3 |
66 |
done |
67 |
popd > /dev/null |