Add a script for installing aliae

This commit is contained in:
Manuel Thalmann 2024-08-23 22:38:28 +02:00
parent b6f25a51b2
commit c6d0260369
3 changed files with 73 additions and 21 deletions

View file

@ -0,0 +1,48 @@
param(
$Action,
[hashtable] $Arguments
)
. "$PSScriptRoot/../PowerShell/Profile.ps1";
. "$PSScriptRoot/../../Scripts/Software.ps1";
Start-SoftwareInstaller @PSBoundParameters `
-Configurator {
$pathExpression = "`"$($IsWindows ? "`$env:ProgramData" : "/etc")/aliae/aliae.yml`"";
$path = & ([scriptblock]::Create($pathExpression));
$null = New-Item -Force -ItemType Directory (Split-Path -Parent $path);
Copy-Item -Force "$PSScriptRoot/aliae.yml" $path;
Add-PowerShellProfileStatement `
-System `
-Category "aliae" `
-Script (
@(
{
#aliae
},
"`$globalPath = $pathExpression",
{
$userPath = & {
if ($env:ALIAE_CONFIG) {
$env:ALIAE_CONFIG;
} else {
"~/.aliae.yaml";
}
};
if (Test-Path $globalPath) {
& ([scriptblock]::Create((aliae init pwsh --config $globalPath)));
}
if (Test-Path $userPath) {
& ([scriptblock]::Create((aliae init pwsh)));
}
& ([scriptblock]::Create((aliae completion powershell)));
}
) -join [System.Environment]::NewLine)
} `
-UserConfigurator {
Copy-Item -Force "$PSScriptRoot/aliae.yml" ~/.aliae.yml;
};

View file

@ -1,22 +1,4 @@
alias: alias: []
- name: totsch env: []
value: git
env:
- name: POSH_THEME
value: '{{ if eq .OS "windows" }}{{ .Home }}/Nextcloud/.omp{{ else }}/usr/local/share/oh-my-posh/themes{{ end }}/manuel.omp.json'
path: [] path: []
script: script: []
- value: |
# Profile Files
$profileRoot = Split-Path -Parent $PROFILE;
$profilePaths = @(
"$profileRoot/conf.d/*.ps1",
"{{ if eq .OS "windows" }}$env:ProgramData{{ else }}/etc{{ end }}/powershell/conf.d/*.ps1"
);
foreach ($profilePath in $profilePaths) {
if (Test-Path $profilePath) {
Get-Item $profilePath | ForEach-Object { . $_; };
}
}
if: match .Shell "pwsh"

View file

@ -0,0 +1,22 @@
param (
$Action,
[hashtable] $Arguments
)
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
. "$PSScriptRoot/../../../Common/Types/InstallerAction.ps1";
& {
$base = "$PSScriptRoot/../../../Common/Software/aliae/Manage.ps1";
Start-SoftwareInstaller @PSBoundParameters `
-Installer {
Install-WingetPackage JanDeDobbeleer.Aliae;
} `
-Configurator {
. $base -Action ([InstallerAction]::Configure);
} `
-UserConfigurator {
. $base -Action ([InstallerAction]::ConfigureUser);
};
};