summaryrefslogtreecommitdiffstats
path: root/sync.py
blob: c298da94f7fd6dd8bbc98dcf6b322a1a0b4f50af (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
#!/usr/bin/env python
from confman import ConfigSource
import sync_options as options

from os import path
base_path = path.join(path.dirname(__file__), '..')

def privpub(dir):
    return [path.join("private", dir), path.join("public", dir)]

dirs = privpub("base")
if "desktop" in options.tags and not options.is_root:
    dirs += privpub("desktop")

for dir in dirs:
    base_dir = path.normpath(path.join(base_path, dir))
    print base_dir + " => " + "~"

    ConfigSource(base_dir, "~", None, options).sync()

# FIXME remove the "desktop" condition when possible
if options.is_root and options.is_gentoo and "desktop" in options.tags:
    dirs = privpub("gentoo")

    for dir in dirs:
        base_dir = path.normpath(path.join(base_path, dir))
        print base_dir + " => " + "/etc"

        c = ConfigSource(base_dir, "/etc", None, options).sync()