Compare commits
4 commits
6de06321ca
...
cebc95eae9
Author | SHA1 | Date | |
---|---|---|---|
Manuel Thalmann | cebc95eae9 | ||
Manuel Thalmann | 2f0198257e | ||
Manuel Thalmann | aa295bae1c | ||
Manuel Thalmann | 6ffc02ad16 |
|
@ -1,5 +1,5 @@
|
|||
#!/bin/pwsh
|
||||
. "$PSScriptRoot/../../Software/powershell/profile.ps1";
|
||||
. "$PSScriptRoot/../../Software/PowerShell/profile.ps1";
|
||||
|
||||
Add-PowerShellProfileStatement `
|
||||
-System `
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/bin/pwsh
|
||||
. "$PSScriptRoot/../../Software/powershell/profile.ps1";
|
||||
. "$PSScriptRoot/../../Software/PowerShell/profile.ps1";
|
||||
|
||||
foreach ($defaultUser in @($true, $false)) {
|
||||
Add-PowerShellProfileStatement -DefaultUser:$defaultUser -Statement "# aliae`naliae init pwsh | Invoke-Expression";
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/bin/pwsh
|
||||
. "$PSScriptRoot/../../Software/powershell/profile.ps1";
|
||||
. "$PSScriptRoot/../../Software/PowerShell/profile.ps1";
|
||||
|
||||
Add-PowerShellProfileStatement `
|
||||
-System `
|
||||
|
|
60
scripts/Common/Software/PowerShell/Manage.ps1
Normal file
60
scripts/Common/Software/PowerShell/Manage.ps1
Normal file
|
@ -0,0 +1,60 @@
|
|||
param (
|
||||
$Action,
|
||||
[hashtable] $Arguments
|
||||
)
|
||||
|
||||
. "$PSScriptRoot/../../../Windows/Scripts/Software.ps1";
|
||||
. "$PSScriptRoot/../../../Windows/Scripts/Scripting.ps1";
|
||||
. "$PSScriptRoot/../../../Windows/Types/InstallerAction.ps1";
|
||||
|
||||
Start-SoftwareInstaller @PSBoundParameters `
|
||||
-Installer {
|
||||
param(
|
||||
[scriptblock] $Installer
|
||||
)
|
||||
|
||||
& $Installer -Action ([InstallerAction]::Configure);
|
||||
} `
|
||||
-Configurator {
|
||||
param(
|
||||
[hashtable] $Arguments
|
||||
)
|
||||
|
||||
[string] $globalDir = $null;
|
||||
$indicator = "# Profile Files";
|
||||
|
||||
if ($Arguments.Linux) {
|
||||
$globalDir = '"/etc/powershell/conf.d"';
|
||||
} else {
|
||||
$globalDir = '"$env:ProgramData/PowerShell/conf.d"';
|
||||
}
|
||||
|
||||
[System.Collections.ArrayList] $files = @($PROFILE);
|
||||
|
||||
if (Test-Command powershell) {
|
||||
$null = $files.Add((powershell -c '$PROFILE'));
|
||||
}
|
||||
|
||||
foreach ($file in $files) {
|
||||
if (-not ((Test-Path -PathType Leaf $file) -and ((Get-Content $file) -contains $indicator))) {
|
||||
Write-PSScript -FileName $file -Script (@(
|
||||
$indicator,
|
||||
"`$globalDir = $globalDir",
|
||||
({
|
||||
$profileRoot = Split-Path -Parent $PROFILE;
|
||||
|
||||
$profilePaths = @(
|
||||
"$profileRoot/conf.d/*.ps1",
|
||||
"$globalDir/*.ps1"
|
||||
)
|
||||
|
||||
foreach ($profilePath in $profilePaths) {
|
||||
if (Test-Path $profilePath) {
|
||||
Get-Item $profilePath | ForEach-Object { . $_; };
|
||||
}
|
||||
}
|
||||
}).ToString()) -join "`n") `
|
||||
-Append;
|
||||
}
|
||||
}
|
||||
};
|
|
@ -1,5 +1,5 @@
|
|||
#!/bin/pwsh
|
||||
. "$PSScriptRoot/../powershell/profile.ps1";
|
||||
. "$PSScriptRoot/../PowerShell/profile.ps1";
|
||||
|
||||
Add-PowerShellProfileStatement `
|
||||
-System `
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
#!/bin/pwsh
|
||||
. "$PSScriptRoot/../../../Common/Software/powershell/profile.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Software/PowerShell/profile.ps1";
|
||||
Add-PowerShellProfileStatement -System -Category "Terminal-Icons" -Statement 'Import-Module "Terminal-Icons";';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/pwsh
|
||||
. "$PSScriptRoot/../../../Common/Software/powershell/profile.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Software/PowerShell/profile.ps1";
|
||||
Write-Host "Configuring posh-git";
|
||||
Add-PowerShellProfileStatement -System -Category "posh-git" -Statement 'Import-Module "posh-git";'
|
||||
|
|
|
@ -63,6 +63,7 @@ $null = New-Module {
|
|||
|
||||
Invoke-Hook "Install-PSModules" -Fallback {
|
||||
Install-Module -AcceptLicense -Force PSWindowsUpdate;
|
||||
Install-Module -AcceptLicense -Force PSScriptAnalyzer;
|
||||
};
|
||||
|
||||
if (-not (Test-Winget)) {
|
||||
|
@ -143,29 +144,31 @@ $null = New-Module {
|
|||
}
|
||||
}
|
||||
|
||||
if (Get-Config "valhalla.hardware.amdCPU") {
|
||||
Install-ChocoPackage amd-ryzen-master;
|
||||
# ToDo: backup Ryzen energy saving plan
|
||||
}
|
||||
if (-not $Action -or ($Action -eq ([InstallerAction]::Install))) {
|
||||
if (Get-Config "valhalla.hardware.amdCPU") {
|
||||
Install-ChocoPackage amd-ryzen-master;
|
||||
# ToDo: backup Ryzen energy saving plan
|
||||
}
|
||||
|
||||
if (Get-Config "valhalla.hardware.nvidiaGPU") {
|
||||
Install-ChocoPackage geforce-game-ready-driver;
|
||||
Remove-DesktopIcon "*Geforce*";
|
||||
}
|
||||
if (Get-Config "valhalla.hardware.nvidiaGPU") {
|
||||
Install-ChocoPackage geforce-game-ready-driver;
|
||||
Remove-DesktopIcon "*Geforce*";
|
||||
}
|
||||
|
||||
if (Get-Config "valhalla.hardware.corsairLighting") {
|
||||
Install-ChocoPackage icue;
|
||||
}
|
||||
if (Get-Config "valhalla.hardware.corsairLighting") {
|
||||
Install-ChocoPackage icue;
|
||||
}
|
||||
|
||||
if (Get-Config "valhalla.hardware.elgatoWave") {
|
||||
if (-not (Test-ChocoPackage wavelink)) {
|
||||
Install-ChocoPackage wavelink -ArgumentList '--install-arguments="/norestart"';
|
||||
Remove-DesktopIcon "*Wave Link*";
|
||||
Restart-Intermediate;
|
||||
exit;
|
||||
if (Get-Config "valhalla.hardware.elgatoWave") {
|
||||
if (-not (Test-ChocoPackage wavelink)) {
|
||||
Install-ChocoPackage wavelink -ArgumentList '--install-arguments="/norestart"';
|
||||
Remove-DesktopIcon "*Wave Link*";
|
||||
Restart-Intermediate;
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (Get-Config "valhalla.hardware.eyeX") {
|
||||
. "$driverPath/Tobii EyeX/Manage.ps1" @arguments;
|
||||
}
|
||||
|
@ -179,11 +182,13 @@ $null = New-Module {
|
|||
if (Test-Collection "essential") {
|
||||
# Essentials
|
||||
. "$softwarePath/OpenSSH/Manage.ps1" @arguments;
|
||||
. "$softwarePath/PowerShell/Manage.ps1";
|
||||
}
|
||||
|
||||
if (Test-Collection "common") {
|
||||
# Common Software
|
||||
. "$softwarePath/WinSCP/Manage.ps1" @arguments;
|
||||
. "$softwarePath/Thunderbird/Manage.ps1" @arguments;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/pwsh
|
||||
. "$PSScriptRoot/Entrypoints.ps1";
|
||||
. "$PSScriptRoot/../../Common/Software/powershell/profile.ps1";
|
||||
. "$PSScriptRoot/../../Common/Software/PowerShell/profile.ps1";
|
||||
|
||||
class Context {
|
||||
[string]$EntryPoint;
|
||||
|
|
|
@ -14,3 +14,49 @@ function ConvertTo-Injection {
|
|||
[System.Convert]::ToBase64String([System.Text.Encoding]::Default.GetBytes($value))
|
||||
)')))"
|
||||
}
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Writes a PowerShell script to a specified location.
|
||||
|
||||
.PARAMETER FileName
|
||||
The name of the file to write the script to.
|
||||
|
||||
.PARAMETER Script
|
||||
The script to write to the file.
|
||||
|
||||
.PARAMETER Replace
|
||||
A value indicating whether the file should be overwritten if it exists.
|
||||
|
||||
.PARAMETER Append
|
||||
A value indicating whether the content should be appended if the file already exists.
|
||||
#>
|
||||
function Write-PSScript {
|
||||
param(
|
||||
[string] $FileName,
|
||||
[string] $Script,
|
||||
[Parameter(ParameterSetName="Replace")]
|
||||
[switch] $Replace,
|
||||
[Parameter(ParameterSetName="Append")]
|
||||
[switch] $Append
|
||||
)
|
||||
|
||||
Import-Module PSScriptAnalyzer;
|
||||
$dirName = Split-Path -Parent $FileName;
|
||||
$content = Invoke-Formatter -ScriptDefinition $Script;
|
||||
$exists = Test-Path -PathType Leaf $FileName;
|
||||
|
||||
if (-not (Test-Path -PathType Container $dirName)) {
|
||||
$null = New-Item -ItemType Directory $dirName;
|
||||
}
|
||||
|
||||
if ($exists -and ($Append.IsPresent)) {
|
||||
Add-Content -Force $FileName "`n$content";
|
||||
} else {
|
||||
if ((-not $exists) -or $Replace.IsPresent) {
|
||||
Set-Content -Force $FileName $content;
|
||||
} else {
|
||||
Write-Host "The file ``$FileName`` already exists!";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
21
scripts/Windows/Software/PowerShell/Manage.ps1
Normal file
21
scripts/Windows/Software/PowerShell/Manage.ps1
Normal file
|
@ -0,0 +1,21 @@
|
|||
param (
|
||||
$Action,
|
||||
[hashtable] $Arguments
|
||||
)
|
||||
|
||||
. "$PSScriptRoot/../../Scripts/Software.ps1";
|
||||
. "$PSScriptRoot/../../Types/InstallerAction.ps1";
|
||||
|
||||
Start-SoftwareInstaller @PSBoundParameters `
|
||||
-Installer {
|
||||
param(
|
||||
[scriptblock] $Installer
|
||||
)
|
||||
|
||||
& $Installer -Action ([InstallerAction]::Configure);
|
||||
} `
|
||||
-Configurator {
|
||||
. "$PSScriptRoot/../../../Common/Software/PowerShell/Manage.ps1" `
|
||||
-Action ([InstallerAction]::Configure) `
|
||||
-Arguments @{ Linux = $false };
|
||||
};
|
25
scripts/Windows/Software/Thunderbird/Manage.ps1
Normal file
25
scripts/Windows/Software/Thunderbird/Manage.ps1
Normal file
|
@ -0,0 +1,25 @@
|
|||
using namespace Microsoft.Win32;
|
||||
|
||||
param(
|
||||
$Action,
|
||||
[hashtable] $Arguments
|
||||
)
|
||||
|
||||
. "$PSScriptRoot/../../Scripts/AppAssociations.ps1";
|
||||
. "$PSScriptRoot/../../Scripts/Software.ps1";
|
||||
|
||||
Start-SoftwareInstaller @PSBoundParameters `
|
||||
-Installer {
|
||||
param(
|
||||
[scriptblock] $Installer
|
||||
)
|
||||
|
||||
Install-ChocoPackage thunderbird -ArgumentList "--params",'"/NoTaskbarShortcut /NoDesktopShortcut"'
|
||||
& $Installer -Action ([InstallerAction]::Configure)
|
||||
} `
|
||||
-Configurator {
|
||||
Write-Host "Making Thunderbird the default mail program…";
|
||||
$applicationName = "Thunderbird";
|
||||
Set-DefaultAppAssociation -Identifier "mailto" -ProgId "Thunderbird.Url.mailto" -ApplicationName $applicationName;
|
||||
Set-DefaultAppAssociation -Identifier ".eml" -ProgId "ThunderbirdEml" -ApplicationName $applicationName;
|
||||
};
|
Loading…
Reference in a new issue