Add capabilities to back up apps
This commit is contained in:
parent
5dcf809caf
commit
f5c2d678ae
2 changed files with 19 additions and 4 deletions
|
@ -200,6 +200,7 @@ $null = New-Module {
|
|||
[scriptblock] $Backup = $null,
|
||||
[scriptblock] $Installer = $null,
|
||||
[scriptblock] $Configurator = $null,
|
||||
[scriptblock] $UserBackup = $null,
|
||||
[scriptblock] $UserConfigurator = $null,
|
||||
[Nullable[InstallerAction]] $Action,
|
||||
[hashtable] $Arguments
|
||||
|
@ -262,17 +263,29 @@ $null = New-Module {
|
|||
& $Configurator @argumentList;
|
||||
}
|
||||
}
|
||||
([InstallerAction]::ConfigureUser) {
|
||||
default {
|
||||
if ((-not $Arguments.ContainsKey($userArgument)) -or (-not $Arguments[$userArgument])) {
|
||||
$Arguments.Add($userArgument, ($IsWindows ? $env:UserName : $env:USER));
|
||||
}
|
||||
|
||||
$user = $Arguments[$userArgument];
|
||||
|
||||
switch ($_) {
|
||||
([InstallerAction]::BackupUser) {
|
||||
if ($UserBackup) {
|
||||
Write-Host "Backing up $Name for user ``$user``…";
|
||||
& $UserBackup @argumentList;
|
||||
}
|
||||
}
|
||||
([InstallerAction]::ConfigureUser) {
|
||||
if ($UserConfigurator) {
|
||||
Write-Host "Configuring $Name for user ``$($Arguments[$userArgument])``…";
|
||||
Write-Host "Configuring $Name for user ``$user``…";
|
||||
& $UserConfigurator @argumentList;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
& $installHandler -Action $Action -Arguments $Arguments;
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
enum InstallerAction {
|
||||
Backup
|
||||
Install
|
||||
Configure
|
||||
BackupUser
|
||||
ConfigureUser
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue