Compare commits
4 commits
3065e12d87
...
1f893ef6eb
Author | SHA1 | Date | |
---|---|---|---|
Manuel Thalmann | 1f893ef6eb | ||
Manuel Thalmann | af0dc7ec4e | ||
Manuel Thalmann | 6e0de869d1 | ||
Manuel Thalmann | 2025fa8afd |
|
@ -1,19 +0,0 @@
|
|||
#!/bin/bash -e
|
||||
function install() {
|
||||
function installDrivers() {
|
||||
. "../../../scripts/Arch/Config/SecureBoot/install.sh";
|
||||
. "../../../scripts/Arch/Software/nvidia-dkms/install.sh";
|
||||
. "../../../scripts/Arch/Software/xone/install.sh";
|
||||
. "../../../scripts/Arch/Software/bt-dualboot/install.sh";
|
||||
}
|
||||
|
||||
function initializeConfig() {
|
||||
. "../../../scripts/Unix/Devices/Logitech G903/install.sh";
|
||||
}
|
||||
|
||||
pushd "$dir" > /dev/null;
|
||||
. "../../../scripts/Arch/OS/install.sh";
|
||||
popd > /dev/null;
|
||||
}
|
||||
|
||||
install;
|
|
@ -1,13 +0,0 @@
|
|||
#!/bin/pwsh
|
||||
. "$PSScriptRoot/../../../scripts/Common/Scripts/Context.ps1";
|
||||
. "$PSScriptRoot/../../../scripts/Windows/OS/Manage.ps1";
|
||||
. "$PSScriptRoot/../../../scripts/Windows/Collections/Generic.ps1"
|
||||
|
||||
function Restore-Apps {
|
||||
param([Context] $context)
|
||||
Restore-GenericApps $context;
|
||||
}
|
||||
|
||||
[Context]$context = [Context]::new();
|
||||
Invoke-WindowsInstallation $context;
|
||||
Restart-Computer -Force;
|
|
@ -1,5 +0,0 @@
|
|||
#!/bin/env fish
|
||||
begin
|
||||
set -l dir (status dirname)
|
||||
source "$dir/../../../scripts/Arch/OS/install.fish"
|
||||
end
|
|
@ -1,26 +0,0 @@
|
|||
#!/bin/bash -e
|
||||
function install() {
|
||||
function installDrivers() {
|
||||
. "../../../scripts/Arch/Config/SecureBoot/install.sh";
|
||||
. "../../../scripts/Arch/Drivers/SurfaceBook2/install.sh";
|
||||
}
|
||||
|
||||
function installSoftware() {
|
||||
. "../../../scripts/Arch/Collections/school.sh";
|
||||
}
|
||||
|
||||
function initializeConfig() {
|
||||
. "../../../scripts/Common/Config/Steam/hidpi.sh";
|
||||
. "../../../scripts/Unix/Devices/Surface Book 2/install.sh";
|
||||
. "../../../scripts/Unix/Devices/Logitech G903/install.sh";
|
||||
|
||||
# Because, as it looks, Surface Books are fucking stupid.
|
||||
. "../../../scripts/Common/Config/GRUB/verbose.sh";
|
||||
}
|
||||
|
||||
pushd "${BASH_SOURCE%/*}" > /dev/null;
|
||||
. "../../../scripts/Arch/OS/install.sh";
|
||||
popd > /dev/null;
|
||||
}
|
||||
|
||||
install;
|
|
@ -1,16 +0,0 @@
|
|||
#!/bin/bash
|
||||
pushd "${BASH_SOURCE%/*}" > /dev/null;
|
||||
# Set Hostname
|
||||
sudo hostnamectl set-hostname ManuSurface;
|
||||
|
||||
source "../../../scripts/PopOS/Scripts/preinstall.sh";
|
||||
source "../../../scripts/PopOS/OS/install.sh";
|
||||
source "../../../scripts/Debian/Drivers/SurfaceBook2/Setup/install.sh";
|
||||
source "../../../scripts/PopOS/Software/Collections/school.sh";
|
||||
INSTALL_FONTS=1 NEXTCLOUD_DIR="${NEXTCLOUD_DIR}" source "../../../scripts/Common/Config/UserProfile/install.sh";
|
||||
|
||||
# Install equalizer
|
||||
source "../../../scripts/Common/Config/EasyEffects/SurfaceBook2/install.sh";
|
||||
|
||||
source "../../../scripts/PopOS/Scripts/postinstall.sh";
|
||||
popd > /dev/null;
|
|
@ -1,12 +0,0 @@
|
|||
#!/bin/bash
|
||||
pushd "${BASH_SOURCE%/*}" > /dev/null;
|
||||
|
||||
# Set Hostname
|
||||
sudo hostnamectl set-hostname ManuPopOSLive;
|
||||
source "../../scripts/PopOS/Scripts/prepare.sh";
|
||||
source "../../scripts/PopOS/OS/install.sh";
|
||||
source "../../scripts/PopOS/Software/Collections/personal.sh";
|
||||
INSTALL_FONTS=1 NEXTCLOUD_DIR="${NEXTCLOUD_DIR}" source "../../scripts/Common/Config/UserProfile/personal.sh";
|
||||
|
||||
source "../../scripts/PopOS/Scripts/postinstall.sh";
|
||||
popd > /dev/null;
|
19
profiles/machines/manuel/DerGeret/Arch/install.sh
Executable file
19
profiles/machines/manuel/DerGeret/Arch/install.sh
Executable file
|
@ -0,0 +1,19 @@
|
|||
#!/bin/bash -e
|
||||
function install() {
|
||||
function installDrivers() {
|
||||
. "../../../../../scripts/Arch/Config/SecureBoot/install.sh";
|
||||
. "../../../../../scripts/Arch/Software/nvidia-dkms/install.sh";
|
||||
. "../../../../../scripts/Arch/Software/xone/install.sh";
|
||||
. "../../../../../scripts/Arch/Software/bt-dualboot/install.sh";
|
||||
}
|
||||
|
||||
function initializeConfig() {
|
||||
. "../../../../../scripts/Unix/Devices/Logitech G903/install.sh";
|
||||
}
|
||||
|
||||
pushd "$dir" > /dev/null;
|
||||
. "../../../../../scripts/Arch/OS/install.sh";
|
||||
popd > /dev/null;
|
||||
}
|
||||
|
||||
install;
|
|
@ -9,5 +9,5 @@ begin
|
|||
CONFIG_MODULE="$dir/config.nix" \
|
||||
ARCH_HOSTNAME="der-geret" \
|
||||
USER_DISPLAYNAME="Manuel Thalmann" \
|
||||
source "$(status dirname)/../../../scripts/Arch/OS/setup.fish"
|
||||
source "$(status dirname)/../../../../../scripts/Arch/OS/setup.fish"
|
||||
end
|
|
@ -4,6 +4,6 @@ pushd "${BASH_SOURCE%/*}" > /dev/null;
|
|||
CONFIG_MODULE="./config.nix" \
|
||||
ARCH_HOSTNAME="der-geret" \
|
||||
USER_DISPLAYNAME="Manuel Thalmann" \
|
||||
. "../../../scripts/Arch/OS/setup.sh";
|
||||
. "../../../../../scripts/Arch/OS/setup.sh";
|
||||
|
||||
popd > /dev/null;
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/pwsh
|
||||
$null = New-Module {
|
||||
. "$PSScriptRoot/../../../scripts/Common/Scripts/Context.ps1";
|
||||
. "$PSScriptRoot/../../../scripts/Windows/OS/Legacy.ps1";
|
||||
. "$PSScriptRoot/../../../../../scripts/Common/Scripts/Context.ps1";
|
||||
. "$PSScriptRoot/../../../../../scripts/Windows/OS/Legacy.ps1";
|
||||
|
||||
Write-Host "Starting Backup of Windows";
|
||||
$context = [Context]::new();
|
|
@ -1,12 +1,12 @@
|
|||
#!/bin/pwsh
|
||||
. "$PSScriptRoot/../../../scripts/Common/Scripts/Context.ps1";
|
||||
. "$PSScriptRoot/../../../../../scripts/Common/Scripts/Context.ps1";
|
||||
|
||||
function Install-PortValhallaDrivers {
|
||||
param(
|
||||
[Context] $context
|
||||
)
|
||||
|
||||
$winPath = "$PSScriptRoot/../../../scripts/Windows";
|
||||
$winPath = "$PSScriptRoot/../../../../../scripts/Windows";
|
||||
$driverPath = "$winPath/Drivers";
|
||||
$mbDriverPath = "$driverPath/ROG Zenith Extreme Alpha";
|
||||
$context.RegisterReboot();
|
||||
|
@ -38,7 +38,7 @@ function Install-PersonalDrivers {
|
|||
[Context] $context
|
||||
)
|
||||
|
||||
$softwarePath = "$PSScriptRoot/../../../scripts/Windows/Software";
|
||||
$softwarePath = "$PSScriptRoot/../../../../../scripts/Windows/Software";
|
||||
. "$softwarePath/TobiiGhost/Install.ps1" $context;
|
||||
. "$softwarePath/TobiiGameHub/Install.ps1" $context;
|
||||
}
|
|
@ -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/Manage.ps1";
|
||||
. "$PSScriptRoot/../../../../../scripts/Common/Scripts/Context.ps1";
|
||||
. "$PSScriptRoot/../../../../../scripts/Windows/Collections/Personal.ps1"
|
||||
. "$PSScriptRoot/../../../../../scripts/Windows/OS/Manage.ps1";
|
||||
|
||||
function Initialize-Configuration {
|
||||
# Fix synchronization between Linux and Windows clock
|
|
@ -3,4 +3,4 @@ $env:WIN_COMPUTER_NAME = "DerGeret";
|
|||
$env:SETUP_SCRIPT_NAME = "$PSScriptRoot/Restore.ps1";
|
||||
$env:CONFIG_MODULE = "$PSScriptRoot/../config.nix";
|
||||
|
||||
. "$PSScriptRoot/../../../scripts/Windows/OS/Setup.ps1";
|
||||
. "$PSScriptRoot/../../../../../scripts/Windows/OS/Setup.ps1";
|
|
@ -1,9 +1,9 @@
|
|||
{ ... }: {
|
||||
imports = [
|
||||
../Generic/config.nix
|
||||
../defaults.nix
|
||||
];
|
||||
|
||||
config = {
|
||||
config = {
|
||||
valhalla = {
|
||||
windows = {
|
||||
dualboot = {
|
|
@ -3,11 +3,11 @@ function install() {
|
|||
local dir="$(realpath "${BASH_SOURCE%/*}")";
|
||||
|
||||
function installDrivers() {
|
||||
. "$dir/../../../scripts/Arch/Config/SecureBoot/install.sh";
|
||||
. "$dir/../../../../../scripts/Arch/Config/SecureBoot/install.sh";
|
||||
}
|
||||
|
||||
|
||||
. "../../../scripts/Arch/OS/install.sh";
|
||||
. "../../../../../scripts/Arch/OS/install.sh";
|
||||
}
|
||||
|
||||
install;
|
|
@ -4,6 +4,6 @@ pushd "${BASH_SOURCE%/*}" > /dev/null;
|
|||
ARCH_MOUNT_ROOT="/mnt" \
|
||||
ARCH_HOSTNAME="archlinux" \
|
||||
USER_DISPLAYNAME="Manuel Thalmann" \
|
||||
. "../../../scripts/Arch/OS/setup.sh";
|
||||
. "../../../../../scripts/Arch/OS/setup.sh";
|
||||
|
||||
popd > /dev/null;
|
13
profiles/machines/manuel/Generic/Windows/Install.ps1
Normal file
13
profiles/machines/manuel/Generic/Windows/Install.ps1
Normal file
|
@ -0,0 +1,13 @@
|
|||
#!/bin/pwsh
|
||||
. "$PSScriptRoot/../../../../../scripts/Common/Scripts/Context.ps1";
|
||||
. "$PSScriptRoot/../../../../../scripts/Windows/OS/Manage.ps1";
|
||||
. "$PSScriptRoot/../../../../../scripts/Windows/Collections/Generic.ps1"
|
||||
|
||||
function Restore-Apps {
|
||||
param([Context] $context)
|
||||
Restore-GenericApps $context;
|
||||
}
|
||||
|
||||
[Context]$context = [Context]::new();
|
||||
Invoke-WindowsInstallation $context;
|
||||
Restart-Computer -Force;
|
|
@ -3,4 +3,4 @@ $env:WIN_COMPUTER_NAME ??= "win11";
|
|||
$env:SETUP_SCRIPT_NAME ??= "$PSScriptRoot/Install.ps1";
|
||||
$env:CONFIG_MODULE ??= "$PSScriptRoot/../config.nix";
|
||||
|
||||
. "$PSScriptRoot/../../../scripts/Windows/OS/Setup.ps1";
|
||||
. "$PSScriptRoot/../../../../../scripts/Windows/OS/Setup.ps1";
|
|
@ -1,10 +1,9 @@
|
|||
{ lib, config, ... }:
|
||||
let
|
||||
fs = import ../../lib/modules/partition/fs.nix;
|
||||
fs = import ../../../../lib/modules/partition/fs.nix;
|
||||
in {
|
||||
imports = [
|
||||
../manuel/config.nix
|
||||
../../lib/modules/valhalla.nix
|
||||
../defaults.nix
|
||||
];
|
||||
|
||||
config = {
|
||||
|
@ -36,53 +35,6 @@
|
|||
};
|
||||
};
|
||||
|
||||
users = {
|
||||
manuel = {
|
||||
displayName = "Manuel Thalmann";
|
||||
mailAddress = "m@nuth.ch";
|
||||
};
|
||||
};
|
||||
|
||||
linux.users.manuel = {
|
||||
defaultShell = "fish";
|
||||
|
||||
groups = [
|
||||
"wheel"
|
||||
"nix-users"
|
||||
];
|
||||
|
||||
rclone = {
|
||||
configurations = {
|
||||
nextcloud = {
|
||||
dirName = "Nextcloud";
|
||||
};
|
||||
proton = {
|
||||
dirName = "Proton";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
windows.users.manuel = {
|
||||
nextcloud = {
|
||||
folderSyncs =
|
||||
let
|
||||
localPath = "C:/tools/RetroArch-Win64";
|
||||
remotePath = "/Saved Games/RetroArch";
|
||||
in [
|
||||
{
|
||||
remotePath = "${remotePath}/Saves";
|
||||
localPath = "${localPath}/saves";
|
||||
virtualFiles = false;
|
||||
}
|
||||
{
|
||||
remotePath = "${remotePath}/System";
|
||||
localPath = "${localPath}/system";
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
timeZone = "Europe/Zurich";
|
||||
keyMap = "de_CH-latin1";
|
||||
keyboardLayout = "ch";
|
|
@ -14,4 +14,4 @@ function Install-PortValhallaDrivers {
|
|||
choco install -y spice-agent;
|
||||
}
|
||||
|
||||
. "$PSScriptRoot/../../Generic/Windows/Install.ps1";
|
||||
. "$PSScriptRoot/../../../../Generic/Windows/Install.ps1";
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/pwsh
|
||||
$env:SETUP_SCRIPT_NAME ??= "$PSScriptRoot/Install.ps1";
|
||||
|
||||
. "$PSScriptRoot/../../Generic/Windows/Setup.ps1";
|
||||
. "$PSScriptRoot/../../../../Generic/Windows/Setup.ps1";
|
5
profiles/machines/manuel/ManuSurface/Arch/install.fish
Executable file
5
profiles/machines/manuel/ManuSurface/Arch/install.fish
Executable file
|
@ -0,0 +1,5 @@
|
|||
#!/bin/env fish
|
||||
begin
|
||||
set -l dir (status dirname)
|
||||
source "$dir/../../../../../scripts/Arch/OS/install.fish"
|
||||
end
|
26
profiles/machines/manuel/ManuSurface/Arch/install.sh
Executable file
26
profiles/machines/manuel/ManuSurface/Arch/install.sh
Executable file
|
@ -0,0 +1,26 @@
|
|||
#!/bin/bash -e
|
||||
function install() {
|
||||
function installDrivers() {
|
||||
. "../../../../../scripts/Arch/Config/SecureBoot/install.sh";
|
||||
. "../../../../../scripts/Arch/Drivers/SurfaceBook2/install.sh";
|
||||
}
|
||||
|
||||
function installSoftware() {
|
||||
. "../../../../../scripts/Arch/Collections/school.sh";
|
||||
}
|
||||
|
||||
function initializeConfig() {
|
||||
. "../../../../../scripts/Common/Config/Steam/hidpi.sh";
|
||||
. "../../../../../scripts/Unix/Devices/Surface Book 2/install.sh";
|
||||
. "../../../../../scripts/Unix/Devices/Logitech G903/install.sh";
|
||||
|
||||
# Because, as it looks, Surface Books are fucking stupid.
|
||||
. "../../../../../scripts/Common/Config/GRUB/verbose.sh";
|
||||
}
|
||||
|
||||
pushd "${BASH_SOURCE%/*}" > /dev/null;
|
||||
. "../../../../../scripts/Arch/OS/install.sh";
|
||||
popd > /dev/null;
|
||||
}
|
||||
|
||||
install;
|
|
@ -3,7 +3,7 @@ begin
|
|||
set -l dir (status dirname)
|
||||
|
||||
function installDrivers -V dir -S
|
||||
source "$dir/../../../scripts/Common/Scripts/config.fish"
|
||||
source "$dir/../../../../../scripts/Common/Scripts/config.fish"
|
||||
pacstrap -K (getConfig valhalla.partition.rootDir) linux-firmware-marvell;
|
||||
end
|
||||
|
||||
|
@ -14,5 +14,5 @@ begin
|
|||
CONFIG_MODULE="$(status dirname)/config.nix" \
|
||||
ARCH_HOSTNAME="manu-surface" \
|
||||
USER_DISPLAYNAME="Manuel Thalmann" \
|
||||
source "$(status dirname)/../../../scripts/Arch/OS/setup.fish";
|
||||
source "$(status dirname)/../../../../../scripts/Arch/OS/setup.fish";
|
||||
end
|
16
profiles/machines/manuel/ManuSurface/PopOS/setup.sh
Executable file
16
profiles/machines/manuel/ManuSurface/PopOS/setup.sh
Executable file
|
@ -0,0 +1,16 @@
|
|||
#!/bin/bash
|
||||
pushd "${BASH_SOURCE%/*}" > /dev/null;
|
||||
# Set Hostname
|
||||
sudo hostnamectl set-hostname ManuSurface;
|
||||
|
||||
source "../../../../../scripts/PopOS/Scripts/preinstall.sh";
|
||||
source "../../../../../scripts/PopOS/OS/install.sh";
|
||||
source "../../../../../scripts/Debian/Drivers/SurfaceBook2/Setup/install.sh";
|
||||
source "../../../../../scripts/PopOS/Software/Collections/school.sh";
|
||||
INSTALL_FONTS=1 NEXTCLOUD_DIR="${NEXTCLOUD_DIR}" source "../../../../../scripts/Common/Config/UserProfile/install.sh";
|
||||
|
||||
# Install equalizer
|
||||
source "../../../../../scripts/Common/Config/EasyEffects/SurfaceBook2/install.sh";
|
||||
|
||||
source "../../../../../scripts/PopOS/Scripts/postinstall.sh";
|
||||
popd > /dev/null;
|
12
profiles/machines/manuel/PopOSLive/setup.sh
Executable file
12
profiles/machines/manuel/PopOSLive/setup.sh
Executable file
|
@ -0,0 +1,12 @@
|
|||
#!/bin/bash
|
||||
pushd "${BASH_SOURCE%/*}" > /dev/null;
|
||||
|
||||
# Set Hostname
|
||||
sudo hostnamectl set-hostname ManuPopOSLive;
|
||||
source "../../../../scripts/PopOS/Scripts/prepare.sh";
|
||||
source "../../../../scripts/PopOS/OS/install.sh";
|
||||
source "../../../../scripts/PopOS/Software/Collections/personal.sh";
|
||||
INSTALL_FONTS=1 NEXTCLOUD_DIR="${NEXTCLOUD_DIR}" source "../../../../scripts/Common/Config/UserProfile/personal.sh";
|
||||
|
||||
source "../../../../scripts/PopOS/Scripts/postinstall.sh";
|
||||
popd > /dev/null;
|
6
profiles/machines/manuel/defaults.nix
Normal file
6
profiles/machines/manuel/defaults.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
{ ... }: {
|
||||
imports = [
|
||||
../../users/manuel/config.nix
|
||||
../../../lib/modules/valhalla.nix
|
||||
];
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
{ ... }: {
|
||||
imports = [
|
||||
../../lib/modules/valhalla.nix
|
||||
];
|
||||
|
||||
config = {
|
||||
valhalla = {
|
||||
users.manuel = {
|
||||
oh-my-posh = {
|
||||
theme = {
|
||||
source = ./manuel.omp.json;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
partition = {
|
||||
os = {
|
||||
partitions = { };
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
66
profiles/users/manuel/config.nix
Normal file
66
profiles/users/manuel/config.nix
Normal file
|
@ -0,0 +1,66 @@
|
|||
{ ... }: {
|
||||
imports = [
|
||||
../../../lib/modules/valhalla.nix
|
||||
];
|
||||
|
||||
config = {
|
||||
valhalla = {
|
||||
users.manuel = {
|
||||
displayName = "Manuel Thalmann";
|
||||
mailAddress = "m@nuth.ch";
|
||||
|
||||
oh-my-posh = {
|
||||
theme = {
|
||||
source = ./manuel.omp.json;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
linux.users.manuel = {
|
||||
defaultShell = "fish";
|
||||
|
||||
groups = [
|
||||
"wheel"
|
||||
"nix-users"
|
||||
];
|
||||
|
||||
rclone = {
|
||||
configurations = {
|
||||
nextcloud = {
|
||||
dirName = "Nextcloud";
|
||||
};
|
||||
proton = {
|
||||
dirName = "Proton";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
windows.users.manuel = {
|
||||
nextcloud = {
|
||||
folderSyncs =
|
||||
let
|
||||
localPath = "C:/tools/RetroArch-Win64";
|
||||
remotePath = "/Saved Games/RetroArch";
|
||||
in [
|
||||
{
|
||||
remotePath = "${remotePath}/Saves";
|
||||
localPath = "${localPath}/saves";
|
||||
virtualFiles = false;
|
||||
}
|
||||
{
|
||||
remotePath = "${remotePath}/System";
|
||||
localPath = "${localPath}/system";
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
partition = {
|
||||
os = {
|
||||
partitions = { };
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -5,6 +5,7 @@ using namespace System.Security.Principal;
|
|||
enum WindowsInstallerStage {
|
||||
Initialize
|
||||
Run
|
||||
Cleanup
|
||||
Completed
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,33 @@ $null = New-Module {
|
|||
Set-SetupOption $taskOption ([string]$Task);
|
||||
};
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Gets the PowerShell modules required for operating.
|
||||
#>
|
||||
function Get-RequiredModules {
|
||||
$modules = @(
|
||||
@("PSScriptAnalyzer")
|
||||
) + (& {
|
||||
if (-not $IsWindows) {
|
||||
@()
|
||||
} else {
|
||||
@(
|
||||
@("KnownFolders"),
|
||||
@("PSWindowsUpdate"),
|
||||
@("LocalAccounts", $true),
|
||||
@("NuGet")
|
||||
)
|
||||
}
|
||||
});
|
||||
|
||||
for ($i = 0; $i -lt $modules.Count; $i++) {
|
||||
if ($modules[$i] -is [string]) {
|
||||
$modules[$i] = @($modules[$i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function Start-Operation {
|
||||
param(
|
||||
[switch] $NonInteractive,
|
||||
|
@ -215,22 +242,7 @@ $null = New-Module {
|
|||
}
|
||||
|
||||
Invoke-Hook "Install-PSModules" -Fallback {
|
||||
$modules = @(
|
||||
@("PSScriptAnalyzer")
|
||||
) + (& {
|
||||
if (-not $IsWindows) {
|
||||
@()
|
||||
} else {
|
||||
@(
|
||||
@("KnownFolders"),
|
||||
@("PSWindowsUpdate"),
|
||||
@("LocalAccounts", $true),
|
||||
@("NuGet")
|
||||
)
|
||||
}
|
||||
});
|
||||
|
||||
foreach ($module in $modules) {
|
||||
foreach ($module in (Get-RequiredModules)) {
|
||||
$parameters = @{ };
|
||||
|
||||
if ($module -is [string]) {
|
||||
|
@ -403,6 +415,13 @@ $null = New-Module {
|
|||
function Clear-OperationResources {
|
||||
if ($IsWindows) {
|
||||
Uninstall-WslDistribution;
|
||||
$null = Uninstall-Package Selenium.WebDriver -ErrorAction Continue;
|
||||
Uninstall-ChocoPackage 7zip.portable gsudo selenium-gecko-driver yq;
|
||||
Uninstall-WingetPackage AutoHotkey.AutoHotkey;
|
||||
}
|
||||
|
||||
foreach ($module in (Get-RequiredModules)) {
|
||||
Uninstall-Module -Force -Name $module[0];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -9,6 +9,64 @@ $null = New-Module {
|
|||
. "$PSScriptRoot/../Types/InstallerAction.ps1";
|
||||
$userArgument = "name";
|
||||
|
||||
$chocoRunner = {
|
||||
param(
|
||||
[string] $Action = 'install',
|
||||
[string[]] $ArgumentList,
|
||||
[scriptblock] $Guard = { $true },
|
||||
[Parameter(Position = 0)]
|
||||
[string] $Name,
|
||||
[Parameter(ValueFromRemainingArguments = $true)]
|
||||
[string[]] $AdditionalNames = @()
|
||||
)
|
||||
|
||||
[System.Collections.ArrayList] $Names = @();
|
||||
$null = $Names.Add($Name);
|
||||
$Names.AddRange($AdditionalNames);
|
||||
|
||||
if (-not ($Force.IsPresent)) {
|
||||
for ($i = $Names.Count - 1; $i -ge 0; $i--) {
|
||||
$name = $Names[$i];
|
||||
|
||||
if (-not (& $Guard $name)) {
|
||||
$Names.RemoveAt($i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($Names.Count -ge 1) {
|
||||
choco $Action -y @ArgumentList @Names;
|
||||
}
|
||||
};
|
||||
|
||||
$wingetRunner = {
|
||||
param(
|
||||
[string] $Action = 'install',
|
||||
[string[]] $ArgumentList,
|
||||
[scriptblock] $Guard = { $true },
|
||||
[Parameter(Position = 0)]
|
||||
[string] $Name,
|
||||
[Parameter(ValueFromRemainingArguments = $true)]
|
||||
[string[]] $AdditionalNames = @()
|
||||
)
|
||||
|
||||
[System.Collections.ArrayList] $Names = @();
|
||||
$null = $Names.Add($Name);
|
||||
$Names.AddRange($AdditionalNames);
|
||||
|
||||
foreach ($name in $Names) {
|
||||
if ($Force.IsPresent -or (& $Guard $name $PSBoundParameters)) {
|
||||
winget $Action `
|
||||
--accept-source-agreements `
|
||||
--source winget `
|
||||
$ArgumentList `
|
||||
--exact --id $name ;
|
||||
} else {
|
||||
Write-Host "Package ``$name`` is already installed"
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Installs the specified packages using chocolatey.
|
||||
|
@ -26,24 +84,39 @@ $null = New-Module {
|
|||
[string[]] $AdditionalNames = @()
|
||||
)
|
||||
|
||||
[System.Collections.ArrayList] $Names = @();
|
||||
$null = $Names.Add($Name);
|
||||
$Names.AddRange($AdditionalNames);
|
||||
|
||||
if (-not ($Force.IsPresent)) {
|
||||
for ($i = $Names.Count - 1; $i -ge 0; $i--) {
|
||||
$name = $Names[$i];
|
||||
|
||||
if (Test-ChocoPackage $name) {
|
||||
Write-Host "Package ``$name`` is already installed"
|
||||
$Names.RemoveAt($i);
|
||||
}
|
||||
& $chocoRunner @PSBoundParameters -Guard {
|
||||
param($Name)
|
||||
if (Test-ChocoPackage $Name) {
|
||||
Write-Host "Package ``$Name`` is already installed"
|
||||
$false;
|
||||
} else {
|
||||
$true;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
if ($Names.Count -ge 1) {
|
||||
choco install -y @ArgumentList @Names;
|
||||
}
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Uninstalls the specified packages using chocolatey.
|
||||
#>
|
||||
function Uninstall-ChocoPackage {
|
||||
param(
|
||||
[string[]] $ArgumentList,
|
||||
[Parameter(Position=0)]
|
||||
[string] $Name,
|
||||
[Parameter(ValueFromRemainingArguments = $true)]
|
||||
[string[]] $AdditionalNames = @()
|
||||
)
|
||||
|
||||
& $chocoRunner @PSBoundParameters -Action 'uninstall' -Guard {
|
||||
param($Name)
|
||||
if (Test-ChocoPackage $Name) {
|
||||
$true;
|
||||
} else {
|
||||
Write-Host "Package ``$Name`` is not installed";
|
||||
$false;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
<#
|
||||
|
@ -63,21 +136,41 @@ $null = New-Module {
|
|||
[string[]] $AdditionalNames = @()
|
||||
)
|
||||
|
||||
[System.Collections.ArrayList] $Names = @();
|
||||
$null = $Names.Add($Name);
|
||||
$Names.AddRange($AdditionalNames);
|
||||
& $wingetRunner @PSBoundParameters `
|
||||
-ArgumentList @($PSBoundParameters.ArgumentList + @("--accept-package-agreements")) `
|
||||
-Guard {
|
||||
param($Name, $Parameters)
|
||||
if (Test-WingetPackage @Parameters) {
|
||||
Write-Host "Package ``$Name`` is already installed"
|
||||
$false;
|
||||
} else {
|
||||
$true;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
foreach ($name in $Names) {
|
||||
if ($Force.IsPresent -or -not (Test-WingetPackage @PSBoundParameters)) {
|
||||
winget install `
|
||||
--accept-source-agreements --accept-package-agreements `
|
||||
--source winget `
|
||||
$ArgumentList `
|
||||
--exact --id $name ;
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Uninstalls the specified packages using `winget`.
|
||||
#>
|
||||
function Uninstall-WingetPackage {
|
||||
param(
|
||||
[string[]] $ArgumentList,
|
||||
[Parameter(Position=0)]
|
||||
[string] $Name,
|
||||
[Parameter(ValueFromRemainingArguments = $true)]
|
||||
[string[]] $AdditionalNames = @()
|
||||
)
|
||||
|
||||
& $wingetRunner @PSBoundParameters -Action 'uninstall' -Guard {
|
||||
param($Name, $Parameters)
|
||||
if (Test-WingetPackage @Parameters) {
|
||||
$true;
|
||||
} else {
|
||||
Write-Host "Package ``$name`` is already installed"
|
||||
Write-Host "Package ``$Name`` is not installed"
|
||||
$false;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
<#
|
||||
|
|
|
@ -20,6 +20,7 @@ $null = New-Module {
|
|||
. "$PSScriptRoot/../Types/WindowsInstallerAction.ps1";
|
||||
. "$PSScriptRoot/../../Common/Scripts/Config.ps1";
|
||||
. "$PSScriptRoot/../../Common/Scripts/Operations.ps1";
|
||||
. "$PSScriptRoot/../../Common/Scripts/Scripting.ps1";
|
||||
. "$PSScriptRoot/../../Common/Scripts/Software.ps1";
|
||||
. "$PSScriptRoot/../../Common/Scripts/SoftwareManagement.ps1";
|
||||
. "$PSScriptRoot/../../Common/Types/InstallerAction.ps1";
|
||||
|
@ -129,7 +130,36 @@ $null = New-Module {
|
|||
}
|
||||
}
|
||||
|
||||
Set-Stage ([WindowsInstallerStage]::Cleanup);
|
||||
break;
|
||||
}
|
||||
([WindowsInstallerStage]::Cleanup) {
|
||||
$taskName = "PortValhalla Cleaner";
|
||||
$setupUser = Get-SetupUser;
|
||||
Clear-OperationResources;
|
||||
Remove-Item -Recurse -Force "C:\ProgramData\PortValhalla";
|
||||
Get-SetupConfigKey | Remove-Item -Recurse -Force;
|
||||
Disable-Autologin;
|
||||
Disable-LocalUser $setupUser;
|
||||
|
||||
$script = {
|
||||
param(
|
||||
$TaskName,
|
||||
$UserName
|
||||
)
|
||||
|
||||
$user = Get-LocalUser $UserName;
|
||||
[string] $sid = $user.SID;
|
||||
Remove-LocalUser $user;
|
||||
Get-CimInstance Win32_UserProfile | Where-Object { $_.SID -eq $sid } | Remove-CimInstance;
|
||||
Unregister-ScheduledTask -Confirm:$false $TaskName;
|
||||
};
|
||||
|
||||
$trigger = New-ScheduledTaskTrigger -AtStartup;
|
||||
$task = New-ScheduledTaskAction -Execute "pwsh" -Argument "-Command & { $script } $(ConvertTo-Injection $taskName) $(ConvertTo-Injection $setupUser)";
|
||||
$null = Register-ScheduledTask -Force $taskName -Action $task -Trigger $trigger -RunLevel Highest -User "SYSTEM";
|
||||
Set-Stage ([WindowsInstallerStage]::Completed);
|
||||
Restart-Intermediate -NoRegister;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue