
# -*- python -*-
#
# The configuration file of rsync.py.
# It's a Python file (*not* a module)
#
# It's executed inside the "Rsync.loadConf()" method. The traditional
# 'self' argument of a Python class is renamed 'rsync' to be more explicit.
#
#
# EPEL.
# rsync -vaH --exclude=4/* --exclude=5/* --exclude=beta/* 
#            --exclude=6/ppc64 --exclude=6/*/debug
#            --numeric-ids --delete --delete-after --delay-updates
#            rsync://download.fedora.redhat.com/fedora-epel epel
#
# ELrepo.
# rsync --exclude=el5
#       elrepo.reloumirrors.net::elrepo elrepo

ExclCommons  = [ "rpmdb/*"
               , "var/cache/*"
               , "var/lib/rpm/*"
               , "var/lib/yum/*"
               , "old/*"
               , "*.swp"
               , ".#*"
              #, ".git"
               , "*~"
               , "*.log"
               , "*.ova"
               , "rpmbuild/BUILD/*"
               , "rpmbuild/BUILDROOT/*"
               , "dim/backup/*"
               , "*/tmp/*"
               , "x86_64/iso/*"
               , "x86_64/updates/*"
               , "x86_64/os/bad"
              #, "x86_64/debug/*"
              #, "*/debugsource/*"
               ]
ExclAdm      = [ "*.log", "*.pyc", "*.swp" ]
ExclSrpms    = [ "SRPMS/*", "Source/*", "source/*"   ]
ExclVendors  = [ "vendors/*" ]
ExclTrac     = [ "*.log", "*.pyc", "*.swp" ]
ExclRpmbuild = [ "rpmbuild/*" ]

fullMirrors = \
    [
   #  { "host":"melon"         , "fqdn":       "melon.soc.lip6.fr", "flags":0, "sshArgs":None }
   #, { "host":"melon.tunnel"  , "fqdn":                 "melon-t", "flags":0, "sshArgs":None }
   #, { "host":"melon.port"    , "fqdn":               "localhost", "flags":0, "sshArgs":"-p 2222" }
   #, { "host":"shadock.wifi"  , "fqdn":"shadock-wifi.soc.lip6.fr", "flags":0, "sshArgs":None }
   #, { "host":"lepka"         , "fqdn":       "goulp.soc.lip6.fr", "flags":0, "sshArgs":None }
      { "host":"backup"        , "fqdn":       "goulp.soc.lip6.fr", "flags":0, "sshArgs":None }
   #, { "host":"shadock"       , "fqdn":     "shadock.soc.lip6.fr", "flags":0, "sshArgs":None }
    , { "host":"gibi"          , "fqdn":        "gibi.soc.lip6.fr", "flags":0, "sshArgs":None }
   #, { "host":"goulp"         , "fqdn":       "goulp.soc.lip6.fr", "flags":0, "sshArgs":None }
   #, { "host":"goulp.wifi"    , "fqdn":  "goulp-wifi.soc.lip6.fr", "flags":0, "sshArgs":None }
   #, { "host":"shadock.orkand", "fqdn":  "meseriphine.dyndns.org", "flags":0, "sshArgs":"-p 2206" }
   #, { "host":"shadock.tunnel", "fqdn":               "shadock-t", "flags":0, "sshArgs":None }
    , { "host":"limavan"       , "fqdn":                 "limavan", "flags":0, "sshArgs":None }
    , { "host":"pasoer"        , "fqdn":                  "pasoer", "flags":0, "sshArgs":None }
    , { "host":"localhost"     , "fqdn":   "localhost.localdomain", "flags":0, "sshArgs":"-p 2222" }
    , { "host":"bop"           , "fqdn":         "bop.soc.lip6.fr", "flags":0, "sshArgs":None }
    , { "host":"fox"           , "fqdn":         "fox.soc.lip6.fr", "flags":0, "sshArgs":None }
    , { "host":"fox.tunnel"    , "fqdn":                   "fox-t", "flags":0, "sshArgs":None }
    ]

for mirror in fullMirrors:
    profile = rsync.add(mirror["host"],mirror["fqdn"],mirror["flags"],mirror["sshArgs"])
    profile.addTreeConf("sl"        ,"/dsk/l1/distributions/sl"              ,"-rptgoDLvuHK",ExclCommons)
    profile.addTreeConf("al"        ,"/dsk/l1/distributions/al"              ,"-rptgoDLvuHK",ExclCommons)
    profile.addTreeConf("epel"      ,"/dsk/l1/distributions/epel"            ,"-auvhH"      ,ExclCommons)
    profile.addTreeConf("centos"    ,"/dsk/l1/distributions/centos"          ,"-auvhH"      ,ExclCommons)
    profile.addTreeConf("rpmfusion" ,"/dsk/l1/distributions/rpmfusion"       ,"-auvhH"      ,ExclCommons)
   #profile.addTreeConf("elrepo"    ,"/dsk/l1/distributions/slsoc/elrepo"    ,"-auvhH"      ,ExclCommons)
   #profile.addTreeConf("vendors"   ,"/dsk/l1/distributions/slsoc/vendors"   ,"-auvhH"      ,ExclCommons)
    profile.addTreeConf("soc"       ,"/dsk/l1/distributions/soc"             ,"-auvhH"      ,ExclCommons)
    profile.addTreeConf("adm"       ,"/dsk/l1/adm"                           ,"-auvhH"      ,ExclAdm)
   #profile.addTreeConf("soc-extras","/dsk/l1/django/django-cms/slsoc"       ,"-rptgoDLvuHK",ExclTrac)
   #profile.addTreeConf("automics"  ,"/dsk/l1/django/django-cms/automics"    ,"-rptgoDLvuHK",ExclTrac)
    profile.addTreeConf("jpc"       ,"/dsk/l1/backup/jpc.20180707"           ,"-auvhH"      ,[])
   #profile.postScript = \
   #  """chgrp -R apache /dsk/l1/django/django-cms/slsoc/db"""             \
   #  """                /dsk/l1/django/django-cms/slsoc/media"""          \
   #  """                /dsk/l1/django/django-cms/slsoc/smedia"""         \
   #  """                /dsk/l1/django/django-cms/slsoc/slsoc.index"""    \
   #  """                /dsk/l1/django/django-cms/automics/db"""          \
   #  """                /dsk/l1/django/django-cms/automics/media"""       \
   #  """                /dsk/l1/django/django-cms/automics/smedia"""      \
   #  """                /dsk/l1/django/django-cms/automics/automics.index;"""

profile = rsync.add("melon", "melon.soc.lip6.fr", 0, None)
profile.addTreeConf("sl"       ,"/dsk/l2/distributions/sl"       ,"-rptgoDLvuHK",ExclCommons)
profile.addTreeConf("al"       ,"/dsk/l2/distributions/al"       ,"-rptgoDLvuHK",ExclCommons)
profile.addTreeConf("epel"     ,"/dsk/l2/distributions/epel"     ,"-auvhH"      ,ExclCommons)
profile.addTreeConf("centos"   ,"/dsk/l2/distributions/centos"   ,"-auvhH"      ,ExclCommons)
profile.addTreeConf("rpmfusion","/dsk/l2/distributions/rpmfusion","-auvhH"      ,ExclCommons)
profile.addTreeConf("soc"      ,"/dsk/l2/distributions/soc"      ,"-auvhH"      ,ExclCommons)
profile.addTreeConf("adm"      ,"/dsk/l2/adm"                    ,"-auvhH"      ,ExclAdm)

profile = rsync.add("melon.tunnel", "melon-t", 0, None)
profile.addTreeConf("sl"       ,"/dsk/l2/distributions/sl"       ,"-rptgoDLvuHK",ExclCommons)
profile.addTreeConf("al"       ,"/dsk/l2/distributions/al"       ,"-rptgoDLvuHK",ExclCommons)
profile.addTreeConf("epel"     ,"/dsk/l2/distributions/epel"     ,"-auvhH"      ,ExclCommons)
profile.addTreeConf("centos"   ,"/dsk/l2/distributions/centos"   ,"-auvhH"      ,ExclCommons)
profile.addTreeConf("rpmfusion","/dsk/l2/distributions/rpmfusion","-auvhH"      ,ExclCommons)
profile.addTreeConf("soc"      ,"/dsk/l2/distributions/soc"      ,"-auvhH"      ,ExclCommons)
profile.addTreeConf("adm"      ,"/dsk/l2/adm"                    ,"-auvhH"      ,ExclAdm)

