diff --git a/archrepo.ini b/archrepo.ini index 3489200..e75e060 100644 --- a/archrepo.ini +++ b/archrepo.ini @@ -1,3 +1,11 @@ +[multi] +# Names of repository config sections, if you have multiple repositories. +# The names should be delimited by commas. And this value is default to +# "repository". +# config names are the same as below, and will act as default if not specified +# in that repository config. +repos: repository + [repository] # Name of the repository. In below example the Pacman repository db file name # will be archlinuxcn.db.tar.gz diff --git a/archreposrv b/archreposrv index 28202d0..ee2a4a5 100755 --- a/archreposrv +++ b/archreposrv @@ -13,17 +13,20 @@ enable_pretty_logging(logging.DEBUG) from repomon import repomon def main(conffile): - config = configparser.ConfigParser() + config = configparser.ConfigParser(default_section='multi') config.read(conffile) - notifier = repomon(config['repository']) + repos = config['multi'].get('repos', 'repository') + repos = [repo.strip() for repo in repos.split(',')] + notifiers = [repomon(config[repo]) for repo in repos] ioloop = IOLoop.instance() try: ioloop.start() except KeyboardInterrupt: ioloop.close() - notifier.stop() + for notifier in notifiers: + notifier.stop() if __name__ == '__main__': main(sys.argv[1])