mirror of https://github.com/micromata/borgbackup-butler.git

Kai Reinhard
21.06.2019 07cb4a3032390625fcec9ade81c606c7c1dee5cc
borg init added.
1 files modified
25 ■■■■■ changed files
borgbutler-core/src/main/java/de/micromata/borgbutler/BorgCommands.java 25 ●●●●● patch | view | raw | blame | history
borgbutler-core/src/main/java/de/micromata/borgbutler/BorgCommands.java
@@ -61,6 +61,31 @@
    }
    /**
     * Executes borg init repository.
     *
     * @param repoConfig The configuration of the repo config (only repo is required).
     * @param encryption The encryption value (repokey, repokey-blake2, none, ...).
     * @return true, if no errors occured, otherwise false.
     */
    public static boolean init(BorgRepoConfig repoConfig, String encryption) {
        BorgCommand command = new BorgCommand()
                .setRepoConfig(repoConfig)
                .setCommand("init")
                //.setParams("--json") // --progress has no effect.
                .setDescription("Init new repo '" + repoConfig.getDisplayName() + "'.");
        JobResult<String> jobResult = getResult(command);
        String result = jobResult != null ? jobResult.getResultObject() : null;
        // If everything is ok, now String will be returned, result must be blank:
        if (jobResult == null || jobResult.getStatus() != JobResult.Status.OK || StringUtils.isNotBlank(result)) {
            log.error("Error while trying to intialize repo '" + repoConfig.getRepo() + "': " + result);
            return false;
        }
        log.error("Error while trying to intialize repo '" + repoConfig.getRepo() + "': " + result);
        return false;
    }
    /**
     * Executes borg info repository.
     *
     * @param repoConfig