lepkaAliases = \
    [ { "host":"shadock.wifi"  , "fqdn":"shadock-wifi.soc.lip6.fr", "flags":0, "sshArgs":None }
    , { "host":"lepka"         , "fqdn":       "goulp.soc.lip6.fr", "flags":0, "sshArgs":None }
    , { "host":"shadock"       , "fqdn":     "shadock.soc.lip6.fr", "flags":0, "sshArgs":None }
    , { "host":"goulp"         , "fqdn":       "goulp.soc.lip6.fr", "flags":0, "sshArgs":None }
    , { "host":"goulp.wifi"    , "fqdn":  "goulp-wifi.soc.lip6.fr", "flags":0, "sshArgs":None }
    , { "host":"shadock.orkand", "fqdn":  "meseriphine.dyndns.org", "flags":0, "sshArgs":"-p 2206" }
    , { "host":"shadock.tunnel", "fqdn":               "shadock-t", "flags":0, "sshArgs":None }
    ]

# /run/media/jpc/SanDisk_JPC/ on old lepka (Dell XPS 13).
for alias in lepkaAliases:
    profile = rsync.add(alias["host"],alias["fqdn"],alias["flags"],alias["sshArgs"])
    profile.addTreeConf("sl"    ,"/dsk/l1/distributions/sl"    ,"-rptgoDLvuHK",ExclCommons)
    profile.addTreeConf("al"    ,"/dsk/l1/distributions/al"    ,"-rptgoDLvuHK",ExclCommons)
    profile.addTreeConf("epel"  ,"/dsk/l1/distributions/epel"  ,"-auvhH"      ,ExclCommons)
    profile.addTreeConf("centos","/dsk/l1/distributions/centos","-auvhH"      ,ExclCommons)
    profile.addTreeConf("soc"   ,"/dsk/l1/distributions/soc"   ,"-auvhH"      ,ExclCommons)
    profile.addTreeConf("adm"   ,"/dsk/l1/adm"                 ,"-auvhH"      ,ExclAdm)
    profile.addTreeConf("jpc"   ,"/dsk/l1/backup/jpc.20180707" ,"-auvhH"      ,[])

profile = rsync.add("bip", "bip.soc.lip6.fr", 0, None)
profile.addTreeConf("sl"       ,"/dsk/l1/distributions/sl"       ,"-rptgoDLvuHK",ExclCommons)
profile.addTreeConf("al"       ,"/dsk/l1/distributions/al"       ,"-rptgoDLvuHK",ExclCommons)
profile.addTreeConf("epel"     ,"/dsk/l1/distributions/epel"     ,"-auvhH"      ,ExclCommons)
profile.addTreeConf("centos"   ,"/dsk/l1/distributions/centos"   ,"-auvhH"      ,ExclCommons)
profile.addTreeConf("rpmfusion","/dsk/l1/distributions/rpmfusion","-auvhH"      ,ExclCommons)
profile.addTreeConf("soc"      ,"/dsk/l1/distributions/soc"      ,"-auvhH"      ,ExclCommons)
profile.addTreeConf("adm"      ,"/dsk/l1/adm"                    ,"-auvhH"      ,ExclAdm)

profile = rsync.add("bop", "bop.soc.lip6.fr", 0, None)
profile.addTreeConf("sl"       ,"/dsk/l1/distributions/sl"       ,"-rptgoDLvuHK",ExclCommons)
profile.addTreeConf("al"       ,"/dsk/l1/distributions/al"       ,"-rptgoDLvuHK",ExclCommons)
profile.addTreeConf("epel"     ,"/dsk/l1/distributions/epel"     ,"-auvhH"      ,ExclCommons)
profile.addTreeConf("centos"   ,"/dsk/l1/distributions/centos"   ,"-auvhH"      ,ExclCommons)
profile.addTreeConf("rpmfusion","/dsk/l1/distributions/rpmfusion","-auvhH"      ,ExclCommons)
profile.addTreeConf("soc"      ,"/dsk/l1/distributions/soc"      ,"-auvhH"      ,ExclCommons)
profile.addTreeConf("adm"      ,"/dsk/l1/adm"                    ,"-auvhH"      ,ExclAdm)

