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] $Backup = $null,
|
||||||
[scriptblock] $Installer = $null,
|
[scriptblock] $Installer = $null,
|
||||||
[scriptblock] $Configurator = $null,
|
[scriptblock] $Configurator = $null,
|
||||||
|
[scriptblock] $UserBackup = $null,
|
||||||
[scriptblock] $UserConfigurator = $null,
|
[scriptblock] $UserConfigurator = $null,
|
||||||
[Nullable[InstallerAction]] $Action,
|
[Nullable[InstallerAction]] $Action,
|
||||||
[hashtable] $Arguments
|
[hashtable] $Arguments
|
||||||
|
@ -262,17 +263,29 @@ $null = New-Module {
|
||||||
& $Configurator @argumentList;
|
& $Configurator @argumentList;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
([InstallerAction]::ConfigureUser) {
|
default {
|
||||||
if ((-not $Arguments.ContainsKey($userArgument)) -or (-not $Arguments[$userArgument])) {
|
if ((-not $Arguments.ContainsKey($userArgument)) -or (-not $Arguments[$userArgument])) {
|
||||||
$Arguments.Add($userArgument, ($IsWindows ? $env:UserName : $env:USER));
|
$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) {
|
if ($UserConfigurator) {
|
||||||
Write-Host "Configuring $Name for user ``$($Arguments[$userArgument])``…";
|
Write-Host "Configuring $Name for user ``$user``…";
|
||||||
& $UserConfigurator @argumentList;
|
& $UserConfigurator @argumentList;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
& $installHandler -Action $Action -Arguments $Arguments;
|
& $installHandler -Action $Action -Arguments $Arguments;
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
enum InstallerAction {
|
enum InstallerAction {
|
||||||
|
Backup
|
||||||
Install
|
Install
|
||||||
Configure
|
Configure
|
||||||
|
BackupUser
|
||||||
ConfigureUser
|
ConfigureUser
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue