2024-08-16 17:40:24 +02:00
|
|
|
import config/init
|
|
|
|
import config/args
|
|
|
|
import borg/borg
|
2024-08-23 10:50:53 +02:00
|
|
|
import restic/restic
|
|
|
|
import model/encryption_type
|
|
|
|
import utils/actions
|
2024-08-16 17:40:24 +02:00
|
|
|
|
|
|
|
proc start() =
|
|
|
|
parseArgs()
|
|
|
|
norg_config = parseConfigFile(norg_args.config_file)
|
|
|
|
norg_config.args = norg_args
|
2024-08-18 19:45:37 +02:00
|
|
|
if norg_config.source_directories.len > 0 and norg_config.repositories.len > 0:
|
2024-08-23 10:50:53 +02:00
|
|
|
run_actions(norg_config.actions.before_everything)
|
|
|
|
for repo in norg_config.repositories:
|
|
|
|
run_actions(norg_config.actions.before_actions)
|
|
|
|
case repo.tool
|
|
|
|
of BORG:
|
|
|
|
borg.execute(norg_config, repo)
|
|
|
|
of RESTIC:
|
|
|
|
restic.execute(norg_config, repo)
|
|
|
|
run_actions(norg_config.actions.after_actions)
|
|
|
|
run_actions(norg_config.actions.after_everything)
|
|
|
|
delEncryptionPassphraseInfo()
|
2024-08-16 17:40:24 +02:00
|
|
|
|
|
|
|
when isMainModule:
|
|
|
|
start()
|