profile = rsync.add("folk", "folk.soc.lip6.fr", 0, None)
profile.addTreeConf("sl"       ,"/dsk/l2/distributions/sl"       ,"-rptgoDLvuHK",ExclCommons)
profile.addTreeConf("al"       ,"/dsk/l2/distributions/al"       ,"-rptgoDLvuHK",ExclCommons)
profile.addTreeConf("epel"     ,"/dsk/l2/distributions/epel"     ,"-auvhH"      ,ExclCommons)
profile.addTreeConf("centos"   ,"/dsk/l2/distributions/centos"   ,"-auvhH"      ,ExclCommons)
profile.addTreeConf("rpmfusion","/dsk/l2/distributions/rpmfusion","-auvhH"      ,ExclCommons)
profile.addTreeConf("soc"      ,"/dsk/l2/distributions/soc"      ,"-auvhH"      ,ExclCommons)
profile.addTreeConf("adm"      ,"/dsk/l2/adm"                    ,"-auvhH"      ,ExclAdm)

profile = rsync.add("sl6-64", "sl6-64.soc.lip6.fr")
profile.addTreeConf("sl"        ,"/dsk/l2/distributions/sl"            ,"-auvHK",ExclCommons)
profile.addTreeConf("al"        ,"/dsk/l2/distributions/al"            ,"-auvHK",ExclCommons)
profile.addTreeConf("epel"      ,"/dsk/l2/distributions/epel"          ,"-auvhH",ExclCommons)
#profile.addTreeConf("elrepo"    ,"/dsk/l2/distributions/slsoc/elrepo"  ,"-auvhH",ExclCommons)
#profile.addTreeConf("vendors"   ,"/dsk/l2/distributions/slsoc/vendors" ,"-auvhH",ExclCommons)
profile.addTreeConf("soc"       ,"/dsk/l2/distributions/soc"           ,"-auvhH",ExclCommons)
profile.addTreeConf("adm"       ,"/dsk/l2/adm"                         ,"-auvhH",ExclAdm)
# Post-script syntax example.
#profile.postScript = \
#    """export directory=/usr              \n""" \
#    """echo "dir=<$directory>"            \n""" \
#    """if [ "$directory" = "/usr" ]; then \n""" \
#    """  echo "Test OK"                   \n""" \
#    """  ls ${directory} /opt             \n""" \
#    """fi \n"""

# For adm.
#profile = rsync.add("jazz", "jazz.soc.lip6.fr", 0, '-l jpc')
# For SL
profile = rsync.add("jazz", "jazz.soc.lip6.fr", 0, '-l jpc')
profile.addTreeConf("sl"        ,"/users/jazz1/linux/sl"                     ,"-auvHK",ExclCommons+ExclSrpms)
profile.addTreeConf("al"        ,"/users/jazz1/linux/al"                     ,"-auvHK",ExclCommons+ExclSrpms)
profile.addTreeConf("epel"      ,"/users/jazz1/linux/epel"                   ,"-auvhH",ExclCommons+ExclSrpms)
profile.addTreeConf("centos"    ,"/users/jazz1/linux/centos"                 ,"-auvhH",ExclCommons+ExclSrpms)
#profile.addTreeConf("elrepo"    ,"/users/jazz1/linux/slsoc/elrepo"           ,"-auvhH",ExclCommons)
#profile.addTreeConf("vendors"   ,"/users/jazz1/linux/slsoc/vendors"          ,"-auvhH",ExclCommons)
profile.addTreeConf("soc"       ,"/users/jazz1/linux/soc"                    ,"-auvhH",ExclCommons+ExclRpmbuild)
profile.addTreeConf("adm"       ,"/home/backup/melon/dsk/l1/adm"             ,"-auvhH",ExclAdm)
#profile.postScript = \
#    """export  distribDir=/users/jazz1/linux/slsoc/6x \n""" \
#    """export tftpbootDir=/home/tftpboot \n"""              \
#    """cp $distribDir/i386/os/images/pxeboot/vmlinuz   $tftpbootDir/vmlinuz-slsoc6x-i386 \n"""      \
#    """cp $distribDir/i386/os/images/pxeboot/initrd    $tftpbootDir/initrd-slsoc6x-i386.img \n"""   \
#    """cp $distribDir/x86_64/os/images/pxeboot/vmlinuz $tftpbootDir/vmlinuz-slsoc6x-x86_64 \n"""    \
#    """cp $distribDir/x86_64/os/images/pxeboot/initrd  $tftpbootDir/initrd-slsoc6x-x86_64.img \n""" \
#profile.postScript = \
#    """cp /users/jazz1/linux/slsoc/6x/i386/os/images/pxeboot/vmlinuz       /home/tftpboot/vmlinuz-slsoc6x-i386 ;"""      \
#    """cp /users/jazz1/linux/slsoc/6x/i386/os/images/pxeboot/initrd.img    /home/tftpboot/initrd-slsoc6x-i386.img ;"""   \
#    """cp /users/jazz1/linux/slsoc/6x/x86_64/os/images/pxeboot/vmlinuz     /home/tftpboot/vmlinuz-slsoc6x-x86_64 ;"""    \
#    """cp /users/jazz1/linux/slsoc/6x/x86_64/os/images/pxeboot/initrd.img  /home/tftpboot/initrd-slsoc6x-x86_64.img ;""" \

