Compare commits
57 commits
cebc95eae9
...
493847e727
Author | SHA1 | Date | |
---|---|---|---|
Manuel Thalmann | 493847e727 | ||
Manuel Thalmann | e0869665dc | ||
Manuel Thalmann | 7e24603c95 | ||
Manuel Thalmann | f0b5e181a5 | ||
Manuel Thalmann | d97854ec55 | ||
Manuel Thalmann | 0a04b12497 | ||
Manuel Thalmann | b8e81d1458 | ||
Manuel Thalmann | bbcaca2c84 | ||
Manuel Thalmann | 324e8bee7e | ||
Manuel Thalmann | 0764d16d35 | ||
Manuel Thalmann | 98df4f242c | ||
Manuel Thalmann | e2536d91a5 | ||
Manuel Thalmann | 00ae67d304 | ||
Manuel Thalmann | 7690248a55 | ||
Manuel Thalmann | 990a42bfb4 | ||
Manuel Thalmann | a044612a5e | ||
Manuel Thalmann | 0c7e9a0959 | ||
Manuel Thalmann | c08378e7ed | ||
Manuel Thalmann | 5f64e299aa | ||
Manuel Thalmann | 180379cb3a | ||
Manuel Thalmann | d87dee8072 | ||
Manuel Thalmann | 3a0643348f | ||
Manuel Thalmann | 9f54702158 | ||
Manuel Thalmann | 23954e7e9f | ||
Manuel Thalmann | a2c6d8bc04 | ||
Manuel Thalmann | e91c7ba371 | ||
Manuel Thalmann | b6135b0750 | ||
Manuel Thalmann | ab07c87c57 | ||
Manuel Thalmann | 1b7e2b5966 | ||
Manuel Thalmann | 8655012f33 | ||
Manuel Thalmann | 9d9d910554 | ||
Manuel Thalmann | 5a64f8e42d | ||
Manuel Thalmann | 889f969045 | ||
Manuel Thalmann | 0d1dbda873 | ||
Manuel Thalmann | 6a443c7438 | ||
Manuel Thalmann | a532df391a | ||
Manuel Thalmann | 96cdbb231d | ||
Manuel Thalmann | 219e991d45 | ||
Manuel Thalmann | 6f4a22b5aa | ||
Manuel Thalmann | 933402144d | ||
Manuel Thalmann | bb9eb99a36 | ||
Manuel Thalmann | f9752543c1 | ||
Manuel Thalmann | e32d97ec51 | ||
Manuel Thalmann | ff86ea62f9 | ||
Manuel Thalmann | dde206a980 | ||
Manuel Thalmann | bfba6b532f | ||
Manuel Thalmann | 1c9de44bd8 | ||
Manuel Thalmann | 72d8ebe35f | ||
Manuel Thalmann | 036d2a8338 | ||
Manuel Thalmann | 049c8d5eba | ||
Manuel Thalmann | 096446e646 | ||
Manuel Thalmann | 27bd44a127 | ||
Manuel Thalmann | 30638e42f1 | ||
Manuel Thalmann | a667593dbb | ||
Manuel Thalmann | df850deeea | ||
Manuel Thalmann | 438bbb911e | ||
Manuel Thalmann | d90e3bb437 |
|
@ -32,11 +32,23 @@
|
|||
default = false;
|
||||
};
|
||||
|
||||
corsairDevice = mkOption {
|
||||
type = types.bool;
|
||||
description = "A value indicating whether a Corsair device is present.";
|
||||
default = false;
|
||||
};
|
||||
|
||||
elgatoWave = mkOption {
|
||||
type = types.bool;
|
||||
description = "A value indicating whether an Elgato Wave device is present.";
|
||||
default = false;
|
||||
};
|
||||
|
||||
logitechG = mkOption {
|
||||
type = types.bool;
|
||||
description = "A value indicating whether a Logitech G device is present.";
|
||||
default = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ lib, config, ... }:
|
||||
{ lib, config, options, ... }:
|
||||
let
|
||||
inherit (lib)
|
||||
mkOption
|
||||
|
@ -7,7 +7,16 @@
|
|||
types
|
||||
;
|
||||
|
||||
setupUser = lib.strings.stringToCharacters config.valhalla.setupUser.name;
|
||||
users = config.valhalla.users;
|
||||
setupUser = config.valhalla.setupUser.name;
|
||||
|
||||
capitalize = text:
|
||||
let
|
||||
chars = lib.strings.stringToCharacters text;
|
||||
in lib.strings.concatStrings (
|
||||
[(lib.strings.toUpper (builtins.elemAt chars 0))] ++
|
||||
(lib.lists.drop 1 chars)
|
||||
);
|
||||
|
||||
winType = types.submodule (
|
||||
{ config, ... }: {
|
||||
|
@ -15,10 +24,16 @@
|
|||
setupUser = mkOption {
|
||||
type = types.str;
|
||||
description = "The name of the user for setting up Windows.";
|
||||
default = lib.strings.concatStrings (
|
||||
[(lib.strings.toUpper (builtins.elemAt setupUser 0))] ++
|
||||
(lib.lists.drop 1 setupUser)
|
||||
);
|
||||
default = capitalize setupUser;
|
||||
};
|
||||
|
||||
users = mkOption {
|
||||
type = options.valhalla.users.type;
|
||||
description = "The users to add.";
|
||||
default = lib.attrsets.concatMapAttrs (
|
||||
name: options: {
|
||||
${capitalize name} = options;
|
||||
}) users;
|
||||
};
|
||||
|
||||
dualboot = {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/pwsh
|
||||
$null = New-Module {
|
||||
. "$PSScriptRoot/../../../scripts/Windows/Scripts/Context.ps1";
|
||||
. "$PSScriptRoot/../../../scripts/Common/Scripts/Context.ps1";
|
||||
. "$PSScriptRoot/../../../scripts/Windows/OS/Manage.ps1";
|
||||
|
||||
Write-Host "Starting Backup of Windows";
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/bin/pwsh
|
||||
. "$PSScriptRoot/../../../scripts/Windows/Scripts/Context.ps1";
|
||||
. "$PSScriptRoot/../../../scripts/Common/Scripts/Context.ps1";
|
||||
|
||||
function Install-PortValhallaDrivers {
|
||||
param(
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#!/bin/pwsh
|
||||
. "$PSScriptRoot/Drivers.ps1";
|
||||
. "$PSScriptRoot/../../../scripts/Common/Scripts/Context.ps1";
|
||||
. "$PSScriptRoot/../../../scripts/Windows/Collections/Personal.ps1"
|
||||
. "$PSScriptRoot/../../../scripts/Windows/OS/Install.ps1";
|
||||
. "$PSScriptRoot/../../../scripts/Windows/Scripts/Context.ps1";
|
||||
|
||||
function Initialize-Configuration {
|
||||
# Fix synchronization between Linux and Windows clock
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
windows = {
|
||||
dualboot = {
|
||||
enable = true;
|
||||
linuxPercentage = 70;
|
||||
linuxPercentage = 30;
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -33,6 +33,8 @@
|
|||
eyeX = true;
|
||||
amdCPU = true;
|
||||
nvidiaGPU = true;
|
||||
logitechG = true;
|
||||
corsairDevice = true;
|
||||
elgatoWave = true;
|
||||
};
|
||||
};
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/bin/pwsh
|
||||
. "$PSScriptRoot/../../../scripts/Windows/Scripts/Context.ps1";
|
||||
. "$PSScriptRoot/../../../scripts/Common/Scripts/Context.ps1";
|
||||
. "$PSScriptRoot/../../../scripts/Windows/OS/Install.ps1";
|
||||
. "$PSScriptRoot/../../../scripts/Windows/Collections/Generic.ps1"
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
#!/bin/pwsh
|
||||
. "$PSScriptRoot/../../Software/PowerShell/profile.ps1";
|
||||
. "$PSScriptRoot/../../Software/PowerShell/Profile.ps1";
|
||||
|
||||
Add-PowerShellProfileStatement `
|
||||
-System `
|
||||
-Category "oh-my-posh" `
|
||||
-Statement $(
|
||||
-Script $(
|
||||
@(
|
||||
"# Oh My Posh!",
|
||||
$(Get-ScriptInitializer "oh-my-posh init pwsh"),
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#!/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";
|
||||
Add-PowerShellProfileStatement -DefaultUser:$defaultUser -Script "# aliae`naliae init pwsh | Invoke-Expression";
|
||||
}
|
||||
|
||||
Add-PowerShellProfileStatement -System -Category "aliae" -Statement "# aliae`n$(Get-ScriptInitializer "aliae completion powershell")";
|
||||
Add-PowerShellProfileStatement -System -Category "aliae" -Script "# aliae`n$(Get-ScriptInitializer "aliae completion powershell")";
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
#!/bin/pwsh
|
||||
. "$PSScriptRoot/../../Software/PowerShell/profile.ps1";
|
||||
. "$PSScriptRoot/../../Software/PowerShell/Profile.ps1";
|
||||
|
||||
Add-PowerShellProfileStatement `
|
||||
-System `
|
||||
-Category "zoxide" `
|
||||
-Statement $(
|
||||
-Script $(
|
||||
@(
|
||||
"# zoxide",
|
||||
$(Get-ScriptInitializer "zoxide init powershell | Out-String")
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
#!/bin/bash
|
||||
. "$PSScriptRoot/Context.ps1";
|
||||
|
||||
$null = New-Module {
|
||||
. "$PSScriptRoot/System.ps1";
|
||||
|
||||
|
@ -54,53 +52,57 @@ $null = New-Module {
|
|||
[string] $OutDir
|
||||
)
|
||||
|
||||
if (-not $OutDir) {
|
||||
$OutDir = ".";
|
||||
}
|
||||
$downloadAction = $Action;
|
||||
|
||||
$dir = New-TemporaryDirectory;
|
||||
Write-Host "Downloading ``$URL`` using browser automation…";
|
||||
$options = [OpenQA.Selenium.Firefox.FirefoxOptions]::new();
|
||||
$options.SetPreference("browser.download.folderList", 2);
|
||||
$options.SetPreference("browser.download.dir", "$dir");
|
||||
|
||||
$downloadChecker = {
|
||||
$files = Get-ChildItem $dir;
|
||||
|
||||
if ((@($files)).Count -gt 0) {
|
||||
foreach ($file in $files) {
|
||||
try {
|
||||
$stream = [System.IO.File]::Open($file.FullName, [System.IO.FileMode]::Open, [System.IO.FileAccess]::ReadWrite, [System.IO.FileShare]::None);
|
||||
|
||||
if ($stream) {
|
||||
$stream.Close();
|
||||
Start-BrowserAutomation {
|
||||
if (-not $OutDir) {
|
||||
$OutDir = ".";
|
||||
}
|
||||
|
||||
$dir = New-TemporaryDirectory;
|
||||
Write-Host "Downloading ``$URL`` using browser automation…";
|
||||
$options = [OpenQA.Selenium.Firefox.FirefoxOptions]::new();
|
||||
$options.SetPreference("browser.download.folderList", 2);
|
||||
$options.SetPreference("browser.download.dir", "$dir");
|
||||
|
||||
$downloadChecker = {
|
||||
$files = Get-ChildItem $dir;
|
||||
|
||||
if ((@($files)).Count -gt 0) {
|
||||
foreach ($file in $files) {
|
||||
try {
|
||||
$stream = [System.IO.File]::Open($file.FullName, [System.IO.FileMode]::Open, [System.IO.FileAccess]::ReadWrite, [System.IO.FileShare]::None);
|
||||
|
||||
if ($stream) {
|
||||
$stream.Close();
|
||||
}
|
||||
}
|
||||
catch {
|
||||
return $true;
|
||||
}
|
||||
}
|
||||
catch {
|
||||
return $true;
|
||||
}
|
||||
|
||||
return $false;
|
||||
} else {
|
||||
return $true;
|
||||
}
|
||||
|
||||
return $false;
|
||||
} else {
|
||||
return $true;
|
||||
};
|
||||
|
||||
$browser = [OpenQA.Selenium.Firefox.FirefoxDriver]::new($options);
|
||||
$browser.Navigate().GoToUrl($URL);
|
||||
$null = & $downloadAction -Browser $browser;
|
||||
|
||||
while (& $downloadChecker) {
|
||||
Write-Host "Waiting for the download to finish…";
|
||||
Start-Sleep 1;
|
||||
}
|
||||
};
|
||||
|
||||
$browser = [OpenQA.Selenium.Firefox.FirefoxDriver]::new($options);
|
||||
$browser.Navigate().GoToUrl($URL);
|
||||
& $Action -Browser $browser;
|
||||
|
||||
while (& $downloadChecker) {
|
||||
Write-Host "Waiting for the download to finish…";
|
||||
Start-Sleep 1;
|
||||
|
||||
$file = Get-ChildItem $dir;
|
||||
$result = Move-Item $file $OutDir -PassThru;
|
||||
$browser.Quit();
|
||||
Remove-Item -Recurse $dir;
|
||||
$result;
|
||||
}
|
||||
|
||||
$file = Get-ChildItem $dir;
|
||||
$result = Move-Item $file $OutDir -PassThru;
|
||||
$browser.Quit();
|
||||
Remove-Item -Recurse $dir;
|
||||
$result;
|
||||
}
|
||||
|
||||
<#
|
|
@ -6,6 +6,7 @@ enum SetupStage {
|
|||
Initialize
|
||||
Configure
|
||||
Install
|
||||
CreateUser
|
||||
}
|
||||
|
||||
$null = New-Module {
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/pwsh
|
||||
. "$PSScriptRoot/Entrypoints.ps1";
|
||||
. "$PSScriptRoot/../../Common/Software/PowerShell/profile.ps1";
|
||||
. "$PSScriptRoot/../../Common/Scripts/Entrypoints.ps1";
|
||||
. "$PSScriptRoot/../../Common/Software/PowerShell/Profile.ps1";
|
||||
|
||||
class Context {
|
||||
[string]$EntryPoint;
|
||||
|
@ -68,9 +68,9 @@ class Context {
|
|||
|
||||
[void] AddPowerShellProfileStatement([bool] $system, [string] $category, [string] $statement, [bool] $overwrite) {
|
||||
if ($system) {
|
||||
Add-PowerShellProfileStatement -System -Category $category -Statement $statement -Overwrite $overwrite;
|
||||
Add-PowerShellProfileStatement -System -Category $category -Script $statement -Overwrite:$overwrite;
|
||||
} else {
|
||||
Add-PowerShellProfileStatement -Category $category -Statement $statement -Overwrite $overwrite;
|
||||
Add-PowerShellProfileStatement -Category $category -Script $statement -Overwrite:$overwrite;
|
||||
}
|
||||
}
|
||||
|
|
@ -3,7 +3,7 @@ function Start-Operation {
|
|||
[scriptblock] $Action
|
||||
)
|
||||
|
||||
$ErrorActionPreference = 'Inquire';
|
||||
$Global:ErrorActionPreference = 'Inquire';
|
||||
$env:WSLENV = "CONFIG_MODULE/p";
|
||||
|
||||
if ($env:CONFIG_MODULE) {
|
|
@ -33,11 +33,19 @@ function ConvertTo-Injection {
|
|||
#>
|
||||
function Write-PSScript {
|
||||
param(
|
||||
[string] $FileName,
|
||||
[string] $Script,
|
||||
[Parameter(Mandatory=$true)]
|
||||
[Parameter(ParameterSetName="Common")]
|
||||
[Parameter(ParameterSetName="Replace")]
|
||||
[switch] $Replace,
|
||||
[Parameter(ParameterSetName="Append")]
|
||||
[string] $FileName,
|
||||
[Parameter(Mandatory=$true)]
|
||||
[Parameter(ParameterSetName="Common")]
|
||||
[Parameter(ParameterSetName="Replace")]
|
||||
[Parameter(ParameterSetName="Append")]
|
||||
[string] $Script,
|
||||
[Parameter(ParameterSetName="Replace", Mandatory=$true)]
|
||||
[switch] $Replace,
|
||||
[Parameter(ParameterSetName="Append", Mandatory=$true)]
|
||||
[switch] $Append
|
||||
)
|
||||
|
|
@ -32,7 +32,10 @@ $null = New-Module {
|
|||
|
||||
if (-not ($Force.IsPresent)) {
|
||||
for ($i = $Names.Count - 1; $i -ge 0; $i--) {
|
||||
if (Test-ChocoPackage $Names[$i]) {
|
||||
$name = $Names[$i];
|
||||
|
||||
if (Test-ChocoPackage $name) {
|
||||
Write-Host "Package ``$name`` is already installed"
|
||||
$Names.RemoveAt($i);
|
||||
}
|
||||
}
|
||||
|
@ -53,17 +56,73 @@ $null = New-Module {
|
|||
function Install-WingetPackage {
|
||||
param(
|
||||
[switch] $Force,
|
||||
[string[]] $ArgumentList,
|
||||
[Parameter(Position=0)]
|
||||
[string] $Name,
|
||||
[Parameter(ValueFromRemainingArguments = $true)]
|
||||
[string[]] $Names
|
||||
[string[]] $AdditionalNames = @()
|
||||
)
|
||||
|
||||
[System.Collections.ArrayList] $Names = @();
|
||||
$null = $Names.Add($Name);
|
||||
$Names.AddRange($AdditionalNames);
|
||||
|
||||
foreach ($name in $Names) {
|
||||
if ($Force.IsPresent -and -not (Test-WingetPackage $name)) {
|
||||
winget install --accept-source-agreements --accept-package-agreements -e --id $name;
|
||||
if ($Force.IsPresent -or -not (Test-WingetPackage $name)) {
|
||||
winget install `
|
||||
--accept-source-agreements --accept-package-agreements `
|
||||
--source winget `
|
||||
--exact --id $name $ArgumentList;
|
||||
} else {
|
||||
Write-Host "Package ``$name`` is already installed"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Installs a setup package from the specified source.
|
||||
|
||||
.PARAMETER Source
|
||||
The location of the setup package.
|
||||
|
||||
.PARAMETER ArgumentList
|
||||
The arguments to pass to the setup package.
|
||||
|
||||
.PARAMETER Local
|
||||
A value indicating whether the setup package is stored locally.
|
||||
#>
|
||||
function Install-SetupPackage {
|
||||
param(
|
||||
[string] $Source,
|
||||
[string[]] $ArgumentList = @("/S"),
|
||||
[switch] $Local
|
||||
)
|
||||
|
||||
[string] $dir = $null;
|
||||
[string] $filePath = $null;
|
||||
|
||||
if (-not ($Local.IsPresent)) {
|
||||
$dir = New-TemporaryDirectory;
|
||||
Write-Host "Determining the file name of ``$Source``…";
|
||||
$fileName = ([uri]$Source).Segments[-1];
|
||||
Write-Host "Found name ``$fileName``";
|
||||
$filePath = Join-Path $dir $fileName;
|
||||
|
||||
Write-Host "Downloading setup file from ``$Source``";
|
||||
Invoke-WebRequest $Source -OutFile $filePath;
|
||||
} else {
|
||||
$filePath = $Source;
|
||||
}
|
||||
|
||||
Write-Host "Starting installation of ``$(Split-Path -Leaf $filePath)``";
|
||||
Start-Process -Wait -WorkingDirectory (Split-Path -Parent $filePath) -FilePath $filePath -ArgumentList $ArgumentList;
|
||||
|
||||
if ($dir) {
|
||||
Remove-Item -Recurse $dir;
|
||||
}
|
||||
}
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Installs a package downloaded from ASUS.
|
||||
|
@ -125,12 +184,12 @@ $null = New-Module {
|
|||
try {
|
||||
& $download;
|
||||
} catch {
|
||||
$Browser.ExecuteScript("document.querySelector('$cookieBannerSelector').remove()");
|
||||
$null = $Browser.ExecuteScript("document.querySelector('$cookieBannerSelector').remove()");
|
||||
& $download;
|
||||
}
|
||||
};
|
||||
|
||||
Start-Process -Wait -WorkingDirectory $dir -FilePath $file -ArgumentList "/S";
|
||||
Start-Process -Wait -WorkingDirectory (Split-Path -Parent "$file") -FilePath "$file" -ArgumentList "/S";
|
||||
Remove-Item -Recurse $dir;
|
||||
}
|
||||
|
||||
|
@ -140,10 +199,18 @@ $null = New-Module {
|
|||
[scriptblock] $Installer = { },
|
||||
[scriptblock] $Configurator = { },
|
||||
[scriptblock] $UserConfigurator = { },
|
||||
[InstallerAction] $Action = [InstallerAction]::Install,
|
||||
[Nullable[InstallerAction]] $Action,
|
||||
[hashtable] $Arguments
|
||||
)
|
||||
|
||||
[InstallerAction] $Action = & {
|
||||
if ($Action.HasValue) {
|
||||
$Action;
|
||||
} else {
|
||||
[InstallerAction]::Install;
|
||||
}
|
||||
};
|
||||
|
||||
if (-not $Name) {
|
||||
$Name = Split-Path -Leaf (Split-Path -Parent ((Get-PSCallStack)[1].ScriptName));
|
||||
}
|
||||
|
@ -171,12 +238,12 @@ $null = New-Module {
|
|||
if ($action -eq ([InstallerAction]::Install)) {
|
||||
Write-Host "Installing $Name…";
|
||||
& $Installer @argumentList;
|
||||
# ToDo: Automatically configure after installation
|
||||
} elseif ($Action -eq ([InstallerAction]::Configure)) {
|
||||
Write-Host "Configuring $Name…";
|
||||
& $Configurator @argumentList;
|
||||
|
||||
foreach ($user in Get-Users) {
|
||||
$Arguments.Add($userArgument, $user);
|
||||
|
||||
if (-not (Test-SetupUser)) {
|
||||
$argumentList.Add("action", [InstallerAction]::ConfigureUser);
|
||||
& $installHandler @argumentList;
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
. "$PSScriptRoot/Context.ps1";
|
||||
|
||||
function Install-SoftwarePackage([Context] $context, [string] $location, [string[]] $argumentList = @("/S"), [switch]$local) {
|
||||
function Install-SoftwarePackage($context, [string] $location, [string[]] $argumentList = @("/S"), [switch]$local) {
|
||||
. "$PSScriptRoot/Context.ps1";
|
||||
[Context]$context = $context;
|
||||
[string]$filePath = "";
|
||||
[string]$tempDir = $null;
|
||||
|
||||
|
@ -56,7 +56,7 @@ function Test-WingetPackage {
|
|||
[string] $ID
|
||||
)
|
||||
|
||||
-not (& { $null = winget list --accept-source-agreements -e --id $ID; $?; });
|
||||
& { $null = winget list --accept-source-agreements -e --id $ID; $?; };
|
||||
}
|
||||
|
||||
<#
|
|
@ -29,3 +29,19 @@ function Remove-DesktopIcon {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Removes icons from the task bar.
|
||||
|
||||
.PARAMETER Pattern
|
||||
The pattern of the icon names to remove.
|
||||
#>
|
||||
function Remove-TaskbarItem {
|
||||
param(
|
||||
[string] $Pattern
|
||||
)
|
||||
|
||||
Import-Module -UseWindowsPowerShell PinnedItem;
|
||||
Get-PinnedItem -Type TaskBar | Where-Object { $_.Name -like "$Pattern" } | Remove-PinnedItem;
|
||||
}
|
28
scripts/Common/Software/Oh My Posh/Manage.ps1
Normal file
28
scripts/Common/Software/Oh My Posh/Manage.ps1
Normal file
|
@ -0,0 +1,28 @@
|
|||
param (
|
||||
$Action,
|
||||
[hashtable] $Arguments
|
||||
)
|
||||
|
||||
. "$PSScriptRoot/../PowerShell/Profile.ps1";
|
||||
. "$PSScriptRoot/../../Scripts/Software.ps1";
|
||||
. "$PSScriptRoot/../../Types/InstallerAction.ps1";
|
||||
|
||||
Start-SoftwareInstaller @PSBoundParameters `
|
||||
-Installer {
|
||||
param(
|
||||
[scriptblock] $Installer
|
||||
)
|
||||
|
||||
& $Installer -Action ([InstallerAction]::Configure);
|
||||
} `
|
||||
-Configurator {
|
||||
Add-PowerShellProfileStatement `
|
||||
-System `
|
||||
-Category "oh-my-posh" `
|
||||
-Script (
|
||||
@(
|
||||
"# Oh My Posh!",
|
||||
(Get-ScriptInitializer "oh-my-posh init pwsh"),
|
||||
(Get-ScriptInitializer "oh-my-posh completion powershell")
|
||||
) -join [System.Environment]::NewLine)
|
||||
};
|
|
@ -3,9 +3,9 @@ param (
|
|||
[hashtable] $Arguments
|
||||
)
|
||||
|
||||
. "$PSScriptRoot/../../../Windows/Scripts/Software.ps1";
|
||||
. "$PSScriptRoot/../../../Windows/Scripts/Scripting.ps1";
|
||||
. "$PSScriptRoot/../../../Windows/Types/InstallerAction.ps1";
|
||||
. "$PSScriptRoot/../../Scripts/Software.ps1";
|
||||
. "$PSScriptRoot/../../Software/PowerShell/Profile.ps1";
|
||||
. "$PSScriptRoot/../../Types/InstallerAction.ps1";
|
||||
|
||||
Start-SoftwareInstaller @PSBoundParameters `
|
||||
-Installer {
|
||||
|
@ -16,45 +16,35 @@ Start-SoftwareInstaller @PSBoundParameters `
|
|||
& $Installer -Action ([InstallerAction]::Configure);
|
||||
} `
|
||||
-Configurator {
|
||||
param(
|
||||
[hashtable] $Arguments
|
||||
)
|
||||
|
||||
[string] $globalDir = $null;
|
||||
$indicator = "# Profile Files";
|
||||
|
||||
if ($Arguments.Linux) {
|
||||
if (-not $IsWindows) {
|
||||
$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 { . $_; };
|
||||
}
|
||||
if (-not ((Test-Path -PathType Leaf $PROFILE) -and ((Get-Content $PROFILE) -contains $indicator))) {
|
||||
Add-PowerShellProfileStatement `
|
||||
-DefaultUser `
|
||||
-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;
|
||||
}
|
||||
}
|
||||
}).ToString()) -join "`n") `
|
||||
-Append;
|
||||
}
|
||||
};
|
||||
|
|
58
scripts/Common/Software/PowerShell/Module.ps1
Normal file
58
scripts/Common/Software/PowerShell/Module.ps1
Normal file
|
@ -0,0 +1,58 @@
|
|||
. "$PSScriptRoot/../../Software/PowerShell/Profile.ps1";
|
||||
. "$PSScriptRoot/../../Types/InstallerAction.ps1";
|
||||
|
||||
$null = New-Module {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Generates the components for creating a module installer.
|
||||
|
||||
.PARAMETER Name
|
||||
The name of the module to install.
|
||||
#>
|
||||
function Get-ModuleInstallerComponents {
|
||||
param(
|
||||
[string] $Name,
|
||||
[switch] $NativeOnly
|
||||
)
|
||||
|
||||
@{
|
||||
arguments = @{
|
||||
name = $Name;
|
||||
nativeOnly = $NativeOnly;
|
||||
};
|
||||
installer = {
|
||||
param(
|
||||
[scriptblock] $Installer,
|
||||
[hashtable] $Arguments
|
||||
)
|
||||
|
||||
$env:PENDING_MODULE_NAME = $Arguments.Name;
|
||||
$installAction = { Install-Module -Scope AllUsers -Force $env:PENDING_MODULE_NAME @args };
|
||||
|
||||
if (-not $Arguments.NativeOnly) {
|
||||
& $installAction -AcceptLicense;
|
||||
}
|
||||
|
||||
if (Test-Command powershell) {
|
||||
powershell -c ($installAction.ToString());
|
||||
}
|
||||
|
||||
Remove-Item Env:\PENDING_MODULE_NAME;
|
||||
& $Installer -Action ([InstallerAction]::Configure) @PSBoundParameters;
|
||||
};
|
||||
|
||||
configurator = {
|
||||
param(
|
||||
[hashtable] $Arguments
|
||||
)
|
||||
|
||||
$name = $Arguments.Name;
|
||||
|
||||
Add-PowerShellProfileStatement `
|
||||
-DefaultUser `
|
||||
-Category $name `
|
||||
-Script "Import-Module `"$name`";";
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
121
scripts/Common/Software/PowerShell/Profile.ps1
Normal file
121
scripts/Common/Software/PowerShell/Profile.ps1
Normal file
|
@ -0,0 +1,121 @@
|
|||
$null = New-Module {
|
||||
. "$PSScriptRoot/../../Scripts/Scripting.ps1";
|
||||
. "$PSScriptRoot/../../Scripts/Software.ps1";
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Adds an initialization script to the profile.
|
||||
|
||||
.PARAMETER System
|
||||
A value indicating whether the script should be installed globally.
|
||||
|
||||
.PARAMETER DefaultUser
|
||||
A value indicating whether the script should be installed to users by default.
|
||||
|
||||
.PARAMETER HomeDir
|
||||
The path to the home directory of the user to install the script to.
|
||||
|
||||
.PARAMETER Category
|
||||
The category name of the script to install.
|
||||
|
||||
.PARAMETER Script
|
||||
The script to install.
|
||||
|
||||
.PARAMETER Replace
|
||||
A value indicating whether the script should be replaced if it already exists.
|
||||
|
||||
.PARAMETER Append
|
||||
A value indicating whether the content should be appended to the script if it already exists.
|
||||
#>
|
||||
function Add-PowerShellProfileStatement {
|
||||
param(
|
||||
[Parameter(ParameterSetName = "Global", Mandatory)]
|
||||
[switch] $System,
|
||||
[Parameter(ParameterSetName = "DefaultUser", Mandatory)]
|
||||
[switch] $DefaultUser,
|
||||
[Parameter(ParameterSetName = "Home")]
|
||||
[string] $HomeDir = "~",
|
||||
[Parameter(ParameterSetName = "Global", Mandatory)]
|
||||
[Parameter(ParameterSetName = "DefaultUser")]
|
||||
[Parameter(ParameterSetName = "Home")]
|
||||
[string] $Category = $null,
|
||||
[Parameter(Position = 0, Mandatory)]
|
||||
[string] $Script,
|
||||
[switch] $Replace,
|
||||
[switch] $Append
|
||||
)
|
||||
|
||||
[System.Collections.ArrayList] $profiles = @();
|
||||
|
||||
if ($System) {
|
||||
[string] $configRoot = $null;
|
||||
|
||||
if ($IsWindows) {
|
||||
# ToDo Change to "PowerShell"
|
||||
$configRoot = "$env:ProgramData";
|
||||
} else {
|
||||
$configRoot = "/etc";
|
||||
}
|
||||
|
||||
$profiles = @("$configRoot/powershell/.");
|
||||
} else {
|
||||
if ($DefaultUser) {
|
||||
if (-not $IsWindows) {
|
||||
$HomeDir = "/etc/skel";
|
||||
} else {
|
||||
$HomeDir = "C:/Users/Default";
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($shell in @("pwsh", "powershell")) {
|
||||
if (Test-Command $shell) {
|
||||
$null = $profiles.Add((& $shell -NoProfile -c '$PROFILE'));
|
||||
}
|
||||
}
|
||||
|
||||
Push-Location ~;
|
||||
|
||||
$profiles = $profiles |
|
||||
ForEach-Object { [System.IO.Path]::GetRelativePath((Get-Location), $_) } |
|
||||
ForEach-Object { "$HomeDir/$_" };
|
||||
|
||||
Pop-Location;
|
||||
}
|
||||
|
||||
if ($Category) {
|
||||
$profiles = @($profiles | ForEach-Object { Join-Path (Split-Path -Parent $_) "conf.d" "$Category.ps1" });
|
||||
}
|
||||
|
||||
$profiles | ForEach-Object {
|
||||
$arguments = @{};
|
||||
|
||||
if ($Replace.IsPresent) {
|
||||
$null = $arguments.Add("Replace", $Replace);
|
||||
}
|
||||
|
||||
if ($Append.IsPresent) {
|
||||
$null = $arguments.Add("Append", $Append);
|
||||
}
|
||||
|
||||
Write-PSScript @arguments `
|
||||
-FileName $_ `
|
||||
-Script $Script;
|
||||
};
|
||||
}
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Creates an eval-script using the `[scriptblock]::Create` method.
|
||||
|
||||
.PARAMETER Initializer
|
||||
The code to evaluate.
|
||||
#>
|
||||
function Get-ScriptInitializer {
|
||||
param (
|
||||
[Parameter(Position=0, Mandatory=$true)]
|
||||
$Initializer
|
||||
)
|
||||
|
||||
return ". ([scriptblock]::Create(($Initializer) -join `"``n`"))";
|
||||
}
|
||||
};
|
|
@ -1,95 +0,0 @@
|
|||
#!/bin/pwsh
|
||||
$null = New-Module {
|
||||
function Add-PowerShellProfileStatement() {
|
||||
param (
|
||||
[Parameter(ParameterSetName="Global", Mandatory)]
|
||||
[switch]$System,
|
||||
[Parameter(ParameterSetName="DefaultUser", Mandatory)]
|
||||
[switch]$DefaultUser,
|
||||
[Parameter(ParameterSetName="Home")]
|
||||
[string]$HomeDir = "~",
|
||||
[Parameter(ParameterSetName="Global", Mandatory)]
|
||||
[Parameter(ParameterSetName="DefaultUser")]
|
||||
[Parameter(ParameterSetName="Home")]
|
||||
[string]$Category = $null,
|
||||
[Parameter(Position=0, Mandatory=$true)]
|
||||
[string]$Statement,
|
||||
[switch]$Overwrite
|
||||
)
|
||||
|
||||
[System.Collections.Generic.List[string]] $profiles = @();
|
||||
|
||||
if ($System) {
|
||||
$configRoot;
|
||||
|
||||
if ($IsWindows) {
|
||||
$configRoot = "$env:ProgramData";
|
||||
} else {
|
||||
$configRoot = "/etc";
|
||||
}
|
||||
|
||||
$profiles = @("$configRoot/powershell/.");
|
||||
} else {
|
||||
[System.Collections.Generic.List[string]] $shells = @();
|
||||
|
||||
if ($DefaultUser) {
|
||||
if ($IsWindows) {
|
||||
$HomeDir = "C:/Users/Default";
|
||||
} else {
|
||||
$HomeDir = "/etc/skel"
|
||||
}
|
||||
}
|
||||
|
||||
if (Get-Command pwsh -ErrorAction SilentlyContinue) {
|
||||
$shells.Add("pwsh");
|
||||
}
|
||||
|
||||
if (Get-Command powershell -ErrorAction SilentlyContinue) {
|
||||
$shells.Add("powershell");
|
||||
}
|
||||
|
||||
foreach ($shell in $shells) {
|
||||
$path = & $shell -NoProfile -c '$PROFILE';
|
||||
$profiles.Add($path);
|
||||
}
|
||||
|
||||
Push-Location ~;
|
||||
$profiles = $profiles |
|
||||
ForEach-Object { [System.IO.Path]::GetRelativePath($(Get-Location), $_); } |
|
||||
ForEach-Object { "$HomeDir/$_" };
|
||||
}
|
||||
|
||||
if ($Category) {
|
||||
if (-not $($Overwrite.IsPresent)) {
|
||||
$Overwrite = $true;
|
||||
}
|
||||
|
||||
$profiles = $profiles | ForEach-Object { Join-Path (Split-Path -Parent $_) "conf.d" "$Category.ps1"; };
|
||||
}
|
||||
|
||||
$profiles | ForEach-Object {
|
||||
$dirName = Split-Path -Parent $_;
|
||||
|
||||
if (-not (Test-Path -PathType Container $dirName)) {
|
||||
$null = New-Item -ItemType Directory -Force $dirName;
|
||||
}
|
||||
|
||||
if ((Test-Path -PathType Leaf $_) -and (-not $Overwrite)) {
|
||||
Add-Content -Force "$_" "`n$Statement";
|
||||
} else {
|
||||
Set-Content -Force "$_" "$Statement";
|
||||
}
|
||||
};
|
||||
|
||||
Pop-Location;
|
||||
}
|
||||
|
||||
function Get-ScriptInitializer() {
|
||||
param (
|
||||
[Parameter(Position=0, Mandatory=$true)]
|
||||
$Initializer
|
||||
)
|
||||
|
||||
return ". ([scriptblock]::Create(($Initializer) -join `"``n`"))";
|
||||
}
|
||||
}
|
15
scripts/Common/Software/Terminal-Icons/Manage.ps1
Normal file
15
scripts/Common/Software/Terminal-Icons/Manage.ps1
Normal file
|
@ -0,0 +1,15 @@
|
|||
param (
|
||||
$Action,
|
||||
[hashtable] $Arguments
|
||||
)
|
||||
|
||||
. "$PSScriptRoot/../PowerShell/Module.ps1";
|
||||
. "$PSScriptRoot/../../Scripts/Software.ps1";
|
||||
|
||||
$parameters = Get-ModuleInstallerComponents "Terminal-Icons";
|
||||
|
||||
foreach ($key in $PSBoundParameters.Keys) {
|
||||
$parameters.Add($key, $PSBoundParameters[$key]);
|
||||
}
|
||||
|
||||
Start-SoftwareInstaller @parameters;
|
15
scripts/Common/Software/posh-git/Manage.ps1
Normal file
15
scripts/Common/Software/posh-git/Manage.ps1
Normal file
|
@ -0,0 +1,15 @@
|
|||
param (
|
||||
$Action,
|
||||
[hashtable] $Arguments
|
||||
)
|
||||
|
||||
. "$PSScriptRoot/../PowerShell/Module.ps1";
|
||||
. "$PSScriptRoot/../../Scripts/Software.ps1";
|
||||
|
||||
$parameters = Get-ModuleInstallerComponents "posh-git";
|
||||
|
||||
foreach ($key in $PSBoundParameters.Keys) {
|
||||
$parameters.Add($key, $PSBoundParameters[$key]);
|
||||
}
|
||||
|
||||
Start-SoftwareInstaller @parameters;
|
|
@ -1,10 +1,10 @@
|
|||
#!/bin/pwsh
|
||||
. "$PSScriptRoot/../PowerShell/profile.ps1";
|
||||
. "$PSScriptRoot/../PowerShell/Profile.ps1";
|
||||
|
||||
Add-PowerShellProfileStatement `
|
||||
-System `
|
||||
-Category "zoxide" `
|
||||
-Statement $(
|
||||
-Script $(
|
||||
@(
|
||||
"# zoxide",
|
||||
$(Get-ScriptInitializer "zoxide init powershell | Out-String")
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
#!/bin/pwsh
|
||||
. "$PSScriptRoot/../Scripts/Context.ps1";
|
||||
. "$PSScriptRoot/../Scripts/SoftwareManagement.ps1";
|
||||
. "$PSScriptRoot/../Software/Firefox/Install.ps1";
|
||||
. "$PSScriptRoot/../Software/git/Manage.ps1";
|
||||
. "$PSScriptRoot/../Software/LGHub/Manage.ps1";
|
||||
. "$PSScriptRoot/../Software/ManiaPlanet/Manage.ps1";
|
||||
. "$PSScriptRoot/../Software/osu!/Manage.ps1";
|
||||
. "$PSScriptRoot/../Software/osu!lazer/Manage.ps1";
|
||||
. "$PSScriptRoot/../Software/PuTTY/Manage.ps1";
|
||||
. "$PSScriptRoot/../Software/RetroArch/Manage.ps1";
|
||||
. "$PSScriptRoot/../Software/reWASD/Manage.ps1";
|
||||
. "$PSScriptRoot/../Software/TrackMania Nations Forever/Manage.ps1";
|
||||
. "$PSScriptRoot/../Software/TrackMania United Forever/Manage.ps1";
|
||||
. "$PSScriptRoot/../Software/VisualStudio/Manage.ps1";
|
||||
. "$PSScriptRoot/../Software/git/Install.ps1";
|
||||
. "$PSScriptRoot/../Software/LGHub/Install.ps1";
|
||||
. "$PSScriptRoot/../Software/ManiaPlanet/Install.ps1";
|
||||
. "$PSScriptRoot/../Software/osu!/Install.ps1";
|
||||
. "$PSScriptRoot/../Software/osu!lazer/Install.ps1";
|
||||
. "$PSScriptRoot/../Software/PuTTY/Install.ps1";
|
||||
. "$PSScriptRoot/../Software/RetroArch/Install.ps1";
|
||||
. "$PSScriptRoot/../Software/reWASD/Install.ps1";
|
||||
. "$PSScriptRoot/../Software/TrackMania Nations Forever/Install.ps1";
|
||||
. "$PSScriptRoot/../Software/TrackMania United Forever/Install.ps1";
|
||||
. "$PSScriptRoot/../Software/VisualStudio/Install.ps1";
|
||||
. "$PSScriptRoot/../../Common/Scripts/Context.ps1";
|
||||
. "$PSScriptRoot/../../Common/Scripts/SoftwareManagement.ps1";
|
||||
|
||||
function Backup-GenericApps([Context] $context) {
|
||||
Backup-Git $context;
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
#!/bin/pwsh
|
||||
. "$PSScriptRoot/../Scripts/Context.ps1";
|
||||
. "$PSScriptRoot/Generic.ps1";
|
||||
. "$PSScriptRoot/../Scripts/SoftwareManagement.ps1";
|
||||
. "$PSScriptRoot/../Software/Firefox/Install.ps1";
|
||||
. "$PSScriptRoot/../Software/git/Manage.ps1";
|
||||
. "$PSScriptRoot/../Software/LGHub/Manage.ps1";
|
||||
. "$PSScriptRoot/../Software/ManiaPlanet/Manage.ps1";
|
||||
. "$PSScriptRoot/../Software/osu!/Manage.ps1";
|
||||
. "$PSScriptRoot/../Software/osu!lazer/Manage.ps1";
|
||||
. "$PSScriptRoot/../Software/PuTTY/Manage.ps1";
|
||||
. "$PSScriptRoot/../Software/RetroArch/Manage.ps1";
|
||||
. "$PSScriptRoot/../Software/reWASD/Manage.ps1";
|
||||
. "$PSScriptRoot/../Software/TrackMania Nations Forever/Manage.ps1";
|
||||
. "$PSScriptRoot/../Software/TrackMania United Forever/Manage.ps1";
|
||||
. "$PSScriptRoot/../Software/VisualStudio/Manage.ps1";
|
||||
. "$PSScriptRoot/../Software/git/Install.ps1";
|
||||
. "$PSScriptRoot/../Software/LGHub/Install.ps1";
|
||||
. "$PSScriptRoot/../Software/ManiaPlanet/Install.ps1";
|
||||
. "$PSScriptRoot/../Software/osu!/Install.ps1";
|
||||
. "$PSScriptRoot/../Software/osu!lazer/Install.ps1";
|
||||
. "$PSScriptRoot/../Software/PuTTY/Install.ps1";
|
||||
. "$PSScriptRoot/../Software/RetroArch/Install.ps1";
|
||||
. "$PSScriptRoot/../Software/reWASD/Install.ps1";
|
||||
. "$PSScriptRoot/../Software/TrackMania Nations Forever/Install.ps1";
|
||||
. "$PSScriptRoot/../Software/TrackMania United Forever/Install.ps1";
|
||||
. "$PSScriptRoot/../Software/VisualStudio/Install.ps1";
|
||||
. "$PSScriptRoot/../../Common/Scripts/Context.ps1";
|
||||
. "$PSScriptRoot/../../Common/Scripts/SoftwareManagement.ps1";
|
||||
|
||||
function Backup-PersonalApps([Context] $context) {
|
||||
Backup-GenericApps $context;
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
#!/bin/pwsh
|
||||
. "$PSScriptRoot/../../../Common/Software/PowerShell/profile.ps1";
|
||||
Add-PowerShellProfileStatement -System -Category "Terminal-Icons" -Statement 'Import-Module "Terminal-Icons";';
|
||||
. "$PSScriptRoot/../../../Common/Software/PowerShell/Profile.ps1";
|
||||
Add-PowerShellProfileStatement -System -Category "Terminal-Icons" -Script 'Import-Module "Terminal-Icons";';
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/pwsh
|
||||
param($context)
|
||||
|
||||
. "$PSScriptRoot/../../Scripts/Context.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Scripts/Context.ps1";
|
||||
|
||||
[Context] $context = $context;
|
||||
$tempDir = $context.GetTempDirectory();
|
||||
|
|
|
@ -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";'
|
||||
Add-PowerShellProfileStatement -System -Category "posh-git" -Script 'Import-Module "posh-git";'
|
||||
|
|
|
@ -3,7 +3,7 @@ param(
|
|||
[hashtable] $Arguments
|
||||
)
|
||||
|
||||
. "$PSScriptRoot/../../Scripts/Software.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
|
||||
|
||||
Start-SoftwareInstaller @PSBoundParameters `
|
||||
-Installer {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
param($context)
|
||||
|
||||
|
||||
. "$PSScriptRoot/../../Scripts/Context.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Scripts/Context.ps1";
|
||||
[Context]$context = $context;
|
||||
|
||||
$tempDir = $context.GetTempDirectory();
|
||||
|
|
|
@ -3,7 +3,7 @@ param(
|
|||
[hashtable] $Arguments
|
||||
)
|
||||
|
||||
. "$PSScriptRoot/../../Scripts/Software.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
|
||||
. "$PSScriptRoot/../../Scripts/System.ps1";
|
||||
|
||||
Start-SoftwareInstaller @PSBoundParameters `
|
||||
|
|
|
@ -3,7 +3,7 @@ param(
|
|||
[hashtable] $Arguments
|
||||
)
|
||||
|
||||
. "$PSScriptRoot/../../../Scripts/Software.ps1";
|
||||
. "$PSScriptRoot/../../../../Common/Scripts/Software.ps1";
|
||||
|
||||
Start-SoftwareInstaller @PSBoundParameters `
|
||||
-Installer {
|
||||
|
|
|
@ -3,7 +3,7 @@ param(
|
|||
[hashtable] $Arguments
|
||||
)
|
||||
|
||||
. "$PSScriptRoot/../../../Scripts/Software.ps1";
|
||||
. "$PSScriptRoot/../../../../Common/Scripts/Software.ps1";
|
||||
|
||||
Start-SoftwareInstaller @PSBoundParameters `
|
||||
-Installer {
|
||||
|
|
|
@ -3,7 +3,7 @@ param(
|
|||
[hashtable] $Arguments
|
||||
)
|
||||
|
||||
. "$PSScriptRoot/../../../Scripts/Software.ps1";
|
||||
. "$PSScriptRoot/../../../../Common/Scripts/Software.ps1";
|
||||
|
||||
Start-SoftwareInstaller @PSBoundParameters `
|
||||
-Installer {
|
||||
|
|
|
@ -3,7 +3,7 @@ param(
|
|||
[hashtable] $Arguments
|
||||
)
|
||||
|
||||
. "$PSScriptRoot/../../../Scripts/Software.ps1";
|
||||
. "$PSScriptRoot/../../../../Common/Scripts/Software.ps1";
|
||||
|
||||
Start-SoftwareInstaller @PSBoundParameters `
|
||||
-Installer {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/bash
|
||||
param($context)
|
||||
. "$PSScriptRoot/../../Scripts/SoftwareManagement.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Scripts/SoftwareManagement.ps1";
|
||||
|
||||
Write-Host "Installing Tobii Eye Tracking";
|
||||
Install-SoftwarePackage $context "https://files.update.tech.tobii.com/Tobii_Eye_Tracking_Core_v2.16.8.214_x86.exe";
|
||||
|
|
|
@ -3,9 +3,26 @@ param(
|
|||
[hashtable] $Arguments
|
||||
)
|
||||
|
||||
. "$PSScriptRoot/../../Scripts/Software.ps1";
|
||||
$null = New-Module {
|
||||
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
|
||||
$softwarePath = "$PSScriptRoot/../../Software";
|
||||
|
||||
Start-SoftwareInstaller @PSBoundParameters `
|
||||
-Installer {
|
||||
Install-SetupPackage -Source "https://files.update.tech.tobii.com/Tobii_Eye_Tracking_Core_v2.16.8.214_x86.exe";
|
||||
};
|
||||
$appScripts = @(
|
||||
"$softwarePath/TobiiGhost/Manage.ps1",
|
||||
"$softwarePath/TobiiGameHub/Manage.ps1"
|
||||
);
|
||||
|
||||
Start-SoftwareInstaller @PSBoundParameters `
|
||||
-Installer {
|
||||
Install-SetupPackage -Source "https://files.update.tech.tobii.com/Tobii_Eye_Tracking_Core_v2.16.8.214_x86.exe";
|
||||
|
||||
foreach ($script in $appScripts) {
|
||||
. $script @PSBoundParameters;
|
||||
}
|
||||
} `
|
||||
-UserConfigurator {
|
||||
foreach ($script in $appScripts) {
|
||||
. $script @PSBoundParameters;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
#!/bin/pwsh
|
||||
. "$PSScriptRoot/../../../scripts/Windows/Scripts/Prerequisites.ps1";
|
||||
. "$PSScriptRoot/../Scripts/Context.ps1";
|
||||
. "$PSScriptRoot/../../Common/Scripts/Context.ps1";
|
||||
. "$PSScriptRoot/../Software/Firefox/Install.ps1";
|
||||
. "$PSScriptRoot/Manage.ps1";
|
||||
. "$PSScriptRoot/User/Install.ps1";
|
||||
|
||||
$null = New-Module {
|
||||
. "$PSScriptRoot/../Scripts/Config.ps1";
|
||||
. "$PSScriptRoot/../Scripts/Hooks.ps1";
|
||||
. "$PSScriptRoot/../Scripts/Operations.ps1";
|
||||
. "$PSScriptRoot/../Scripts/PowerManagement.ps1";
|
||||
. "$PSScriptRoot/../Scripts/Software.ps1";
|
||||
. "$PSScriptRoot/../Scripts/SoftwareManagement.ps1";
|
||||
. "$PSScriptRoot/../Scripts/Update.ps1";
|
||||
. "$PSScriptRoot/../Types/InstallerAction.ps1";
|
||||
. "$PSScriptRoot/../../Common/Scripts/Config.ps1";
|
||||
. "$PSScriptRoot/../../Common/Scripts/Operations.ps1";
|
||||
. "$PSScriptRoot/../../Common/Scripts/Software.ps1";
|
||||
. "$PSScriptRoot/../../Common/Scripts/SoftwareManagement.ps1";
|
||||
. "$PSScriptRoot/../../Common/Types/InstallerAction.ps1";
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
|
@ -45,6 +45,12 @@ $null = New-Module {
|
|||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (-not (Test-Command "git")) {
|
||||
Install-ChocoPackage git;
|
||||
refreshenv;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (-not (Test-ChocoPackage "powershell-core")) {
|
||||
Invoke-Hook "Install-PowerShellCore" -Fallback {
|
||||
|
@ -61,15 +67,29 @@ $null = New-Module {
|
|||
continue;
|
||||
}
|
||||
|
||||
Invoke-Hook "Install-PSModules" -Fallback {
|
||||
Install-Module -AcceptLicense -Force PSWindowsUpdate;
|
||||
Install-Module -AcceptLicense -Force PSScriptAnalyzer;
|
||||
};
|
||||
|
||||
if (-not (Test-Winget)) {
|
||||
. "$PSScriptRoot/../Software/winget/Manage.ps1";
|
||||
continue;
|
||||
}
|
||||
|
||||
if (-not (& { wsl --status; $?; })) {
|
||||
wsl --install --no-launch;
|
||||
Restart-Intermediate;
|
||||
return;
|
||||
}
|
||||
|
||||
if (-not (wsl --shell-type login type -t nix)) {
|
||||
ubuntu install --root;
|
||||
wsl -- sh `<`(curl -L https://nixos.org/nix/install`) --daemon --yes;
|
||||
wsl --shutdown;
|
||||
continue;
|
||||
}
|
||||
|
||||
Invoke-Hook "Install-PSModules" -Fallback {
|
||||
Install-Module -AcceptLicense -Force PSWindowsUpdate;
|
||||
Install-Module -AcceptLicense -Force PSScriptAnalyzer;
|
||||
. "$PSScriptRoot/../Software/PinnedItem/Manage.ps1";
|
||||
};
|
||||
|
||||
if (-not (Test-PSPackage Selenium.WebDriver)) {
|
||||
Install-Module -AcceptLicense -Force NuGet;
|
||||
|
@ -79,20 +99,7 @@ $null = New-Module {
|
|||
}
|
||||
|
||||
Install-ChocoPackage selenium-gecko-driver firefox;
|
||||
|
||||
if (-not (& { wsl --status; $?; })) {
|
||||
wsl --install --no-launch;
|
||||
Restart-Intermediate;
|
||||
return;
|
||||
} else {
|
||||
ubuntu install --root;
|
||||
wsl -- sh `<`(curl -L https://nixos.org/nix/install`) --daemon --yes;
|
||||
wsl --shutdown;
|
||||
}
|
||||
|
||||
if (wsl --shell-type login type -t nix) {
|
||||
Set-Stage ([SetupStage]::Configure);
|
||||
}
|
||||
Set-Stage ([SetupStage]::Configure);
|
||||
} else {
|
||||
$null = Import-Module PSWindowsUpdate;
|
||||
|
||||
|
@ -117,10 +124,14 @@ $null = New-Module {
|
|||
[InstallerAction] $Action
|
||||
)
|
||||
|
||||
[bool] $install = $null;
|
||||
$arguments = [hashtable]@{ };
|
||||
|
||||
if ($Action) {
|
||||
$arguments.Add("action", $Action);
|
||||
$install = $true;
|
||||
$null = $arguments.Add("action", $Action);
|
||||
} else {
|
||||
$install = ($Action -eq ([InstallerAction]::Install));
|
||||
}
|
||||
|
||||
# Drivers
|
||||
|
@ -144,7 +155,7 @@ $null = New-Module {
|
|||
}
|
||||
}
|
||||
|
||||
if (-not $Action -or ($Action -eq ([InstallerAction]::Install))) {
|
||||
if ($install) {
|
||||
if (Get-Config "valhalla.hardware.amdCPU") {
|
||||
Install-ChocoPackage amd-ryzen-master;
|
||||
# ToDo: backup Ryzen energy saving plan
|
||||
|
@ -177,18 +188,200 @@ $null = New-Module {
|
|||
$null = New-Module {
|
||||
# Windows Config
|
||||
$softwarePath = "$PSScriptRoot/../Software";
|
||||
$commonSoftware = "$PSScriptRoot/../../Common/Software";
|
||||
. "$softwarePath/Windows/Manage.ps1" @arguments;
|
||||
|
||||
if (Get-Config "valhalla.hardware.logitechG") {
|
||||
. "$softwarePath/LGHub/Manage.ps1" @arguments;
|
||||
}
|
||||
|
||||
if (Test-Collection "essential") {
|
||||
# Essentials
|
||||
. "$softwarePath/OpenSSH/Manage.ps1" @arguments;
|
||||
. "$softwarePath/PowerShell/Manage.ps1";
|
||||
. "$softwarePath/PowerShell/Manage.ps1" @arguments;
|
||||
. "$softwarePath/chocolatey/Manage.ps1" @arguments;
|
||||
. "$softwarePath/zoxide/Manage.ps1" @arguments;
|
||||
. "$commonSoftware/posh-git/Manage.ps1" @arguments;
|
||||
. "$commonSoftware/Terminal-Icons/Manage.ps1" @arguments;
|
||||
. "$commonSoftware/Oh My Posh/Manage.ps1" @arguments;
|
||||
|
||||
if ($install) {
|
||||
Install-ChocoPackage `
|
||||
procexp `
|
||||
procmon `
|
||||
;
|
||||
|
||||
Install-WingetPackage `
|
||||
KDE.KDEConnect `
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
if (Test-Collection "common") {
|
||||
# Common Software
|
||||
. "$softwarePath/WinSCP/Manage.ps1" @arguments;
|
||||
. "$softwarePath/Thunderbird/Manage.ps1" @arguments;
|
||||
. "$softwarePath/PuTTY/Manage.ps1" @arguments;
|
||||
|
||||
if ($install) {
|
||||
Install-ChocoPackage `
|
||||
7zip `
|
||||
chocolateygui `
|
||||
DefaultProgramsEditor `
|
||||
bitwarden `
|
||||
keepass `
|
||||
;
|
||||
|
||||
Install-WingetPackage `
|
||||
SomePythonThings.WingetUIStore `
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
if (Test-Collection "desktopExperience") {
|
||||
if ($install) {
|
||||
# Fonts
|
||||
Install-ChocoPackage nerd-fonts-CascadiaCode;
|
||||
|
||||
# Internet Access
|
||||
Install-WingetPackage Brave.Brave kamranahmedse.pennywise;
|
||||
Remove-DesktopIcon "*Brave*";
|
||||
Remove-TaskbarItem "*Brave*";
|
||||
Remove-DesktopIcon "Pennywise*";
|
||||
|
||||
# Tools
|
||||
Install-SetupPackage -Source "https://github.com/mRemoteNG/mRemoteNG/releases/download/2023.03.03-v1.77.3-nb/mRemoteNG-Installer-1.77.3.nb-1784.msi" -ArgumentList "/Quiet";
|
||||
|
||||
Install-ChocoPackage `
|
||||
gimp `
|
||||
gpu-z `
|
||||
windirstat `
|
||||
winmerge `
|
||||
handbrake `
|
||||
hwmonitor `
|
||||
qbittorrent `
|
||||
imgburn `
|
||||
inkscape `
|
||||
krita `
|
||||
MetaX `
|
||||
obs-studio
|
||||
;
|
||||
|
||||
Remove-DesktopIcon "GPU-Z*";
|
||||
Remove-DesktopIcon "WinDirStat*";
|
||||
Remove-DesktopIcon "*HWMonitor*";
|
||||
Remove-DesktopIcon "ImgBurn*";
|
||||
Remove-DesktopIcon "InkScape*";
|
||||
Remove-DesktopIcon "Krita*";
|
||||
Remove-DesktopIcon "mRemoteNG*";
|
||||
Remove-DesktopIcon "MetaX*";
|
||||
Remove-DesktopIcon "OBS Studio*";
|
||||
|
||||
Install-WingetPackage `
|
||||
AntSoftware.AntRenamer `
|
||||
AppWork.JDownloader;
|
||||
|
||||
Remove-DesktopIcon "JDownloader*";
|
||||
}
|
||||
|
||||
# ToDo: Consider hiding behind own config?
|
||||
. "$softwarePath/Ubiquiti UniFi Controller/Manage.ps1" @arguments;
|
||||
|
||||
# Internet Access
|
||||
. "$softwarePath/Firefox/Manage.ps1" @arguments;
|
||||
. "$softwarePath/MSEdgeRedirect/Manage.ps1" @arguments;
|
||||
|
||||
if (Test-Collection "fileSync") {
|
||||
. "$softwarePath/Nextcloud/Manage.ps1" @arguments;
|
||||
}
|
||||
}
|
||||
|
||||
if (Test-Collection "socialMedia") {
|
||||
if ($install) {
|
||||
Install-ChocoPackage `
|
||||
signal `
|
||||
threema-desktop `
|
||||
element-desktop `
|
||||
teamspeak `
|
||||
;
|
||||
|
||||
Remove-DesktopIcon "*Element*";
|
||||
Remove-DesktopIcon "*TeamSpeak*";
|
||||
|
||||
Install-WingetPackage Discord.Discord;
|
||||
Remove-DesktopIcon "*Discord*";
|
||||
}
|
||||
}
|
||||
|
||||
if (Test-Collection "media") {
|
||||
if ($install) {
|
||||
Install-ChocoPackage `
|
||||
k-litecodecpackmega `
|
||||
jellyfin-media-player `
|
||||
vlc `
|
||||
;
|
||||
|
||||
Remove-DesktopIcon "VLC*";
|
||||
Install-WingetPackage Ytmdesktop.Ytmdesktop;
|
||||
Remove-DesktopIcon "Youtube Music*";
|
||||
}
|
||||
}
|
||||
|
||||
if (Test-Collection "coding") {
|
||||
if ($install) {
|
||||
Install-ChocoPackage vscode -ArgumentList "--params","/NoDesktopIcon";
|
||||
Install-ChocoPackage vscodium -ArgumentList "--params","/NoDesktopIcon /AssociateWithFiles";
|
||||
|
||||
Install-ChocoPackage `
|
||||
gh `
|
||||
github-desktop `
|
||||
ida-free `
|
||||
HxD `
|
||||
docker-desktop `
|
||||
imhex `
|
||||
dotpeek `
|
||||
;
|
||||
|
||||
Remove-DesktopIcon "IDA *";
|
||||
Remove-DesktopIcon "GitHub*";
|
||||
Remove-DesktopIcon "Docker*";
|
||||
}
|
||||
|
||||
. "$softwarePath/VisualStudio/Manage.ps1" @arguments;
|
||||
|
||||
# Node.js
|
||||
. "$softwarePath/NVS/Manage.ps1" @arguments;
|
||||
}
|
||||
|
||||
if (Test-Collection "gaming") {
|
||||
# Gaming
|
||||
if ($install) {
|
||||
Install-ChocoPackage `
|
||||
goggalaxy `
|
||||
epicgameslauncher `
|
||||
steam `
|
||||
rayman-controlpanel `
|
||||
ppsspp `
|
||||
;
|
||||
|
||||
Remove-DesktopIcon "*Epic Games*";
|
||||
Remove-DesktopIcon "*Steam*";
|
||||
Remove-DesktopIcon "*PPSSPP *-Bit*";
|
||||
|
||||
Install-ChocoPackage ubisoft-connect -ArgumentList "--ignore-checksums";
|
||||
Remove-DesktopIcon "*Ubisoft Connect*";
|
||||
|
||||
Install-WingetPackage ElectronicArts.EADesktop;
|
||||
Remove-DesktopIcon "EA.*";
|
||||
}
|
||||
|
||||
. "$softwarePath/TrackMania Nations Forever/Manage.ps1" @arguments;
|
||||
. "$softwarePath/TrackMania United Forever/Manage.ps1" @arguments;
|
||||
. "$softwarePath/ManiaPlanet/Manage.ps1" @arguments;
|
||||
. "$softwarePath/osu!/Manage.ps1" @arguments;
|
||||
. "$softwarePath/osu!lazer/Manage.ps1" @arguments;
|
||||
. "$softwarePath/RetorArch/Manage.ps1" @arguments;
|
||||
. "$softwarePath/reWASD/Manage.ps1" @arguments;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -215,6 +408,9 @@ $null = New-Module {
|
|||
([SetupStage]::Install) {
|
||||
Write-Host "Entering install phase";
|
||||
Deploy-SoftwareAction;
|
||||
Set-Stage ([SetupStage]::CreateUser);
|
||||
}
|
||||
([SetupStage]::CreateUser) {
|
||||
Set-IsFinished $true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#!/bin/pwsh
|
||||
. "$PSScriptRoot/../Scripts/Context.ps1";
|
||||
. "$PSScriptRoot/../Scripts/PersonalFiles.ps1";
|
||||
. "$PSScriptRoot/../Software/Firefox/Install.ps1";
|
||||
. "$PSScriptRoot/../Software/Nextcloud/Manage.ps1";
|
||||
. "$PSScriptRoot/../Software/Nextcloud/Install.ps1";
|
||||
. "$PSScriptRoot/../Collections/Personal.ps1";
|
||||
. "$PSScriptRoot/../../Common/Scripts/Context.ps1";
|
||||
|
||||
function Backup-WindowsInstallation([Context] $context) {
|
||||
Write-Information "Backing up Windows";
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#!/bin/pwsh
|
||||
. "$PSScriptRoot/../Scripts/Scripting.ps1";
|
||||
. "$PSScriptRoot/../../Common/Scripts/Scripting.ps1";
|
||||
|
||||
function Start-Setup {
|
||||
. "$PSScriptRoot/../Scripts/Scripting.ps1";
|
||||
. "$PSScriptRoot/../../Common/Scripts/Scripting.ps1";
|
||||
$Global:InformationPreference = "Continue";
|
||||
$Global:ErrorActionPreference = "Inquire";
|
||||
$null = $env:WIN_COMPUTER_NAME;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/bin/pwsh
|
||||
. "$PSScriptRoot/../Scripts/Context.ps1";
|
||||
. "$PSScriptRoot/../../Common/Scripts/Context.ps1";
|
||||
|
||||
function Update-WindowsInstallation([Context] $context)
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/bin/pwsh
|
||||
$contextScript = "$PSScriptRoot/../../Scripts/Context.ps1";
|
||||
$contextScript = "$PSScriptRoot/../../../Common/Scripts/Context.ps1";
|
||||
. "$contextScript";
|
||||
$preparedUsernameProperty = "AutoLoginUser";
|
||||
$preparedPasswordProperty = "AutoLoginPassword";
|
||||
|
|
|
@ -5,7 +5,7 @@ param(
|
|||
[string]$PreparedSecretProperty
|
||||
);
|
||||
|
||||
. "$PSScriptRoot/../../Scripts/Context.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Scripts/Context.ps1";
|
||||
$context = [Context]::new();
|
||||
$userName = $context.Get($PreparedUsernameProperty);
|
||||
$password = $context.Get($PreparedSecretProperty);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/bin/pwsh
|
||||
. "$PSScriptRoot/../../Scripts/Context.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Scripts/Context.ps1";
|
||||
. "$PSScriptRoot/Add.ps1";
|
||||
|
||||
function Install-PersonalUsers([Context] $context) {
|
||||
|
|
|
@ -7,7 +7,7 @@ param (
|
|||
[string]$UACDisablerTriggerProperty
|
||||
);
|
||||
|
||||
. "$PSScriptRoot/../../Scripts/Context.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Scripts/Context.ps1";
|
||||
$context = [Context]::new();
|
||||
$context.SetUACState($false);
|
||||
Unregister-ScheduledTask -Confirm:$false $UACDisablerTaskName;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/pwsh
|
||||
. "$PSScriptRoot/Context.ps1";
|
||||
. "$PSScriptRoot/BrowserAutomation.ps1";
|
||||
. "$PSScriptRoot/../../Common/Scripts/Context.ps1";
|
||||
. "$PSScriptRoot/../../Common/Scripts/BrowserAutomation.ps1";
|
||||
|
||||
function Install-AmdSoftwarePackage() {
|
||||
param(
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
using namespace System.Xml;
|
||||
|
||||
$null = New-Module {
|
||||
$associationElementName = "Association";
|
||||
$rootSelector = "/DefaultAssociations";
|
||||
$associationSelector = "./Association";
|
||||
$associationSelector = "./$associationElementName";
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
|
@ -32,7 +33,9 @@ $null = New-Module {
|
|||
function Get-DefaultAppAssociations {
|
||||
[OutputType([xml])]
|
||||
param()
|
||||
[xml]::new().LoadXml(((DISM /Online /Get-DefaultAppAssociations) | Select-Object -Skip 6 | Select-Object -SkipLast 2 | Out-String));
|
||||
$result = [xml]::new();
|
||||
$result.LoadXml(((DISM /Online /Get-DefaultAppAssociations) | Select-Object -Skip 6 | Select-Object -SkipLast 2 | Out-String));
|
||||
$result;
|
||||
}
|
||||
|
||||
<#
|
||||
|
@ -58,11 +61,17 @@ $null = New-Module {
|
|||
[System.Xml.XmlNode] $association = $null;
|
||||
$document = Get-DefaultAppAssociations;
|
||||
$candidates = $document.SelectNodes((& $getSelector $Identifier));
|
||||
Write-Host "Number of potential associations: $($candidates.Count)"
|
||||
|
||||
if ($candidates.Count -eq 1) {
|
||||
$association = $candidates[0];
|
||||
} else {
|
||||
$association = ([System.Xml.XmlNode]($document.SelectNodes((& $getSelector)) | Select-Object -Last 1)[0]).CloneNode($true);
|
||||
$association = $document.SelectSingleNode($rootSelector).AppendChild($document.CreateElement($associationElementName));
|
||||
|
||||
foreach ($attributeName in @("Identifier", "ProgId", "ApplicationName")) {
|
||||
$null = $association.Attributes.Append($document.CreateAttribute($attributeName));
|
||||
}
|
||||
|
||||
$association.Identifier = $Identifier;
|
||||
}
|
||||
|
||||
|
@ -87,7 +96,7 @@ $null = New-Module {
|
|||
$associations = $root.SelectNodes((& $getSelector));
|
||||
|
||||
# Reorder associations by their Identifier
|
||||
$associations | ForEach-Object { $root.RemoveChild($_); } | Sort-Object -Property "Identifier" | ForEach-Object { $root.AppendChild($_); };
|
||||
$null = $associations | ForEach-Object { $root.RemoveChild($_) } | Sort-Object -Property "Identifier" | ForEach-Object { $root.AppendChild($_); };
|
||||
|
||||
$configFile = New-TemporaryFile;
|
||||
$writerSettings = [XmlWriterSettings]::new();
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
. "$PSScriptRoot/Context.ps1";
|
||||
. "$PSScriptRoot/../../Common/ScriptsContext.ps1";
|
||||
|
||||
function Install-AsusSoftwarePackage([Context] $context, [string] $url) {
|
||||
$packageFile = "AsusPackage.zip";
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/bin/pwsh
|
||||
. "$PSScriptRoot/Context.ps1";
|
||||
. "$PSScriptRoot/../../Common/Scripts/Context.ps1";
|
||||
|
||||
function Get-BackupCandidates() {
|
||||
[System.Collections.Generic.List[System.Tuple[string, string, string[]]]]$candidates = @();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
using namespace Microsoft.Win32;
|
||||
|
||||
$null = New-Module {
|
||||
. "$PSScriptRoot/Scripting.ps1";
|
||||
. "$PSScriptRoot/../../Common/Scripts/Scripting.ps1";
|
||||
[RegistryKey] $key = $null;
|
||||
$runOncePath = "HKLM:\Software\Microsoft\Windows\CurrentVersion\RunOnce";
|
||||
$runOnceName = "PortValhalla";
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/bin/pwsh
|
||||
. "$PSScriptRoot/Context.ps1";
|
||||
. "$PSScriptRoot/../../Common/Scripts/Context.ps1";
|
||||
|
||||
[Context]::new().PreventSleepMode();
|
||||
$null = powershell -c Get-PackageProvider -ListAvailable NuGet;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/pwsh
|
||||
param($context)
|
||||
. "$PSScriptRoot/../../Scripts/SoftwareManagement.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Scripts/SoftwareManagement.ps1";
|
||||
Install-SoftwarePackage $context "https://github.com/bobranten/Ext4Fsd/releases/download/v0.71/Ext2Fsd-0.71-setup.exe"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/bin/pwsh
|
||||
. "$PSScriptRoot/../../Scripts/Context.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Scripts/Context.ps1";
|
||||
|
||||
function Install-Firefox {
|
||||
param([Context] $context)
|
||||
|
|
45
scripts/Windows/Software/Firefox/Manage.ps1
Normal file
45
scripts/Windows/Software/Firefox/Manage.ps1
Normal file
|
@ -0,0 +1,45 @@
|
|||
param(
|
||||
$Action,
|
||||
[hashtable] $Arguments
|
||||
)
|
||||
|
||||
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
|
||||
. "$PSScriptRoot/../../Scripts/AppAssociations.ps1";
|
||||
|
||||
Start-SoftwareInstaller @PSBoundParameters `
|
||||
-Installer {
|
||||
param(
|
||||
[scriptblock] $Installer
|
||||
)
|
||||
|
||||
Install-ChocoPackage firefox;
|
||||
& $Installer -Action ([InstallerAction]::Configure)
|
||||
} `
|
||||
-Configurator {
|
||||
Write-Host "Making Firefox the default browser…";
|
||||
$progIdSuffix = "-308046B0AF4A39CB";
|
||||
$appName = "Firefox";
|
||||
|
||||
$extensions = @(
|
||||
".htm",
|
||||
".html",
|
||||
".svg",
|
||||
".xht",
|
||||
".xhtml"
|
||||
);
|
||||
|
||||
$schemes = @(
|
||||
"http",
|
||||
"https"
|
||||
);
|
||||
|
||||
foreach ($extension in $extensions) {
|
||||
Set-DefaultAppAssociation -Identifier $extension -ProgId "${appName}HTML$progIdSuffix" -ApplicationName $appName;
|
||||
}
|
||||
|
||||
foreach ($scheme in $schemes) {
|
||||
Set-DefaultAppAssociation -Identifier $scheme -ProgId "${appName}URL$progIdSuffix" -ApplicationName $appName;
|
||||
}
|
||||
|
||||
Remove-TaskbarItem "*Firefox*";
|
||||
};
|
|
@ -1,8 +1,8 @@
|
|||
#!/bin/pwsh
|
||||
param($context)
|
||||
. "$PSScriptRoot/../../Scripts/Context.ps1";
|
||||
. "$PSScriptRoot/../../Scripts/BrowserAutomation.ps1";
|
||||
. "$PSScriptRoot/../../Scripts/SoftwareManagement.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Scripts/BrowserAutomation.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Scripts/Context.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Scripts/SoftwareManagement.ps1";
|
||||
|
||||
Write-Host "Installing GPU-Z";
|
||||
$tempDir = $context.GetTempDirectory();
|
||||
|
|
54
scripts/Windows/Software/LGHub/Install.ps1
Normal file
54
scripts/Windows/Software/LGHub/Install.ps1
Normal file
|
@ -0,0 +1,54 @@
|
|||
#!/bin/pwsh
|
||||
. "$PSScriptRoot/../../../Common/Scripts/Context.ps1";
|
||||
|
||||
$null = New-Module {
|
||||
$path = "$env:LOCALAPPDATA/LGHUB";
|
||||
$softwareName = "LGHub";
|
||||
[string]$lghubPath;
|
||||
|
||||
function Get-LogitechGHUBName() {
|
||||
return "lghub_system_tray.exe";
|
||||
}
|
||||
|
||||
function Stop-LogitechGHUB() {
|
||||
[OutputType([string])]
|
||||
param();
|
||||
Write-Host "Killing Logitech G HUB process";
|
||||
$hubName = Get-LogitechGHUBName;
|
||||
$lghubPath = $(Get-Process | Where-Object { [System.IO.Path]::GetFileName($_.Path) -eq $hubName })[0].Path;
|
||||
|
||||
$mainProcesses = Get-Process | Where-Object { @("lghub_agent.exe", $hubName) -contains [System.IO.Path]::GetFileName($_.Path) -and $(
|
||||
$_.Parent.ProcessName -eq "explorer" -or $null -eq $_.Parent) };
|
||||
|
||||
$null = $mainProcesses | Foreach-Object { $_.Kill($true) };
|
||||
return $lghubPath;
|
||||
}
|
||||
|
||||
function Backup-LogitechGHUB([Context] $context) {
|
||||
Write-Host "Backing Up Logitech G HUB";
|
||||
$hubPath = Stop-LogitechGHUB;
|
||||
|
||||
Write-Information "Backing up important files";
|
||||
$context.Backup($path, $context.SoftwareArchive($softwareName), @("-i!settings.db", "-i!icon_cache"));
|
||||
|
||||
if ($hubPath) {
|
||||
Write-Information "Restarting Logitech G HUB";
|
||||
Start-Process $hubPath;
|
||||
}
|
||||
}
|
||||
|
||||
function Restore-LogitechGHUB([Context] $context) {
|
||||
Write-Host "Restoring Logitech G HUB";
|
||||
Write-Information "Installing the app";
|
||||
choco install -y --ignore-checksums lghub;
|
||||
$hubPath = Stop-LogitechGHUB;
|
||||
Write-Information "Removing existing settings";
|
||||
Remove-Item "$path/settings.*";
|
||||
Write-Information "Restoring important files";
|
||||
$context.Restore($context.SoftwareArchive($softwareName), $path);
|
||||
Write-Information "Deleting desktop icon";
|
||||
$context.RemoveDesktopIcon("*G HUB*");
|
||||
Write-Information "Restarting Logitech G HUB";
|
||||
Start-Process $hubPath;
|
||||
}
|
||||
}
|
|
@ -1,54 +1,15 @@
|
|||
#!/bin/pwsh
|
||||
. "$PSScriptRoot/../../Scripts/Context.ps1";
|
||||
param(
|
||||
$Action,
|
||||
[hashtable] $Arguments
|
||||
)
|
||||
|
||||
$null = New-Module {
|
||||
$path = "$env:LOCALAPPDATA/LGHUB";
|
||||
$softwareName = "LGHub";
|
||||
[string]$lghubPath;
|
||||
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
|
||||
. "$PSScriptRoot/../../Scripts/AppAssociations.ps1";
|
||||
|
||||
function Get-LogitechGHUBName() {
|
||||
return "lghub_system_tray.exe";
|
||||
}
|
||||
Start-SoftwareInstaller @PSBoundParameters `
|
||||
-Installer {
|
||||
Install-ChocoPackage lghub;
|
||||
Remove-DesktopIcon "*G HUB*";
|
||||
};
|
||||
|
||||
function Stop-LogitechGHUB() {
|
||||
[OutputType([string])]
|
||||
param();
|
||||
Write-Host "Killing Logitech G HUB process";
|
||||
$hubName = Get-LogitechGHUBName;
|
||||
$lghubPath = $(Get-Process | Where-Object { [System.IO.Path]::GetFileName($_.Path) -eq $hubName })[0].Path;
|
||||
|
||||
$mainProcesses = Get-Process | Where-Object { @("lghub_agent.exe", $hubName) -contains [System.IO.Path]::GetFileName($_.Path) -and $(
|
||||
$_.Parent.ProcessName -eq "explorer" -or $null -eq $_.Parent) };
|
||||
|
||||
$null = $mainProcesses | Foreach-Object { $_.Kill($true) };
|
||||
return $lghubPath;
|
||||
}
|
||||
|
||||
function Backup-LogitechGHUB([Context] $context) {
|
||||
Write-Host "Backing Up Logitech G HUB";
|
||||
$hubPath = Stop-LogitechGHUB;
|
||||
|
||||
Write-Information "Backing up important files";
|
||||
$context.Backup($path, $context.SoftwareArchive($softwareName), @("-i!settings.db", "-i!icon_cache"));
|
||||
|
||||
if ($hubPath) {
|
||||
Write-Information "Restarting Logitech G HUB";
|
||||
Start-Process $hubPath;
|
||||
}
|
||||
}
|
||||
|
||||
function Restore-LogitechGHUB([Context] $context) {
|
||||
Write-Host "Restoring Logitech G HUB";
|
||||
Write-Information "Installing the app";
|
||||
choco install -y --ignore-checksums lghub;
|
||||
$hubPath = Stop-LogitechGHUB;
|
||||
Write-Information "Removing existing settings";
|
||||
Remove-Item "$path/settings.*";
|
||||
Write-Information "Restoring important files";
|
||||
$context.Restore($context.SoftwareArchive($softwareName), $path);
|
||||
Write-Information "Deleting desktop icon";
|
||||
$context.RemoveDesktopIcon("*G HUB*");
|
||||
Write-Information "Restarting Logitech G HUB";
|
||||
Start-Process $hubPath;
|
||||
}
|
||||
}
|
||||
# ToDo: Add restoration
|
||||
|
|
35
scripts/Windows/Software/MSEdgeRedirect/Manage.ps1
Normal file
35
scripts/Windows/Software/MSEdgeRedirect/Manage.ps1
Normal file
|
@ -0,0 +1,35 @@
|
|||
param(
|
||||
$Action,
|
||||
[hashtable] $Arguments
|
||||
)
|
||||
|
||||
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
|
||||
|
||||
Start-SoftwareInstaller @PSBoundParameters `
|
||||
-Installer {
|
||||
param(
|
||||
[scriptblock] $Installer
|
||||
)
|
||||
|
||||
Install-ChocoPackage MSEdgeRedirect;
|
||||
& $Installer -Action ([InstallerAction]::Configure);
|
||||
} `
|
||||
-Configurator {
|
||||
$configPath = "HKLM:\SOFTWARE\Robert Maehl Software\MSEdgeRedirect";
|
||||
|
||||
[hashtable] $options = @{
|
||||
NoBing = 1;
|
||||
NoImgs = 1;
|
||||
NoNews = 1;
|
||||
NoPDFs = 1;
|
||||
Search = "StartPage";
|
||||
Images = "Custom";
|
||||
ImagePath = "https://startpage.com/sp/search?cat=images&query=";
|
||||
News = "Google";
|
||||
PDFApp = "C:\Program Files\Mozilla Firefox\firefox.exe";
|
||||
};
|
||||
|
||||
foreach ($key in $options.Keys) {
|
||||
Set-ItemProperty $configPath -Name $key -Value ($options[$key]);
|
||||
}
|
||||
};
|
20
scripts/Windows/Software/ManiaPlanet/Install.ps1
Normal file
20
scripts/Windows/Software/ManiaPlanet/Install.ps1
Normal file
|
@ -0,0 +1,20 @@
|
|||
#!/bin/pwsh
|
||||
. "$PSScriptRoot/../../../Common/Scripts/Context.ps1";
|
||||
|
||||
$null = New-Module {
|
||||
$path = "$HOME/Documents/ManiaPlanet";
|
||||
$softwareName = "ManiaPlanet";
|
||||
|
||||
function Backup-ManiaPlanet([Context] $context) {
|
||||
Write-Information "Backing up ManiaPlanet";
|
||||
$context.Backup($path, $context.SoftwareArchive($softwareName), @("-i@`"$PSScriptRoot/include.txt`""));
|
||||
}
|
||||
|
||||
function Restore-ManiaPlanet([Context] $context) {
|
||||
Write-Host "Restoring ManiaPlanet";
|
||||
Write-Information "Installing ManiaPlanet";
|
||||
winget install --accept-source-agreements --accept-package-agreements -e --id Nadeo.ManiaPlanet;
|
||||
Write-Information "Restoring files";
|
||||
$context.Restore($context.SoftwareArchive($softwareName), $path);
|
||||
}
|
||||
}
|
|
@ -1,20 +1,13 @@
|
|||
#!/bin/pwsh
|
||||
. "$PSScriptRoot/../../Scripts/Context.ps1";
|
||||
param(
|
||||
$Action,
|
||||
[hashtable] $Arguments
|
||||
)
|
||||
|
||||
$null = New-Module {
|
||||
$path = "$HOME/Documents/ManiaPlanet";
|
||||
$softwareName = "ManiaPlanet";
|
||||
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
|
||||
|
||||
function Backup-ManiaPlanet([Context] $context) {
|
||||
Write-Information "Backing up ManiaPlanet";
|
||||
$context.Backup($path, $context.SoftwareArchive($softwareName), @("-i@`"$PSScriptRoot/include.txt`""));
|
||||
}
|
||||
Start-SoftwareInstaller @PSBoundParameters `
|
||||
-Installer {
|
||||
Install-WingetPackage Nadeo.ManiaPlanet;
|
||||
};
|
||||
|
||||
function Restore-ManiaPlanet([Context] $context) {
|
||||
Write-Host "Restoring ManiaPlanet";
|
||||
Write-Information "Installing ManiaPlanet";
|
||||
winget install --accept-source-agreements --accept-package-agreements -e --id Nadeo.ManiaPlanet;
|
||||
Write-Information "Restoring files";
|
||||
$context.Restore($context.SoftwareArchive($softwareName), $path);
|
||||
}
|
||||
}
|
||||
# ToDo: Add restoration
|
||||
|
|
39
scripts/Windows/Software/NVS/Manage.ps1
Normal file
39
scripts/Windows/Software/NVS/Manage.ps1
Normal file
|
@ -0,0 +1,39 @@
|
|||
using namespace System.Security.AccessControl;
|
||||
using namespace System.Security.Principal;
|
||||
|
||||
param(
|
||||
$Action,
|
||||
[hashtable] $Arguments
|
||||
)
|
||||
|
||||
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Types/InstallerAction.ps1";
|
||||
|
||||
Start-SoftwareInstaller @PSBoundParameters `
|
||||
-Installer {
|
||||
param(
|
||||
[scriptblock] $Installer
|
||||
)
|
||||
|
||||
$env:NVS_HOME = "$env:ProgramData\nvs";
|
||||
git clone "https://github.com/jasongin/nvs.git" $env:NVS_HOME;
|
||||
& "$env:NVS_HOME\nvs.cmd" install;
|
||||
|
||||
$acl = Get-Acl $env:NVS_HOME;
|
||||
|
||||
$acl.AddAccessRule(
|
||||
[FileSystemAccessRule]::new(
|
||||
[SecurityIdentifier]::new([WellKnownSidType]::BuiltinUsersSid, $null),
|
||||
[FileSystemRights]::FullControl,
|
||||
[InheritanceFlags]::ObjectInherit -bor [InheritanceFlags]::ContainerInherit,
|
||||
[PropagationFlags]::InheritOnly,
|
||||
[AccessControlType]::Allow));
|
||||
|
||||
Set-Acl $env:NVS_HOME $acl;
|
||||
refreshenv;
|
||||
& $Installer -Action ([InstallerAction]::Configure);
|
||||
} `
|
||||
-Configurator {
|
||||
nvs add latest;
|
||||
nvs link latest;
|
||||
};
|
32
scripts/Windows/Software/Nextcloud/Install.ps1
Normal file
32
scripts/Windows/Software/Nextcloud/Install.ps1
Normal file
|
@ -0,0 +1,32 @@
|
|||
#!/bin/pwsh
|
||||
. "$PSScriptRoot/../../../Common/Scripts/Context.ps1";
|
||||
|
||||
$null = New-Module {
|
||||
function Restore-Nextcloud([Context] $context) {
|
||||
choco list --exact nextcloud-client
|
||||
|
||||
if (-not $?) {
|
||||
Write-Information "Installing Nextcloud Client";
|
||||
choco install nextcloud-client -y --params="'/KeepUpdateCheck'";
|
||||
}
|
||||
|
||||
if (-not (Test-Path $context.GetNextcloudConfigFile())) {
|
||||
Write-Information "Setting up Nextcloud configuration";
|
||||
|
||||
Write-Information "Ensuring all Let's Encrypt certificates are cached";
|
||||
$null = Invoke-WebRequest https://valid-isrgrootx1.letsencrypt.org/;
|
||||
|
||||
while (-not (Test-Path $context.GetNextcloudConfigFile())) {
|
||||
Write-Host "Nextcloud has been installed!";
|
||||
Read-Host "Please log in in the Nextcloud app and hit enter to continue";
|
||||
|
||||
if (-not (Test-Path $context.GetNextcloudConfigFile())) {
|
||||
Write-Error "The login seems to have failed. Please try again.";
|
||||
}
|
||||
}
|
||||
|
||||
$context.Reboot();
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,15 +1,41 @@
|
|||
#!/bin/pwsh
|
||||
. "$PSScriptRoot/../../Scripts/Context.ps1";
|
||||
param(
|
||||
$Action,
|
||||
[hashtable] $Arguments
|
||||
)
|
||||
|
||||
$null = New-Module {
|
||||
function Restore-Nextcloud([Context] $context) {
|
||||
choco list --exact nextcloud-client
|
||||
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
|
||||
|
||||
if (-not $?) {
|
||||
Write-Information "Installing Nextcloud Client";
|
||||
choco install nextcloud-client -y --params="'/KeepUpdateCheck'";
|
||||
Start-SoftwareInstaller @PSBoundParameters `
|
||||
-Installer {
|
||||
Install-ChocoPackage nextcloud-client -ArgumentList "-y","--params='/KeepUpdateCheck'";
|
||||
} `
|
||||
-Configurator {
|
||||
Write-Host "Making Firefox the default browser…";
|
||||
$progIdSuffix = "-308046B0AF4A39CB";
|
||||
$appName = "Firefox";
|
||||
|
||||
$extensions = @(
|
||||
".htm",
|
||||
".html",
|
||||
".svg",
|
||||
".xht",
|
||||
".xhtml"
|
||||
);
|
||||
|
||||
$schemes = @(
|
||||
"http",
|
||||
"https"
|
||||
);
|
||||
|
||||
foreach ($extension in $extensions) {
|
||||
Set-DefaultAppAssociation -Identifier $extensions -ProgId "${appName}HTML$progIdSuffix" -ApplicationName $appName;
|
||||
}
|
||||
|
||||
foreach ($scheme in $schemes) {
|
||||
Set-DefaultAppAssociation -Identifier $scheme -ProgId "${appName}URL$progIdSuffix" -ApplicationName $appName;
|
||||
}
|
||||
} `
|
||||
-UserConfigurator {
|
||||
if (-not (Test-Path $context.GetNextcloudConfigFile())) {
|
||||
Write-Information "Setting up Nextcloud configuration";
|
||||
|
||||
|
@ -28,5 +54,5 @@ $null = New-Module {
|
|||
$context.Reboot();
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/pwsh
|
||||
param($context);
|
||||
. "$PSScriptRoot/../../Scripts/Context.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Scripts/Context.ps1";
|
||||
|
||||
[Context] $context = $context;
|
||||
winget install --accept-source-agreements --accept-package-agreements -s winget --scope machine -e --id JanDeDobbeleer.OhMyPosh;
|
||||
|
|
21
scripts/Windows/Software/Oh My Posh/Manage.ps1
Normal file
21
scripts/Windows/Software/Oh My Posh/Manage.ps1
Normal file
|
@ -0,0 +1,21 @@
|
|||
param (
|
||||
$Action,
|
||||
[hashtable] $Arguments
|
||||
)
|
||||
|
||||
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Types/InstallerAction.ps1";
|
||||
|
||||
Start-SoftwareInstaller @PSBoundParameters `
|
||||
-Installer {
|
||||
param(
|
||||
[scriptblock] $Installer
|
||||
)
|
||||
|
||||
Install-WingetPackage JanDeDobbeleer.OhMyPosh -ArgumentList "--scope","machine";
|
||||
& $Installer -Action ([InstallerAction]::Configure);
|
||||
} `
|
||||
-Configurator {
|
||||
. "$PSScriptRoot/../../../Common/Software/Oh My Posh/Manage.ps1" `
|
||||
-Action ([InstallerAction]::Configure);
|
||||
};
|
|
@ -5,7 +5,7 @@ param(
|
|||
[hashtable] $Arguments
|
||||
)
|
||||
|
||||
. "$PSScriptRoot/../../Scripts/Software.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
|
||||
|
||||
Start-SoftwareInstaller @PSBoundParameters `
|
||||
-Installer {
|
||||
|
|
32
scripts/Windows/Software/PinnedItem/Manage.ps1
Normal file
32
scripts/Windows/Software/PinnedItem/Manage.ps1
Normal file
|
@ -0,0 +1,32 @@
|
|||
param (
|
||||
$Action,
|
||||
[hashtable] $Arguments
|
||||
)
|
||||
|
||||
. "$PSScriptRoot/../../../Common/Software/PowerShell/Module.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
|
||||
|
||||
$parameters = Get-ModuleInstallerComponents "PinnedItem" -NativeOnly;
|
||||
|
||||
foreach ($key in $PSBoundParameters.Keys) {
|
||||
$parameters.Add($key, $PSBoundParameters.TryGetValue($key));
|
||||
}
|
||||
|
||||
$arguments = $parameters.arguments;
|
||||
$arguments.Add("Installer", $parameters.installer);
|
||||
|
||||
Start-SoftwareInstaller @parameters -Installer {
|
||||
param(
|
||||
[scriptblock] $Installer,
|
||||
[hashtable] $Arguments
|
||||
)
|
||||
|
||||
$feature = "NetFx3";
|
||||
|
||||
if ((Get-WindowsOptionalFeature -Online -FeatureName $feature).State -ne "Enabled") {
|
||||
Write-Host "Enabling ``$feature`` feature…";
|
||||
choco install --source windowsFeatures -y $feature;
|
||||
}
|
||||
|
||||
& $Arguments.Installer @PSBoundParameters;
|
||||
}
|
|
@ -3,8 +3,8 @@ param (
|
|||
[hashtable] $Arguments
|
||||
)
|
||||
|
||||
. "$PSScriptRoot/../../Scripts/Software.ps1";
|
||||
. "$PSScriptRoot/../../Types/InstallerAction.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Types/InstallerAction.ps1";
|
||||
|
||||
Start-SoftwareInstaller @PSBoundParameters `
|
||||
-Installer {
|
||||
|
@ -16,6 +16,5 @@ Start-SoftwareInstaller @PSBoundParameters `
|
|||
} `
|
||||
-Configurator {
|
||||
. "$PSScriptRoot/../../../Common/Software/PowerShell/Manage.ps1" `
|
||||
-Action ([InstallerAction]::Configure) `
|
||||
-Arguments @{ Linux = $false };
|
||||
-Action ([InstallerAction]::Configure);
|
||||
};
|
||||
|
|
29
scripts/Windows/Software/PuTTY/Install.ps1
Normal file
29
scripts/Windows/Software/PuTTY/Install.ps1
Normal file
|
@ -0,0 +1,29 @@
|
|||
#!/bin/pwsh
|
||||
. "$PSScriptRoot/../../../Common/Scripts/Context.ps1";
|
||||
|
||||
$null = New-Module {
|
||||
$softwareName = "PuTTY";
|
||||
$configFile = "$($softwareName).reg";
|
||||
|
||||
function Backup-PuTTY([Context] $context) {
|
||||
Write-Host "Backing up PuTTY";
|
||||
$tempDir = $context.GetTempDirectory();
|
||||
$fileName = Join-Path "$tempDir" $configFile;
|
||||
& reg export "HKCU\Software\SimonTatham" "$fileName" /y;
|
||||
$context.Backup($tempDir, $context.SoftwareArchive($softwareName));
|
||||
Remove-Item -Recurse $tempDir;
|
||||
}
|
||||
|
||||
function Restore-PuTTY([Context] $context) {
|
||||
Write-Host "Restoring PuTTY";
|
||||
Write-Information "Installing PuTTY";
|
||||
choco install -y putty;
|
||||
|
||||
Write-Information "Restoring configuration";
|
||||
$tempDir = $context.GetTempDirectory();
|
||||
$fileName = Join-Path "$tempDir" $configFile;
|
||||
$context.Restore($context.SoftwareArchive($softwareName), $tempDir);
|
||||
& reg import "$fileName";
|
||||
Remove-Item -Recurse $tempDir;
|
||||
}
|
||||
}
|
|
@ -1,29 +1,15 @@
|
|||
#!/bin/pwsh
|
||||
. "$PSScriptRoot/../../Scripts/Context.ps1";
|
||||
using namespace Microsoft.Win32;
|
||||
|
||||
$null = New-Module {
|
||||
$softwareName = "PuTTY";
|
||||
$configFile = "$($softwareName).reg";
|
||||
param(
|
||||
$Action,
|
||||
[hashtable] $Arguments
|
||||
)
|
||||
|
||||
function Backup-PuTTY([Context] $context) {
|
||||
Write-Host "Backing up PuTTY";
|
||||
$tempDir = $context.GetTempDirectory();
|
||||
$fileName = Join-Path "$tempDir" $configFile;
|
||||
& reg export "HKCU\Software\SimonTatham" "$fileName" /y;
|
||||
$context.Backup($tempDir, $context.SoftwareArchive($softwareName));
|
||||
Remove-Item -Recurse $tempDir;
|
||||
}
|
||||
. "$PSScriptRoot/../../Scripts/Software.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Scripts/AppAssociations.ps1";
|
||||
|
||||
function Restore-PuTTY([Context] $context) {
|
||||
Write-Host "Restoring PuTTY";
|
||||
Write-Information "Installing PuTTY";
|
||||
choco install -y putty;
|
||||
|
||||
Write-Information "Restoring configuration";
|
||||
$tempDir = $context.GetTempDirectory();
|
||||
$fileName = Join-Path "$tempDir" $configFile;
|
||||
$context.Restore($context.SoftwareArchive($softwareName), $tempDir);
|
||||
& reg import "$fileName";
|
||||
Remove-Item -Recurse $tempDir;
|
||||
}
|
||||
}
|
||||
Start-SoftwareInstaller @PSBoundParameters `
|
||||
-Installer {
|
||||
Install-ChocoPackage putty;
|
||||
};
|
||||
# ToDo: Add restoration
|
||||
|
|
35
scripts/Windows/Software/RetroArch/Install.ps1
Normal file
35
scripts/Windows/Software/RetroArch/Install.ps1
Normal file
|
@ -0,0 +1,35 @@
|
|||
#!/bin/pwsh
|
||||
. "$PSScriptRoot/../../Scripts/KnownFolders.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Scripts/Context.ps1";
|
||||
|
||||
$null = New-Module {
|
||||
Import-Module "$env:ChocolateyInstall/helpers/chocolateyInstaller.psm1";
|
||||
$path = "C:/tools/RetroArch-Win64";
|
||||
$softwareName = "RetroArch";
|
||||
|
||||
function Backup-RetroArch([Context] $context) {
|
||||
Write-Host "Backing up RetroArch";
|
||||
$context.Backup($path, $context.SoftwareArchive($softwareName), @("-i@`"$PSScriptRoot/include.txt`""));
|
||||
}
|
||||
|
||||
function Restore-RetroArch([Context] $context) {
|
||||
Write-Host "Restoring RetroArch";
|
||||
Write-Information "Installing RetroArch";
|
||||
choco install -y --ignore-checksums retroarch;
|
||||
Write-Information "Restoring files";
|
||||
$context.Restore($context.SoftwareArchive($softwareName), $path);
|
||||
|
||||
Write-Information "Adding cloud sync folders";
|
||||
|
||||
$context.AddNextcloudSync(
|
||||
"$path\saves",
|
||||
"/Saved Games/RetroArch/Saves");
|
||||
|
||||
$context.AddNextcloudSync(
|
||||
"$path\system",
|
||||
"/Saved Games/RetroArch/System");
|
||||
|
||||
Write-Information "Creating a Start Menu Icon";
|
||||
Install-ChocolateyShortcut -ShortcutFilePath "$((Get-KnownFolder "Common Programs").Path)/RetroArch.lnk" -TargetPath ((Get-Item "$path\retroarch.exe").FullName);
|
||||
}
|
||||
}
|
|
@ -1,35 +1,15 @@
|
|||
#!/bin/pwsh
|
||||
. "$PSScriptRoot/../../Scripts/KnownFolders.ps1";
|
||||
. "$PSScriptRoot/../../Scripts/Context.ps1";
|
||||
param(
|
||||
$Action,
|
||||
[hashtable] $Arguments
|
||||
)
|
||||
|
||||
$null = New-Module {
|
||||
Import-Module "$env:ChocolateyInstall/helpers/chocolateyInstaller.psm1";
|
||||
$path = "C:/tools/RetroArch-Win64";
|
||||
$softwareName = "RetroArch";
|
||||
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
|
||||
|
||||
function Backup-RetroArch([Context] $context) {
|
||||
Write-Host "Backing up RetroArch";
|
||||
$context.Backup($path, $context.SoftwareArchive($softwareName), @("-i@`"$PSScriptRoot/include.txt`""));
|
||||
}
|
||||
Start-SoftwareInstaller @PSBoundParameters `
|
||||
-Installer {
|
||||
Install-ChocoPackage retroarch;
|
||||
# ToDo: Add start menu shortcut
|
||||
# ToDo: Add function for this purpose
|
||||
};
|
||||
|
||||
function Restore-RetroArch([Context] $context) {
|
||||
Write-Host "Restoring RetroArch";
|
||||
Write-Information "Installing RetroArch";
|
||||
choco install -y --ignore-checksums retroarch;
|
||||
Write-Information "Restoring files";
|
||||
$context.Restore($context.SoftwareArchive($softwareName), $path);
|
||||
|
||||
Write-Information "Adding cloud sync folders";
|
||||
|
||||
$context.AddNextcloudSync(
|
||||
"$path\saves",
|
||||
"/Saved Games/RetroArch/Saves");
|
||||
|
||||
$context.AddNextcloudSync(
|
||||
"$path\system",
|
||||
"/Saved Games/RetroArch/System");
|
||||
|
||||
Write-Information "Creating a Start Menu Icon";
|
||||
Install-ChocolateyShortcut -ShortcutFilePath "$((Get-KnownFolder "Common Programs").Path)/RetroArch.lnk" -TargetPath ((Get-Item "$path\retroarch.exe").FullName);
|
||||
}
|
||||
}
|
||||
# ToDo: Add restoration
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/pwsh
|
||||
param($context)
|
||||
|
||||
. "$PSScriptRoot/../../Scripts/Context.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Scripts/Context.ps1";
|
||||
[Context] $context = $context;
|
||||
|
||||
choco install -y thunderbird --params "/NoTaskbarShortcut /NoDesktopShortcut";
|
||||
|
|
|
@ -6,7 +6,7 @@ param(
|
|||
)
|
||||
|
||||
. "$PSScriptRoot/../../Scripts/AppAssociations.ps1";
|
||||
. "$PSScriptRoot/../../Scripts/Software.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
|
||||
|
||||
Start-SoftwareInstaller @PSBoundParameters `
|
||||
-Installer {
|
||||
|
|
30
scripts/Windows/Software/TobiiGameHub/Manage.ps1
Normal file
30
scripts/Windows/Software/TobiiGameHub/Manage.ps1
Normal file
|
@ -0,0 +1,30 @@
|
|||
using namespace Microsoft.Win32;
|
||||
|
||||
param(
|
||||
$Action,
|
||||
[hashtable] $Arguments
|
||||
)
|
||||
|
||||
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Scripts/System.ps1";
|
||||
|
||||
Start-SoftwareInstaller @PSBoundParameters `
|
||||
-Installer {
|
||||
param(
|
||||
[scriptblock] $Installer
|
||||
)
|
||||
|
||||
Install-ChocoPackage "vcredist2013";
|
||||
} `
|
||||
-UserConfigurator {
|
||||
$file = "setup.exe";
|
||||
$dir = New-TemporaryDirectory;
|
||||
|
||||
Push-Location $dir;
|
||||
Invoke-WebRequest "https://files.update.oem.tobii.com/GameHub/TobiiGameHub.3.0.1-Setup.exe" -OutFile $file;
|
||||
Write-Host "Running Tobii Game Hub installer";
|
||||
Start-Process -Wait -FilePath "$PSScriptRoot/GameHub.ahk";
|
||||
Pop-Location;
|
||||
|
||||
Remove-Item -Recurse $dir;
|
||||
};
|
28
scripts/Windows/Software/TobiiGhost/Manage.ps1
Normal file
28
scripts/Windows/Software/TobiiGhost/Manage.ps1
Normal file
|
@ -0,0 +1,28 @@
|
|||
param(
|
||||
$Action,
|
||||
[hashtable] $Arguments
|
||||
)
|
||||
|
||||
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Scripts/System.ps1";
|
||||
|
||||
Start-SoftwareInstaller @PSBoundParameters `
|
||||
-Installer {
|
||||
param(
|
||||
[scriptblock] $Installer
|
||||
)
|
||||
|
||||
Install-ChocoPackage "dotnet-6.0-desktopruntime";
|
||||
} `
|
||||
-UserConfigurator {
|
||||
$file = "setup.exe";
|
||||
$dir = New-TemporaryDirectory;
|
||||
|
||||
Push-Location $dir;
|
||||
Invoke-WebRequest "https://files.update.oem.tobii.com/Ghost/TobiiGhost.1.14.1-Setup.exe" -OutFile $file;
|
||||
Write-Host "Running Tobii Ghost installer";
|
||||
Start-Process -Wait -FilePath "$PSScriptRoot/Ghost.ahk";
|
||||
Pop-Location;
|
||||
|
||||
Remove-Item -Recurse $dir;
|
||||
};
|
|
@ -0,0 +1,31 @@
|
|||
#!/bin/pwsh
|
||||
. "$PSScriptRoot/../../../Common/Scripts/Context.ps1";
|
||||
|
||||
$null = New-Module {
|
||||
$path = "$HOME/Documents/TmForever";
|
||||
$softwareName = "TmNationsForever";
|
||||
|
||||
function Backup-TmNations([Context] $context) {
|
||||
Write-Host "Backing up TrackMania Nations Forever";
|
||||
$context.Backup($path, $context.SoftwareArchive($softwareName), @("-i@`"$PSScriptRoot/include.txt`""));
|
||||
}
|
||||
|
||||
function Restore-TmNations([Context] $context) {
|
||||
$features = @("DirectPlay", "NetFx3");
|
||||
Write-Host "Restoring TrackMania Nations Forever";
|
||||
|
||||
foreach ($feature in $features) {
|
||||
if ((Get-WindowsOptionalFeature -Online -FeatureName $feature).State -ne "Enabled") {
|
||||
Write-Information "Enabling the ``$feature`` feature";
|
||||
$null = Enable-WindowsOptionalFeature -Online -All -FeatureName $feature;
|
||||
}
|
||||
}
|
||||
|
||||
Write-Information "Installing TrackMania Nations Forever";
|
||||
winget install --accept-source-agreements --accept-package-agreements -e --id Nadeo.TrackManiaNationsForever;
|
||||
Write-Information "Removing Desktop Icon";
|
||||
$context.RemoveDesktopIcon("*TmNationsForever*");
|
||||
Write-Information "Restoring Files";
|
||||
$context.Restore($context.SoftwareArchive($softwareName), $path);
|
||||
}
|
||||
}
|
|
@ -1,31 +1,21 @@
|
|||
#!/bin/pwsh
|
||||
. "$PSScriptRoot/../../Scripts/Context.ps1";
|
||||
param(
|
||||
$Action,
|
||||
[hashtable] $Arguments
|
||||
)
|
||||
|
||||
$null = New-Module {
|
||||
$path = "$HOME/Documents/TmForever";
|
||||
$softwareName = "TmNationsForever";
|
||||
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
|
||||
|
||||
function Backup-TmNations([Context] $context) {
|
||||
Write-Host "Backing up TrackMania Nations Forever";
|
||||
$context.Backup($path, $context.SoftwareArchive($softwareName), @("-i@`"$PSScriptRoot/include.txt`""));
|
||||
}
|
||||
|
||||
function Restore-TmNations([Context] $context) {
|
||||
$features = @("DirectPlay", "NetFx3");
|
||||
Write-Host "Restoring TrackMania Nations Forever";
|
||||
|
||||
foreach ($feature in $features) {
|
||||
Start-SoftwareInstaller @PSBoundParameters `
|
||||
-Installer {
|
||||
foreach ($feature in @("DirectPlay", "NetFx3")) {
|
||||
if ((Get-WindowsOptionalFeature -Online -FeatureName $feature).State -ne "Enabled") {
|
||||
Write-Information "Enabling the ``$feature`` feature";
|
||||
$null = Enable-WindowsOptionalFeature -Online -All -FeatureName $feature;
|
||||
Write-Information "Enabling the ``$feature`` feature…";
|
||||
choco install --source windowsFeatures -y $feature;
|
||||
}
|
||||
}
|
||||
|
||||
Write-Information "Installing TrackMania Nations Forever";
|
||||
winget install --accept-source-agreements --accept-package-agreements -e --id Nadeo.TrackManiaNationsForever;
|
||||
Write-Information "Removing Desktop Icon";
|
||||
$context.RemoveDesktopIcon("*TmNationsForever*");
|
||||
Write-Information "Restoring Files";
|
||||
$context.Restore($context.SoftwareArchive($softwareName), $path);
|
||||
}
|
||||
}
|
||||
Install-WingetPackage Nadeo.TrackManiaNationsForever;
|
||||
Remove-DesktopIcon "*TmNationsForever*";
|
||||
}
|
||||
};
|
||||
|
||||
# ToDo: Add restoration
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
#!/bin/pwsh
|
||||
. "$PSScriptRoot/../../../Common/Scripts/Context.ps1";
|
||||
|
||||
$null = New-Module {
|
||||
$path = "$HOME/Documents/TrackMania";
|
||||
$softwareName = "TmUnitedForever";
|
||||
|
||||
function Backup-TmUnited([Context] $context) {
|
||||
Write-Host "Backing up TrackMania United Forever";
|
||||
$context.Backup($path, $context.SoftwareArchive($softwareName), @("-i@`"$PSScriptRoot/include.txt`""));
|
||||
}
|
||||
|
||||
function Restore-TmUnited([Context] $context) {
|
||||
$setupFile = "TmUnitedForever.exe";
|
||||
$features = @("DirectPlay", "NetFx3");
|
||||
Write-Host "Restoring TrackMania United Forever";
|
||||
|
||||
foreach ($feature in $features) {
|
||||
if ((Get-WindowsOptionalFeature -Online -FeatureName $feature).State -ne "Enabled") {
|
||||
Write-Information "Enabling the ``$feature`` feature";
|
||||
$null = Enable-WindowsOptionalFeature -Online -All -FeatureName $feature;
|
||||
}
|
||||
}
|
||||
|
||||
$tempDir = $context.GetTempDirectory();
|
||||
Push-Location $tempDir;
|
||||
Write-Information "Downloading TrackMania United Forever setup";
|
||||
Invoke-WebRequest "http://files.trackmaniaforever.com/tmunitedforever_setup.exe" -OutFile "$setupFile";
|
||||
|
||||
Write-Information "Installing TrackMania United Forever";
|
||||
Start-Process -Wait -FilePath $setupFile -ArgumentList @("/Silent");
|
||||
Write-Information "Removing desktop icon";
|
||||
$context.RemoveDesktopIcon("*TmUnitedForever*");
|
||||
Write-Information "Restoring files";
|
||||
$context.Restore($context.SoftwareArchive($softwareName), $path);
|
||||
Pop-Location;
|
||||
|
||||
Remove-Item -Recurse $tempDir;
|
||||
}
|
||||
}
|
|
@ -1,40 +1,33 @@
|
|||
#!/bin/pwsh
|
||||
. "$PSScriptRoot/../../Scripts/Context.ps1";
|
||||
param(
|
||||
$Action,
|
||||
[hashtable] $Arguments
|
||||
)
|
||||
|
||||
$null = New-Module {
|
||||
$path = "$HOME/Documents/TrackMania";
|
||||
$softwareName = "TmUnitedForever";
|
||||
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Scripts/System.ps1";
|
||||
|
||||
function Backup-TmUnited([Context] $context) {
|
||||
Write-Host "Backing up TrackMania United Forever";
|
||||
$context.Backup($path, $context.SoftwareArchive($softwareName), @("-i@`"$PSScriptRoot/include.txt`""));
|
||||
}
|
||||
Start-SoftwareInstaller @PSBoundParameters `
|
||||
-Installer {
|
||||
$file = "TmUnitedForever.exe";
|
||||
$dir = New-TemporaryDirectory;
|
||||
|
||||
function Restore-TmUnited([Context] $context) {
|
||||
$setupFile = "TmUnitedForever.exe";
|
||||
$features = @("DirectPlay", "NetFx3");
|
||||
Write-Host "Restoring TrackMania United Forever";
|
||||
|
||||
foreach ($feature in $features) {
|
||||
foreach ($feature in @("DirectPlay", "NetFx3")) {
|
||||
if ((Get-WindowsOptionalFeature -Online -FeatureName $feature).State -ne "Enabled") {
|
||||
Write-Information "Enabling the ``$feature`` feature";
|
||||
$null = Enable-WindowsOptionalFeature -Online -All -FeatureName $feature;
|
||||
Write-Information "Enabling the ``$feature`` feature…";
|
||||
choco install --source windowsFeatures -y $feature;
|
||||
}
|
||||
}
|
||||
|
||||
$tempDir = $context.GetTempDirectory();
|
||||
Push-Location $tempDir;
|
||||
Write-Information "Downloading TrackMania United Forever setup";
|
||||
Invoke-WebRequest "http://files.trackmaniaforever.com/tmunitedforever_setup.exe" -OutFile "$setupFile";
|
||||
$null = Push-Location $dir;
|
||||
Write-Host "Downloading TrackMania United Forever…";
|
||||
Invoke-WebRequest "http://files.trackmaniaforever.com/tmunitedforever_setup.exe" -OutFile "$file";
|
||||
|
||||
Write-Information "Installing TrackMania United Forever";
|
||||
Start-Process -Wait -FilePath $setupFile -ArgumentList @("/Silent");
|
||||
Write-Information "Removing desktop icon";
|
||||
$context.RemoveDesktopIcon("*TmUnitedForever*");
|
||||
Write-Information "Restoring files";
|
||||
$context.Restore($context.SoftwareArchive($softwareName), $path);
|
||||
Pop-Location;
|
||||
Write-Host "Starting installation…";
|
||||
Start-Process -Wait -FilePath $file -ArgumentList "/Silent";
|
||||
Remove-DesktopIcon "*TmUnitedForever*";
|
||||
$null = Pop-Location;
|
||||
|
||||
Remove-Item -Recurse $tempDir;
|
||||
}
|
||||
}
|
||||
Remove-Item -Recurse $dir;
|
||||
};
|
||||
|
||||
# ToDo: Add restoration
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/pwsh
|
||||
param($context);
|
||||
|
||||
. "$PSScriptRoot/../../Scripts/Context.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Scripts/Context.ps1";
|
||||
[Context] $context = $context;
|
||||
|
||||
Write-Host "Installing UniFi Controller";
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
param(
|
||||
$Action,
|
||||
[hashtable] $Arguments
|
||||
)
|
||||
|
||||
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Scripts/System.ps1";
|
||||
|
||||
Start-SoftwareInstaller @PSBoundParameters `
|
||||
-Installer {
|
||||
Write-Information "Downgrading AutoHotkey…";
|
||||
$id = "AutoHotkey.AutoHotkey";
|
||||
$uninstall = { winget uninstall --accept-source-agreements -e --id "$id"; };
|
||||
& $uninstall;
|
||||
Install-WingetPackage $id -ArgumentList "--version","1.1.37.00";
|
||||
Install-ChocoPackage temurin11jre;
|
||||
|
||||
Write-Host "Installing UniFi Controller…";
|
||||
Install-ChocoPackage ubiquiti-unifi-controller -ArgumentList "--ignore-dependencies";
|
||||
|
||||
Write-Information "Upgrading AutoHotkey…";
|
||||
& $uninstall;
|
||||
Install-WingetPackage $id;
|
||||
Remove-DesktopIcon "UniFi*";
|
||||
};
|
||||
|
||||
# ToDo: Add restoration
|
57
scripts/Windows/Software/VisualStudio/Install.ps1
Normal file
57
scripts/Windows/Software/VisualStudio/Install.ps1
Normal file
|
@ -0,0 +1,57 @@
|
|||
#!/bin/pwsh
|
||||
. "$PSScriptRoot/../../Scripts/KnownFolders.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Scripts/Context.ps1";
|
||||
|
||||
$null = New-Module {
|
||||
$programs32Path = $(Get-KnownFolder "ProgramFilesX86").Path;
|
||||
$vsInstaller = "$programs32Path/Microsoft Visual Studio/Installer/vs_installer.exe";
|
||||
|
||||
[System.Tuple[string, string, string][]]$versions = @(
|
||||
[System.Tuple]::Create("visualstudio2019enterprise", "VisualStudio.16.Release", "Microsoft.VisualStudio.Product.Enterprise"),
|
||||
[System.Tuple]::Create("visualstudio2019community", "VisualStudio.16.Release", "Microsoft.VisualStudio.Product.Community"),
|
||||
[System.Tuple]::Create("visualstudio2022enterprise", "VisualStudio.17.Release", "Microsoft.VisualStudio.Product.Enterprise"),
|
||||
[System.Tuple]::Create("visualstudio2022community", "VisualStudio.17.Release", "Microsoft.VisualStudio.Product.Community"));
|
||||
|
||||
function Get-ConfigPath([Context] $context, [string] $packageName) {
|
||||
return Join-Path $($context.BackupRoot()) "Visual Studio" $packageName ".vsconfig";
|
||||
}
|
||||
|
||||
function Backup-VisualStudio([Context] $context) {
|
||||
Write-Host "Backing up Visual Studio";
|
||||
|
||||
foreach ($version in $versions) {
|
||||
if ((choco list -e $version[0])) {
|
||||
Write-Information "Backing up $($version[1]): $($version[2])";
|
||||
|
||||
$configPath = Get-ConfigPath $context $version[0];
|
||||
$null = New-Item -Force -ItemType Directory "$(Split-Path -Parent $configPath)";
|
||||
|
||||
Start-Process -FilePath "$vsInstaller" `
|
||||
-Wait `
|
||||
-ArgumentList @(
|
||||
"export",
|
||||
"--channelId", "$($version[1])",
|
||||
"--productId", "$($version[2])",
|
||||
"--config", "`"$configPath`"",
|
||||
"--quiet");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function Restore-VisualStudio([Context] $context) {
|
||||
Write-Host "Restoring Visual Studio";
|
||||
|
||||
foreach ($version in $versions) {
|
||||
$configFileName = Get-ConfigPath $context $version[0];
|
||||
|
||||
if (Test-Path $configFileName) {
|
||||
Write-Information "Restoring $($version[1]): $($version[2])";
|
||||
$arguments = "--config `"$configFileName`"";
|
||||
|
||||
choco install -y $version[0] --params "$arguments";
|
||||
$context.RemoveDesktopIcon("CocosCreator*");
|
||||
$context.RemoveDesktopIcon("Unity Hub*");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,57 +1,31 @@
|
|||
#!/bin/pwsh
|
||||
. "$PSScriptRoot/../../Scripts/KnownFolders.ps1";
|
||||
. "$PSScriptRoot/../../Scripts/Context.ps1";
|
||||
param(
|
||||
$Action,
|
||||
[hashtable] $Arguments
|
||||
)
|
||||
|
||||
$null = New-Module {
|
||||
$programs32Path = $(Get-KnownFolder "ProgramFilesX86").Path;
|
||||
$vsInstaller = "$programs32Path/Microsoft Visual Studio/Installer/vs_installer.exe";
|
||||
. "$PSScriptRoot/../../../Common/Scripts/BrowserAutomation.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Scripts/System.ps1";
|
||||
|
||||
[System.Tuple[string, string, string][]]$versions = @(
|
||||
[System.Tuple[string, string, string][]] $versions = @(
|
||||
[System.Tuple]::Create("visualstudio2019enterprise", "VisualStudio.16.Release", "Microsoft.VisualStudio.Product.Enterprise"),
|
||||
[System.Tuple]::Create("visualstudio2019community", "VisualStudio.16.Release", "Microsoft.VisualStudio.Product.Community"),
|
||||
[System.Tuple]::Create("visualstudio2022enterprise", "VisualStudio.17.Release", "Microsoft.VisualStudio.Product.Enterprise"),
|
||||
[System.Tuple]::Create("visualstudio2022community", "VisualStudio.17.Release", "Microsoft.VisualStudio.Product.Community"));
|
||||
|
||||
function Get-ConfigPath([Context] $context, [string] $packageName) {
|
||||
return Join-Path $($context.BackupRoot()) "Visual Studio" $packageName ".vsconfig";
|
||||
}
|
||||
|
||||
function Backup-VisualStudio([Context] $context) {
|
||||
Write-Host "Backing up Visual Studio";
|
||||
|
||||
foreach ($version in $versions) {
|
||||
if ((choco list -e $version[0])) {
|
||||
Write-Information "Backing up $($version[1]): $($version[2])";
|
||||
[System.Tuple]::Create("visualstudio2022community", "VisualStudio.17.Release", "Microsoft.VisualStudio.Product.Community")
|
||||
);
|
||||
|
||||
$configPath = Get-ConfigPath $context $version[0];
|
||||
$null = New-Item -Force -ItemType Directory "$(Split-Path -Parent $configPath)";
|
||||
Start-SoftwareInstaller @PSBoundParameters `
|
||||
-Installer {
|
||||
foreach ($version in $versions) {
|
||||
$packageName = $version[0];
|
||||
Write-Host "Installing ``$packageName``…";
|
||||
Install-ChocoPackage $packageName;
|
||||
Remove-DesktopIcon "CocosCreator*";
|
||||
Remove-DesktopIcon "Unity Hub*";
|
||||
}
|
||||
};
|
||||
|
||||
Start-Process -FilePath "$vsInstaller" `
|
||||
-Wait `
|
||||
-ArgumentList @(
|
||||
"export",
|
||||
"--channelId", "$($version[1])",
|
||||
"--productId", "$($version[2])",
|
||||
"--config", "`"$configPath`"",
|
||||
"--quiet");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function Restore-VisualStudio([Context] $context) {
|
||||
Write-Host "Restoring Visual Studio";
|
||||
|
||||
foreach ($version in $versions) {
|
||||
$configFileName = Get-ConfigPath $context $version[0];
|
||||
|
||||
if (Test-Path $configFileName) {
|
||||
Write-Information "Restoring $($version[1]): $($version[2])";
|
||||
$arguments = "--config `"$configFileName`"";
|
||||
|
||||
choco install -y $version[0] --params "$arguments";
|
||||
$context.RemoveDesktopIcon("CocosCreator*");
|
||||
$context.RemoveDesktopIcon("Unity Hub*");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
# ToDo: Add restoration
|
||||
# Only restore version if it has been backed up
|
||||
};
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/pwsh
|
||||
param($context)
|
||||
|
||||
. "$PSScriptRoot/../../Scripts/Context.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Scripts/Context.ps1";
|
||||
[Context] $context = $context;
|
||||
|
||||
choco install -y winscp;
|
||||
|
|
|
@ -6,8 +6,8 @@ param(
|
|||
)
|
||||
|
||||
. "$PSScriptRoot/../../Scripts/AppAssociations.ps1";
|
||||
. "$PSScriptRoot/../../Scripts/Software.ps1";
|
||||
. "$PSScriptRoot/../../Scripts/System.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Scripts/System.ps1";
|
||||
|
||||
Start-SoftwareInstaller @PSBoundParameters `
|
||||
-Installer {
|
||||
|
|
|
@ -6,10 +6,10 @@ param(
|
|||
)
|
||||
|
||||
. "$PSScriptRoot/../../Scripts/Registry.ps1";
|
||||
. "$PSScriptRoot/../../Scripts/Config.ps1";
|
||||
. "$PSScriptRoot/../../Scripts/System.ps1";
|
||||
. "$PSScriptRoot/../../Scripts/Software.ps1";
|
||||
. "$PSScriptRoot/../../Types/InstallerAction.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Scripts/Config.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Scripts/System.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Types/InstallerAction.ps1";
|
||||
|
||||
Start-SoftwareInstaller @PSBoundParameters `
|
||||
-Installer {
|
||||
|
@ -31,6 +31,10 @@ Start-SoftwareInstaller @PSBoundParameters `
|
|||
Get-Config "valhalla.windows.$Name";
|
||||
}
|
||||
|
||||
# Copy keyboard layout
|
||||
# ToDo: Why not NewUser? Investiagte!
|
||||
Copy-UserInternationalSettingsToSystem -WelcomeScreen $True -NewUser $False;
|
||||
|
||||
if (Get-WinConfig "legacyIconSpacing") {
|
||||
Write-Host "Setting up old-school Desktop Icon spacing";
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/pwsh
|
||||
param($context);
|
||||
. "$PSScriptRoot/../../Scripts/Context.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Scripts/Context.ps1";
|
||||
|
||||
[Context] $context = $context;
|
||||
winget install --accept-source-agreements --accept-package-agreements -s winget --scope machine -e --id JanDeDobbeleer.Aliae;
|
||||
|
|
|
@ -5,7 +5,7 @@ param(
|
|||
[hashtable] $Arguments
|
||||
)
|
||||
|
||||
. "$PSScriptRoot/../../Scripts/Software.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
|
||||
|
||||
Start-SoftwareInstaller @PSBoundParameters `
|
||||
-Installer {
|
||||
|
@ -16,24 +16,25 @@ Start-SoftwareInstaller @PSBoundParameters `
|
|||
& $Installer -Action ([InstallerAction]::Configure)
|
||||
} `
|
||||
-Configurator {
|
||||
[string] $backup = $null;
|
||||
$nativeProfile = powershell -c '$PROFILE';
|
||||
|
||||
if (Test-Path -PathType Leaf $nativeProfile) {
|
||||
$backup = "${nativeProfile}_";
|
||||
Move-Item $nativeProfile $backup;
|
||||
}
|
||||
|
||||
$null = New-Item -Force $nativeProfile;
|
||||
choco install -y --force chocolatey;
|
||||
Copy-Item -Force $nativeProfile $PROFILE;
|
||||
|
||||
Push-Location ~;
|
||||
$files = @($nativeProfile, $PROFILE) | ForEach-Object { Resolve-Path -Relative $_ };
|
||||
Pop-Location;
|
||||
Add-PowerShellProfileStatement `
|
||||
-DefaultUser `
|
||||
-Category "chocolatey" `
|
||||
-Script (Get-Content $nativeProfile | Out-String) `
|
||||
-Append;
|
||||
|
||||
foreach ($path in $files) {
|
||||
$fullName = "$env:SystemDrive/Users/Default/$path";
|
||||
$dirName = Split-Path -Parent $fullName;
|
||||
|
||||
if (-not (Test-Path -PathType Container $dirName)) {
|
||||
$null = New-Item -Force -ItemType Directory $dirName;
|
||||
}
|
||||
|
||||
Copy-Item -Force ~/"$path" $fullName;
|
||||
if ($backup) {
|
||||
Move-Item $backup $nativeProfile;
|
||||
}
|
||||
|
||||
Import-Module "$env:ChocolateyInstall/helpers/chocolateyProfile.psm1";
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/pwsh
|
||||
. "$PSScriptRoot/../../Scripts/Context.ps1";
|
||||
. "$PSScriptRoot/../../Scripts/BashScript.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Scripts/Context.ps1";
|
||||
|
||||
$null = New-Module {
|
||||
function Backup-Git([Context] $context) {}
|
36
scripts/Windows/Software/osu!/Install.ps1
Normal file
36
scripts/Windows/Software/osu!/Install.ps1
Normal file
|
@ -0,0 +1,36 @@
|
|||
#!/bin/pwsh
|
||||
. "$PSScriptRoot/../../Scripts/KnownFolders.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Scripts/Context.ps1";
|
||||
|
||||
$null = New-Module {
|
||||
$path = "$((Get-KnownFolder -SpecialFolder ProgramFilesX86).Path)/osu!";
|
||||
$softwareName = "osu!";
|
||||
$genericConfigName = "osu!.User.cfg";
|
||||
|
||||
function Backup-Osu([Context] $context) {
|
||||
Write-Host "Backing up osu!";
|
||||
$archive = $context.SoftwareArchive($softwareName);
|
||||
Write-Information "Backing up important files";
|
||||
$context.Backup($path, $archive, @("-i@`"$PSScriptRoot/include.txt`""));
|
||||
Write-Information "Renaming user configuration to $genericConfigName";
|
||||
& 7z rn "$archive" "osu!.$env:USERNAME.cfg" $genericConfigName;
|
||||
}
|
||||
|
||||
function Restore-Osu([Context] $context) {
|
||||
Write-Host "Restoring osu!";
|
||||
Write-Information "Installing osu!";
|
||||
choco install -y osu;
|
||||
$context.RemoveDesktopIcon("*osu*");
|
||||
Write-Information "Restoring files";
|
||||
$context.Restore($context.SoftwareArchive($softwareName), $path, @("-aos"));
|
||||
$configName = "osu!.$env:USERNAME.cfg";
|
||||
Write-Information "Renaming user configuration to $configName";
|
||||
Push-Location $path;
|
||||
|
||||
if ((Test-Path $genericConfigName)) {
|
||||
Rename-Item $genericConfigName $configName;
|
||||
}
|
||||
|
||||
Pop-Location;
|
||||
}
|
||||
}
|
|
@ -1,36 +1,14 @@
|
|||
#!/bin/pwsh
|
||||
. "$PSScriptRoot/../../Scripts/KnownFolders.ps1";
|
||||
. "$PSScriptRoot/../../Scripts/Context.ps1";
|
||||
param(
|
||||
$Action,
|
||||
[hashtable] $Arguments
|
||||
)
|
||||
|
||||
$null = New-Module {
|
||||
$path = "$((Get-KnownFolder -SpecialFolder ProgramFilesX86).Path)/osu!";
|
||||
$softwareName = "osu!";
|
||||
$genericConfigName = "osu!.User.cfg";
|
||||
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
|
||||
|
||||
function Backup-Osu([Context] $context) {
|
||||
Write-Host "Backing up osu!";
|
||||
$archive = $context.SoftwareArchive($softwareName);
|
||||
Write-Information "Backing up important files";
|
||||
$context.Backup($path, $archive, @("-i@`"$PSScriptRoot/include.txt`""));
|
||||
Write-Information "Renaming user configuration to $genericConfigName";
|
||||
& 7z rn "$archive" "osu!.$env:USERNAME.cfg" $genericConfigName;
|
||||
}
|
||||
Start-SoftwareInstaller @PSBoundParameters `
|
||||
-Installer {
|
||||
Install-ChocoPackage osu;
|
||||
Remove-DesktopIcon "*osu*";
|
||||
};
|
||||
|
||||
function Restore-Osu([Context] $context) {
|
||||
Write-Host "Restoring osu!";
|
||||
Write-Information "Installing osu!";
|
||||
choco install -y osu;
|
||||
$context.RemoveDesktopIcon("*osu*");
|
||||
Write-Information "Restoring files";
|
||||
$context.Restore($context.SoftwareArchive($softwareName), $path, @("-aos"));
|
||||
$configName = "osu!.$env:USERNAME.cfg";
|
||||
Write-Information "Renaming user configuration to $configName";
|
||||
Push-Location $path;
|
||||
|
||||
if ((Test-Path $genericConfigName)) {
|
||||
Rename-Item $genericConfigName $configName;
|
||||
}
|
||||
|
||||
Pop-Location;
|
||||
}
|
||||
}
|
||||
# ToDo: Add restoration
|
||||
|
|
37
scripts/Windows/Software/osu!lazer/Install.ps1
Normal file
37
scripts/Windows/Software/osu!lazer/Install.ps1
Normal file
|
@ -0,0 +1,37 @@
|
|||
#!/bin/pwsh
|
||||
. "$PSScriptRoot/../../../Common/Scripts/Context.ps1";
|
||||
|
||||
$null = New-Module {
|
||||
$path = "$env:APPDATA/osu";
|
||||
$softwareName = "osu!lazer";
|
||||
|
||||
function Backup-OsuLazer([Context] $context) {
|
||||
Write-Host "Backing up osu!lazer";
|
||||
$context.Backup($path, $context.SoftwareArchive($softwareName), @("-i@`"$PSScriptRoot/include.txt`"", "-i!*.realm", "-i!*.db"));
|
||||
}
|
||||
|
||||
function Restore-OsuLazer([Context] $context) {
|
||||
Write-Host "Restoring osu!lazer";
|
||||
Write-Information "Restoring files";
|
||||
$context.Restore($context.SoftwareArchive($softwareName), $path);
|
||||
Write-Information "Installing osu!lazer";
|
||||
|
||||
$installerName = "osu!lazer.exe";
|
||||
$processName = "osu!";
|
||||
$tempDir = $context.GetTempDirectory();
|
||||
Push-Location $tempDir;
|
||||
Invoke-WebRequest "https://github.com/ppy/osu/releases/latest/download/install.exe" -OutFile $installerName;
|
||||
Start-Process -FilePath $installerName;
|
||||
|
||||
while (-not (Get-Process -ErrorAction "SilentlyContinue" $processName)) {
|
||||
Start-Sleep 1;
|
||||
}
|
||||
|
||||
Start-Sleep 10;
|
||||
Get-Process $processName | Stop-Process -Force;
|
||||
|
||||
$context.RemoveDesktopIcon("*osu*");
|
||||
Pop-Location;
|
||||
Remove-Item -Recurse $tempDir;
|
||||
}
|
||||
}
|
|
@ -1,37 +1,31 @@
|
|||
#!/bin/pwsh
|
||||
. "$PSScriptRoot/../../Scripts/Context.ps1";
|
||||
param(
|
||||
$Action,
|
||||
[hashtable] $Arguments
|
||||
)
|
||||
|
||||
$null = New-Module {
|
||||
$path = "$env:APPDATA/osu";
|
||||
$softwareName = "osu!lazer";
|
||||
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Scripts/System.ps1";
|
||||
|
||||
function Backup-OsuLazer([Context] $context) {
|
||||
Write-Host "Backing up osu!lazer";
|
||||
$context.Backup($path, $context.SoftwareArchive($softwareName), @("-i@`"$PSScriptRoot/include.txt`"", "-i!*.realm", "-i!*.db"));
|
||||
}
|
||||
|
||||
function Restore-OsuLazer([Context] $context) {
|
||||
Write-Host "Restoring osu!lazer";
|
||||
Write-Information "Restoring files";
|
||||
$context.Restore($context.SoftwareArchive($softwareName), $path);
|
||||
Write-Information "Installing osu!lazer";
|
||||
|
||||
$installerName = "osu!lazer.exe";
|
||||
Start-SoftwareInstaller @PSBoundParameters `
|
||||
-Installer {
|
||||
$file = "osu!lazer.exe";
|
||||
$processName = "osu!";
|
||||
$tempDir = $context.GetTempDirectory();
|
||||
Push-Location $tempDir;
|
||||
Invoke-WebRequest "https://github.com/ppy/osu/releases/latest/download/install.exe" -OutFile $installerName;
|
||||
Start-Process -FilePath $installerName;
|
||||
$dir = New-TemporaryDirectory;
|
||||
|
||||
while (-not (Get-Process -ErrorAction "SilentlyContinue" $processName)) {
|
||||
Push-Location $dir;
|
||||
Invoke-WebRequest "https://github.com/ppy/osu/releases/latest/download/install.exe" -OutFile $file;
|
||||
Start-Process -FilePath $file;
|
||||
|
||||
while (-not (Get-Process -ErrorAction SilentlyContinue $processName)) {
|
||||
Start-Sleep 1;
|
||||
}
|
||||
|
||||
Start-Sleep 10;
|
||||
Get-Process $processName | Stop-Process -Force;
|
||||
|
||||
$context.RemoveDesktopIcon("*osu*");
|
||||
Pop-Location;
|
||||
Remove-Item -Recurse $tempDir;
|
||||
}
|
||||
}
|
||||
Remove-Item -Recurse $dir;
|
||||
|
||||
Remove-DesktopIcon "*osu*";
|
||||
};
|
||||
|
||||
# ToDo: Add restoration
|
||||
|
|
31
scripts/Windows/Software/reWASD/Install.ps1
Normal file
31
scripts/Windows/Software/reWASD/Install.ps1
Normal file
|
@ -0,0 +1,31 @@
|
|||
#!/bin/pwsh
|
||||
$null = New-Module {
|
||||
. "$PSScriptRoot/../../../Common/Scripts/BrowserAutomation.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Scripts/Context.ps1";
|
||||
|
||||
$path = "$env:PUBLIC/Documents/reWASD";
|
||||
$softwareName = "reWASD";
|
||||
|
||||
function Backup-reWASD([Context] $context) {
|
||||
Write-Host "Backing up reWASD";
|
||||
$context.Backup($path, $context.SoftwareArchive($softwareName), @("-x@`"$PSScriptRoot/exclude.txt`""));
|
||||
}
|
||||
|
||||
function Restore-reWASD([Context] $context) {
|
||||
Write-Host "Restoring reWASD";
|
||||
$tempDir = $context.GetTempDirectory();
|
||||
|
||||
Write-Information "Downloading reWASD";
|
||||
$file = Start-BrowserDownload $context "https://rewasd.com/" 'a.btn-default[href="#"]' $tempDir;
|
||||
|
||||
Write-Information "Installing reWASD";
|
||||
Start-Process -Wait -FilePath $file.FullName -ArgumentList "/S";
|
||||
|
||||
Write-Information "Restoring files";
|
||||
$context.Restore($context.SoftwareArchive($softwareName), $path, @("-aos"));
|
||||
|
||||
Write-Information "Removing desktop icon";
|
||||
$context.RemoveDesktopIcon("*reWASD*");
|
||||
Remove-Item -Recurse $tempDir;
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue