Add a function for selecting the profile
This commit is contained in:
parent
0d66964615
commit
85347231e1
|
@ -1,4 +1,5 @@
|
||||||
using namespace Microsoft.Win32;
|
using namespace Microsoft.Win32;
|
||||||
|
using namespace System.Management.Automation.Host;
|
||||||
using namespace System.Security.AccessControl;
|
using namespace System.Security.AccessControl;
|
||||||
using namespace System.Security.Principal;
|
using namespace System.Security.Principal;
|
||||||
|
|
||||||
|
@ -32,6 +33,54 @@ $null = New-Module {
|
||||||
[string] $finishedOption = "Finished";
|
[string] $finishedOption = "Finished";
|
||||||
[RegistryKey] $key = $null;
|
[RegistryKey] $key = $null;
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Prompts the user to select a profile to act on.
|
||||||
|
#>
|
||||||
|
function Show-ProfileNamePrompt {
|
||||||
|
. "$PSScriptRoot/../../Windows/Types/WindowsInstallerAction.ps1";
|
||||||
|
|
||||||
|
$profiles = & {
|
||||||
|
. "$PSScriptRoot/SoftwareManagement.ps1";
|
||||||
|
|
||||||
|
if (Test-Command "wsl") {
|
||||||
|
return Invoke-ConfigScript "getProfiles";
|
||||||
|
} else {
|
||||||
|
return Get-ChildItem "$PSScriptRoot/../../../.config" | ForEach-Object { Split-Path -LeafBase $_ };
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
$choice = $Host.UI.PromptForChoice(
|
||||||
|
"Select Profile",
|
||||||
|
(& {
|
||||||
|
switch (Get-Stage) {
|
||||||
|
([WindowsInstallerAction]::Backup) {
|
||||||
|
"Which profile do you wish to back up?";
|
||||||
|
}
|
||||||
|
([WindowsInstallerAction]::Install) {
|
||||||
|
"Which profile do you wish to install?";
|
||||||
|
}
|
||||||
|
$null {
|
||||||
|
"Which profile do you wish to set up?";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
(& {
|
||||||
|
for ($i = 0; $i -lt $profiles.Count; $i++) {
|
||||||
|
[ChoiceDescription]"&$i - $($profiles[$i])";
|
||||||
|
}
|
||||||
|
|
||||||
|
[ChoiceDescription]"&Abort";
|
||||||
|
}),
|
||||||
|
$profiles.Count);
|
||||||
|
|
||||||
|
if ($choice -eq $profiles.Count) {
|
||||||
|
exit;
|
||||||
|
} else {
|
||||||
|
$env:CONFIG_NAME = $profiles[$choice];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Converts the specified path to linux and escapes it for the use in a script.
|
Converts the specified path to linux and escapes it for the use in a script.
|
||||||
|
|
Loading…
Reference in a new issue