Compare commits

..

57 commits

Author SHA1 Message Date
Manuel Thalmann 493847e727 Install Oh My Posh system wide 2024-08-08 14:23:15 +02:00
Manuel Thalmann e0869665dc Fix typo 2024-08-08 14:22:22 +02:00
Manuel Thalmann 7e24603c95 Skip scope argument by default 2024-08-08 14:22:13 +02:00
Manuel Thalmann f0b5e181a5 Fix incorrect file paths 2024-08-08 14:21:55 +02:00
Manuel Thalmann d97854ec55 Configure NVS after installation 2024-08-08 14:09:20 +02:00
Manuel Thalmann 0a04b12497 Refactor app association script 2024-08-08 14:09:07 +02:00
Manuel Thalmann b8e81d1458 Fix typo 2024-08-08 14:08:48 +02:00
Manuel Thalmann bbcaca2c84 Apply the error action globally 2024-08-08 14:08:38 +02:00
Manuel Thalmann 324e8bee7e Move PinnedItem script to proper location 2024-08-08 14:04:51 +02:00
Manuel Thalmann 0764d16d35 Add notes to installation script 2024-08-08 14:03:15 +02:00
Manuel Thalmann 98df4f242c Add a script for installing LGHub 2024-08-08 13:25:21 +02:00
Manuel Thalmann e2536d91a5 Reorder installation steps 2024-08-08 13:17:14 +02:00
Manuel Thalmann 00ae67d304 Reload env after installing git 2024-08-08 12:18:04 +02:00
Manuel Thalmann 7690248a55 Enure features for PinnedItem are installed 2024-08-08 05:21:21 +02:00
Manuel Thalmann 990a42bfb4 Install features using chocolatey 2024-08-08 05:20:58 +02:00
Manuel Thalmann a044612a5e Ensure git is installed 2024-08-08 05:14:31 +02:00
Manuel Thalmann 0c7e9a0959 Fix broken XML document creation 2024-08-08 05:04:59 +02:00
Manuel Thalmann c08378e7ed Fix incorrect parameter access 2024-08-08 05:03:24 +02:00
Manuel Thalmann 5f64e299aa Fix incorrect path 2024-08-08 05:01:45 +02:00
Manuel Thalmann 180379cb3a Add a dedicated user option for windows 2024-08-08 04:45:27 +02:00
Manuel Thalmann d87dee8072 Add a stage for creating users 2024-08-08 04:38:40 +02:00
Manuel Thalmann 3a0643348f Add scripts for all remaining apps 2024-08-08 04:36:35 +02:00
Manuel Thalmann 9f54702158 Allow custom winget arguments 2024-08-08 04:29:00 +02:00
Manuel Thalmann 23954e7e9f Improve winget function 2024-08-08 04:28:21 +02:00
Manuel Thalmann a2c6d8bc04 Add missing function 2024-08-08 04:20:11 +02:00
Manuel Thalmann e91c7ba371 Refactor browser scripts 2024-08-08 03:32:03 +02:00
Manuel Thalmann b6135b0750 Ensure Selenium is imported 2024-08-08 02:59:02 +02:00
Manuel Thalmann ab07c87c57 Allow skipping the Action argument 2024-08-08 02:56:28 +02:00
Manuel Thalmann 1b7e2b5966 Rename all old installation scripts 2024-08-08 02:56:13 +02:00
Manuel Thalmann 8655012f33 Add options for enabling LG Hub 2024-08-08 02:32:15 +02:00
Manuel Thalmann 9d9d910554 Remove Firefox taskbar icon 2024-08-08 02:32:15 +02:00
Manuel Thalmann 5a64f8e42d Allow removing task bar icons 2024-08-08 02:31:59 +02:00
Manuel Thalmann 889f969045 Allow installing modules native only 2024-08-08 02:28:23 +02:00
Manuel Thalmann 0d1dbda873 Rename old LGHub script 2024-08-08 02:27:39 +02:00
Manuel Thalmann 6a443c7438 Add missing config 2024-08-08 01:51:21 +02:00
Manuel Thalmann a532df391a Rename PuTTY script 2024-08-08 00:51:45 +02:00
Manuel Thalmann 96cdbb231d Fix permission issue 2024-08-08 00:48:18 +02:00
Manuel Thalmann 219e991d45 Add scripts for installing Tobii apps 2024-08-08 00:06:49 +02:00
Manuel Thalmann 6f4a22b5aa Copy keyboard layout to welcome screen 2024-08-07 23:53:26 +02:00
Manuel Thalmann 933402144d Add scripts for desktop apps 2024-08-07 23:53:12 +02:00
Manuel Thalmann bb9eb99a36 Rename old Nextcloud script 2024-08-07 23:45:56 +02:00
Manuel Thalmann f9752543c1 Configure user only outside of setup 2024-08-07 23:30:29 +02:00
Manuel Thalmann e32d97ec51 Add a script for installing Oh My Posh 2024-08-07 23:22:04 +02:00
Manuel Thalmann ff86ea62f9 Fix incorrect installation filter 2024-08-07 23:20:28 +02:00
Manuel Thalmann dde206a980 Fix profile script for individual profiles 2024-08-07 23:18:44 +02:00
Manuel Thalmann bfba6b532f Show messages if packages are installed 2024-08-07 23:18:23 +02:00
Manuel Thalmann 1c9de44bd8 Fix incorrect package check 2024-08-07 23:17:07 +02:00
Manuel Thalmann 72d8ebe35f Refactor default winget parameters 2024-08-07 22:56:42 +02:00
Manuel Thalmann 036d2a8338 Add scripts for installing PS modules 2024-08-07 22:55:25 +02:00
Manuel Thalmann 049c8d5eba Allow skipping PowerShell profile files 2024-08-07 22:25:42 +02:00
Manuel Thalmann 096446e646 Resolve dependency loop 2024-08-07 21:54:58 +02:00
Manuel Thalmann 27bd44a127 Remove unnecessary statement 2024-08-07 21:53:26 +02:00
Manuel Thalmann 30638e42f1 Refactor chocolatey script 2024-08-07 21:50:21 +02:00
Manuel Thalmann a667593dbb Pass arguments to software script 2024-08-07 21:37:33 +02:00
Manuel Thalmann df850deeea Use internal OS detection 2024-08-07 21:35:03 +02:00
Manuel Thalmann 438bbb911e Refactor PowerShell profile script 2024-08-07 21:34:40 +02:00
Manuel Thalmann d90e3bb437 Move scripts properly 2024-08-07 21:05:32 +02:00
104 changed files with 1708 additions and 672 deletions

