Skip to content

Commit

Permalink
add windows exclusions for non-agent targets
Browse files Browse the repository at this point in the history
  • Loading branch information
Son Roy Almerol committed Dec 6, 2024
1 parent dd46cfd commit f347e58
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 23 deletions.
12 changes: 8 additions & 4 deletions internal/backend/backup/jobrun.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,17 @@ func RunBackup(job *store.Job, storeInstance *store.Store, waitChan chan struct{
"--backup-id", backupId,
}

if !isAgent {
for _, exclusion := range store.WindowsStapleExclusions {
cmdArgs = append(cmdArgs, "--exclude", exclusion)
}
}

if job.Namespace != "" {
cmdArgs = append(cmdArgs, "--ns")
cmdArgs = append(cmdArgs, job.Namespace)
cmdArgs = append(cmdArgs, "--ns", job.Namespace)
} else if isAgent && job.Namespace == "" {
newNamespace := strings.ReplaceAll(job.Target, " - ", "/")
cmdArgs = append(cmdArgs, "--ns")
cmdArgs = append(cmdArgs, strings.ReplaceAll(job.Target, " - ", "/"))
cmdArgs = append(cmdArgs, "--ns", strings.ReplaceAll(job.Target, " - ", "/"))

_ = CreateNamespace(newNamespace, job, storeInstance)
}
Expand Down
8 changes: 8 additions & 0 deletions internal/store/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,14 @@ func (store *Store) CreateTables() error {
}

if exclusionCheck != nil {
for _, path := range WindowsStapleExclusions {
_ = store.CreateExclusion(Exclusion{
Path: path,
IsGlobal: true,
Comment: "Generated from default list of exclusions",
})
}

for _, path := range defaultExclusions {
_ = store.CreateExclusion(Exclusion{
Path: path,
Expand Down
41 changes: 22 additions & 19 deletions internal/store/default_exclusions.go
Original file line number Diff line number Diff line change
@@ -1,28 +1,31 @@
package store

var defaultExclusions = []string{
`/hiberfil.sys`,
`/pagefile.sys`,
`/swapfile.sys`,
`/autoexec.bat`,
`/Config.Msi`,
`/Documents and Settings`,
`/Recycled`,
`/Recycler`,
`/$$Recycle.Bin`,
`/Recovery`,
`/Program Files`,
`/Program Files (x86)`,
`/ProgramData`,
`/PerfLogs`,
`/Windows`,
`/Windows.old`,
`/$$WINDOWS.~BT`,
`/$$WinREAgent`,
var WindowsStapleExclusions = []string{
`hiberfil.sys`,
`pagefile.sys`,
`swapfile.sys`,
`autoexec.bat`,
`Config.Msi`,
`Documents and Settings`,
`Recycled`,
`Recycler`,
`$$Recycle.Bin`,
`Recovery`,
`Program Files`,
`Program Files (x86)`,
`ProgramData`,
`PerfLogs`,
`Windows`,
`Windows.old`,
`$$WINDOWS.~BT`,
`$$WinREAgent`,
"$RECYCLE.BIN",
"$WinREAgent",
"System Volume Information",
"Temporary Internet Files",
}

var defaultExclusions = []string{
`Microsoft/Windows/Recent`,
`Microsoft/**/RecoveryStore**`,
`Microsoft/**/Windows/**.edb`,
Expand Down

0 comments on commit f347e58

Please sign in to comment.