diff --git a/scripts/Common/Software/aliae/Main.ps1 b/scripts/Common/Software/aliae/Main.ps1 new file mode 100644 index 00000000..ffd1fe07 --- /dev/null +++ b/scripts/Common/Software/aliae/Main.ps1 @@ -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.yaml; + }; diff --git a/scripts/Common/Software/aliae/aliae.yml b/scripts/Common/Software/aliae/aliae.yml index 1e381147..84d82c4e 100644 --- a/scripts/Common/Software/aliae/aliae.yml +++ b/scripts/Common/Software/aliae/aliae.yml @@ -1,22 +1,4 @@ -alias: - - name: totsch - 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' +alias: [] +env: [] path: [] -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" +script: [] diff --git a/scripts/Windows/Software/aliae/Main.ps1 b/scripts/Windows/Software/aliae/Main.ps1 new file mode 100644 index 00000000..2143ea1c --- /dev/null +++ b/scripts/Windows/Software/aliae/Main.ps1 @@ -0,0 +1,23 @@ +param ( + $Action, + [hashtable] $Arguments +) + +. "$PSScriptRoot/../../../Common/Scripts/Software.ps1"; +. "$PSScriptRoot/../../../Common/Types/InstallerAction.ps1"; + +& { + param($Parameters) + $base = "$PSScriptRoot/../../../Common/Software/aliae/Main.ps1"; + + Start-SoftwareInstaller @Parameters ` + -Installer { + Install-WingetPackage JanDeDobbeleer.Aliae; + } ` + -Configurator { + . $base -Action ([InstallerAction]::Configure); + } ` + -UserConfigurator { + . $base -Action ([InstallerAction]::ConfigureUser); + }; +} $PSBoundParameters;