Compare commits
38 commits
8e2e4bf114
...
a749fcf9fd
Author | SHA1 | Date | |
---|---|---|---|
Manuel Thalmann | a749fcf9fd | ||
Manuel Thalmann | 1abbd8402f | ||
Manuel Thalmann | 34110c377d | ||
Manuel Thalmann | d1072d52b5 | ||
Manuel Thalmann | eb72304da6 | ||
Manuel Thalmann | 5786007b78 | ||
Manuel Thalmann | 5a5a439ecf | ||
Manuel Thalmann | 0622d085f3 | ||
Manuel Thalmann | a02a4b3f40 | ||
Manuel Thalmann | 49defe698d | ||
Manuel Thalmann | 7444ac1ed1 | ||
Manuel Thalmann | dad4bcc4ae | ||
Manuel Thalmann | 60cad3b2d5 | ||
Manuel Thalmann | 831eba83a4 | ||
Manuel Thalmann | cfa79a211a | ||
Manuel Thalmann | 2a7425125d | ||
Manuel Thalmann | c7be2a00bd | ||
Manuel Thalmann | 98d76eb9bd | ||
Manuel Thalmann | 3ea0092e92 | ||
Manuel Thalmann | fc75af9ac6 | ||
Manuel Thalmann | 704dc40811 | ||
Manuel Thalmann | 5db19fd8a4 | ||
Manuel Thalmann | db90dc3f92 | ||
Manuel Thalmann | ef308add7e | ||
Manuel Thalmann | ac1c5beb45 | ||
Manuel Thalmann | 884d724afb | ||
Manuel Thalmann | e6ebb1bb4d | ||
Manuel Thalmann | 6b6a057f44 | ||
Manuel Thalmann | 0537682a55 | ||
Manuel Thalmann | c82ecd92df | ||
Manuel Thalmann | 094bdae2df | ||
Manuel Thalmann | a100b33c99 | ||
Manuel Thalmann | f2c66e8150 | ||
Manuel Thalmann | d2120b7758 | ||
Manuel Thalmann | 73400ea7d2 | ||
Manuel Thalmann | 69c5d84af6 | ||
Manuel Thalmann | 874901004e | ||
Manuel Thalmann | 2a421e637e |
2
.gitattributes
vendored
Normal file
2
.gitattributes
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
*.fish text eol=lf
|
||||
*.sh text eol=lf
|
|
@ -34,9 +34,8 @@
|
|||
};
|
||||
})) // {
|
||||
valhalla = {
|
||||
"DerGeret Windows" = import ./profiles/DerGeret/config.nix;
|
||||
"der-geret Arch Linux" = import ./profiles/DerGeret/Arch/config.nix;
|
||||
"manu-surface Arch Linux" = import ./profiles/ManuSurface/Arch/config.nix;
|
||||
DerGeret = import ./profiles/machines/manuel/DerGeret/Arch/config.nix;
|
||||
ManuSurface = import ./profiles/machines/manuel/ManuSurface/Arch/config.nix;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
15
lib/eval-attribute.nix
Normal file
15
lib/eval-attribute.nix
Normal file
|
@ -0,0 +1,15 @@
|
|||
let
|
||||
inherit (nixpkgs) lib;
|
||||
nixpkgs = import <nixpkgs> { config = {}; overlay = []; };
|
||||
property = (builtins.getEnv "PROPERTY");
|
||||
processor = if (builtins.stringLength property > 0)
|
||||
then
|
||||
(_: lib.attrsets.getAttrFromPath (lib.strings.splitString "." property) _)
|
||||
else
|
||||
(_: _);
|
||||
in
|
||||
_: processor (lib.evalModules {
|
||||
modules = [
|
||||
_
|
||||
];
|
||||
}).config
|
|
@ -78,9 +78,7 @@
|
|||
description = "Blablabla";
|
||||
default = (lib.attrsets.concatMapAttrs (
|
||||
name: options: {
|
||||
${capitalize name} = options // {
|
||||
groups = [];
|
||||
};
|
||||
${capitalize name} = options;
|
||||
}) config.users);
|
||||
};
|
||||
};
|
||||
|
|
|
@ -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,6 +0,0 @@
|
|||
#!/bin/pwsh
|
||||
$env:WIN_COMPUTER_NAME = "DerGeret";
|
||||
$env:SETUP_SCRIPT_NAME = "$PSScriptRoot/Restore.ps1";
|
||||
$env:CONFIG_MODULE = "$PSScriptRoot/../config.nix";
|
||||
|
||||
. "$PSScriptRoot/../../../scripts/Windows/OS/Setup.ps1";
|
|
@ -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,6 +0,0 @@
|
|||
#!/bin/pwsh
|
||||
$env:WIN_COMPUTER_NAME ??= "win11";
|
||||
$env:SETUP_SCRIPT_NAME ??= "$PSScriptRoot/Install.ps1";
|
||||
$env:CONFIG_MODULE ??= "$PSScriptRoot/../config.nix";
|
||||
|
||||
. "$PSScriptRoot/../../../scripts/Windows/OS/Setup.ps1";
|
|
@ -1,4 +0,0 @@
|
|||
#!/bin/pwsh
|
||||
$env:SETUP_SCRIPT_NAME ??= "$PSScriptRoot/Install.ps1";
|
||||
|
||||
. "$PSScriptRoot/../../Generic/Windows/Setup.ps1";
|
|
@ -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;
|
|
@ -6,8 +6,8 @@ begin
|
|||
echo "$dir/install.fish"
|
||||
end
|
||||
|
||||
CONFIG_MODULE="$dir/config.nix" \
|
||||
CONFIG_NAME="DerGeret" \
|
||||
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
|
5
profiles/machines/manuel/DerGeret/Windows/Setup.ps1
Normal file
5
profiles/machines/manuel/DerGeret/Windows/Setup.ps1
Normal file
|
@ -0,0 +1,5 @@
|
|||
#!/bin/pwsh
|
||||
$env:WIN_COMPUTER_NAME = "DerGeret";
|
||||
$env:CONFIG_NAME = $env:WIN_COMPUTER_NAME;
|
||||
|
||||
. "$PSScriptRoot/../../../../../scripts/Windows/OS/Setup.ps1";
|
|
@ -1,6 +1,6 @@
|
|||
{ ... }: {
|
||||
imports = [
|
||||
../Generic/config.nix
|
||||
../defaults.nix
|
||||
];
|
||||
|
||||
config = {
|
|
@ -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;
|
5
profiles/machines/manuel/Generic/Windows/Setup.ps1
Normal file
5
profiles/machines/manuel/Generic/Windows/Setup.ps1
Normal file
|
@ -0,0 +1,5 @@
|
|||
#!/bin/pwsh
|
||||
$env:WIN_COMPUTER_NAME ??= "win11";
|
||||
$env:CONFIG_MODULE ??= "$PSScriptRoot/../config.nix";
|
||||
|
||||
. "$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";
|
||||
|
||||
groups = [
|
||||
"wheel"
|
||||
"nix-users"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
linux.users.manuel = {
|
||||
defaultShell = "fish";
|
||||
|
||||
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";
|
2
profiles/machines/manuel/KVM/Windows/Setup.ps1
Normal file
2
profiles/machines/manuel/KVM/Windows/Setup.ps1
Normal file
|
@ -0,0 +1,2 @@
|
|||
#!/bin/pwsh
|
||||
. "$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
|
||||
|
||||
|
@ -11,8 +11,8 @@ begin
|
|||
echo "$dir/install.fish"
|
||||
end
|
||||
|
||||
CONFIG_MODULE="$(status dirname)/config.nix" \
|
||||
CONFIG_NAME="ManuSurface" \
|
||||
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 = { };
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -24,7 +24,7 @@ if [ (id -u) -eq 0 ]
|
|||
echo "$name ALL=(ALL:ALL) NOPASSWD: ALL"
|
||||
end > "$sudoConfig"
|
||||
|
||||
and sudo --preserve-env="CONFIG_MODULE" --user "$name" "$INSTALLER_SCRIPT"
|
||||
and sudo --preserve-env="CONFIG_NAME" --user "$name" "$INSTALLER_SCRIPT"
|
||||
rm "$sudoConfig"
|
||||
userdel -r "$name"
|
||||
else
|
||||
|
|
|
@ -39,7 +39,7 @@ function runSetup
|
|||
function wrapScript -S
|
||||
printf %s\n \
|
||||
"cd $PROJECT_CLONE_ROOT" \
|
||||
"export CONFIG_MODULE=$(string escape (getCloneFile "$CONFIG_MODULE"))" \
|
||||
"export CONFIG_NAME=$(string escape (getCloneFile "$CONFIG_NAME"))" \
|
||||
"$argv"
|
||||
end
|
||||
|
||||
|
|
|
@ -15,18 +15,10 @@ $null = New-Module {
|
|||
)
|
||||
|
||||
if (-not ("OpenQA.Selenium.Firefox.FirefoxDriver" -as [type])) {
|
||||
$zipFile = [System.IO.Compression.ZipFile]::OpenRead((Get-Package Selenium.WebDriver).Source);
|
||||
$webDriver = ($zipFile.Entries | Where-Object { $_.FullName -like "lib/net6.0/WebDriver.dll" })[0];
|
||||
$stream = [System.IO.MemoryStream]::new();
|
||||
$reader = [System.IO.StreamReader]($webDriver).Open();
|
||||
$reader.BaseStream.CopyTo($stream);
|
||||
[byte[]]$bytes = $stream.ToArray();
|
||||
$reader.Close();
|
||||
$reader.Dispose();
|
||||
$stream.Close();
|
||||
$stream.Dispose();
|
||||
$zipFile.Dispose();
|
||||
$null = [System.Reflection.Assembly]::Load($bytes);
|
||||
$packageRoot = Split-Path -Parent (Get-Package Selenium.WebDriver).Source;
|
||||
$file = Join-Path $packageRoot "lib/netstandard2.0/WebDriver.dll";
|
||||
$env:SE_MANAGER_PATH = Join-Path $packageRoot "manager" ($IsWindows ? "windows" : "linux") "selenium-manager$($IsWindows ? ".exe" : '')";
|
||||
$null = [System.Reflection.Assembly]::LoadFile($file);
|
||||
}
|
||||
|
||||
& $Action;
|
||||
|
|
|
@ -1,19 +1,28 @@
|
|||
using namespace Microsoft.Win32;
|
||||
using namespace System.Management.Automation.Host;
|
||||
using namespace System.Security.AccessControl;
|
||||
using namespace System.Security.Principal;
|
||||
|
||||
enum WindowsInstallerStage {
|
||||
Initialize
|
||||
Run
|
||||
Cleanup
|
||||
Completed
|
||||
}
|
||||
|
||||
enum SetupStage {
|
||||
Initialize
|
||||
Configure
|
||||
Install
|
||||
CreateUser
|
||||
}
|
||||
|
||||
enum BackupStage {
|
||||
Initialize
|
||||
Backup
|
||||
BackupUsers
|
||||
}
|
||||
|
||||
enum UserStage {
|
||||
Create
|
||||
Configure
|
||||
|
@ -25,12 +34,61 @@ $null = New-Module {
|
|||
[string] $configRoot = "HKLM:\Software\PortValhalla";
|
||||
[string] $stageOption = "Stage";
|
||||
[string] $setupStageOption = "SetupStage";
|
||||
[string] $backupStageOption = "BackupStage";
|
||||
[string] $userOption = "SetupUser";
|
||||
[string] $userStageOption = "UserStage";
|
||||
[string] $accountOption = "MSAccount";
|
||||
[string] $finishedOption = "Finished";
|
||||
[RegistryKey] $key = $null;
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Prompts the user to select a profile to act on.
|
||||
#>
|
||||
function Show-ProfileNamePrompt {
|
||||
. "$PSScriptRoot/../../Windows/Types/WindowsInstallerAction.ps1";
|
||||
|
||||
$profiles = & {
|
||||
. "$PSScriptRoot/SoftwareManagement.ps1";
|
||||
|
||||
if (Test-Command "wsl") {
|
||||
return Invoke-ConfigScript "getProfiles";
|
||||
} else {
|
||||
return Get-ChildItem "$PSScriptRoot/../../../.config" | ForEach-Object { Split-Path -LeafBase $_ };
|
||||
}
|
||||
};
|
||||
|
||||
$choice = $Host.UI.PromptForChoice(
|
||||
"Select Profile",
|
||||
(& {
|
||||
switch (Get-Stage) {
|
||||
([WindowsInstallerAction]::Backup) {
|
||||
"Which profile do you wish to back up?";
|
||||
}
|
||||
([WindowsInstallerAction]::Install) {
|
||||
"Which profile do you wish to install?";
|
||||
}
|
||||
$null {
|
||||
"Which profile do you wish to set up?";
|
||||
}
|
||||
}
|
||||
}),
|
||||
(& {
|
||||
for ($i = 0; $i -lt $profiles.Count; $i++) {
|
||||
[ChoiceDescription]"&$i - $($profiles[$i])";
|
||||
}
|
||||
|
||||
[ChoiceDescription]"&Abort";
|
||||
}),
|
||||
$profiles.Count);
|
||||
|
||||
if ($choice -eq $profiles.Count) {
|
||||
exit;
|
||||
} else {
|
||||
$env:CONFIG_NAME = $profiles[$choice];
|
||||
}
|
||||
}
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Converts the specified path to linux and escapes it for the use in a script.
|
||||
|
@ -114,16 +172,29 @@ $null = New-Module {
|
|||
|
||||
$scriptPath = "$PSScriptRoot/../../Common/Scripts/config.fish";
|
||||
|
||||
if ($env:CONFIG_MODULE) {
|
||||
if ($env:CONFIG_NAME -or ($Script -eq "getProfiles")) {
|
||||
$output = & {
|
||||
if (-not $IsWindows) {
|
||||
$escapedPath = (fish -c 'string escape $argv' "$scriptPath");
|
||||
fish -c ". $escapedPath; $Script";
|
||||
} else {
|
||||
$cleanup = { };
|
||||
$projectRoot = "$PSScriptRoot/../../..";
|
||||
$archisoDir = "$projectRoot/archiso";
|
||||
|
||||
function fish {
|
||||
wsl --shell-type login -- nix --extra-experimental-features "nix-command flakes" run nixpkgs`#fish -- $args
|
||||
}
|
||||
|
||||
if (Test-Path -PathType Container "$archisoDir") {
|
||||
$git = {
|
||||
git -C "$projectRoot" -c safe.directory="$("$(Resolve-Path $projectRoot)".Replace("\", "/"))" @args;
|
||||
};
|
||||
|
||||
& $git rm -r --cached "$archisoDir" *> $null;
|
||||
$cleanup = { & $git restore --staged "$archisoDir" };
|
||||
}
|
||||
|
||||
$output = fish -c ". $(ConvertTo-LinuxPath $scriptPath); $Script";
|
||||
|
||||
if (-not $?) {
|
||||
|
@ -131,6 +202,8 @@ $null = New-Module {
|
|||
} else {
|
||||
$output;
|
||||
}
|
||||
|
||||
& $cleanup *> $null;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -343,6 +416,39 @@ $null = New-Module {
|
|||
$null = Set-SetupOption $setupStageOption $Name;
|
||||
}
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Gets the name of the current stage of the backup.
|
||||
#>
|
||||
function Get-BackupStage {
|
||||
$stage = Get-SetupOption $backupStageOption;
|
||||
|
||||
if ($null -ne $stage) {
|
||||
$stage = [BackupStage]$stage;
|
||||
}
|
||||
|
||||
return $stage;
|
||||
}
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Sets the current stage of the backup.
|
||||
|
||||
.PARAMETER Name
|
||||
The name to set the current stage to.
|
||||
#>
|
||||
function Set-BackupStage {
|
||||
param(
|
||||
$Name
|
||||
)
|
||||
|
||||
if (-not (($null -eq $Name) -or ($Name -is [string]))) {
|
||||
$Name = ([BackupStage]$Name).ToString();
|
||||
}
|
||||
|
||||
$null = Set-SetupOption $backupStageOption $Name;
|
||||
}
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Gets the current user to set up.
|
||||
|
@ -442,21 +548,6 @@ $null = New-Module {
|
|||
Set-SetupOption $finishedOption $true;
|
||||
}
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Checks whether the specified software collection is enabled.
|
||||
|
||||
.PARAMETER Name
|
||||
The name of the collection to check.
|
||||
#>
|
||||
function Test-Collection {
|
||||
param(
|
||||
[string] $Name
|
||||
)
|
||||
|
||||
Get-Config "$(Get-ConfigRootName).software.$Name";
|
||||
}
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Checks whether the running system is a QEMU virtual machine.
|
||||
|
|
|
@ -27,6 +27,35 @@ $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]);
|
||||
}
|
||||
}
|
||||
|
||||
return $modules;
|
||||
}
|
||||
|
||||
function Start-Operation {
|
||||
param(
|
||||
[switch] $NonInteractive,
|
||||
|
@ -51,16 +80,7 @@ $null = New-Module {
|
|||
$Global:ErrorActionPreference = $NonInteractive.IsPresent ? 'Continue' : 'Inquire';
|
||||
|
||||
if ($IsWindows) {
|
||||
$env:WSLENV = "CONFIG_MODULE/p";
|
||||
|
||||
if ($env:CONFIG_MODULE) {
|
||||
$env:CONFIG_MODULE = Resolve-Path $env:CONFIG_MODULE;
|
||||
}
|
||||
|
||||
if (Test-Admin) {
|
||||
Disable-WindowsUpdateAutoRestart;
|
||||
}
|
||||
|
||||
$env:WSLENV = "CONFIG_NAME";
|
||||
New-Alias -Force "sudo" gsudo;
|
||||
}
|
||||
|
||||
|
@ -104,16 +124,20 @@ $null = New-Module {
|
|||
}
|
||||
|
||||
if ($env:DEBUG) {
|
||||
if (
|
||||
(Get-Item $env:INSTALLER_SCRIPT).IsReadOnly -and
|
||||
(Test-Qemu) -and
|
||||
($Host.UI.PromptForChoice(
|
||||
$liveScriptOption = "LiveScripts";
|
||||
|
||||
if (($null -eq (Get-SetupOption $liveScriptOption)) -and (Test-Qemu)) {
|
||||
$result = $Host.UI.PromptForChoice(
|
||||
"Confirm",
|
||||
"Do you wish to swap to live scripts?",
|
||||
[ChoiceDescription[]]@(
|
||||
[ChoiceDescription]::new("&No", "Use scripts stored in the virtual machine"),
|
||||
[ChoiceDescription]::new("&Yes", "Use live scripts stored on the host")),
|
||||
0) -eq 1)) {
|
||||
0);
|
||||
|
||||
Set-SetupOption $liveScriptOption $result;
|
||||
|
||||
if ($result -eq 1) {
|
||||
Install-ChocoPackage winfsp qemu-guest-agent;
|
||||
Get-Service VirtioFsSvc | Start-Service -PassThru | Set-Service -StartupType Automatic;
|
||||
|
||||
|
@ -121,7 +145,7 @@ $null = New-Module {
|
|||
Start-Sleep 0.1;
|
||||
}
|
||||
|
||||
foreach ($name in @("CONFIG_MODULE", "INSTALLER_SCRIPT")) {
|
||||
foreach ($name in @("INSTALLER_SCRIPT")) {
|
||||
$variable = Get-Item "Env:\$name";
|
||||
|
||||
$path = Join-Path `
|
||||
|
@ -136,6 +160,7 @@ $null = New-Module {
|
|||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (-not (Test-Command "gsudo")) {
|
||||
Install-ChocoPackage gsudo;
|
||||
|
@ -169,6 +194,12 @@ $null = New-Module {
|
|||
continue;
|
||||
}
|
||||
|
||||
if (-not (Test-Command "7z")) {
|
||||
Install-ChocoPackage 7zip.portable;
|
||||
refreshenv;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (-not (Test-Command "yq")) {
|
||||
Install-ChocoPackage "yq";
|
||||
refreshenv;
|
||||
|
@ -198,7 +229,7 @@ $null = New-Module {
|
|||
|
||||
if (-not (Test-PSPackage Selenium.WebDriver)) {
|
||||
Write-Host "Installing browser automation tools…";
|
||||
$null = Install-Package -Force Selenium.WebDriver -RequiredVersion 4.10.0 -SkipDependencies;
|
||||
$null = Install-Package -Force Selenium.WebDriver -RequiredVersion 4.24.0 -SkipDependencies;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -208,22 +239,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]) {
|
||||
|
@ -243,6 +259,10 @@ $null = New-Module {
|
|||
}
|
||||
};
|
||||
|
||||
if (-not $env:CONFIG_NAME) {
|
||||
Show-ProfileNamePrompt;
|
||||
}
|
||||
|
||||
$initialized = $true;
|
||||
}
|
||||
}
|
||||
|
@ -396,6 +416,14 @@ $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)) {
|
||||
Remove-Module -Force $module[0] -ErrorAction SilentlyContinue;
|
||||
Uninstall-Module -Force -Name $module[0] -ErrorAction SilentlyContinue;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -9,6 +9,70 @@ $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);
|
||||
|
||||
[string[]] $arguments = $ArgumentList + (& {
|
||||
if ($Action -eq 'install') {
|
||||
@("--accept-package-agreements")
|
||||
};
|
||||
});
|
||||
|
||||
foreach ($name in $Names) {
|
||||
if ($Force.IsPresent -or (& $Guard $name $PSBoundParameters)) {
|
||||
winget $Action `
|
||||
--accept-source-agreements `
|
||||
--source winget `
|
||||
@arguments `
|
||||
--exact --id $name ;
|
||||
} else {
|
||||
Write-Host "Package ``$name`` is already installed"
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Installs the specified packages using chocolatey.
|
||||
|
@ -26,24 +90,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 +142,40 @@ $null = New-Module {
|
|||
[string[]] $AdditionalNames = @()
|
||||
)
|
||||
|
||||
[System.Collections.ArrayList] $Names = @();
|
||||
$null = $Names.Add($Name);
|
||||
$Names.AddRange($AdditionalNames);
|
||||
|
||||
foreach ($name in $Names) {
|
||||
if ($Force.IsPresent -or -not (Test-WingetPackage $name)) {
|
||||
winget install `
|
||||
--accept-source-agreements --accept-package-agreements `
|
||||
--source winget `
|
||||
$ArgumentList `
|
||||
--exact --id $name ;
|
||||
& $wingetRunner @PSBoundParameters `
|
||||
-Guard {
|
||||
param($Name, $Parameters)
|
||||
if (Test-WingetPackage @Parameters) {
|
||||
Write-Host "Package ``$Name`` is already installed"
|
||||
$false;
|
||||
} else {
|
||||
Write-Host "Package ``$name`` is already installed"
|
||||
$true;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
<#
|
||||
.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 not installed"
|
||||
$false;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
<#
|
||||
|
@ -200,6 +298,7 @@ $null = New-Module {
|
|||
[scriptblock] $Backup = $null,
|
||||
[scriptblock] $Installer = $null,
|
||||
[scriptblock] $Configurator = $null,
|
||||
[scriptblock] $UserBackup = $null,
|
||||
[scriptblock] $UserConfigurator = $null,
|
||||
[Nullable[InstallerAction]] $Action,
|
||||
[hashtable] $Arguments
|
||||
|
@ -262,17 +361,29 @@ $null = New-Module {
|
|||
& $Configurator @argumentList;
|
||||
}
|
||||
}
|
||||
([InstallerAction]::ConfigureUser) {
|
||||
default {
|
||||
if ((-not $Arguments.ContainsKey($userArgument)) -or (-not $Arguments[$userArgument])) {
|
||||
$Arguments.Add($userArgument, ($IsWindows ? $env:UserName : $env:USER));
|
||||
}
|
||||
|
||||
$user = $Arguments[$userArgument];
|
||||
|
||||
switch ($_) {
|
||||
([InstallerAction]::BackupUser) {
|
||||
if ($UserBackup) {
|
||||
Write-Host "Backing up $Name for user ``$user``…";
|
||||
& $UserBackup @argumentList;
|
||||
}
|
||||
}
|
||||
([InstallerAction]::ConfigureUser) {
|
||||
if ($UserConfigurator) {
|
||||
Write-Host "Configuring $Name for user ``$($Arguments[$userArgument])``…";
|
||||
Write-Host "Configuring $Name for user ``$user``…";
|
||||
& $UserConfigurator @argumentList;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
& $installHandler -Action $Action -Arguments $Arguments;
|
||||
|
|
|
@ -53,10 +53,11 @@ function Test-ChocoPackage {
|
|||
function Test-WingetPackage {
|
||||
[OutputType([bool])]
|
||||
param(
|
||||
[string] $ID
|
||||
[string] $Name,
|
||||
[string[]] $ArgumentList
|
||||
)
|
||||
|
||||
& { $null = winget list --accept-source-agreements -e --id $ID; $?; };
|
||||
& { $null = winget list --accept-source-agreements -e --id $Name @ArgumentList; $?; };
|
||||
}
|
||||
|
||||
<#
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
#!/bin/env fish
|
||||
function isConfigured -S
|
||||
set -q "$CONFIG_MODULE"
|
||||
set -q "$CONFIG_NAME"
|
||||
end
|
||||
|
||||
function getProfiles -S
|
||||
source "$(status dirname)/eval-flake.fish";
|
||||
evalFlake "" "" --apply "builtins.attrNames" --json
|
||||
end
|
||||
|
||||
function getConfig -S -a property
|
||||
source "$(status dirname)/eval-module.fish"
|
||||
evalModule "$CONFIG_MODULE" "$property" $argv[2..]
|
||||
source "$(status dirname)/eval-flake.fish"
|
||||
evalFlake "$CONFIG_NAME" "$property" $argv[2..]
|
||||
end
|
||||
|
||||
function getAttributes -S -a property
|
||||
|
|
27
scripts/Common/Scripts/eval-flake.fish
Executable file
27
scripts/Common/Scripts/eval-flake.fish
Executable file
|
@ -0,0 +1,27 @@
|
|||
#!/bin/env fish
|
||||
function evalFlake --argument-names config property
|
||||
set -l argv $argv[3..]
|
||||
argparse --ignore-unknown "apply=" "json" -- $argv
|
||||
|
||||
if [ -z "$_flag_json" ]
|
||||
set -a argv --raw
|
||||
else
|
||||
set -a argv --json
|
||||
end
|
||||
|
||||
if [ -z "$_flag_apply" ]
|
||||
set _flag_apply "_: _"
|
||||
end
|
||||
|
||||
if [ -n "$config" ]
|
||||
set config ".$config"
|
||||
set _flag_apply "_: ($_flag_apply) ((import $(status dirname)/../../../lib/eval-attribute.nix) _)"
|
||||
end
|
||||
|
||||
ROOT="$(realpath (status dirname))/../../.." \
|
||||
PROPERTY="$property" \
|
||||
nix eval --impure --extra-experimental-features "nix-command flakes" \
|
||||
--apply "$_flag_apply" \
|
||||
"$(status dirname)/../../..#valhalla$config" \
|
||||
$argv
|
||||
end
|
|
@ -48,10 +48,10 @@ Start-SoftwareInstaller @PSBoundParameters `
|
|||
}
|
||||
|
||||
if ($IsWindows) {
|
||||
[System.Environment]::SetEnvironmentVariable($varName, $path, "User");
|
||||
[System.Environment]::SetEnvironmentVariable($varName, "%AppData%/$([System.IO.Path]::GetRelativePath($env:AppData, $path))", "User");
|
||||
} else {
|
||||
. "$PSScriptRoot/../aliae/Manage.ps1";
|
||||
Add-EnvironmentVariable -User $Arguments.Name $varName $path;
|
||||
Add-EnvironmentVariable -User $Arguments.Name $varName ($path).Replace("~", "{{ .Home }}");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -75,9 +75,11 @@ $null = New-Module {
|
|||
|
||||
Push-Location ~;
|
||||
|
||||
$profiles = $profiles |
|
||||
$profiles = @(
|
||||
$profiles |
|
||||
ForEach-Object { [System.IO.Path]::GetRelativePath((Get-Location), $_) } |
|
||||
ForEach-Object { "$HomeDir/$_" };
|
||||
ForEach-Object { "$HomeDir/$_" }
|
||||
);
|
||||
|
||||
Pop-Location;
|
||||
}
|
||||
|
|
|
@ -28,20 +28,7 @@ $null = New-Module {
|
|||
$configArgs = @("--system");
|
||||
}
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Gets the specified git configuration.
|
||||
|
||||
.PARAMETER Name
|
||||
THe name of the configuration to get.
|
||||
#>
|
||||
function Get-GitConfig {
|
||||
param(
|
||||
[string] $Name
|
||||
)
|
||||
|
||||
Get-Config "$root.git.$Name";
|
||||
}
|
||||
$config = Get-Config "$root.git";
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
|
@ -52,7 +39,7 @@ $null = New-Module {
|
|||
}
|
||||
|
||||
if ((-not $IsWindows) -or $User) {
|
||||
$branch = Get-GitConfig "defaultBranch";
|
||||
$branch = $config.defaultBranch;
|
||||
|
||||
if ($branch) {
|
||||
Set-GitConfig "init.defaultBranch" $branch;
|
||||
|
@ -76,8 +63,8 @@ $null = New-Module {
|
|||
. {
|
||||
$dir = New-TemporaryDirectory;
|
||||
$key = "flow";
|
||||
$mainBranch = Get-GitConfig "$key.mainBranch";
|
||||
$devBranch = Get-GitConfig "$key.devBranch";
|
||||
$mainBranch = $config."$key".mainBranch;
|
||||
$devBranch = $config."$key".devBranch;
|
||||
|
||||
& {
|
||||
git -C "$dir" init;
|
||||
|
@ -103,7 +90,7 @@ $null = New-Module {
|
|||
};
|
||||
|
||||
# Aliases
|
||||
[PSCustomObject] $aliases = Get-GitConfig "aliases";
|
||||
[PSCustomObject] $aliases = $config.aliases;
|
||||
|
||||
if ($aliases) {
|
||||
foreach ($alias in ($aliases | Get-Member -MemberType Properties)) {
|
||||
|
|
|
@ -26,7 +26,7 @@ begin
|
|||
"Terminal=false" (
|
||||
printf "%s " \
|
||||
"Exec=env" \
|
||||
"CONFIG_MODULE=$(echo "$CONFIG_MODULE" | string escape)" \
|
||||
"CONFIG_NAME=$(echo "$CONFIG_NAME" | string escape)" \
|
||||
"konsole -e fish $(realpath (status filename) | string escape) userConfig"
|
||||
)
|
||||
end | sudo -u "$name" tee "$entryPoint" > /dev/null
|
||||
|
@ -36,7 +36,7 @@ begin
|
|||
rm "$entryPoint"
|
||||
rm ~"$name"/.config/plasma-welcomerc
|
||||
else if [ -n "$name" ] && [ "$name" != "$USER" ]
|
||||
sudo -Eu "$name" CONFIG_MODULE="$CONFIG_MODULE" fish "$(status filename)" userConfig
|
||||
sudo -Eu "$name" CONFIG_NAME="$CONFIG_NAME" fish "$(status filename)" userConfig
|
||||
else
|
||||
systemctl --user enable rclone.service
|
||||
echo "Please complete the setup of your rclone configurations!"
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
enum InstallerAction {
|
||||
Backup
|
||||
Install
|
||||
Configure
|
||||
BackupUser
|
||||
ConfigureUser
|
||||
}
|
||||
|
|
4
scripts/Windows/OS/Backup.ps1
Normal file
4
scripts/Windows/OS/Backup.ps1
Normal file
|
@ -0,0 +1,4 @@
|
|||
#!/bin/pwsh
|
||||
. "$PSScriptRoot/Manage.ps1";
|
||||
$env:INSTALLER_SCRIPT = "$PSCommandPath";
|
||||
Start-WindowsBackup;
|
3
scripts/Windows/OS/Install.ps1
Normal file
3
scripts/Windows/OS/Install.ps1
Normal file
|
@ -0,0 +1,3 @@
|
|||
#!/bin/pwsh
|
||||
. "$PSScriptRoot/Manage.ps1";
|
||||
Start-WindowsInstallation;
|
|
@ -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";
|
||||
|
@ -34,6 +35,16 @@ $null = New-Module {
|
|||
};
|
||||
}
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Creates a backup of the current Windows machine.
|
||||
#>
|
||||
function Start-WindowsBackup {
|
||||
Start-Operation -NoImplicitCleanup {
|
||||
Start-InstallationLoop ([WindowsInstallerAction]::Backup);
|
||||
};
|
||||
}
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Starts the installation loop.
|
||||
|
@ -50,6 +61,19 @@ $null = New-Module {
|
|||
break;
|
||||
}
|
||||
([WindowsInstallerStage]::Initialize) {
|
||||
$env:BACKUP_ARCHIVE = pwsh -Command Write-Host (
|
||||
Read-Host (
|
||||
& {
|
||||
switch ($Action) {
|
||||
([WindowsInstallerAction]::Backup) {
|
||||
"Please select the path you wish to store your backup at"
|
||||
}
|
||||
([WindowsInstallerAction]::Install) {
|
||||
"Please select an archive you wish to restore from, if you wish to restore from a backup"
|
||||
}
|
||||
}
|
||||
}));
|
||||
|
||||
Set-Stage ([WindowsInstallerStage]::Run);
|
||||
break;
|
||||
}
|
||||
|
@ -72,9 +96,12 @@ $null = New-Module {
|
|||
|
||||
switch (Get-SetupStage) {
|
||||
($null) {
|
||||
Set-SetupStage ([SetupStage]::Configure);
|
||||
Set-SetupStage ([SetupStage]::Initialize);
|
||||
break;
|
||||
}
|
||||
([SetupStage]::Initialize) {
|
||||
Set-SetupStage ([SetupStage]::Configure);
|
||||
}
|
||||
([SetupStage]::Configure) {
|
||||
if (Get-Config "valhalla.windows.dualboot.enable") {
|
||||
if (-not (Test-Qemu)) {
|
||||
|
@ -114,9 +141,94 @@ $null = New-Module {
|
|||
}
|
||||
}
|
||||
}
|
||||
([WindowsInstallerAction]::Backup) {
|
||||
$finished = $false;
|
||||
|
||||
$adminGroup = @{
|
||||
SID = [SecurityIdentifier]::new([WellKnownSidType]::BuiltinAdministratorsSid, $null);
|
||||
};
|
||||
|
||||
while (-not $finished) {
|
||||
switch (Get-BackupStage) {
|
||||
$null {
|
||||
Set-BackupStage ([BackupStage]::Initialize);
|
||||
}
|
||||
([BackupStage]::Initialize) {
|
||||
$user = Get-SetupUser;
|
||||
Add-LocalUser $user;
|
||||
Add-LocalGroupMember -Member "$user" @adminGroup;
|
||||
Set-AutologinUser $user;
|
||||
Disable-UAC;
|
||||
Set-BackupStage ([BackupStage]::Backup);
|
||||
Restart-Intermediate;
|
||||
return;
|
||||
}
|
||||
([BackupStage]::Backup) {
|
||||
Deploy-SoftwareAction ([InstallerAction]::Backup);
|
||||
Set-BackupStage ([BackupStage]::BackupUsers);
|
||||
}
|
||||
([BackupStage]::BackupUsers) {
|
||||
$users = @(Get-Users);
|
||||
$i = Get-CurrentUser;
|
||||
|
||||
for (; $i -lt $users.Count; $i++) {
|
||||
Set-CurrentUser $i;
|
||||
$user = $users[$i];
|
||||
|
||||
if ($env:UserName -ne $user) {
|
||||
Set-BootMessage "Please Log In" "Please log in with the user ``$user``";
|
||||
Add-LocalGroupMember -Member "$user" @adminGroup -ErrorAction SilentlyContinue;
|
||||
Restart-Intermediate;
|
||||
return;
|
||||
} else {
|
||||
Deploy-SoftwareAction -Action ([InstallerAction]::BackupUser);
|
||||
Remove-LocalGroupMember -Member "$user" @adminGroup;
|
||||
|
||||
foreach ($group in Get-UserConfig -UserName "$user" "groups") {
|
||||
Add-LocalGroupMember -Member "$user" $group;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Disable-BootMessage;
|
||||
$finished = $true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
Enable-UAC;
|
||||
Restart-Intermediate -NoRegister;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,16 +2,18 @@
|
|||
. "$PSScriptRoot/../../Common/Scripts/Scripting.ps1";
|
||||
|
||||
function Start-Setup {
|
||||
param($ConfigurationName)
|
||||
. "$PSScriptRoot/../../Common/Scripts/Config.ps1";
|
||||
. "$PSScriptRoot/../../Common/Scripts/Scripting.ps1";
|
||||
$Global:InformationPreference = "Continue";
|
||||
$Global:ErrorActionPreference = "Inquire";
|
||||
$env:CONFIG_NAME ??= $ConfigurationName;
|
||||
$null = $env:WIN_COMPUTER_NAME;
|
||||
$null = $env:SETUP_SCRIPT_NAME;
|
||||
$null = $env:CONFIG_MODULE;
|
||||
$env:WSLENV = "CONFIG_MODULE/p";
|
||||
|
||||
$valhallaConfig = ConvertFrom-Json (Get-Content "$env:CONFIG_MODULE.json");
|
||||
$null = $env:SETUP_SCRIPT_NAME ??= "$PSScriptRoot/Install.ps1";
|
||||
$env:WSLENV = "CONFIG_NAME";
|
||||
|
||||
Show-ProfileNamePrompt;
|
||||
$valhallaConfig = ConvertFrom-Json (Get-Content "$PSScriptRoot/../../../.config/$env:CONFIG_NAME.json");
|
||||
[xml]$unattendedConfig = [xml]::new();
|
||||
$unattendedConfig.PreserveWhitespace = $true;
|
||||
|
||||
|
@ -233,7 +235,7 @@ function Start-Setup {
|
|||
($env:DEBUG ? "`$env:DEBUG = $([int]$env:DEBUG);" : "") +
|
||||
"`$env:PWSH_PATH = $(Get-PathInjection $env:PWSH_PATH);" +
|
||||
"`$env:INSTALLER_SCRIPT = $(Get-ScriptPathInjection $env:SETUP_SCRIPT_NAME);" +
|
||||
"`$env:CONFIG_MODULE = $(Get-ScriptPathInjection $env:CONFIG_MODULE);" +
|
||||
"`$env:CONFIG_NAME = $(ConvertTo-Injection $env:CONFIG_NAME);" +
|
||||
"& (Join-Path `$env:PWSH_PATH pwsh) `$env:INSTALLER_SCRIPT;") `
|
||||
-Description "Install PowerShell Core and git and run setup script";
|
||||
|
||||
|
@ -264,4 +266,4 @@ function Start-Setup {
|
|||
& "$SETUP_DRIVE\setup.exe" /Unattend:$unattendedConfigFile;
|
||||
}
|
||||
|
||||
Start-Setup
|
||||
Start-Setup @args;
|
||||
|
|
|
@ -24,13 +24,16 @@ function Deploy-SoftwareAction {
|
|||
$install = $true;
|
||||
}
|
||||
|
||||
$hardware = Get-Config "valhalla.hardware";
|
||||
$collections = Get-Config "valhalla.windows.software";
|
||||
|
||||
# Drivers
|
||||
& {
|
||||
$driverPath = "$PSScriptRoot/../Drivers";
|
||||
$mbPath = "$driverPath/ROG Zenith Extreme Alpha";
|
||||
|
||||
if ($install) {
|
||||
if (Get-Config "valhalla.hardware.elgatoWave") {
|
||||
if ($hardware.elgatoWave) {
|
||||
if (-not (Test-ChocoPackage wavelink)) {
|
||||
Install-ChocoPackage wavelink -ArgumentList '--install-arguments="/norestart"';
|
||||
Remove-DesktopIcon "*Wave Link*";
|
||||
|
@ -40,7 +43,7 @@ function Deploy-SoftwareAction {
|
|||
}
|
||||
}
|
||||
|
||||
foreach ($component in (Get-Config "valhalla.hardware.components")) {
|
||||
foreach ($component in $hardware.components) {
|
||||
switcH ($component) {
|
||||
("ROG Zenith Extreme Alpha") {
|
||||
& "$mbPath/MarvellEthernet/Manage.ps1" @arguments;
|
||||
|
@ -56,22 +59,22 @@ function Deploy-SoftwareAction {
|
|||
}
|
||||
|
||||
if ($install) {
|
||||
if (Get-Config "valhalla.hardware.amdCPU") {
|
||||
if ($hardware.amdCPU) {
|
||||
Install-ChocoPackage amd-ryzen-master;
|
||||
# ToDo: backup Ryzen energy saving plan
|
||||
}
|
||||
|
||||
if (Get-Config "valhalla.hardware.nvidiaGPU") {
|
||||
if ($hardware.nvidiaGPU) {
|
||||
Install-ChocoPackage geforce-game-ready-driver;
|
||||
Remove-DesktopIcon "*Geforce*";
|
||||
}
|
||||
|
||||
if (Get-Config "valhalla.hardware.corsairDevice") {
|
||||
if ($hardware.corsairDevice) {
|
||||
Install-ChocoPackage icue;
|
||||
}
|
||||
}
|
||||
|
||||
if (Get-Config "valhalla.hardware.eyeX") {
|
||||
if ($hardware.eyeX) {
|
||||
& "$driverPath/Tobii EyeX/Manage.ps1" @arguments;
|
||||
}
|
||||
};
|
||||
|
@ -83,12 +86,12 @@ function Deploy-SoftwareAction {
|
|||
# Windows Config
|
||||
& "$softwarePath/Windows/Manage.ps1" @arguments;
|
||||
|
||||
if (Get-Config "valhalla.hardware.logitechG") {
|
||||
if ($hardware.logitechG) {
|
||||
& "$softwarePath/LGHub/Manage.ps1" @arguments;
|
||||
}
|
||||
|
||||
# Essentials
|
||||
if (Test-Collection "essential") {
|
||||
if ($collections.essential) {
|
||||
& "$softwarePath/aliae/Main.ps1" @arguments;
|
||||
& "$softwarePath/OpenSSH/Manage.ps1" @arguments;
|
||||
& "$softwarePath/PowerShell/Manage.ps1" @arguments;
|
||||
|
@ -115,7 +118,7 @@ function Deploy-SoftwareAction {
|
|||
}
|
||||
|
||||
# Common Software
|
||||
if (Test-Collection "common") {
|
||||
if ($collections.common) {
|
||||
& "$softwarePath/WinSCP/Manage.ps1" @arguments;
|
||||
& "$softwarePath/Thunderbird/Manage.ps1" @arguments;
|
||||
& "$softwarePath/PuTTY/Manage.ps1" @arguments;
|
||||
|
@ -137,7 +140,7 @@ function Deploy-SoftwareAction {
|
|||
}
|
||||
}
|
||||
|
||||
if (Test-Collection "desktopExperience") {
|
||||
if ($collections.desktopExperience) {
|
||||
if ($install) {
|
||||
# Fonts
|
||||
Install-ChocoPackage nerd-fonts-CascadiaCode;
|
||||
|
@ -170,7 +173,7 @@ function Deploy-SoftwareAction {
|
|||
Remove-DesktopIcon "GIMP*";
|
||||
Remove-DesktopIcon "GPU-Z*";
|
||||
Remove-DesktopIcon "WinDirStat*";
|
||||
Remove-DesktopIcon "*HWMonior*";
|
||||
Remove-DesktopIcon "*HWMonitor*";
|
||||
Remove-DesktopIcon "ImgBurn*";
|
||||
Remove-DesktopIcon "InkScape*";
|
||||
Remove-DesktopIcon "Krita*";
|
||||
|
@ -192,12 +195,12 @@ function Deploy-SoftwareAction {
|
|||
& "$softwarePath/Firefox/Manage.ps1" @arguments;
|
||||
& "$softwarePath/MSEdgeRedirect/Manage.ps1" @arguments;
|
||||
|
||||
if (Test-Collection "fileSync") {
|
||||
if ($collections.fileSync) {
|
||||
& "$softwarePath/Nextcloud/Main.ps1" @arguments;
|
||||
}
|
||||
}
|
||||
|
||||
if (Test-Collection "socialMedia") {
|
||||
if ($collections.socialMedia) {
|
||||
if ($install) {
|
||||
Install-ChocoPackage `
|
||||
signal `
|
||||
|
@ -214,7 +217,7 @@ function Deploy-SoftwareAction {
|
|||
}
|
||||
}
|
||||
|
||||
if (Test-Collection "media") {
|
||||
if ($collections.media) {
|
||||
if ($install) {
|
||||
Install-ChocoPackage `
|
||||
k-litecodecpackmega `
|
||||
|
@ -230,7 +233,7 @@ function Deploy-SoftwareAction {
|
|||
}
|
||||
}
|
||||
|
||||
if (Test-Collection "coding") {
|
||||
if ($collections.coding) {
|
||||
if ($install) {
|
||||
& "$softwarePath/vscode/Main.ps1" @arguments;
|
||||
|
||||
|
@ -256,7 +259,7 @@ function Deploy-SoftwareAction {
|
|||
}
|
||||
|
||||
# Gaming
|
||||
if (Test-Collection "gaming") {
|
||||
if ($collections.gaming) {
|
||||
if ($install) {
|
||||
Install-ChocoPackage `
|
||||
goggalaxy `
|
||||
|
|
|
@ -53,8 +53,9 @@ $null = New-Module {
|
|||
function Get-StartupCommand {
|
||||
($env:PWSH_PATH ? "`$env:PWSH_PATH = $(ConvertTo-Injection $env:PWSH_PATH);" : "") +
|
||||
($env:DEBUG ? "`$env:DEBUG = $([int]$env:DEBUG);" : "") +
|
||||
($env:BACKUP_ARCHIVE ? "`$env:BACKUP_ARCHIVE = $(ConvertTo-Injection ([System.IO.Path]::GetFullPath($env:BACKUP_ARCHIVE)));" : "") +
|
||||
"`$env:INSTALLER_SCRIPT = $(ConvertTo-Injection (Resolve-Path $env:INSTALLER_SCRIPT));" +
|
||||
"`$env:CONFIG_MODULE = $(ConvertTo-Injection (Resolve-Path $env:CONFIG_MODULE));" +
|
||||
"`$env:CONFIG_NAME = $(ConvertTo-Injection $env:CONFIG_NAME);" +
|
||||
"& `$env:INSTALLER_SCRIPT;";
|
||||
}
|
||||
|
||||
|
|
|
@ -56,19 +56,6 @@ $null = New-Module {
|
|||
Set-BootMessage;
|
||||
}
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Disables automatic reboots by Windows Update.
|
||||
#>
|
||||
function Disable-WindowsUpdateAutoRestart {
|
||||
$path = "$wuPolicyPath\AU";
|
||||
$null = New-Item -Force $path -ErrorAction SilentlyContinue;
|
||||
|
||||
Set-ItemProperty $path `
|
||||
-Name NoAutoRebootWithLoggedOnUsers `
|
||||
-Value 1;
|
||||
}
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Resets the automatic reboot state.
|
||||
|
|
|
@ -16,6 +16,10 @@ $null = New-Module {
|
|||
$result = "System";
|
||||
}
|
||||
|
||||
if (-not $Path) {
|
||||
$Path = "Files";
|
||||
}
|
||||
|
||||
$result = Join-Path $result $Path;
|
||||
return $result;
|
||||
};
|
||||
|
@ -153,7 +157,12 @@ $null = New-Module {
|
|||
7z x "-o$dir" (Get-ValhallaBackupArchive) $sourcePath @ArgumentList;
|
||||
|
||||
if (Test-Path $filePath) {
|
||||
Copy-Item -Recurse (Join-Path $dir $sourcePath) $Target;
|
||||
if (Test-Path -PathType Container $filePath) {
|
||||
$null = New-Item -ItemType Directory $Target -Force;
|
||||
$filePath = "$filePath/*";
|
||||
}
|
||||
|
||||
Copy-Item -Recurse $filePath $Target -Force;
|
||||
}
|
||||
|
||||
Remove-Item -Recurse -Force $dir;
|
||||
|
|
|
@ -54,6 +54,10 @@ function Test-WslDistribution {
|
|||
#>
|
||||
function Install-Wsl {
|
||||
wsl --install --no-launch;
|
||||
# Microsoft broke WSL - Quelle surprise!
|
||||
# ToDo: Remove this workaround once it's unbroken
|
||||
. "$PSScriptRoot/../../Common/Scripts/Software.ps1";
|
||||
Install-SetupPackage "https://github.com/microsoft/WSL/releases/download/2.3.17/wsl.2.3.17.0.x64.msi" -ArgumentList "/Quiet";
|
||||
}
|
||||
|
||||
<#
|
||||
|
@ -63,9 +67,14 @@ function Install-Wsl {
|
|||
function Install-WslDistribution {
|
||||
$dir = Get-WslDistributionPath;
|
||||
$root = Split-Path -Parent $dir;
|
||||
$ubuntuPattern = "*Ubuntu*";
|
||||
$registryPath = "HKCU:/Software/Microsoft/Windows/CurrentVersion/Lxss";
|
||||
$key = Get-Item $registryPath;
|
||||
|
||||
if (Get-AppxPackage $ubuntuPattern) {
|
||||
Install-Wsl;
|
||||
}
|
||||
|
||||
if ($key) {
|
||||
$key = $key | Rename-Item -NewName "$(Split-Path -Leaf $key)_" -PassThru;
|
||||
}
|
||||
|
@ -74,7 +83,7 @@ function Install-WslDistribution {
|
|||
$null = New-Item -ItemType Directory $root;
|
||||
}
|
||||
|
||||
Copy-Item -Recurse -Force (Get-AppxPackage "*Ubuntu*").InstallLocation $dir;
|
||||
Copy-Item -Recurse -Force (Get-AppxPackage $ubuntuPattern).InstallLocation $dir;
|
||||
Set-UserPermissions $dir;
|
||||
& "$dir\ubuntu.exe" install --root;
|
||||
wsl --shutdown;
|
||||
|
|
|
@ -3,13 +3,83 @@ param(
|
|||
[hashtable] $Arguments
|
||||
)
|
||||
|
||||
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
|
||||
. "$PSScriptRoot/../../Scripts/AppAssociations.ps1";
|
||||
& {
|
||||
param ($Parameters)
|
||||
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
|
||||
. "$PSScriptRoot/../../Scripts/Restoration.ps1";
|
||||
$configPath = "$env:LocalAppData/LGHUB";
|
||||
|
||||
Start-SoftwareInstaller @PSBoundParameters `
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Stops the running Logitech G Hub instance.
|
||||
#>
|
||||
function Stop-LGHub {
|
||||
[OutputType([string])]
|
||||
param()
|
||||
|
||||
$hubName = "lghub_system_tray.exe";
|
||||
|
||||
$candidates = Get-Process | Where-Object { $_.Path -and ((Split-Path -Leaf $_.Path) -eq $hubName) };
|
||||
|
||||
if ($candidates.Count -gt 0) {
|
||||
$lghubPath = $()[0].Path;
|
||||
} else {
|
||||
$lghubPath = $null;
|
||||
}
|
||||
|
||||
$mainProcesses = Get-Process | Where-Object {
|
||||
$_.Path -and
|
||||
(@("lghub.exe", "lghub_agent.exe", "lghub_updater.exe", $hubName) -contains (Split-Path -Leaf $_.Path)) -and
|
||||
(($_.Parent.ProcessName -eq "explorer") -or ($null -eq $_.Parent))
|
||||
};
|
||||
|
||||
$null = $mainProcesses | ForEach-Object { $_.Kill($true) };
|
||||
return $lghubPath;
|
||||
}
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Edits the Logitech G Hub configuration.
|
||||
#>
|
||||
function Edit-LGHubConfig {
|
||||
param(
|
||||
[scriptblock] $Action
|
||||
)
|
||||
|
||||
Write-Host "Stopping Logitech G Hub";
|
||||
$path = Stop-LGHub;
|
||||
& $Action;
|
||||
|
||||
if ($path) {
|
||||
Write-Host "Restarting Logitech G Hub";
|
||||
Start-Process $path;
|
||||
}
|
||||
}
|
||||
|
||||
Start-SoftwareInstaller @Parameters `
|
||||
-Installer {
|
||||
Install-ChocoPackage lghub;
|
||||
Remove-DesktopIcon "*G HUB*";
|
||||
} `
|
||||
-UserBackup {
|
||||
param(
|
||||
[hashtable] $Arguments
|
||||
)
|
||||
|
||||
Edit-LGHubConfig {
|
||||
Add-BackupArtifacts -User $Arguments.Name -Source $configPath -Path "LGHub" `
|
||||
-Include @("settings.db", "icon_cache")
|
||||
};
|
||||
} `
|
||||
-UserConfigurator {
|
||||
param(
|
||||
[hashtable] $Arguments
|
||||
)
|
||||
|
||||
Edit-LGHubConfig {
|
||||
Expand-BackupArtifacts -User $Arguments.Name -Path "LGHub" -Target $configPath;
|
||||
};
|
||||
};
|
||||
} $PSBoundParameters;
|
||||
|
||||
# ToDo: Add restoration
|
||||
|
|
|
@ -3,13 +3,44 @@ param(
|
|||
[hashtable] $Arguments
|
||||
)
|
||||
|
||||
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Scripts/System.ps1";
|
||||
& {
|
||||
param($Parameters)
|
||||
. "$PSScriptRoot/../../Scripts/Restoration.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Scripts/System.ps1";
|
||||
$path = "$HOME/Documents/ManiaPlanet";
|
||||
|
||||
Start-SoftwareInstaller @PSBoundParameters `
|
||||
Start-SoftwareInstaller @Parameters `
|
||||
-Installer {
|
||||
Install-WingetPackage Nadeo.ManiaPlanet;
|
||||
Remove-DesktopIcon "ManiaPlanet*";
|
||||
} `
|
||||
-UserBackup {
|
||||
param(
|
||||
[hashtable] $Arguments
|
||||
)
|
||||
|
||||
Add-BackupArtifacts -User $Arguments.Name -Source $path -Path "ManiaPlanet" `
|
||||
-Include @(
|
||||
"Actions",
|
||||
"Blocks",
|
||||
"Items",
|
||||
"Maps",
|
||||
"Media",
|
||||
"Modules",
|
||||
"Packs",
|
||||
"Replays",
|
||||
"Scripts",
|
||||
"Skins"
|
||||
);
|
||||
} `
|
||||
-UserConfigurator {
|
||||
param(
|
||||
[hashtable] $Arguments
|
||||
)
|
||||
|
||||
Expand-BackupArtifacts -User $Arguments.Name -Path "ManiaPlanet" -Target $path;
|
||||
};
|
||||
} $PSBoundParameters;
|
||||
|
||||
# ToDo: Add restoration
|
||||
|
|
|
@ -6,10 +6,28 @@ param(
|
|||
)
|
||||
|
||||
. "$PSScriptRoot/../../Scripts/AppAssociations.ps1";
|
||||
. "$PSScriptRoot/../../Scripts/Restoration.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Scripts/System.ps1";
|
||||
|
||||
Start-SoftwareInstaller @PSBoundParameters `
|
||||
-Installer {
|
||||
Install-ChocoPackage putty;
|
||||
} `
|
||||
-UserBackup {
|
||||
param([hashtable] $Arguments)
|
||||
$dir = New-TemporaryDirectory;
|
||||
$fileName = Join-Path "$dir" PuTTY.reg;
|
||||
& reg export "HKCU\Software\SimonTatham\PuTTY" $fileName /y;
|
||||
Add-BackupArtifacts -User $Arguments.Name -Source $fileName -Path "PuTTY/PuTTY.reg";
|
||||
Remove-Item -Recurse -Force $dir;
|
||||
} `
|
||||
-UserConfigurator {
|
||||
param([hashtable] $Arguments)
|
||||
$dir = New-TemporaryDirectory;
|
||||
$fileName = Join-Path "$dir" PuTTY.reg;
|
||||
Expand-BackupArtifacts -User $Arguments.Name -Path "PuTTY/PuTTY.reg" -Target $fileName;
|
||||
& reg import $fileName;
|
||||
Remove-Item -Recurse -Force $dir;
|
||||
};
|
||||
# ToDo: Add restoration
|
||||
|
|
|
@ -3,15 +3,34 @@ param(
|
|||
[hashtable] $Arguments
|
||||
)
|
||||
|
||||
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Scripts/System.ps1";
|
||||
|
||||
Start-SoftwareInstaller @PSBoundParameters `
|
||||
$null = New-Module {
|
||||
param($Parameters)
|
||||
. "$PSScriptRoot/../../Scripts/Restoration.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Scripts/System.ps1";
|
||||
$path = "C:/tools/RetroArch-Win64";
|
||||
|
||||
Start-SoftwareInstaller @Parameters `
|
||||
-Backup {
|
||||
Add-BackupArtifacts -Path "RetroArch" -Source $path `
|
||||
-Include @(
|
||||
"config",
|
||||
"cores",
|
||||
"downloads",
|
||||
"playlists",
|
||||
"recordings",
|
||||
"screenshots",
|
||||
"content_history.lpl",
|
||||
"content_*_history.lpl",
|
||||
"retroarch.cfg"
|
||||
);
|
||||
} `
|
||||
-Installer {
|
||||
Install-ChocoPackage retroarch;
|
||||
} `
|
||||
-Configurator {
|
||||
Add-StartMenuIcon "RetroArch" "C:\tools\RetroArch-Win64\retroarch.exe";
|
||||
Expand-BackupArtifacts -Path "RetroArch" -Target $path;
|
||||
};
|
||||
|
||||
# ToDo: Add restoration
|
||||
} $PSBoundParameters;
|
||||
|
|
|
@ -3,9 +3,14 @@ param(
|
|||
[hashtable] $Arguments
|
||||
)
|
||||
|
||||
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
|
||||
|
||||
Start-SoftwareInstaller @PSBoundParameters `
|
||||
& {
|
||||
param($Parameters)
|
||||
. "$PSScriptRoot/../../Scripts/Restoration.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
|
||||
$path = "$HOME/Documents/TmForever";
|
||||
|
||||
Start-SoftwareInstaller @Parameters `
|
||||
-Installer {
|
||||
foreach ($feature in @("DirectPlay", "NetFx3")) {
|
||||
if ((Get-WindowsOptionalFeature -Online -FeatureName $feature).State -ne "Enabled") {
|
||||
|
@ -16,6 +21,24 @@ Start-SoftwareInstaller @PSBoundParameters `
|
|||
|
||||
Install-WingetPackage Nadeo.TrackManiaNationsForever;
|
||||
Remove-DesktopIcon "*TmNationsForever*";
|
||||
} `
|
||||
-UserBackup {
|
||||
param([hashtable] $Arguments)
|
||||
$name = $Arguments.Name;
|
||||
Add-BackupArtifacts -User $name -Source $path -Path "TmNationsForever" `
|
||||
-Include @(
|
||||
"ChallengeMusics",
|
||||
"MediaTracker",
|
||||
"MenuMusics",
|
||||
"Painter",
|
||||
"Scores",
|
||||
"Skins",
|
||||
"Tracks"
|
||||
);
|
||||
} `
|
||||
-UserConfigurator {
|
||||
param([hashtable] $Arguments)
|
||||
$name = $Arguments.Name;
|
||||
Expand-BackupArtifacts -User $name -Path "TmNationsForever" -Target $path;
|
||||
};
|
||||
|
||||
# ToDo: Add restoration
|
||||
} $PSBoundParameters;
|
||||
|
|
|
@ -3,10 +3,15 @@ param(
|
|||
[hashtable] $Arguments
|
||||
)
|
||||
|
||||
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Scripts/System.ps1";
|
||||
|
||||
Start-SoftwareInstaller @PSBoundParameters `
|
||||
& {
|
||||
param($Parameters)
|
||||
. "$PSScriptRoot/../../Scripts/Restoration.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Scripts/System.ps1";
|
||||
$path = "$HOME/Documents/TrackMania";
|
||||
|
||||
Start-SoftwareInstaller @Parameters `
|
||||
-Installer {
|
||||
$file = "TmUnitedForever.exe";
|
||||
$dir = New-TemporaryDirectory;
|
||||
|
@ -28,6 +33,21 @@ Start-SoftwareInstaller @PSBoundParameters `
|
|||
$null = Pop-Location;
|
||||
|
||||
Remove-Item -Recurse $dir;
|
||||
} `
|
||||
-UserBackup {
|
||||
param([hashtable] $Arguments)
|
||||
Add-BackupArtifacts -User $Arguments.Name -Source $path -Path "TmUnitedForever" `
|
||||
-Include @(
|
||||
"ChallengeMusics",
|
||||
"MediaTracker",
|
||||
"MenuMusics",
|
||||
"Scores",
|
||||
"Skins",
|
||||
"Tracks"
|
||||
);
|
||||
} `
|
||||
-UserConfigurator {
|
||||
param([hashtable] $Arguments)
|
||||
Expand-BackupArtifacts -User $Arguments.Name -Path "TmUnitedForever" -Target $path;
|
||||
};
|
||||
|
||||
# ToDo: Add restoration
|
||||
} $PSBoundParameters;
|
||||
|
|
|
@ -6,6 +6,8 @@ param(
|
|||
& {
|
||||
param($parameters)
|
||||
|
||||
. "$PSScriptRoot/../../Scripts/Restoration.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Scripts/SoftwareManagement.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Scripts/BrowserAutomation.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Scripts/System.ps1";
|
||||
|
@ -17,18 +19,64 @@ param(
|
|||
[System.Tuple]::Create("visualstudio2022community", "VisualStudio.17.Release", "Microsoft.VisualStudio.Product.Community")
|
||||
);
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Gets the path to the Visual Studio Installer.
|
||||
#>
|
||||
function Get-InstallerPath {
|
||||
return "$((Get-KnownFolder ProgramFilesX86).Path)/Microsoft Visual Studio/Installer/vs_installer.exe";
|
||||
}
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Gets the path to the configuration file in the backup archive.
|
||||
|
||||
.PARAMETER PackageName
|
||||
The name of the package to get the configuration for.
|
||||
#>
|
||||
function Get-ConfigPath {
|
||||
param(
|
||||
[string] $PackageName
|
||||
)
|
||||
|
||||
return Join-Path "Visual Studio" "$PackageName.vsconfig";
|
||||
}
|
||||
|
||||
Start-SoftwareInstaller @parameters `
|
||||
-Backup {
|
||||
foreach ($version in $versions) {
|
||||
if (Test-ChocoPackage $version[0]) {
|
||||
Write-Host "Backing up ``$($version[0])…";
|
||||
$configFile = New-TemporaryFile;
|
||||
|
||||
Start-Process -FilePath (Get-InstallerPath) -Wait `
|
||||
-ArgumentList @(
|
||||
"export",
|
||||
"--channelId", $version[1],
|
||||
"--productId", $version[2],
|
||||
"--config", $configFile,
|
||||
"--quiet"
|
||||
);
|
||||
|
||||
Add-BackupArtifacts -Source $configFile -Path (Get-ConfigPath $version[0]);
|
||||
Remove-Item $configFile;
|
||||
}
|
||||
}
|
||||
} `
|
||||
-Installer {
|
||||
foreach ($version in $versions) {
|
||||
$packageName = $version[0];
|
||||
Write-Host "Installing ``$packageName``…";
|
||||
Install-ChocoPackage $packageName;
|
||||
$file = New-TemporaryFile;
|
||||
Remove-Item $file;
|
||||
Expand-BackupArtifacts -Path (Get-ConfigPath $packageName) -Target $file;
|
||||
|
||||
if (Test-Path $file) {
|
||||
Write-Host "Restoring ``$packageName``…";
|
||||
Install-ChocoPackage $packageName -ArgumentList "--params","--config `"$file`"";
|
||||
}
|
||||
}
|
||||
|
||||
Remove-DesktopIcon "CocosCreator*";
|
||||
Remove-DesktopIcon "Unity Hub*";
|
||||
};
|
||||
|
||||
# ToDo: Add restoration
|
||||
# Only restore version if it has been backed up
|
||||
} $PSBoundParameters;
|
||||
|
|
37
scripts/Windows/Software/Windows/Home.exclude.txt
Normal file
37
scripts/Windows/Software/Windows/Home.exclude.txt
Normal file
|
@ -0,0 +1,37 @@
|
|||
Pictures/Feedback
|
||||
Documents/BeamNG.drive
|
||||
Documents/Default.rdp
|
||||
Documents/den4b/ReNamer
|
||||
Documents/Dolphin Emulator
|
||||
Documents/eFisc
|
||||
Documents/IISExpress
|
||||
Documents/KINGDOM HEARTS HD 1.5+2.5 ReMIX
|
||||
Documents/ManiaPlanet
|
||||
Documents/MetaX
|
||||
Documents/MuseScore3
|
||||
Documents/My Web Sites
|
||||
Documents/OneNote-Notizbücher
|
||||
Documents/PCSX2
|
||||
Documents/PowerShell
|
||||
Documents/PPSSPP
|
||||
Documents/PS Vita
|
||||
Documents/PSV Packages
|
||||
Documents/PSV Updates
|
||||
Documents/Repositories
|
||||
Documents/Rise of the Tomb Raider
|
||||
Documents/S2
|
||||
Documents/SEGA
|
||||
Documents/SEGA Mega Drive Classics
|
||||
Documents/SQL Server Management Studio
|
||||
Documents/Square Enix
|
||||
Documents/TI-Nspire CX
|
||||
Documents/TmForever
|
||||
Documents/TrackMania
|
||||
Documents/UltraVNC
|
||||
Documents/Visual Studio 2017
|
||||
Documents/Visual Studio 2019
|
||||
Documents/Visual Studio 2022
|
||||
Documents/Viwizard M4V Converter
|
||||
Documents/WindowsPowerShell
|
||||
Documents/Zoom
|
||||
Music/iTunes
|
|
@ -5,13 +5,41 @@ param(
|
|||
[hashtable] $Arguments
|
||||
)
|
||||
|
||||
. "$PSScriptRoot/../../Scripts/Registry.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Scripts/Config.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Scripts/System.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Types/InstallerAction.ps1";
|
||||
|
||||
Start-SoftwareInstaller @PSBoundParameters `
|
||||
$null = New-Module {
|
||||
param($Parameters)
|
||||
|
||||
. "$PSScriptRoot/../../Scripts/Registry.ps1";
|
||||
. "$PSScriptRoot/../../Scripts/Restoration.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Scripts/Config.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Scripts/System.ps1";
|
||||
|
||||
$userFolders = @(
|
||||
"Pictures",
|
||||
"Documents",
|
||||
"Downloads",
|
||||
"Music",
|
||||
"Videos"
|
||||
);
|
||||
|
||||
$userExclusions = @(
|
||||
"Documents/Eigene*",
|
||||
"Documents/My Games",
|
||||
"Documents/My Music",
|
||||
"Documents/My Pictures",
|
||||
"Documents/My Videos"
|
||||
);
|
||||
|
||||
[string[]] $homeExclusions = Get-Content "$PSScriptRoot/Home.exclude.txt";
|
||||
|
||||
Start-SoftwareInstaller @Parameters `
|
||||
-Backup {
|
||||
Add-BackupArtifacts -Source "$env:PUBLIC" -Path "Public" `
|
||||
-Include ($userFolders) `
|
||||
-Exclude ($userExclusions + @("Documents/Hyper-V", "Documents/reWASD"));
|
||||
} `
|
||||
-Configurator {
|
||||
$dir = New-TemporaryDirectory;
|
||||
Push-Location $dir;
|
||||
|
@ -54,7 +82,7 @@ Start-SoftwareInstaller @PSBoundParameters `
|
|||
)
|
||||
|
||||
$path = "$($Key.PSPath)\Software\Microsoft\Lighting";
|
||||
$null = New-Item $path;
|
||||
$null = New-Item $path -ErrorAction SilentlyContinue;
|
||||
Set-ItemProperty $path -Name "AmbientLightingEnabled" -Value 0 -Type "DWord";
|
||||
};
|
||||
}
|
||||
|
@ -136,4 +164,20 @@ Start-SoftwareInstaller @PSBoundParameters `
|
|||
|
||||
Pop-Location;
|
||||
Remove-Item -Recurse $dir;
|
||||
Expand-BackupArtifacts -Path "Public" -Target $env:PUBLIC;
|
||||
} `
|
||||
-UserBackup {
|
||||
param(
|
||||
[hashtable] $Arguments
|
||||
)
|
||||
|
||||
Add-BackupArtifacts -User $Arguments.Name -Source $HOME -Path "Home" -Include ($userFolders) -Exclude ($userExclusions + $homeExclusions);
|
||||
} `
|
||||
-UserConfigurator {
|
||||
param(
|
||||
[hashtable] $Arguments
|
||||
)
|
||||
|
||||
Expand-BackupArtifacts -User $Arguments.Name -Path "Home" -Target $HOME;
|
||||
};
|
||||
} $PSBoundParameters;
|
||||
|
|
|
@ -5,10 +5,45 @@ param(
|
|||
|
||||
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
|
||||
|
||||
Start-SoftwareInstaller @PSBoundParameters `
|
||||
$null = New-Module {
|
||||
param($Parameters)
|
||||
. "$PSScriptRoot/../../Scripts/Restoration.ps1";
|
||||
Export-ModuleMember -Function @();
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Gets the path to the installation directory of osu!.
|
||||
#>
|
||||
function Get-InstallPath {
|
||||
return "$((Get-KnownFolder -SpecialFolder ProgramFilesX86).Path)/osu!";
|
||||
}
|
||||
|
||||
Start-SoftwareInstaller @Parameters `
|
||||
-Installer {
|
||||
Install-ChocoPackage osu;
|
||||
Remove-DesktopIcon "*osu*";
|
||||
} `
|
||||
-Backup {
|
||||
Add-BackupArtifacts -Source (Get-InstallPath) -Path "osu!" `
|
||||
-Include @(
|
||||
"Screenshots",
|
||||
"Skins",
|
||||
"Songs",
|
||||
"osu!.cfg",
|
||||
"scores.db"
|
||||
);
|
||||
} `
|
||||
-Configurator {
|
||||
Expand-BackupArtifacts -Path "osu!" -Target (Get-InstallPath);
|
||||
} `
|
||||
-UserBackup {
|
||||
param([hashtable] $Arguments)
|
||||
$name = $Arguments.Name;
|
||||
Add-BackupArtifacts -Source "$(Get-InstallPath)/osu!.$name.cfg" -User $name -Path "osu!/osu!.cfg";
|
||||
} `
|
||||
-UserConfigurator {
|
||||
param([hashtable] $Arguments)
|
||||
$name = $Arguments.Name;
|
||||
Expand-BackupArtifacts -User $name -Path "osu!/osu!.cfg" -Target "$(Get-InstallPath)/osu!.$name.cfg";
|
||||
};
|
||||
|
||||
# ToDo: Add restoration
|
||||
} $PSBoundParameters;
|
||||
|
|
|
@ -3,13 +3,30 @@ param(
|
|||
[hashtable] $Arguments
|
||||
)
|
||||
|
||||
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Scripts/System.ps1";
|
||||
& {
|
||||
param($Parameters)
|
||||
. "$PSScriptRoot/../../Scripts/Restoration.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Scripts/System.ps1";
|
||||
$path = "$env:AppData/osu";
|
||||
|
||||
Start-SoftwareInstaller @PSBoundParameters `
|
||||
-Installer {
|
||||
Install-WingetPackage "ppy.osu";
|
||||
Start-SoftwareInstaller @Parameters `
|
||||
-UserBackup {
|
||||
param([hashtable] $Arguments)
|
||||
Add-BackupArtifacts -User $Arguments.Name -Source $path -Path "osu!lazer" `
|
||||
-Include @(
|
||||
"files",
|
||||
"rulesets",
|
||||
"screenshots",
|
||||
"framework.ini",
|
||||
"game.ini",
|
||||
"input.json"
|
||||
);
|
||||
} `
|
||||
-UserConfigurator {
|
||||
param([hashtable] $Arguments)
|
||||
Install-WingetPackage "ppy.osu" -ArgumentList "--scope","user";
|
||||
Remove-DesktopIcon "*osu*";
|
||||
Expand-BackupArtifacts -User $Arguments.Name -Path "osu!lazer" -Target $path;
|
||||
};
|
||||
|
||||
# ToDo: Add restoration
|
||||
} $PSBoundParameters;
|
||||
|
|
|
@ -3,11 +3,31 @@ param(
|
|||
[hashtable] $Arguments
|
||||
)
|
||||
|
||||
. "$PSScriptRoot/../../../Common/Scripts/BrowserAutomation.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Scripts/System.ps1";
|
||||
& {
|
||||
param($Parameters)
|
||||
. "$PSScriptRoot/../../Scripts/Restoration.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Scripts/BrowserAutomation.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Scripts/System.ps1";
|
||||
|
||||
Start-SoftwareInstaller @PSBoundParameters `
|
||||
$path = "$env:Public/Documents/reWASD";
|
||||
|
||||
Start-SoftwareInstaller @Parameters `
|
||||
-Backup {
|
||||
Add-BackupArtifacts -Path "reWASD" -Source $path `
|
||||
-Exclude @(
|
||||
"Logs",
|
||||
"Presets",
|
||||
"Profiles/Destop",
|
||||
"Profiles/Duality",
|
||||
"Profiles/Fortnite",
|
||||
"Profiles/PS4 Remote*",
|
||||
"Profiles/Switch console",
|
||||
"Profiles/Switch to Xbox 360",
|
||||
"Profiles/Valorant",
|
||||
"Profiles/xCloud"
|
||||
);
|
||||
} `
|
||||
-Installer {
|
||||
Write-Host "Downloading reWASD…";
|
||||
$dir = New-TemporaryDirectory;
|
||||
|
@ -17,6 +37,8 @@ Start-SoftwareInstaller @PSBoundParameters `
|
|||
Start-Process -Wait -FilePath $($file.FullName) -ArgumentList "/S";
|
||||
Remove-Item -Recurse $dir;
|
||||
Remove-DesktopIcon "*reWASD*";
|
||||
} `
|
||||
-Configurator {
|
||||
Expand-BackupArtifacts -Path "reWASD" -Target $path;
|
||||
};
|
||||
|
||||
# ToDo: Add restoration
|
||||
} $PSBoundParameters;
|
||||
|
|
|
@ -1,11 +1,19 @@
|
|||
#!/bin/env fish
|
||||
begin
|
||||
set -l varName WIN11_IMAGE_PATH
|
||||
set -l $varName
|
||||
set -l dir (status dirname)
|
||||
source "$dir/lib/choose-disk.fish"
|
||||
set $varName (bash -c ". $(string escape $dir)/.env; echo \$$varName" 2> /dev/null)
|
||||
|
||||
set -q WIN11_IMAGE_PATH
|
||||
[ ! -z "$$varName" ]
|
||||
or begin
|
||||
echo "Please specify the Windows 11 ISO in the `WIN11_IMAGE_PATH` variable."
|
||||
if [ ! -f "$dir/.env" ]
|
||||
cp $dir/.env.template $dir/.env
|
||||
end
|
||||
|
||||
echo "Please epecify the path to the Windows 11 ISO image in your .env file located at:"
|
||||
realpath --relative-to (pwd) (realpath $dir/.env)
|
||||
exit 1
|
||||
end
|
||||
|
||||
|
@ -158,7 +166,7 @@ begin
|
|||
end
|
||||
|
||||
mkdir -p "$(dirname "$winpe")"
|
||||
sudo mount --mkdir "$WIN11_IMAGE_PATH" "$winPath"
|
||||
sudo mount --mkdir $$varName "$winPath"
|
||||
mkwinpeimg --iso --arch amd64 --overlay "$winpeOverlay" --windows-dir "$winPath" "$winpe"
|
||||
sudo mount --mkdir "$winpe" "$winpePath"
|
||||
|
||||
|
@ -201,9 +209,11 @@ begin
|
|||
begin
|
||||
source "$dir/../scripts/Common/Scripts/config.fish"
|
||||
|
||||
find "$projectPath/profiles" -type f -name "*.nix" | while read -l file
|
||||
set -l CONFIG_MODULE "$file"
|
||||
getConfig "valhalla.windows.config" --json > "$file.json"
|
||||
for name in (getProfiles | jq '.[]' --raw-output0 | string split0)
|
||||
set -l CONFIG_NAME "$name"
|
||||
set -l file "$projectPath/.config/$name.json"
|
||||
mkdir -p (dirname $file)
|
||||
getConfig "valhalla.windows.config" --json > "$file"
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
#!/bin/bash
|
||||
WIN_DISK="${WIN_DISK}";
|
||||
workingDir="$(pwd)";
|
||||
pushd "${BASH_SOURCE%/*}" > /dev/null;
|
||||
. "./.env" > /dev/null 2>&1;
|
||||
|
||||
if [ ! -z "$WIN11_IMAGE_PATH" ]
|
||||
then
|
||||
WIN11_IMAGE_PATH="$(bash -c "realpath $WIN11_IMAGE_PATH")";
|
||||
fi;
|
||||
|
||||
if [ ! -f "$WIN11_IMAGE_PATH" ]
|
||||
then
|
||||
if [ ! -f "./.env" ]
|
||||
then
|
||||
cp .env.template .env;
|
||||
fi;
|
||||
|
||||
echo "Please specify the path to the Windows 11 ISO image in your .env file located at:";
|
||||
realpath --relative-to "$workingDir" "$(realpath .env)";
|
||||
else
|
||||
WIN11_IMAGE_PATH="$WIN11_IMAGE_PATH" exec fish ./deploy.fish $@;
|
||||
fi;
|
||||
|
||||
popd > /dev/null;
|
|
@ -1,2 +1,3 @@
|
|||
$env:SETUP_DRIVE = (ConvertFrom-Csv ((wmic volume where "Label='$env:SETUP_LABEL'" get DriveLetter) | ForEach-Object { "$_".Trim(); })).DriveLetter;
|
||||
Set-Location (Join-Path $env:SETUP_DRIVE $env:LOCAL_PROJECT_PATH)
|
||||
& ./scripts/Windows/OS/Setup.ps1;
|
||||
|
|
Loading…
Reference in a new issue