PortValhalla/scripts/Common/Software/aliae/Main.ps1

52 lines
1.8 KiB
PowerShell
Raw Normal View History

. "$PSScriptRoot/Constants.ps1";
2024-10-13 13:35:24 +00:00
. "$PSScriptRoot/../powershell/Profile.ps1";
2024-08-23 20:38:28 +00:00
. "$PSScriptRoot/../../Scripts/Software.ps1";
2024-09-30 03:00:20 +00:00
Start-SoftwareInstaller @args `
2024-08-23 20:38:28 +00:00
-Configurator {
param([string] $Name)
. "$PSScriptRoot/Constants.ps1";
$pathExpression = Get-GlobalConfigExpression;
$path = Get-GlobalConfigPath;
2024-08-23 20:38:28 +00:00
$null = New-Item -Force -ItemType Directory (Split-Path -Parent $path);
Copy-Item -Force "$PSScriptRoot/aliae.yml" $path;
Add-PowerShellProfileStatement `
-System `
-Category $Name `
2024-08-23 20:38:28 +00:00
-Script (
@(
{
#aliae
},
"`$globalPath = $pathExpression",
{
$userPath = & {
if ($env:ALIAE_CONFIG) {
$env:ALIAE_CONFIG;
2024-10-06 19:25:34 +00:00
}
else {
2024-08-23 20:38:28 +00:00
"~/.aliae.yaml";
}
};
if (Test-Path $globalPath) {
$null = & ([scriptblock]::Create((aliae init pwsh --config $globalPath))) *>&1;
2024-08-23 20:38:28 +00:00
}
if (Test-Path $userPath) {
$null = & ([scriptblock]::Create((aliae init pwsh))) *>&1;
2024-08-23 20:38:28 +00:00
}
aliae completion powershell | Out-String | Invoke-Expression;
2024-08-23 20:38:28 +00:00
}
) -join [System.Environment]::NewLine)
} `
-UserConfigurator {
param(
[hashtable] $Arguments
)
sudo -u $Arguments.Name pwsh -c Copy-Item -Force "$PSScriptRoot/aliae.yml" "~/.aliae.yaml";
2024-08-23 20:38:28 +00:00
};