summaryrefslogtreecommitdiffstats
path: root/functions
blob: 53bec753ec70e426ff80a974fc61b12d0df744bc (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
# 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"

. /etc/mgatools.conf

function isingroup()
{
    grp="$1"
    for group in `groups`; do
        [ "$grp" = "$group" ] && return 0
    done
    return 1
}

function inlist()
{
    k="$1"
    list="$2"
    for e in $list; do
        [ "$k" = "$e" ] && return 0
    done
    return 1
}

function update_hdlist()
{
    repository="$1"
    fdeps="$repository/../../media_info/file-deps"
    test -f "$fdeps" && ofdeps="--file-deps $fdeps"
    /usr/bin/genhdlist2 -v --versioned --allow-empty-media $ofdeps "$repository"
}

function update_common_MD5SUM()
{
    distrorelease="$1"
    for arch in $arches; do
        pushd "$distribdir/$distrorelease/$arch/media/media_info"
        /usr/bin/md5sum hdlist_* synthesis.* > MD5SUM
        popd
    done
}

function mirror_repository()
{
    distrorelease="$1"
    /usr/bin/rsync $mirror_rsync_options "$distribdir/$distrorelease/" "$finaldistribdir/$distrorelease/"
}