func (runner *Runner) encryptTmpFiles(backupFilePath string, tmpFiles []string) (output []byte, err error) { if len(tmpFiles) == 0 { return []byte{}, errors.New("No files to encrypt") } // cmd := fmt.Sprintf( // "tar -cf - -C %s %s | %s > %s", // runner.tmpDirPath(), // strings.Join(tmpFiles, " "), // EncryptCmd((*runner.secretConfig)["encryption"]["pass"]), // backupFilePath, // ) hmutil.PackAndCompress( runner.tmpDirPath(), tmpFiles, []string{}, backupFilePath+".tar.gz", []byte((*runner.secretConfig)["encryption"]["pass"]), true, ) return []byte{}, nil //return hmutil.System(cmd) }
func (localTask *backupLocalTask) GenerateTmpFile(tmpFilePath string) (output []byte, err error) { file, err := os.Open(localTask.sourcePath()) if err == nil { err = file.Close() } if err != nil { return } // cmd := fmt.Sprintf( // "tar -cf - %s -C %s %s >%s", // localTask.compressionFlag(), // localTask.pathParentDir, // localTask.pathBaseName, // tmpFilePath, // ) // return hmutil.System(cmd) err = hmutil.PackAndCompress( localTask.pathParentDir, []string{localTask.pathBaseName}, localTask.excludePath(), tmpFilePath, []byte{}, false, ) return []byte{}, err }