View file

@ -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;
};
};
};
};

View file

@ -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 = {

View file

@ -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";

View file

@ -1,5 +1,5 @@
#!/bin/pwsh
. "$PSScriptRoot/../../../scripts/Windows/Scripts/Context.ps1";
. "$PSScriptRoot/../../../scripts/Common/Scripts/Context.ps1";
function Install-PortValhallaDrivers {
param(

View file

@ -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

View file

@ -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;
};
};

View file

@ -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"

View file

@ -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"),

View file

@ -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")";

View file

@ -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")

View file

@ -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;
}
<#

View file

@ -6,6 +6,7 @@ enum SetupStage {
Initialize
Configure
Install
CreateUser
}
$null = New-Module {

View file

@ -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;
}
}

View file

@ -3,7 +3,7 @@ function Start-Operation {
[scriptblock] $Action
)
$ErrorActionPreference = 'Inquire';
$Global:ErrorActionPreference = 'Inquire';
$env:WSLENV = "CONFIG_MODULE/p";
if ($env:CONFIG_MODULE) {

View file

@ -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
)

View file

@ -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;
}

View file

@ -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; $?; };
}
<#

View file

@ -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;
}

View 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)
};

View file

@ -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;
}
};

View 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`";";
};
}
}
};

View 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`"))";
}
};

View file

