22 Commits

Author SHA1 Message Date
febc2680f4 Update docs
Some checks failed
ci/woodpecker/push/go-lint Pipeline failed
ci/woodpecker/push/publish-docs Pipeline was successful
2025-11-17 16:46:54 -06:00
caf2397349 Update docs
Some checks failed
ci/woodpecker/push/go-lint Pipeline failed
ci/woodpecker/push/publish-docs Pipeline failed
2025-11-17 16:27:33 -06:00
172ca8712e Update docs
Some checks failed
ci/woodpecker/push/go-lint Pipeline failed
ci/woodpecker/push/publish-docs Pipeline failed
2025-11-17 16:12:02 -06:00
bda16bcbb5 Update docs
Some checks failed
ci/woodpecker/push/go-lint Pipeline failed
2025-11-17 16:08:42 -06:00
b5d069112f Update docs
Some checks failed
ci/woodpecker/push/go-lint Pipeline failed
ci/woodpecker/push/publish-docs Pipeline failed
2025-11-17 15:56:28 -06:00
f56393c84c fix small things 2025-11-17 15:55:51 -06:00
55ef8e1733 Update docs
Some checks failed
ci/woodpecker/push/go-lint Pipeline failed
2025-11-17 15:43:47 -06:00
075fc16ec9 Update docs
Some checks failed
ci/woodpecker/push/go-lint Pipeline failed
ci/woodpecker/push/publish-docs Pipeline failed
2025-11-15 22:54:02 -06:00
0d6a13c1cf Cmd Type script now correctly appends arguments
Some checks failed
ci/woodpecker/push/go-lint Pipeline failed
ci/woodpecker/push/publish-docs Pipeline was successful
2025-11-15 17:37:17 -06:00
e57939f858 add files
Some checks failed
ci/woodpecker/push/go-lint Pipeline failed
2025-10-21 23:19:00 -05:00
d45b1562fc started refactoring into executors using interfaces 2025-09-07 20:44:48 -05:00
7fe07f86a9 CLI: added exec hosts subcommand list 2025-07-23 22:05:44 -05:00
14c81a00a7 CLI: added exec hosts subcommand list 2025-07-23 22:04:48 -05:00
3eced64453 CLI: Exec subcommand host 2025-07-15 20:24:30 -05:00
c284d928fd CLI: Exec subcommand host 2025-07-15 20:24:06 -05:00
dd9da9452b CLI: Exec subcommand host 2025-07-15 20:23:58 -05:00
11d5121954 update deps 2025-07-14 20:48:53 -05:00
66d622b474 Improved error message for remote version package output 2025-07-09 23:21:46 -05:00
47b2aabd9f Improved error message for remote version package output 2025-07-09 23:20:11 -05:00
b91cf18b04 change file 2025-07-04 10:22:37 -05:00
305b504ca1 tests: beginning of tests using Docker 2025-07-04 09:02:27 -05:00
7be2679b91 change: Commands: host can now be localhost or 127.0.0.1 to run commands locally
All checks were successful
ci/woodpecker/push/go-lint Pipeline was successful
2025-03-21 09:09:56 -05:00
152 changed files with 2193 additions and 727 deletions

0
.changes/0.2.4.md Normal file → Executable file
View File

0
.changes/header.tpl.md Normal file → Executable file
View File

0
.changes/unreleased/.gitkeep Normal file → Executable file
View File

View File

@@ -0,0 +1,3 @@
kind: Added
body: 'feat: Package operation `versionCheck` supports regular expressions (see [regexp](https://pkg.go.dev/regexp) package for docs)'
time: 2025-04-09T17:45:28.836497149-05:00

View File

@@ -0,0 +1,3 @@
kind: Added
body: 'Command lists: added `cmdLists.[name].notify` object'
time: 2025-05-01T11:07:45.96164753-05:00

View File

@@ -0,0 +1,3 @@
kind: Added
body: Testing setup with Docker
time: 2025-07-04T08:59:17.430373451-05:00

View File

@@ -0,0 +1,3 @@
kind: Added
body: 'CLI: add global flag --hostsConfig that allows hosts to be dynamic in relation to the main config'
time: 2025-07-04T10:21:26.864635558-05:00

View File

@@ -0,0 +1,3 @@
kind: Added
body: 'CLI: Exec subcommand `hosts`. See documentation for more details.'
time: 2025-07-15T20:23:03.647128713-05:00

View File

@@ -0,0 +1,3 @@
kind: Added
body: 'CLI: added `exec hosts` subcommand `list`'
time: 2025-07-23T22:03:40.24191927-05:00

View File

@@ -0,0 +1,3 @@
kind: Changed
body: 'Commands: `host` can now be `localhost` or `127.0.0.1` to run commands locally'
time: 2025-03-21T09:08:49.871021144-05:00

View File

@@ -0,0 +1,3 @@
kind: Changed
body: lists loaded from external files only if no list config present in current file
time: 2025-03-25T00:33:57.039431409-05:00

View File

@@ -0,0 +1,3 @@
kind: Changed
body: "`PackageManager.Parse` renamed to `ParseRemotePackageManagerVersionOutput`. This now returns arrays of PackageManagerCommon.Package and errors."
time: 2025-04-07T22:30:20.342177323-05:00

View File

@@ -0,0 +1,3 @@
kind: Changed
body: 'Internal: refactoring and renaming functions'
time: 2025-04-18T13:34:40.842541658-05:00

View File

@@ -0,0 +1,3 @@
kind: Changed
body: 'Commands: moved output-prefixed keys to the `commands.[name].output` object'
time: 2025-05-01T11:05:34.90130087-05:00

View File

