1
0

」 feat: finished borg backup

This commit is contained in:
2025-03-03 21:16:45 +01:00
parent 25ec0ebb31
commit 57387462cf
6 changed files with 49 additions and 31 deletions

View File

@ -1,16 +1,16 @@
package main
import (
"bufio"
"fmt"
"log"
"os"
"os/exec"
"bufio"
"slices"
"git.keyzox.me/42_adjoly/inception/internal/cmd"
"git.keyzox.me/42_adjoly/inception/internal/env"
_log "git.keyzox.me/42_adjoly/inception/internal/log"
"git.keyzox.me/42_adjoly/inception/internal/pass"
)
func overrideCronFile(filePath string, jobs []string) error {
@ -70,13 +70,13 @@ func main() {
_log.Log("error", "No passphrase specified, exiting...")
}
err = cmd.ExecCmd([]string{"borg", "init", "--encryption=" + passphrase, repo})
err = cmd.ExecCmd([]string{"borg", "init", "--encryption=repokey-blake2", repo}, slices.Insert(os.Environ(), len(os.Environ()), "BORG_PASSPHRASE="+passphrase))
if err != nil {
log.Fatal(err)
}
}
interval := env.EnvCheck("CRON_INTERVAL", "0 0 * * *")
interval := env.EnvCheck("CRON_INTERVAL", "0 2 * * *")
cronFilePath := "/etc/crontabs/root"
newJobs := []string{
"# Borg Backup Cron Job",

View File

@ -0,0 +1,16 @@
package main
import (
"fmt"
"git.keyzox.me/42_adjoly/inception/internal/env"
_log "git.keyzox.me/42_adjoly/inception/internal/log"
)
func main(){
pass := env.FileEnv("BORG_PASSPHRASE", "")
if pass == "" {
_log.Log("error", "Could not found passphrase")
}
fmt.Print(pass)
}