profile = rsync.add("ftp", "ftp.lip6.fr", 0, "-l sclinux")
#profile.addTreeConf("sl"     ,"/home/ftp/pub/linux/distributions/slsoc/6x" ,"-auvHK",ExclCommons)
profile.addTreeConf("soc"    ,"/home/ftp/pub/linux/distributions/slsoc/soc","-auvhH",ExclCommons+ExclVendors)
#
#profile = rsync.add("netadmin", "netadmin.lip6.fr",0,"-l jpc")
#profile.addTreeConf("slsoc6x","/home/trac/slsoc6x","-auvHK",ExclTrac)
#
#profile = rsync.add("asim", "asim.lip6.fr",0,"-l root")
#profile.addTreeConf("vlsi-cad"  ,"/users/largo2/trac/vlsi-cad"                        ,"-auvHK",ExclTrac)
#profile.addTreeConf("soc-extras","/users/largo2/webmastr/soc-extras/django-cms/slsoc" ,"-auvHK",ExclTrac)
#profile.addTreeConf("automics"  ,"/users/largo2/webmastr/automics/django-cms/automics","-auvHK",ExclTrac)
#profile.postScript = \
#    """chgrp -R www /users/largo2/webmastr/soc-extras/django-cms/slsoc/db"""          \
#    """             /users/largo2/webmastr/soc-extras/django-cms/slsoc/media"""       \
#    """             /users/largo2/webmastr/soc-extras/django-cms/slsoc/smedia"""      \
#    """             /users/largo2/webmastr/soc-extras/django-cms/slsoc/slsoc.index""" \
#    """             /users/largo2/webmastr/automics/django-cms/automics/db"""         \
#    """             /users/largo2/webmastr/automics/django-cms/automics/media"""      \
#    """             /users/largo2/webmastr/automics/django-cms/automics/smedia"""     \
#    """             /users/largo2/webmastr/automics/django-cms/automics/automics.index;"""
#
profile = rsync.add("cloudbox", "lepka")
profile.addTreeConf("sl"    ,"/media/cloudbox/socadmin/distributions/sl"              ,"-rptgoDLvuHK",ExclCommons)
profile.addTreeConf("al"    ,"/media/cloudbox/socadmin/distributions/al"              ,"-rptgoDLvuHK",ExclCommons)
profile.addTreeConf("epel"  ,"/media/cloudbox/socadmin/distributions/epel"            ,"-auvhH"      ,ExclCommons)
profile.addTreeConf("centos","/media/cloudbox/socadmin/distributions/centos"          ,"-auvhH"      ,ExclCommons)
profile.addTreeConf("soc"   ,"/media/cloudbox/socadmin/distributions/soc"             ,"-auvhH"      ,ExclCommons)

#profile = rsync.add("backup","localhost.localdomain",0,"-p 2222")
#profile.addTreeConf("jpc","/dsk/l1/jpc.20180707","-auvhH",[])
#profile.addTreeConf("adm","/dsk/l1/adm"         ,"-auvhH",ExclAdm)
#profile.addTreeConf("epel","/dsk/l1/distributions/epel","-auvhH",ExclCommons)
