blob: 7f5f63cb3e2e6a95eb74fd2f71b42755efdc894a (
plain)
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
# to be sourced
# Default values
dryrun=echo
moveupdate_allowed_group='mga-qa'
moveupdate_mailto='sysadmin-reports@ml.mageia.org'
requestuser="${SUDO_USER:-$USER}"
moveupdate_mailfrom="$requestuser <root@mageia.org>"
distribdir='/distrib/bootstrap/distrib'
finaldistribdir='/distrib/mirror/distrib'
distrosections='core nonfree tainted'
distrosubsections='release updates updates_testing backports backports_testing'
distroreleases='1 2 3 4'
arches='i586 x86_64'
mirror_rsync_options="--dry-run -v --delete -alH"
[ -f /etc/mgatools.conf ] && . /etc/mgatools.conf
# Generic support for --dry-run as first argument
if [ "$1" = "--dry-run" ]; then
dryrun=echo
mirror_rsync_options="--dry-run -v --delete -alH"
shift
fi
function isingroup()
{
local grp="$1"
for group in `groups`; do
[ "$grp" = "$group" ] && return 0
done
return 1
}
function inlist()
{
local k="$1"
local list="$2"
for e in $list; do
[ "$k" = "$e" ] && return 0
done
return 1
}
function valid_release()
{
[ "cauldron" = "$1" ] && return 0
inlist "$1" "$distroreleases" && return 0
echo "Invalid release '$1'" >&2
return 1
}
function valid_section()
{
inlist "$1" "$distrosections" && return 0
echo "Invalid section '$1'" >&2
return 1
}
function valid_subsection()
{
inlist "$1" "$distrosubsections" && return 0
echo "Invalid subsection '$1'" >&2
return 1
}
function update_hdlist()
{
local ofdeps
local repository="$1"
local fdeps="$repository/../../media_info/file-deps"
test -f "$fdeps" && ofdeps="--file-deps $fdeps"
$dryrun /usr/bin/genhdlist2 -v --versioned --allow-empty-media $ofdeps "$repository"
}
function update_distro_hdlist()
{
if [ "$1" = "--nocheck" ]; then
shift
else
valid_release "$1" && valid_section "$2" && valid_subsection "$3" || return 1
fi
local release="$1"
local section="$2"
local subsection="$3"
for arch in $arches; do
update_hdlist "$distribdir/$release/$arch/media/$section/$subsection"
update_hdlist "$distribdir/$release/$arch/media/debug/$section/$subsection"
done
update_hdlist "$distribdir/$release/SRPMS/$section/$subsection"
}
function update_common_MD5SUM()
{
local release="$1"
for arch in $arches; do
pushd "$distribdir/$release/$arch/media/media_info"
$dryrun /bin/sh -c "/usr/bin/md5sum hdlist_* synthesis.* >MD5SUM"
popd
done
}
function mirror_repository()
{
local release="$1"
/usr/bin/rsync $mirror_rsync_options "$distribdir/$release/" "$finaldistribdir/$release/"
}
|