Wrapper script to automatically: mount/connect a backup destination disk → perform backup with `rdiff-backup` → dismount/disconnect the backup destination. Particularly useful as a Windows scheduled task/job.
The path parameter preparation / sanitation at the beginning of the script could do with some refactoring, to:
extract path calculation to functions
store Windows / WSL path sets separately
automatically use the path set which matches the environment of the called executable
In other terms, something like this crude pseudocode:
functionCalculateWinPath {
...
return$WinPathVars
}
functionCalculateWSLPath {
...
return$WSLPathVars
}
# before rdiff-backup execution$Paths[[RdiffBackupExeEnv]::Win] = CalculateWinPath
$Paths[[RdiffBackupExeEnv]::WSL] = CalculateWSLPath
# when referring to paths:$Paths[$RdiffBackupExe.Environment] # for example
Currently it only calculates, stores and uses one type of paths, depending on the environment of the rdiff-backup executable set to be called. This requires both "backup" and "remove" executables to run in the same environment (i.e. Windows or WSL).
This refactoring would allow for removing this current restriction.