@@ -0,0 +1,3 @@
kind: Changed
body: Change internal method name for better understanding
time: 2025-06-09T07:26:01.819927627-05:00

View File

@@ -0,0 +1,3 @@
kind: Changed
body: Improved error message for remote version package output
time: 2025-07-09T23:19:19.431960446-05:00

View File

@@ -0,0 +1,3 @@
kind: Fixed
body: 'Command Lists: hooks now run correctly when commands finish'
time: 2025-04-18T09:57:47.39035092-05:00

View File

@@ -0,0 +1,3 @@
kind: Fixed
body: Log file passed using `--log-file` correctly used
time: 2025-04-24T22:57:11.592829277-05:00

View File

@@ -0,0 +1,3 @@
kind: Fixed
body: Cmd Type `script` now correctly appends arguments
time: 2025-11-15T17:32:06.86128885-06:00

0
.changes/v0.10.0.md Normal file → Executable file
View File

0
.changes/v0.10.1.md Normal file → Executable file
View File

0
.changes/v0.10.2.md Normal file → Executable file
View File

0
.changes/v0.3.0.md Normal file → Executable file
View File

0
.changes/v0.3.1.md Normal file → Executable file
View File

0
.changes/v0.4.0.md Normal file → Executable file
View File

0
.changes/v0.5.0.md Normal file → Executable file
View File

0
.changes/v0.6.0.md Normal file → Executable file
View File

0
.changes/v0.6.1.md Normal file → Executable file
View File

0
.changes/v0.7.0.md Normal file → Executable file
View File

0
.changes/v0.7.1.md Normal file → Executable file
View File

0
.changes/v0.7.2.md Normal file → Executable file
View File

0
.changes/v0.7.3.md Normal file → Executable file
View File

0
.changes/v0.7.4.md Normal file → Executable file
View File

0
.changes/v0.7.5.md Normal file → Executable file
View File

0
.changes/v0.7.6.md Normal file → Executable file
View File

0
.changes/v0.7.7.md Normal file → Executable file
View File

0
.changes/v0.7.8.md Normal file → Executable file
View File

0
.changes/v0.8.0.md Normal file → Executable file
View File

0
.changes/v0.9.0.md Normal file → Executable file
View File

0
.changes/v0.9.1.md Normal file → Executable file
View File

0
.changie.yaml Normal file → Executable file
View File

0
.frontmatter/database/mediaDb.json Normal file → Executable file
View File

0
.frontmatter/database/taxonomyDb.json Normal file → Executable file
View File

0
.github/workflows/release.yml vendored Normal file → Executable file
View File

2
.gitignore vendored Normal file → Executable file
View File

@@ -5,6 +5,6 @@ dist/
.codegpt .codegpt
*.log *.log
*.sh /*.sh
/*.yaml /*.yaml
/*.yml /*.yml

0
.gitmodules vendored Normal file → Executable file
View File

0
.goreleaser/gitea.yml Normal file → Executable file
View File

0
.goreleaser/github.yml Normal file → Executable file
View File

0
.goreleaser/vern.yml Normal file → Executable file
View File

3
.vscode/settings.json vendored Normal file → Executable file
View File

@@ -9,5 +9,6 @@
"mautrix", "mautrix",
"nikoksr", "nikoksr",
"Strs" "Strs"
] ],
"CodeGPT.apiKey": "CodeGPT Plus Beta"
} }

0
.woodpecker/gitea.yml Normal file → Executable file
View File

0
.woodpecker/go-lint.yml Normal file → Executable file
View File

4
.woodpecker/publish-docs.yml Normal file → Executable file
View File

@@ -1,11 +1,11 @@
steps: steps:
build: build:
image: hugomods/hugo:ci image: hugomods/hugo:debian-ci-0.147.2
commands: commands:
- git submodule foreach 'git fetch origin; git checkout $(git describe --tags `git rev-list --tags --max-count=1`);' - git submodule foreach 'git fetch origin; git checkout $(git describe --tags `git rev-list --tags --max-count=1`);'
- cd docs - cd docs
- hugo mod get -u github.com/divinerites/plausible-hugo - hugo mod get -u github.com/divinerites/plausible-hugo
- hugo mod get -u github.com/McShelby/hugo-theme-relearn@7.3.1 - hugo mod get -u github.com/McShelby/hugo-theme-relearn@8.2.0
- hugo - hugo
deploy: deploy:

0
CHANGELOG.md Normal file → Executable file
View File

0
License Normal file → Executable file
View File

0
README.md Normal file → Executable file
View File

1
backy.code-workspace Normal file → Executable file
View File

@@ -18,6 +18,7 @@
"maunium", "maunium",
"mautrix", "mautrix",
"nikoksr", "nikoksr",
"packagemanagercommon",
"rawbytes", "rawbytes",
"remotefetcher", "remotefetcher",
"Strs" "Strs"

0
backy.go Normal file → Executable file
View File

0
cmd/.gitignore vendored Normal file → Executable file
View File

9
cmd/backup.go Normal file → Executable file
View File

@@ -30,9 +30,14 @@ func init() {
} }
func Backup(cmd *cobra.Command, args []string) { func Backup(cmd *cobra.Command, args []string) {
backyConfOpts := backy.NewOpts(cfgFile, backy.AddCommandLists(cmdLists), backy.SetLogFile(logFile), backy.SetCmdStdOut(cmdStdOut)) backyConfOpts := backy.NewConfigOptions(configFile,
backy.AddCommandLists(cmdLists),
backy.SetLogFile(logFile),
backy.EnableCommandStdOut(cmdStdOut),
backy.SetHostsConfigFile(hostsConfigFile))
backyConfOpts.InitConfig() backyConfOpts.InitConfig()
backyConfOpts.ReadConfig() backyConfOpts.ParseConfigurationFile()
backyConfOpts.RunListConfig("") backyConfOpts.RunListConfig("")
for _, host := range backyConfOpts.Hosts { for _, host := range backyConfOpts.Hosts {

54
cmd/backup_test.go Executable file
View File

@@ -0,0 +1,54 @@
package cmd
// import (
// "bufio"
// "encoding/json"
// "os"
// "os/exec"
// "strings"
// "testing"
// "github.com/stretchr/testify/assert"
// )
// // TestConfigOptions tests the configuration options for the backy package.
// func Test_ErrorHook(t *testing.T) {
// configFile := "-f ../../tests/ErrorHook.yml"
// logFile := "--log-file=ErrorHook.log"
// backyCommand := exec.Command("go", "run", "../../backy.go", configFile, logFile, "backup")
// backyCommand.Stderr = os.Stdout
// backyCommand.Stdout = os.Stdout
// err := backyCommand.Run()
// assert.Nil(t, err)
// os.Remove("ErrorHook.log")
// logFileData, logFileErr := os.ReadFile("ErrorHook.log")
// if logFileErr != nil {
// assert.FailNow(t, logFileErr.Error())
// }
// var JsonData []map[string]interface{}
// jsonScanner := bufio.NewScanner(strings.NewReader(string(logFileData)))
// for jsonScanner.Scan() {
// var jsonDataLine map[string]interface{}
// err = json.Unmarshal(jsonScanner.Bytes(), &jsonDataLine)
// assert.Nil(t, err)
// JsonData = append(JsonData, jsonDataLine)
// }
// for _, v := range JsonData {
// _, ok := v["error"]
// if !ok {
// assert.FailNow(t, "error does not exist\n")
// // return
// }
// }
// // t.Logf("%s", logFileData)
// // t.Logf("%v", JsonData)
// }
// func TestBackupErrorHook(t *testing.T) {
// logFile = "ErrorHook.log"
// configFile = "../tests/ErrorHook.yml"
// }

2
cmd/config.go Normal file → Executable file
View File

@@ -20,7 +20,7 @@ package cmd
// func config(cmd *cobra.Command, args []string) { // func config(cmd *cobra.Command, args []string) {
// opts := backy.NewOpts(cfgFile, backy.cronEnabled()) // opts := backy.NewConfigOptions(configFile, backy.cronEnabled())
// opts.InitConfig() // opts.InitConfig()
// } // }

7
cmd/cron.go Normal file → Executable file
View File

@@ -18,13 +18,14 @@ var (
func cron(cmd *cobra.Command, args []string) { func cron(cmd *cobra.Command, args []string) {
parseS3Config() parseS3Config()
opts := backy.NewOpts(cfgFile, opts := backy.NewConfigOptions(configFile,
backy.EnableCron(), backy.EnableCron(),
backy.SetLogFile(logFile), backy.SetLogFile(logFile),
backy.SetCmdStdOut(cmdStdOut)) backy.EnableCommandStdOut(cmdStdOut),
backy.SetHostsConfigFile(hostsConfigFile))
opts.InitConfig() opts.InitConfig()
opts.ReadConfig() opts.ParseConfigurationFile()
opts.Cron() opts.Cron()
} }

10
cmd/exec.go Normal file → Executable file
View File

@@ -21,7 +21,7 @@ var (
) )
func init() { func init() {
execCmd.AddCommand(hostExecCommand) execCmd.AddCommand(hostExecCommand, hostsExecCommand)
} }
@@ -32,8 +32,12 @@ func execute(cmd *cobra.Command, args []string) {
logging.ExitWithMSG("Please provide a command to run. Pass --help to see options.", 1, nil) logging.ExitWithMSG("Please provide a command to run. Pass --help to see options.", 1, nil)
} }
opts := backy.NewOpts(cfgFile, backy.AddCommands(args), backy.SetLogFile(logFile), backy.SetCmdStdOut(cmdStdOut)) opts := backy.NewConfigOptions(configFile,
backy.AddCommands(args),
backy.SetLogFile(logFile),
backy.EnableCommandStdOut(cmdStdOut),
backy.SetHostsConfigFile(hostsConfigFile))
opts.InitConfig() opts.InitConfig()
opts.ReadConfig() opts.ParseConfigurationFile()
opts.ExecuteCmds() opts.ExecuteCmds()
} }

17
cmd/host.go Normal file → Executable file
View File

@@ -35,10 +35,13 @@ func init() {
// 2. stdin (on command line) (TODO) // 2. stdin (on command line) (TODO)
func Host(cmd *cobra.Command, args []string) { func Host(cmd *cobra.Command, args []string) {
backyConfOpts := backy.NewOpts(cfgFile, backy.SetLogFile(logFile), backy.SetCmdStdOut(cmdStdOut)) backyConfOpts := backy.NewConfigOptions(configFile,
backy.SetLogFile(logFile),
backy.EnableCommandStdOut(cmdStdOut),
backy.SetHostsConfigFile(hostsConfigFile))
backyConfOpts.InitConfig() backyConfOpts.InitConfig()
backyConfOpts.ReadConfig() backyConfOpts.ParseConfigurationFile()
// check CLI input // check CLI input
if hostsList == nil { if hostsList == nil {
@@ -46,14 +49,20 @@ func Host(cmd *cobra.Command, args []string) {
} }
for _, h := range hostsList { for _, h := range hostsList {
if backy.IsHostLocal(h) {
continue
}
// check if h exists in the config file // check if h exists in the config file
_, hostFound := backyConfOpts.Hosts[h] _, hostFound := backyConfOpts.Hosts[h]
if !hostFound { if !hostFound {
// check if h exists in the SSH config file // check if h exists in the SSH config file
hostFoundInConfig, s := backy.CheckIfHostHasHostName(h) hostFoundInConfig, s := backy.DoesHostHaveHostName(h)
if !hostFoundInConfig { if !hostFoundInConfig {
logging.ExitWithMSG("host "+h+" not found", 1, &backyConfOpts.Logger) logging.ExitWithMSG("host "+h+" not found", 1, &backyConfOpts.Logger)
} }
if backyConfOpts.Hosts == nil {
backyConfOpts.Hosts = make(map[string]*backy.Host)
}
// create host with hostname and host // create host with hostname and host
backyConfOpts.Hosts[h] = &backy.Host{Host: h, HostName: s} backyConfOpts.Hosts[h] = &backy.Host{Host: h, HostName: s}
} }
@@ -68,5 +77,5 @@ func Host(cmd *cobra.Command, args []string) {
} }
} }
backyConfOpts.ExecCmdsSSH(cmdList, hostsList) backyConfOpts.ExecCmdsOnHosts(cmdList, hostsList)
} }

93
cmd/hosts.go Executable file
View File

@@ -0,0 +1,93 @@
package cmd
import (
"maps"
"slices"
"git.andrewnw.xyz/CyberShell/backy/pkg/backy"
"git.andrewnw.xyz/CyberShell/backy/pkg/logging"
"github.com/spf13/cobra"
)
var (
runCommandsInParallel bool
hostsExecCommand = &cobra.Command{
Use: "hosts [--command=command1 --command=command2 ... | -c command1 -c command2 ...]",
Short: "Runs command defined in config file on the hosts in order specified.",
Long: "Hosts executes specified commands on all the hosts defined in config file.\nUse the --commands or -c flag to choose the commands.",
Run: Hosts,
}
hostsListExecCommand = &cobra.Command{
Use: "list list1 list2 ...",
Short: "Runs lists in order specified defined in config file on all hosts.",
Long: "Lists executes specified lists on all the hosts defined in hosts config.\nPass the names of lists as arguments after command.",
Run: HostsList,
}
)
func init() {
hostsExecCommand.AddCommand(hostsListExecCommand)
hostsListExecCommand.Flags().BoolVarP(&runCommandsInParallel, "parallel", "p", false, "Run commands in parallel on hosts")
parseS3Config()
}
// cli input should be hosts and commands. Hosts are defined in config files.
// commands can be passed by the following mutually exclusive options:
// 1. as a list of commands defined in the config file
// 2. stdin (on command line) (TODO)
func Hosts(cmd *cobra.Command, args []string) {
backyConfOpts := backy.NewConfigOptions(configFile,
backy.SetLogFile(logFile),
backy.EnableCommandStdOut(cmdStdOut),
backy.SetHostsConfigFile(hostsConfigFile))
backyConfOpts.InitConfig()
backyConfOpts.ParseConfigurationFile()
for _, h := range backyConfOpts.Hosts {
hostsList = append(hostsList, h.Host)
}
if cmdList == nil {
logging.ExitWithMSG("error: commands must be specified", 1, &backyConfOpts.Logger)
}
for _, c := range cmdList {
_, cmdFound := backyConfOpts.Cmds[c]
if !cmdFound {
logging.ExitWithMSG("cmd "+c+" not found", 1, &backyConfOpts.Logger)
}
}
backyConfOpts.ExecCmdsOnHosts(cmdList, hostsList)
}
func HostsList(cmd *cobra.Command, args []string) {
backyConfOpts := backy.NewConfigOptions(configFile,
backy.SetLogFile(logFile),
backy.EnableCommandStdOut(cmdStdOut),
backy.SetHostsConfigFile(hostsConfigFile))
backyConfOpts.InitConfig()
backyConfOpts.ParseConfigurationFile()
if len(args) == 0 {
logging.ExitWithMSG("error: no lists specified", 1, &backyConfOpts.Logger)
}
for _, l := range args {
_, listFound := backyConfOpts.CmdConfigLists[l]
if !listFound {
logging.ExitWithMSG("list "+l+" not found", 1, &backyConfOpts.Logger)
}
}
maps.DeleteFunc(backyConfOpts.CmdConfigLists, func(k string, v *backy.CmdList) bool {
return !slices.Contains(args, k)
})
backyConfOpts.ExecuteListOnHosts(args, runCommandsInParallel)
}

20
cmd/list.go Normal file → Executable file
View File

@@ -22,13 +22,13 @@ var (
Use: "cmds [cmd1 cmd2 cmd3...]", Use: "cmds [cmd1 cmd2 cmd3...]",
Short: "List commands defined in config file.", Short: "List commands defined in config file.",
Long: "List commands defined in config file", Long: "List commands defined in config file",
Run: ListCmds, Run: ListCommands,
} }
listCmdLists = &cobra.Command{ listCmdLists = &cobra.Command{
Use: "lists [list1 list2 ...]", Use: "lists [list1 list2 ...]",
Short: "List lists defined in config file.", Short: "List lists defined in config file.",
Long: "List lists defined in config file", Long: "List lists defined in config file",
Run: ListCmdLists, Run: ListCommandLists,
} }
) )
@@ -40,7 +40,7 @@ func init() {
} }
func ListCmds(cmd *cobra.Command, args []string) { func ListCommands(cmd *cobra.Command, args []string) {
// setup based on whats passed in: // setup based on whats passed in:
// - cmds // - cmds
@@ -54,17 +54,19 @@ func ListCmds(cmd *cobra.Command, args []string) {
parseS3Config() parseS3Config()
opts := backy.NewOpts(cfgFile, backy.SetLogFile(logFile)) opts := backy.NewConfigOptions(configFile,
backy.SetLogFile(logFile),
backy.SetHostsConfigFile(hostsConfigFile))
opts.InitConfig() opts.InitConfig()
opts.ReadConfig() opts.ParseConfigurationFile()
for _, v := range cmdsToList { for _, v := range cmdsToList {
opts.ListCommand(v) opts.ListCommand(v)
} }
} }
func ListCmdLists(cmd *cobra.Command, args []string) { func ListCommandLists(cmd *cobra.Command, args []string) {
parseS3Config() parseS3Config()
@@ -74,10 +76,12 @@ func ListCmdLists(cmd *cobra.Command, args []string) {
logging.ExitWithMSG("Error: lists subcommand needs lists", 1, nil) logging.ExitWithMSG("Error: lists subcommand needs lists", 1, nil)
} }
opts := backy.NewOpts(cfgFile, backy.SetLogFile(logFile)) opts := backy.NewConfigOptions(configFile,
backy.SetLogFile(logFile),
backy.SetHostsConfigFile(hostsConfigFile))
opts.InitConfig() opts.InitConfig()
opts.ReadConfig() opts.ParseConfigurationFile()
for _, v := range listsToList { for _, v := range listsToList {
opts.ListCommandList(v) opts.ListCommandList(v)

18
cmd/root.go Normal file → Executable file
View File

@@ -13,11 +13,12 @@ import (
var ( var (
// Used for flags. // Used for flags.
cfgFile string configFile string
verbose bool hostsConfigFile string
cmdStdOut bool verbose bool
logFile string cmdStdOut bool
s3Endpoint string logFile string
s3Endpoint string
rootCmd = &cobra.Command{ rootCmd = &cobra.Command{
Use: "backy", Use: "backy",
@@ -35,12 +36,13 @@ func Execute() {
} }
func init() { func init() {
rootCmd.PersistentFlags().StringVar(&logFile, "log-file", "", "log file to write to") rootCmd.PersistentFlags().StringVar(&logFile, "logFile", "", "log file to write to")
rootCmd.PersistentFlags().BoolVar(&cmdStdOut, "cmdStdOut", false, "Pass to print command output to stdout") rootCmd.PersistentFlags().BoolVar(&cmdStdOut, "cmdStdOut", false, "Pass to print command output to stdout")
rootCmd.PersistentFlags().StringVarP(&cfgFile, "config", "f", "", "config file to read from") rootCmd.PersistentFlags().StringVarP(&configFile, "config", "f", "", "config file to read from")
rootCmd.PersistentFlags().StringVar(&hostsConfigFile, "hostsConfig", "", "yaml hosts file to read from")
rootCmd.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, "Sets verbose level") rootCmd.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, "Sets verbose level")
rootCmd.PersistentFlags().StringVar(&s3Endpoint, "s3-endpoint", "", "Sets the S3 endpoint used for config file fetching. Overrides S3_ENDPOINT env variable.") rootCmd.PersistentFlags().StringVar(&s3Endpoint, "s3Endpoint", "", "Sets the S3 endpoint used for config file fetching. Overrides S3_ENDPOINT env variable.")
rootCmd.AddCommand(backupCmd, execCmd, cronCmd, versionCmd, listCmd) rootCmd.AddCommand(backupCmd, execCmd, cronCmd, versionCmd, listCmd)
} }

0
cmd/version.go Normal file → Executable file
View File

0
docs/.gitignore vendored Normal file → Executable file
View File

0
docs/.hugo_build.lock Normal file → Executable file
View File

0
docs/archetypes/default.md Normal file → Executable file
View File

1
docs/config.yaml Normal file → Executable file
View File

@@ -13,6 +13,7 @@ module:
imports: imports:
- path: github.com/divinerites/plausible-hugo - path: github.com/divinerites/plausible-hugo
- path: github.com/McShelby/hugo-theme-relearn - path: github.com/McShelby/hugo-theme-relearn
version: "v8.2.0"
params: params:
themeVariant: themeVariant:
- auto: [] - auto: []

0
docs/content/_index.md Normal file → Executable file
View File

View File

@@ -26,8 +26,9 @@ Flags:
--cmdStdOut Pass to print command output to stdout --cmdStdOut Pass to print command output to stdout
-f, --config string config file to read from -f, --config string config file to read from
-h, --help help for backy -h, --help help for backy
--log-file string log file to write to --hostsConfig string yaml hosts file to read from
--s3-endpoint string Sets the S3 endpoint used for config file fetching. Overrides S3_ENDPOINT env variable. --logFile string log file to write to
--s3Endpoint string Sets the S3 endpoint used for config file fetching. Overrides S3_ENDPOINT env variable.
-v, --verbose Sets verbose level -v, --verbose Sets verbose level
Use "backy [command] --help" for more information about a command. Use "backy [command] --help" for more information about a command.
@@ -51,8 +52,9 @@ Flags:
Global Flags: Global Flags:
--cmdStdOut Pass to print command output to stdout --cmdStdOut Pass to print command output to stdout
-f, --config string config file to read from -f, --config string config file to read from
--log-file string log file to write to --hostsConfig string yaml hosts file to read from
--s3-endpoint string Sets the S3 endpoint used for config file fetching. Overrides S3_ENDPOINT env variable. --logFile string log file to write to
--s3Endpoint string Sets the S3 endpoint used for config file fetching. Overrides S3_ENDPOINT env variable.
-v, --verbose Sets verbose level -v, --verbose Sets verbose level
``` ```
@@ -70,8 +72,9 @@ Flags:
Global Flags: Global Flags:
--cmdStdOut Pass to print command output to stdout --cmdStdOut Pass to print command output to stdout
-f, --config string config file to read from -f, --config string config file to read from
--log-file string log file to write to --hostsConfig string yaml hosts file to read from
--s3-endpoint string Sets the S3 endpoint used for config file fetching. Overrides S3_ENDPOINT env variable. --logFile string log file to write to
--s3Endpoint string Sets the S3 endpoint used for config file fetching. Overrides S3_ENDPOINT env variable.
-v, --verbose Sets verbose level -v, --verbose Sets verbose level
``` ```
@@ -86,6 +89,7 @@ Usage:
Available Commands: Available Commands:
host Runs command defined in config file on the hosts in order specified. host Runs command defined in config file on the hosts in order specified.
hosts Runs command defined in config file on the hosts in order specified.
Flags: Flags:
-h, --help help for exec -h, --help help for exec
@@ -93,8 +97,9 @@ Flags:
Global Flags: Global Flags:
--cmdStdOut Pass to print command output to stdout --cmdStdOut Pass to print command output to stdout
-f, --config string config file to read from -f, --config string config file to read from
--log-file string log file to write to --hostsConfig string yaml hosts file to read from
--s3-endpoint string Sets the S3 endpoint used for config file fetching. Overrides S3_ENDPOINT env variable. --logFile string log file to write to
--s3Endpoint string Sets the S3 endpoint used for config file fetching. Overrides S3_ENDPOINT env variable.
-v, --verbose Sets verbose level -v, --verbose Sets verbose level
Use "backy exec [command] --help" for more information about a command. Use "backy exec [command] --help" for more information about a command.
@@ -117,8 +122,9 @@ Flags:
Global Flags: Global Flags:
--cmdStdOut Pass to print command output to stdout --cmdStdOut Pass to print command output to stdout
-f, --config string config file to read from -f, --config string config file to read from
--log-file string log file to write to --hostsConfig string yaml hosts file to read from
--s3-endpoint string Sets the S3 endpoint used for config file fetching. Overrides S3_ENDPOINT env variable. --logFile string log file to write to
--s3Endpoint string Sets the S3 endpoint used for config file fetching. Overrides S3_ENDPOINT env variable.
-v, --verbose Sets verbose level -v, --verbose Sets verbose level
``` ```
@@ -138,8 +144,9 @@ Flags:
Global Flags: Global Flags:
--cmdStdOut Pass to print command output to stdout --cmdStdOut Pass to print command output to stdout
-f, --config string config file to read from -f, --config string config file to read from
--log-file string log file to write to --hostsConfig string yaml hosts file to read from
--s3-endpoint string Sets the S3 endpoint used for config file fetching. Overrides S3_ENDPOINT env variable. --logFile string log file to write to
--s3Endpoint string Sets the S3 endpoint used for config file fetching. Overrides S3_ENDPOINT env variable.
-v, --verbose Sets verbose level -v, --verbose Sets verbose level
``` ```
@@ -161,8 +168,9 @@ Flags:
Global Flags: Global Flags:
--cmdStdOut Pass to print command output to stdout --cmdStdOut Pass to print command output to stdout
-f, --config string config file to read from -f, --config string config file to read from
--log-file string log file to write to --hostsConfig string yaml hosts file to read from
--s3-endpoint string Sets the S3 endpoint used for config file fetching. Overrides S3_ENDPOINT env variable. --logFile string log file to write to
--s3Endpoint string Sets the S3 endpoint used for config file fetching. Overrides S3_ENDPOINT env variable.
-v, --verbose Sets verbose level -v, --verbose Sets verbose level
Use "backy list [command] --help" for more information about a command. Use "backy list [command] --help" for more information about a command.
@@ -181,8 +189,9 @@ Flags:
Global Flags: Global Flags:
--cmdStdOut Pass to print command output to stdout --cmdStdOut Pass to print command output to stdout
-f, --config string config file to read from -f, --config string config file to read from
--log-file string log file to write to --hostsConfig string yaml hosts file to read from
--s3-endpoint string Sets the S3 endpoint used for config file fetching. Overrides S3_ENDPOINT env variable. --logFile string log file to write to
--s3Endpoint string Sets the S3 endpoint used for config file fetching. Overrides S3_ENDPOINT env variable.
-v, --verbose Sets verbose level -v, --verbose Sets verbose level
``` ```
## list lists ## list lists
@@ -199,7 +208,8 @@ Flags:
Global Flags: Global Flags:
--cmdStdOut Pass to print command output to stdout --cmdStdOut Pass to print command output to stdout
-f, --config string config file to read from -f, --config string config file to read from
--log-file string log file to write to --hostsConfig string yaml hosts file to read from
--s3-endpoint string Sets the S3 endpoint used for config file fetching. Overrides S3_ENDPOINT env variable. --logFile string log file to write to
--s3Endpoint string Sets the S3 endpoint used for config file fetching. Overrides S3_ENDPOINT env variable.
-v, --verbose Sets verbose level -v, --verbose Sets verbose level
``` ```

0
docs/content/cli/exec.md Normal file → Executable file
View File

0
docs/content/cli/list.md Normal file → Executable file
View File

0
docs/content/config/_index.md Normal file → Executable file
View File

12
docs/content/config/command-lists.md Normal file → Executable file
View File

@@ -35,12 +35,12 @@ If a remote config file is specified (on the command-line using `-f`) and the li
``` ```
| key | description | type | required | key | description | type | required
| --- | --- | --- | --- | | --- | --- | --- | ---
| `order` | Defines the sequence of commands to execute | `[]string` | yes | | `order` | Defines the sequence of commands to execute | `[]string` | yes
| `getOutput` | Command(s) output is in the notification(s) | `bool` | no | | `sendNotificationOnSuccess` | Whether to send notification on list success with the commands' output | `bool` | no
| `notifications` | The notification service(s) and ID(s) to use on success and failure. Must be *`service.id`*. See the [notifications documentation page](/config/notifications/) for more | `[]string` | no | | `notifications` | The notification service(s) and ID(s) to use on success and failure. Must be *`service.id`*. See the [notifications documentation page](/config/notifications/) for more | `[]string` | no
| `name` | Optional name of the list | `string` | no | | `name` | Optional name of the list | `string` | no
| `cron` | Time at which to schedule the list. Only has affect when cron subcommand is run. | `string` | no | | `cron` | Time at which to schedule the list. Only has affect when cron subcommand is run. | `string` | no
### Order ### Order

0
docs/content/config/commands/_index.md Normal file → Executable file
View File

0
docs/content/config/commands/packages.md Normal file → Executable file
View File

0
docs/content/config/commands/user-commands.md Normal file → Executable file
View File

0
docs/content/config/directives.md Normal file → Executable file
View File

2
docs/content/config/hosts.md Normal file → Executable file
View File

@@ -21,4 +21,4 @@ description: >
## exec host subcommand ## exec host subcommand
Backy has a subcommand `exec host`. This subcommand takes the flags of `-m host1 -m host2`. For now these hosts need to be defined in the config file. Backy has a subcommand `exec host`. This subcommand takes the flags of `-m host1 -m host2`. The commands can also be specified by `-c command1 -c command2`.

0
docs/content/config/notifications.md Normal file → Executable file
View File

0
docs/content/config/remote-resources.md Normal file → Executable file
View File

0
docs/content/config/vault.md Normal file → Executable file
View File

0
docs/content/examples/backy.yaml Normal file → Executable file
View File

0
docs/content/examples/example.yml Normal file → Executable file
View File

0
docs/content/getting-started/_index.md Normal file → Executable file
View File

8
docs/content/getting-started/config.md Normal file → Executable file
View File

@@ -124,13 +124,13 @@ notifications:
### Logging ### Logging
cmd-std-out controls whether commands output is echoed to StdOut. `cmd-std-out` controls whether commands output is echoed to StdOut.
If logfile is not defined, the log file will be written to the config directory in the file `backy.log`. If `logfile` is not defined, the log file will be written to the config directory in the file `backy.log`.
`console-disabled` controls whether the logging messages are echoed to StdOut. Default is false. `console-disabled` controls whether the logging messages are echoed to StdOut. Default is false.
`verbose` basically does nothing as all necessary info is already output. `verbose` prints out debugging messages.
```yaml ```yaml
logging: logging:
@@ -144,7 +144,7 @@ logging:
[Vault](https://www.vaultproject.io/) can be used to get some configuration values and ENV variables securely. [Vault](https://www.vaultproject.io/) can be used to get some configuration values and ENV variables securely.
``` ```yaml
vault: vault:
token: hvs.tXqcASvTP8wg92f7riyvGyuf token: hvs.tXqcASvTP8wg92f7riyvGyuf
address: http://127.0.0.1:8200 address: http://127.0.0.1:8200

0
docs/content/getting-started/install.md Normal file → Executable file
View File

0
docs/content/repositories/_index.md Normal file → Executable file
View File

4
docs/go.mod Normal file → Executable file
View File

@@ -3,6 +3,6 @@ module git.andrewnw.xyz/CyberShell/backy/docs
go 1.19 go 1.19
require ( require (
github.com/McShelby/hugo-theme-relearn v0.0.0-20250103114405-80e448e5bdaa // indirect github.com/McShelby/hugo-theme-relearn v0.0.0-20251115105808-d9ca8e8d8f59 // indirect
github.com/divinerites/plausible-hugo v1.21.1 // indirect github.com/divinerites/plausible-hugo v1.22.0 // indirect
) )

14
docs/go.sum Normal file → Executable file
View File

@@ -1,10 +1,4 @@
github.com/McShelby/hugo-theme-relearn v0.0.0-20230209073138-890d12ea922d h1:weq1mrQ/qNAvGrNgvZVL1K8adbT3bswZf2ABLr/LCIA= github.com/McShelby/hugo-theme-relearn v0.0.0-20251115105808-d9ca8e8d8f59 h1:mnEjz/Wrpv6Hea26KeFJPx94w9g9ZHIurUEWvPdaEvs=
github.com/McShelby/hugo-theme-relearn v0.0.0-20230209073138-890d12ea922d/go.mod h1:mKQQdxZNIlLvAj8X3tMq+RzntIJSr9z7XdzuMomt0IM= github.com/McShelby/hugo-theme-relearn v0.0.0-20251115105808-d9ca8e8d8f59/go.mod h1:mKQQdxZNIlLvAj8X3tMq+RzntIJSr9z7XdzuMomt0IM=
github.com/McShelby/hugo-theme-relearn v0.0.0-20241210183303-16d4de84becf h1:bMx4kwM7Q+dAzvSOWs3XWZ25o+n4mI0GPHqzbzeWb3M= github.com/divinerites/plausible-hugo v1.22.0 h1:2pZheSaIMc+EtwcEeZv0ioU2qBOEZa1Ii7IaR/9II9k=
github.com/McShelby/hugo-theme-relearn v0.0.0-20241210183303-16d4de84becf/go.mod h1:mKQQdxZNIlLvAj8X3tMq+RzntIJSr9z7XdzuMomt0IM= github.com/divinerites/plausible-hugo v1.22.0/go.mod h1:cxr+YB3FUwbLon8KCs4pV4Ankbkq6lJxTQUpNb5KqPo=
github.com/McShelby/hugo-theme-relearn v0.0.0-20250102210630-dd0597ffa4b2 h1:sWaC1/dL65v3iRvblEAaBLpKC5TIT0R9JASk1hZNET8=
github.com/McShelby/hugo-theme-relearn v0.0.0-20250102210630-dd0597ffa4b2/go.mod h1:mKQQdxZNIlLvAj8X3tMq+RzntIJSr9z7XdzuMomt0IM=
github.com/McShelby/hugo-theme-relearn v0.0.0-20250103114405-80e448e5bdaa h1:G+OnMEzK4XOzbbcf1SmaGyOYJ0h5idp/IJdguWs8ioU=
github.com/McShelby/hugo-theme-relearn v0.0.0-20250103114405-80e448e5bdaa/go.mod h1:mKQQdxZNIlLvAj8X3tMq+RzntIJSr9z7XdzuMomt0IM=
github.com/divinerites/plausible-hugo v1.21.1 h1:ZTWwjhZ0PmLMacCVGlcGiYFEZW7VaYE767tchDskOug=
github.com/divinerites/plausible-hugo v1.21.1/go.mod h1:cxr+YB3FUwbLon8KCs4pV4Ankbkq6lJxTQUpNb5KqPo=

17
docs/layouts/_default/baseof.html Normal file → Executable file
View File

@@ -1,7 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
{{- block "storeOutputFormat" . }}{{ end }} {{- block "storeOutputFormat" . }}{{ end }}
{{- if .IsHome }} {{- if .IsHome }}
{{- $hugoVersion := "0.126.0" }} {{- $hugoVersion := "0.141.0" }}
{{- if lt hugo.Version $hugoVersion }} {{- if lt hugo.Version $hugoVersion }}
{{- errorf "The Relearn theme requires Hugo %s or later" $hugoVersion }} {{- errorf "The Relearn theme requires Hugo %s or later" $hugoVersion }}
{{- end }} {{- end }}
@@ -36,12 +36,12 @@
{{ (printf $link (partial "permalink.gotmpl" (dict "to" .)) .Rel .MediaType.Type ($title | htmlEscape)) | safeHTML }} {{ (printf $link (partial "permalink.gotmpl" (dict "to" .)) .Rel .MediaType.Type ($title | htmlEscape)) | safeHTML }}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- partialCached "favicon.html" . }} {{- partialCached "favicon.html" . }}
{{- partial "stylesheet.html" . }} {{- partial "dependencies.html" (dict "page" . "location" "header") }}
{{- partial "dependencies.gotmpl" (dict "page" . "location" "header") }}
{{- partial "custom-header.html" . }} {{- partial "custom-header.html" . }}
</head> </head>
<body class="mobile-support {{ with .Store.Get "relearnOutputFormat" }}{{ . }}{{ else }}html{{ end }}{{- if .Site.Params.disableInlineCopyToClipBoard }} disableInlineCopyToClipboard{{ end }}{{- if .Site.Params.disableHoverBlockCopyToClipBoard }} disableHoverBlockCopyToClipBoard{{ end }}" data-url="{{ partial "permalink.gotmpl" (dict "to" .) }}"> <body class="mobile-support {{ with .Store.Get "relearnOutputFormat" }}{{ . }}{{ else }}html{{ end }}{{- if .Site.Params.disableHoverBlockCopyToClipBoard }} disableHoverBlockCopyToClipBoard{{ end }}" data-url="{{ partial "permalink.gotmpl" (dict "to" .) }}">
<div id="R-body" class="default-animation"> <div id="R-body" class="default-animation">
<div id="R-body-overlay"></div> <div id="R-body-overlay"></div>
<nav id="R-topbar"> <nav id="R-topbar">
@@ -53,7 +53,7 @@
{{- $showBreadcrumb := (and (not .Params.disableBreadcrumb) (not .Site.Params.disableBreadcrumb)) }} {{- $showBreadcrumb := (and (not .Params.disableBreadcrumb) (not .Site.Params.disableBreadcrumb)) }}
{{- if $showBreadcrumb }} {{- if $showBreadcrumb }}
<ol class="topbar-breadcrumbs breadcrumbs highlightable" itemscope itemtype="http://schema.org/BreadcrumbList"> <ol class="topbar-breadcrumbs breadcrumbs highlightable" itemscope itemtype="http://schema.org/BreadcrumbList">
{{- partial "breadcrumbs.html" (dict "page" .) }} {{- partial "breadcrumbs.html" (dict "page" . "schema" true) }}
</ol> </ol>
{{- else }} {{- else }}
<span class="topbar-breadcrumbs highlightable"> <span class="topbar-breadcrumbs highlightable">
@@ -74,11 +74,8 @@
{{- partial "custom-comments.html" . }} {{- partial "custom-comments.html" . }}
</div> </div>
{{- block "menu" . }}{{ end }} {{- block "menu" . }}{{ end }}
{{- $assetBusting := partialCached "assetbusting.gotmpl" . }} {{- partial "dependencies.html" (dict "page" . "location" "footer") }}
<script src="{{"js/clipboard.min.js" | relURL}}{{ $assetBusting }}" defer></script>
<script src="{{"js/perfect-scrollbar.min.js" | relURL}}{{ $assetBusting }}" defer></script>
{{- partial "dependencies.gotmpl" (dict "page" . "location" "footer") }}
<script src="{{"js/theme.js" | relURL}}{{ $assetBusting }}" defer></script>
{{- partial "custom-footer.html" . }} {{- partial "custom-footer.html" . }}
<div id="toast-container" role="status" aria-live="polite" aria-atomic="false"></div>
</body> </body>
</html> </html>

0
docs/layouts/partials/logo.html Normal file → Executable file
View File

0
docs/layouts/shortcodes/code.html Normal file → Executable file
View File

0
docs/vangen.json Normal file → Executable file
View File

Some files were not shown because too many files have changed in this diff Show More