@ -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`"))";
}
}

View 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;

View 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;

View file

@ -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")

View file

@ -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;

View file

@ -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;

View file

@ -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";';

View file

@ -1,7 +1,7 @@
#!/bin/pwsh
param($context)
. "$PSScriptRoot/../../Scripts/Context.ps1";
. "$PSScriptRoot/../../../Common/Scripts/Context.ps1";
[Context] $context = $context;
$tempDir = $context.GetTempDirectory();

View file

@ -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";'

View file

@ -3,7 +3,7 @@ param(
[hashtable] $Arguments
)
. "$PSScriptRoot/../../Scripts/Software.ps1";
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
Start-SoftwareInstaller @PSBoundParameters `
-Installer {

View file

@ -2,7 +2,7 @@
param($context)
. "$PSScriptRoot/../../Scripts/Context.ps1";
. "$PSScriptRoot/../../../Common/Scripts/Context.ps1";
[Context]$context = $context;
$tempDir = $context.GetTempDirectory();

View file

@ -3,7 +3,7 @@ param(
[hashtable] $Arguments
)
. "$PSScriptRoot/../../Scripts/Software.ps1";
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
. "$PSScriptRoot/../../Scripts/System.ps1";
Start-SoftwareInstaller @PSBoundParameters `

View file

@ -3,7 +3,7 @@ param(
[hashtable] $Arguments
)
. "$PSScriptRoot/../../../Scripts/Software.ps1";
. "$PSScriptRoot/../../../../Common/Scripts/Software.ps1";
Start-SoftwareInstaller @PSBoundParameters `
-Installer {

View file

@ -3,7 +3,7 @@ param(
[hashtable] $Arguments
)
. "$PSScriptRoot/../../../Scripts/Software.ps1";
. "$PSScriptRoot/../../../../Common/Scripts/Software.ps1";
Start-SoftwareInstaller @PSBoundParameters `
-Installer {

View file

@ -3,7 +3,7 @@ param(
[hashtable] $Arguments
)
. "$PSScriptRoot/../../../Scripts/Software.ps1";
. "$PSScriptRoot/../../../../Common/Scripts/Software.ps1";
Start-SoftwareInstaller @PSBoundParameters `
-Installer {

View file

@ -3,7 +3,7 @@ param(
[hashtable] $Arguments
)
. "$PSScriptRoot/../../../Scripts/Software.ps1";
. "$PSScriptRoot/../../../../Common/Scripts/Software.ps1";
Start-SoftwareInstaller @PSBoundParameters `
-Installer {

View file

@ -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";

View file

@ -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;
}
};
};

View file

@ -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;
}
}

View file

@ -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";

View file

@ -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;

View file

@ -1,5 +1,5 @@
#!/bin/pwsh
. "$PSScriptRoot/../Scripts/Context.ps1";
. "$PSScriptRoot/../../Common/Scripts/Context.ps1";
function Update-WindowsInstallation([Context] $context)
{

View file

@ -1,5 +1,5 @@
#!/bin/pwsh
$contextScript = "$PSScriptRoot/../../Scripts/Context.ps1";
$contextScript = "$PSScriptRoot/../../../Common/Scripts/Context.ps1";
. "$contextScript";
$preparedUsernameProperty = "AutoLoginUser";
$preparedPasswordProperty = "AutoLoginPassword";

View file

@ -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);

View file

@ -1,5 +1,5 @@
#!/bin/pwsh
. "$PSScriptRoot/../../Scripts/Context.ps1";
. "$PSScriptRoot/../../../Common/Scripts/Context.ps1";
. "$PSScriptRoot/Add.ps1";
function Install-PersonalUsers([Context] $context) {

View file

@ -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;

View file

@ -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(

View file

@ -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();

View file

@ -1,4 +1,4 @@
. "$PSScriptRoot/Context.ps1";
. "$PSScriptRoot/../../Common/ScriptsContext.ps1";
function Install-AsusSoftwarePackage([Context] $context, [string] $url) {
$packageFile = "AsusPackage.zip";

View file

@ -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 = @();

View file

@ -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";

View file

@ -1,5 +1,5 @@
#!/bin/pwsh
. "$PSScriptRoot/Context.ps1";
. "$PSScriptRoot/../../Common/Scripts/Context.ps1";
[Context]::new().PreventSleepMode();
$null = powershell -c Get-PackageProvider -ListAvailable NuGet;

View file

@ -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"

View file

@ -1,5 +1,5 @@
#!/bin/pwsh
. "$PSScriptRoot/../../Scripts/Context.ps1";
. "$PSScriptRoot/../../../Common/Scripts/Context.ps1";
function Install-Firefox {
param([Context] $context)

View 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*";
};

View file

@ -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();

View 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;
}
}

View file

@ -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

View 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]);
}
};

View 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);
}
}

View file

@ -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

View 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;
};

View 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;
}
}
}

View file

@ -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;
}
}
}
};

View file

@ -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;

View 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);
};

View file

@ -5,7 +5,7 @@ param(
[hashtable] $Arguments
)
. "$PSScriptRoot/../../Scripts/Software.ps1";
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
Start-SoftwareInstaller @PSBoundParameters `
-Installer {

View 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;
}

View file

@ -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);
};

View 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;
}
}

View file

@ -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

View 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);
}
}

View file

@ -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

View file

@ -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";

View file

@ -6,7 +6,7 @@ param(
)
. "$PSScriptRoot/../../Scripts/AppAssociations.ps1";
. "$PSScriptRoot/../../Scripts/Software.ps1";
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
Start-SoftwareInstaller @PSBoundParameters `
-Installer {

View 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;
};

View 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;
};

View file

@ -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);
}
}

View file

@ -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

View file

@ -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;
}
}

View file

@ -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

View file

@ -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";

View file

@ -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

View 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*");
}
}
}
}

View file

@ -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
};

View file

@ -1,7 +1,7 @@
#!/bin/pwsh
param($context)
. "$PSScriptRoot/../../Scripts/Context.ps1";
. "$PSScriptRoot/../../../Common/Scripts/Context.ps1";
[Context] $context = $context;
choco install -y winscp;

View file

@ -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 {

View file

@ -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";

View file

@ -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;

View file

@ -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";

View file

@ -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) {}

View 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;
}
}

View file

@ -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

View 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;
}
}

View file

@ -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

View 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