Compare commits

..

170 commits

Author SHA1 Message Date
Manuel Thalmann 822393bef3 Create a separate script for WSL interaction 2024-08-26 23:33:46 +02:00
Manuel Thalmann dccc531fbb Fix recursive configuration 2024-08-25 03:58:28 +02:00
Manuel Thalmann 17a0eb1f8b Fix malformed module 2024-08-24 18:35:43 +02:00
Manuel Thalmann f3480ce6f4 Keep Windows fixes separate 2024-08-24 16:56:29 +02:00
Manuel Thalmann 1ebd2d7b0d Remove WSL after operation 2024-08-24 16:52:41 +02:00
Manuel Thalmann 7cf5ecaa06 Make distribution name unique 2024-08-24 16:41:05 +02:00
Manuel Thalmann 957fe77eda Streamline WSL distribution name 2024-08-24 16:27:34 +02:00
Manuel Thalmann 48edcc443c Remove unused resources after user setup 2024-08-24 16:15:10 +02:00
Manuel Thalmann 068858d683 Print update logs properly 2024-08-24 14:47:51 +02:00
Manuel Thalmann 4e2bde01fe Allow overriding Windows settings 2024-08-24 14:20:22 +02:00
Manuel Thalmann ad4e548cb6 Update incorrect path 2024-08-24 14:11:38 +02:00
Manuel Thalmann 83a55f9f63 Simplify osu!lazer installation 2024-08-24 14:10:02 +02:00
Manuel Thalmann 50f820f0ed Determine name of setup user properly 2024-08-24 14:01:05 +02:00
Manuel Thalmann 99b89fc2f7 Make OMP configuration platform independent 2024-08-24 13:27:48 +02:00
Manuel Thalmann 8051db7194 Fix incorrect character in OMP theme 2024-08-24 13:27:35 +02:00
Manuel Thalmann fb6ec523fc Remove unnecessary code 2024-08-24 04:25:07 +02:00
Manuel Thalmann f0e9e2e6fc Remove unnecessary loop 2024-08-24 04:24:55 +02:00
Manuel Thalmann fb9f1f2b73 Add missing module 2024-08-24 04:24:37 +02:00
Manuel Thalmann 905aa08a51 Add nextcloud to the module list 2024-08-24 04:18:57 +02:00
Manuel Thalmann 4ff78ef57f Add a function for creating shortcuts 2024-08-24 04:18:33 +02:00
Manuel Thalmann e9f439f880 Configure nextcloud syncs 2024-08-24 04:07:47 +02:00
Manuel Thalmann 2366505747 Allow configuring nextcloud syncs 2024-08-24 04:07:35 +02:00
Manuel Thalmann 28b62123d8 Create separate option holding win users 2024-08-24 03:25:28 +02:00
Manuel Thalmann 8bed546ccc Rename Nextcloud installer 2024-08-24 01:50:07 +02:00
Manuel Thalmann f4dfd3e22d Add file system driver for dual boot 2024-08-24 01:41:09 +02:00
Manuel Thalmann c67f006b26 Prevent unnecessary config evaluation 2024-08-24 01:31:39 +02:00
Manuel Thalmann 4ced7916b3 Fix non-functioning installer 2024-08-24 01:27:26 +02:00
Manuel Thalmann 585c3ba323 Install vscode extensions by default 2024-08-24 01:16:56 +02:00
Manuel Thalmann ba8b72bf9c Load theme file from WSL properly 2024-08-24 00:59:59 +02:00
Manuel Thalmann a1da5c64a1 Update aliae configuration script 2024-08-24 00:42:57 +02:00
Manuel Thalmann ff6e9d252c Strip duplicate variables and aliases 2024-08-24 00:08:58 +02:00
Manuel Thalmann 37a877d6e5 Install posh theme automatically 2024-08-23 23:53:48 +02:00
Manuel Thalmann 3b1162c1ed Export missing function 2024-08-23 23:50:13 +02:00
Manuel Thalmann b1ccdd73f7 Install aliae by default 2024-08-23 23:46:23 +02:00
Manuel Thalmann 315ffb66bf Add scripts for changing aliae config 2024-08-23 23:44:51 +02:00
Manuel Thalmann 91ff5e69c6 Fix compatibility with mixed new line characters 2024-08-23 23:44:23 +02:00
Manuel Thalmann 3758592e23 Add a script for installing aliae 2024-08-23 22:38:28 +02:00
Manuel Thalmann 3673b8e910 Add desired posh theme 2024-08-23 19:43:06 +02:00
Manuel Thalmann 5192922b85 Make option names more clear 2024-08-23 19:42:27 +02:00
Manuel Thalmann 30c79164c4 Allow configuring oh-my-posh 2024-08-23 19:39:18 +02:00
Manuel Thalmann 4e693da84d Fetch config from proper section 2024-08-23 19:24:49 +02:00
Manuel Thalmann c640fe10cb Adjust configuration accordingly 2024-08-23 19:14:09 +02:00
Manuel Thalmann 5f4c7ace0a Refactor option descriptions 2024-08-23 19:02:06 +02:00
Manuel Thalmann ec0823df14 Clean up the Windows configuration 2024-08-23 18:59:49 +02:00
Manuel Thalmann a2919452b2 Clean up the users.nix file 2024-08-23 18:51:54 +02:00
Manuel Thalmann 645b31b795 Create dedicated rclone module 2024-08-23 18:48:30 +02:00
Manuel Thalmann d5ae24b487 Move git module to separate directory 2024-08-23 18:42:16 +02:00
Manuel Thalmann 9cf600fb62 Move git options to separate module 2024-08-23 18:40:24 +02:00
Manuel Thalmann 54cabbcdc8 Fix inheritance of user config 2024-08-23 18:28:20 +02:00
Manuel Thalmann 58f32346bb Allow OS specific settings 2024-08-23 18:11:48 +02:00
Manuel Thalmann 95408e47b6 Update archiso 2024-08-23 14:19:56 +02:00
Manuel Thalmann 66430773a0 Set user info during git setup 2024-08-23 02:01:16 +02:00
Manuel Thalmann e351108288 Make all config scripts platform independent 2024-08-23 01:57:53 +02:00
Manuel Thalmann e2707152d4 Allow leaving aliases unspecified 2024-08-23 01:52:25 +02:00
Manuel Thalmann 8f841ba449 Make scripts platform independent 2024-08-23 01:52:04 +02:00
Manuel Thalmann 12ce6e8cab Add scripts for configuring git 2024-08-23 01:43:26 +02:00
Manuel Thalmann ea2f616a28 Configure software implicitly 2024-08-23 01:41:32 +02:00
Manuel Thalmann 539e9fb661 Skip profile creation for PinnedItem 2024-08-22 23:55:41 +02:00
Manuel Thalmann 2aac92dfc7 Allow skipping powershell module registration 2024-08-22 23:55:00 +02:00
Manuel Thalmann e8ec44c021 Add profiles to the flake 2024-08-22 23:37:53 +02:00
Manuel Thalmann 9b5a8382b7 Remove user profile of OneShot user 2024-08-22 23:12:11 +02:00
Manuel Thalmann ae4947fbef Add missing variable 2024-08-22 21:14:52 +02:00
Manuel Thalmann 0ad40548e9 Add missing OneShotTask declaration 2024-08-22 20:41:30 +02:00
Manuel Thalmann a88543d40f Fix infinite loop 2024-08-22 20:41:17 +02:00
Manuel Thalmann 836ec6ce78 Fix incorrect variable name 2024-08-22 20:34:16 +02:00
Manuel Thalmann 1a81aa9db7 Fix handling empty error messages 2024-08-22 20:12:18 +02:00
Manuel Thalmann d38dec6c66 Add choco to the profile of the setup user 2024-08-22 13:46:55 +02:00
Manuel Thalmann 4e78728b76 Add functions for handling options for creating users 2024-08-22 11:11:37 +02:00
Manuel Thalmann 335a13e258 Fix incorrect typings 2024-08-22 11:11:12 +02:00
Manuel Thalmann d1a2fcdef0 Fix permission issues when enabling Win hack 2024-08-22 11:11:00 +02:00
Manuel Thalmann e1dc26b3c2 Register setup script as admin 2024-08-22 11:10:39 +02:00
Manuel Thalmann 55eb62d1ff Execute the entire installer using live scripts 2024-08-21 23:21:32 +02:00
Manuel Thalmann 1d8f7c6ea7 Streamline the creation of users 2024-08-21 18:34:18 +02:00
Manuel Thalmann febfd16df2 Replace osk with cmd during debugging 2024-08-21 18:33:41 +02:00
Manuel Thalmann 73cc50943e Prevent pauses in OneShot tasks 2024-08-21 18:28:50 +02:00
Manuel Thalmann a487e86d37 Print commands in debug mode 2024-08-21 18:28:08 +02:00
Manuel Thalmann 6cd880c7a6 Run OneShot tasks with dedicated user 2024-08-21 18:27:47 +02:00
Manuel Thalmann 77edbb51a6 Add function for generating startup command 2024-08-21 18:26:58 +02:00
Manuel Thalmann 3aa46f61c6 Allow registering startup script for the default user 2024-08-21 18:20:11 +02:00
Manuel Thalmann c46a540599 Prevent unnecessary errors during WSL execution 2024-08-21 14:08:26 +02:00
Manuel Thalmann c97bebefb3 Register WSL before running OneShot tasks 2024-08-21 03:37:44 +02:00
Manuel Thalmann 70b452f140 Overwrite broken module 2024-08-21 03:20:37 +02:00
Manuel Thalmann 5009b0d97a Prevent initialization of nested operations 2024-08-21 03:18:31 +02:00
Manuel Thalmann 42a448ec8e Improve log messages of OneShot tasks 2024-08-21 02:02:30 +02:00
Manuel Thalmann 26406e33fc Retry Linux path conversion for errors 2024-08-20 00:20:33 +02:00
Manuel Thalmann ff0a13fb30 Fix typo 2024-08-20 00:20:07 +02:00
Manuel Thalmann 22f312b3ed Fix broken signature of Restart-Intermediate 2024-08-19 12:07:26 +02:00
Manuel Thalmann 29d7fa30be Report unexpected path conversions 2024-08-19 02:50:41 +02:00
Manuel Thalmann 9d020f94f7 Load missing path 2024-08-19 02:50:19 +02:00
Manuel Thalmann 407a4d3fab Ensure error file can be read from 2024-08-19 02:24:45 +02:00
Manuel Thalmann 935fc4dab4 Streamline OneShot task handler 2024-08-19 02:24:30 +02:00
Manuel Thalmann bb5427f255 Simplify script registration 2024-08-19 02:24:13 +02:00
Manuel Thalmann 0c68b92380 Fix broken regedit paths 2024-08-19 01:38:25 +02:00
Manuel Thalmann 5b86da8697 Allow registering reboots for users 2024-08-19 01:37:14 +02:00
Manuel Thalmann 476b76f581 Prevent users from being excluded 2024-08-19 01:10:29 +02:00
Manuel Thalmann 7b26f113da Force copying of Linux users to Windows 2024-08-19 00:54:13 +02:00
Manuel Thalmann aa21ac9115 Improve log messages of updates 2024-08-18 12:20:21 +02:00
Manuel Thalmann 8873a97412 Remove unnecessary command 2024-08-18 10:24:15 +02:00
Manuel Thalmann 93049868b6 Fix time for QEMU VMs 2024-08-18 09:35:16 +02:00
Manuel Thalmann 5dd5ec4839 Remove unnecessary desktop icons 2024-08-18 09:25:23 +02:00
Manuel Thalmann bd23cfd358 Add a timeout for the reWASD downloader 2024-08-18 09:05:04 +02:00
Manuel Thalmann b0f21037cc Allow setting a timeout for clicking download buttons 2024-08-18 09:04:42 +02:00
Manuel Thalmann 6860d9ac8e Emit errors concerning WSL commands 2024-08-17 13:51:10 +02:00
Manuel Thalmann baa4d6e201 Emit errors using Write-Error 2024-08-17 13:49:21 +02:00
Manuel Thalmann 89025560dd Convert Argument to string explicitly 2024-08-16 23:03:19 +02:00
Manuel Thalmann 46dbec234e Ignore unfinished browser downloads 2024-08-16 17:57:22 +02:00
Manuel Thalmann 03e16767e5 Install powershell modules for all users 2024-08-16 16:43:30 +02:00
Manuel Thalmann 338d672a32 Fix typos 2024-08-16 16:10:09 +02:00
Manuel Thalmann 714cf21e90 Install AutoHotkey as preparation 2024-08-16 15:22:09 +02:00
Manuel Thalmann 77bd653839 Allow running live scripts in debug mode 2024-08-16 15:21:41 +02:00
Manuel Thalmann d38e6a24fd Generate env variables using shorthand scripts 2024-08-16 15:16:56 +02:00
Manuel Thalmann 4ad3cfd5d8 Allow running installation in debug mode 2024-08-16 15:16:28 +02:00
Manuel Thalmann c40d39173f Redirect winiso exit code properly 2024-08-16 15:13:53 +02:00
Manuel Thalmann d87be04660 Allow specifying winiso build type 2024-08-16 15:13:33 +02:00
Manuel Thalmann c1d1fbc7e2 Refactor winget check for rare issue 2024-08-16 15:04:37 +02:00
Manuel Thalmann 1b33fd0696 Disable Windows Update reboot only as admin 2024-08-16 14:35:35 +02:00
Manuel Thalmann 793aa59db0 Add a function for queueing startup commands 2024-08-15 18:34:48 +02:00
Manuel Thalmann ab8d89e7a3 Hide output of DISM commands 2024-08-15 13:57:15 +02:00
Manuel Thalmann f7346d838a Ensure website is loaded before download 2024-08-15 02:42:00 +02:00
Manuel Thalmann 337a89120f Prevent Jellyfin from rebooting 2024-08-15 02:22:07 +02:00
Manuel Thalmann 25d7fa6ab1 Improve handling of slow websites 2024-08-14 18:47:29 +02:00
Manuel Thalmann ef1bf5ebf8 Fix potential CRC errors 2024-08-14 18:46:42 +02:00
Manuel Thalmann cd5d45bff3 Ensure auto reboot is disabled properly 2024-08-12 21:32:53 +02:00
Manuel Thalmann 68d3a4ab17 Disable auto reboot by default 2024-08-12 01:27:50 +02:00
Manuel Thalmann 804e30f267 Add methods for managing auto restart feature 2024-08-12 01:23:42 +02:00
Manuel Thalmann c8670d1fea Install Wave Link first 2024-08-11 18:27:16 +02:00
Manuel Thalmann e880d939a2 Throw an error when failing to load config 2024-08-11 18:27:06 +02:00
Manuel Thalmann 8378b3b1c0 Fix incorrect script path 2024-08-10 20:37:10 +02:00
Manuel Thalmann e5b5083fd4 Allow leaving install action unspecified 2024-08-10 19:27:56 +02:00
Manuel Thalmann feeefa0a10 Retrieve registry value properly 2024-08-10 19:26:53 +02:00
Manuel Thalmann a35f82d131 Add scripts for installing git 2024-08-10 15:28:10 +02:00
Manuel Thalmann 24d8642ec3 Remove unnecessary code 2024-08-10 15:24:15 +02:00
Manuel Thalmann 2aeac879d4 Add a function for removing the RunOnce key 2024-08-10 15:24:04 +02:00
Manuel Thalmann 3c14daea72 Set user groups properly 2024-08-10 15:23:38 +02:00
Manuel Thalmann da45d50898 Configure MS accounts properly 2024-08-10 15:21:13 +02:00
Manuel Thalmann fb65d630e3 Queue next user after configuration finished 2024-08-10 15:20:36 +02:00
Manuel Thalmann e45ed64b06 Disable UAC after logging in MS account 2024-08-10 15:19:14 +02:00
Manuel Thalmann b84acea51a Enable OneShot listener for MS accounts 2024-08-10 15:18:10 +02:00
Manuel Thalmann f7e13a6c07 Set timezone automatically 2024-08-10 15:17:21 +02:00
Manuel Thalmann 7174c2d772 Prevent variable overwrite 2024-08-10 15:16:57 +02:00
Manuel Thalmann a13997aab0 Register installer script after disabling UAG 2024-08-10 15:16:27 +02:00
Manuel Thalmann 4c8b4a0385 Redirect user for configuration properly 2024-08-10 15:16:00 +02:00
Manuel Thalmann 4b18b15230 Fix broken redirection of arguments 2024-08-10 15:15:40 +02:00
Manuel Thalmann 3f8dfdab2c Determine installer action properly 2024-08-10 15:15:21 +02:00
Manuel Thalmann c22f48e592 Redirect arguments to chocolatey properly 2024-08-10 15:13:46 +02:00
Manuel Thalmann 15cba6ebc9 Fix non-functioning OneShot script 2024-08-10 15:13:20 +02:00
Manuel Thalmann 7fd185b5c1 Fix oneshot task execution 2024-08-10 06:11:55 +02:00
Manuel Thalmann ca5ac7a203 Allow removing the OneShot listener 2024-08-10 05:19:24 +02:00
Manuel Thalmann ffb2fd565c Remove duplicate code 2024-08-10 05:17:08 +02:00
Manuel Thalmann 181ca03e3a Fix typo 2024-08-10 03:57:37 +02:00
Manuel Thalmann f2c2582310 Fix copy paste error 2024-08-10 03:57:26 +02:00
Manuel Thalmann 56803b42d6 Allow skipping the User parameter 2024-08-10 03:40:37 +02:00
Manuel Thalmann 6f98557062 Fix incorrect script path 2024-08-10 03:13:13 +02:00
Manuel Thalmann c57294bde8 Fix broken scripts 2024-08-10 01:50:52 +02:00
Manuel Thalmann 8e3c017699 Remove unnecessary confirmation dialogue 2024-08-10 00:23:47 +02:00
Manuel Thalmann 069aec8271 Add a task for disabling UAC 2024-08-10 00:23:37 +02:00
Manuel Thalmann d809ed112c Force creation of sudo alias 2024-08-10 00:22:46 +02:00
Manuel Thalmann a7d6cc444e Allow execution of OneShot tasks 2024-08-10 00:22:30 +02:00
Manuel Thalmann 9be293b799 Ensure CONFIG_MODULE is resolved 2024-08-09 23:23:55 +02:00
Manuel Thalmann 012f5d5fdb Add dedicated functions for creating startup scripts 2024-08-09 23:23:29 +02:00
Manuel Thalmann f38f0e68ca Change login message 2024-08-09 22:11:12 +02:00
Manuel Thalmann ed0db7af27 Set up shared WSL 2024-08-09 16:02:33 +02:00
Manuel Thalmann f23f35da73 Install updates only as admin 2024-08-09 16:02:24 +02:00
Manuel Thalmann 51eb97e435 Disable boot message only as admin 2024-08-09 16:02:00 +02:00
Manuel Thalmann 07d3a2378d Add a function for allowing user access 2024-08-09 15:56:16 +02:00
Manuel Thalmann 4a7d5db510 Fix broken reboot registration 2024-08-09 15:49:36 +02:00
Manuel Thalmann 3db1c587dd Ensure the script path is detected properly 2024-08-09 14:45:50 +02:00
Manuel Thalmann a3dd1af30b Allow automatic script execution for MS accounts 2024-08-09 14:45:29 +02:00
Manuel Thalmann db31a862cf Reorder winget arguments 2024-08-09 14:45:05 +02:00
Manuel Thalmann 24c3bd1d11 Allow registering reboot for the default user 2024-08-09 14:44:57 +02:00
15 changed files with 144 additions and 56 deletions

View file

@ -10,7 +10,21 @@
type = types.submodule (
{ extendModules, ... }:
let
osVariant = extendModules { };
osVariant = extendModules {
modules = [
({ config, ... }: {
options = {
config = mkOption {
type = types.attrs;
description = "The configuration of the Operating System.";
default = builtins.removeAttrs config ["_module" "config" "linux" "windows"];
visible = false;
};
};
})
];
};
linuxVariant = osVariant.extendModules { };
windowsVariant = osVariant.extendModules { };
in {

View file

@ -1,9 +1,10 @@
{ lib, config, ... }:
let
inherit (lib)
mkOption
mkDefault
mkEnableOption
mkIf
mkOption
types
;
@ -39,8 +40,8 @@
config = {
valhalla.windows = {
setupUser.name = capitalize config.valhalla.setupUser.name;
dualboot.linuxPercentage = mkIf (!config.valhalla.windows.dualboot.enable) 0;
setupUser.name = mkDefault (capitalize config.valhalla.setupUser.name);
dualboot.linuxPercentage = mkIf (!config.valhalla.windows.dualboot.enable) (mkDefault 0);
};
};
}

View file

@ -1,8 +1,22 @@
{ ... }: {
valhalla.users.manuel = {
oh-my-posh = {
theme = {
source = ./manuel.omp.json;
imports = [
../../lib/modules/valhalla.nix
];
config = {
valhalla = {
users.manuel = {
oh-my-posh = {
theme = {
source = ./manuel.omp.json;
};
};
};
partition = {
os = {
partitions = { };
};
};
};
};

View file

@ -29,7 +29,7 @@
"properties": {
"display_host": false
},
"template": " {{ if .SSHSession }}\uf817 {{ end }}{{ .UserName }} "
"template": " {{ if .SSHSession }}\ueb39 {{ end }}{{ .UserName }} "
},
{
"type": "path",

View file

@ -14,6 +14,7 @@ enum SetupStage {
enum UserStage {
Create
Configure
Cleanup
Completed
}
@ -228,7 +229,7 @@ $null = New-Module {
function Get-SetupUser {
[OutputType([string])]
param()
Get-Config "$(Get-ConfigRootName).setupUser";
Get-Config "$(Get-ConfigRootName).setupUser.name";
}
<#

View file

@ -3,6 +3,7 @@
. "$PSScriptRoot/../../Windows/Scripts/PowerManagement.ps1";
. "$PSScriptRoot/../../Windows/Scripts/Registry.ps1";
. "$PSScriptRoot/../../Windows/Scripts/Security.ps1";
. "$PSScriptRoot/../../Windows/Scripts/WSL.ps1";
$null = New-Module {
. "$PSScriptRoot/../Types/OneShotTask.ps1";
@ -25,9 +26,12 @@ $null = New-Module {
function Start-Operation {
param(
[switch] $NonInteractive,
[switch] $NoImplicitCleanup,
[scriptblock] $Action
)
$cleanup = { };
if (-not $Global:InOperation) {
if ($env:DEBUG) {
Set-PSDebug -Trace 1;
@ -35,20 +39,30 @@ $null = New-Module {
$Global:InOperation = $true;
$Global:ErrorActionPreference = $NonInteractive.IsPresent ? 'Continue' : 'Inquire';
$env:WSLENV = "CONFIG_MODULE/p";
if ($env:CONFIG_MODULE) {
$env:CONFIG_MODULE = Resolve-Path $env:CONFIG_MODULE;
if ($IsWindows) {
$env:WSLENV = "CONFIG_MODULE/p";
if ($env:CONFIG_MODULE) {
$env:CONFIG_MODULE = Resolve-Path $env:CONFIG_MODULE;
}
if (Test-Admin) {
Disable-WindowsUpdateAutoRestart;
}
New-Alias -Force "sudo" gsudo;
}
if (Test-Admin) {
Disable-WindowsUpdateAutoRestart;
if (-not $NoImplicitCleanup.IsPresent) {
$cleanup = {
Clear-OperationResources;
};
}
New-Alias -Force "sudo" gsudo;
}
& $Action;
& $cleanup;
}
<#
@ -174,4 +188,12 @@ $null = New-Module {
Write-EventLog -LogName $logName -Source $logName -EventId $oneShotTrigger -Message "The OneShot task ``$(Get-OneShotTask)`` finished.";
}
}
<#
.SYNOPSIS
Clears resources allocated during the operation.
#>
function Clear-OperationResources {
wsl --unregister (Get-DistributionName);
}
};

View file

@ -34,7 +34,16 @@ Start-SoftwareInstaller @PSBoundParameters `
$root = "$($IsWindows ? $env:AppData : "~/.config")/oh-my-posh";
$path = Join-Path $root "$($theme.name).omp.json";
$null = New-Item -Force -ItemType Directory $root;
Set-Content $path (wsl cat $theme.source);
Set-Content $path (
& {
if ($IsWindows) {
wsl cat $theme.source
} else {
cat $theme.source
}
});
$theme = [string] $path;
}

View file

@ -3,6 +3,7 @@ using namespace System.Management.Automation.Host;
using namespace System.Security.Principal;
. "$PSScriptRoot/../../../scripts/Windows/Scripts/Prerequisites.ps1";
. "$PSScriptRoot/../../../scripts/Windows/Scripts/WSL.ps1";
. "$PSScriptRoot/../../Common/Scripts/Context.ps1";
. "$PSScriptRoot/../Scripts/Security.ps1";
. "$PSScriptRoot/../Software/Firefox/Install.ps1";
@ -27,7 +28,7 @@ $null = New-Module {
Finishes the installation of a running Windows machine.
#>
function Start-WindowsInstallation {
Start-Operation {
Start-Operation -NoImplicitCleanup {
Start-InstallationLoop;
};
}
@ -37,7 +38,9 @@ $null = New-Module {
Starts the installation loop.
#>
function Start-InstallationLoop {
$wslLocation = "$env:ProgramData\PortValhalla\Ubuntu";
$distribution = Get-DistributionName;
$wslLocation = Get-DistributionPath;
$wslDisk = Get-DistributionDisk;
while (-not (Get-IsFinished)) {
switch (Get-Stage) {
@ -131,7 +134,7 @@ $null = New-Module {
gsudo -d -s copy $cmd $osk;
continue;
}
}
};
}
if (-not (Test-Winget)) {
@ -161,6 +164,7 @@ $null = New-Module {
Copy-Item -Recurse (Get-AppxPackage "*Ubuntu*").InstallLocation $wslLocation;
Set-UserPermissions $wslLocation;
& "$wslLocation\ubuntu.exe" install --root;
wsl --shutdown;
continue;
}
@ -195,8 +199,8 @@ $null = New-Module {
}
default {
if (-not (& { $null = wsl -l; $? })) {
wsl --import-in-place "PortValhalla" "$wslLocation/ext4.vhdx";
wsl --set-default "PortValhalla";
wsl --import-in-place $distribution "$wslDisk";
wsl --set-default $distribution;
}
switch ($_) {
@ -318,7 +322,7 @@ $null = New-Module {
if (Test-Collection "essential") {
# Essentials
& "$softwarePath/aliae/Manage.ps1" @arguments;
& "$softwarePath/aliae/Main.ps1" @arguments;
& "$softwarePath/OpenSSH/Manage.ps1" @arguments;
& "$softwarePath/PowerShell/Manage.ps1" @arguments;
& "$softwarePath/chocolatey/Manage.ps1" @arguments;
@ -328,7 +332,7 @@ $null = New-Module {
& "$softwarePath/Oh My Posh/Manage.ps1" @arguments;
if (Get-Config "valhalla.windows.dualboot") {
& "$softwarePath/Ext4Fsd/Manage.ps1" @arguments;
& "$softwarePath/Ext4Fsd/Main.ps1" @arguments;
}
if ($install) {
@ -610,7 +614,18 @@ $null = New-Module {
Add-LocalGroupMember -Member "$name" -Name "$group";
}
Set-UserStage ([UserStage]::Cleanup);
}
([UserStage]::Cleanup) {
$user = Get-SetupUser;
Enable-LocalUser $user;
Set-AutologinUser $user;
wsl --shutdown;
$tempDisk = Rename-Item $wslDisk "ext4_.vhdx" -PassThru;
wsl --unregister $distribution;
Move-Item $tempDisk $wslDisk;
Set-UserStage ([UserStage]::Completed);
Restart-Intermediate;
}
}
}

View file

@ -224,7 +224,7 @@ function Start-Setup {
foreach ($xpath in @("./ua:AutoLogon/ua:Username",
"./ua:UserAccounts/ua:LocalAccounts/ua:LocalAccount/ua:Name",
"./ua:UserAccounts/ua:LocalAccounts/ua:LocalAccount/ua:DisplayName")) {
$oobeSettings.SelectSingleNode($xpath, $namespace).InnerText = $valhallaConfig.setupUser;
$oobeSettings.SelectSingleNode($xpath, $namespace).InnerText = $valhallaConfig.setupUser.name;
}
Add-StartupCommand `

View file

@ -23,7 +23,7 @@ $null = New-Module {
[RegistryKey] $UserKey
)
[string] $path;
[string] $path = $null;
if ($UserKey) {
$path = Join-Path ($UserKey.PSPath) $runOncePath;
@ -55,7 +55,7 @@ $null = New-Module {
($env:DEBUG ? "`$env:DEBUG = $([int]$env:DEBUG);" : "")
"`$env:INSTALLER_SCRIPT = $(ConvertTo-Injection (Resolve-Path $env:INSTALLER_SCRIPT));" +
"`$env:CONFIG_MODULE = $(ConvertTo-Injection (Resolve-Path $env:CONFIG_MODULE));" +
"& `$env:INSTALLER_SCRIPT;"
"& `$env:INSTALLER_SCRIPT;";
}
<#
@ -86,7 +86,11 @@ $null = New-Module {
Register-Setup -UserKey $Key;
}
} elseif ($User.IsPresent -or $UserKey) {
return;
}
if ($User.IsPresent -or $UserKey) {
if (-not $UserKey) {
$UserKey = Get-Item "HKCU:\";
}

View file

@ -22,11 +22,11 @@ function Update-WindowsInstallation {
catch { }
if ((Get-WURebootStatus -Silent)) {
Write-Information "A Reboot is Required!";
Write-Information "Windows will reboot now and the installation will be continued automatically.";
Write-Host "A Reboot is Required!";
Write-Host "Windows will reboot now and the installation will be continued automatically.";
return;
} else {
Write-Information "Updating Windows finished successfully!";
Write-Host "Updating Windows finished successfully!";
return;
}
}

View file

@ -105,7 +105,7 @@ $null = New-Module {
if ($msAccount) {
Add-MicrosoftAccount $Name;
Set-SetupOption $loggedInUserOption $env:UserName;
Invoke-OneShot ([OneShotTask]::InitializeMSAccount)
Invoke-OneShot ([OneShotTask]::InitializeMSAccount);
} else {
New-LocalUser -NoPassword @userArguments;
Initialize-UserCreation;
@ -121,8 +121,7 @@ $null = New-Module {
$msAccount = Get-UserConfig -UserName $name "microsoftAccount";
$displayName = Get-UserConfig -UserName $Name "displayName";
Write-Host "Initializing user $name";
Write-Host "MS Account: $msAccount"
Write-Host "Initializing user ``$name``";
$userArguments = @{
name = $name;
@ -137,8 +136,9 @@ $null = New-Module {
}
if ($msAccount) {
Write-Host "Renaming $(Get-MSAccountName) to $name"
Rename-LocalUser (Get-MSAccountName) $name;
$accountName = Get-MSAccountName;
Write-Host "Renaming ``$accountName`` to ``$name``"
Rename-LocalUser $accountName $name;
}
Set-LocalUser @userArguments;
@ -157,7 +157,6 @@ $null = New-Module {
if ($msAccount) {
Disable-Autologin;
Set-BootMessage -Caption "Please Log In" -Message "Please log in using your new Microsoft Account ``$name``.";
Write-Host "MS Account successfully initialized";
} else {
Set-AutologinUser "$name";
}

View file

@ -0,0 +1,25 @@
$null = New-Module {
<#
.SYNOPSIS
Gets the name of the WSL distribution used for managing the configuration.
#>
function Get-DistributionName {
return "ValhallaUbuntu";
}
<#
.SYNOPSIS
Gets the path to the directory containing the WSL distribution.
#>
function Get-DistributionPath {
return "$env:ProgramData/PortValhalla/$distribution";
}
<#
.SYNOPSIS
Gets the path to the virtual hard disk of the WSL distribution.
#>
function Get-DistributionDisk {
return "$(Get-DistributionPath)/ext4.vhdx";
}
};

View file

@ -8,23 +8,7 @@ param(
Start-SoftwareInstaller @PSBoundParameters `
-Installer {
$file = "osu!lazer.exe";
$processName = "osu!";
$dir = New-TemporaryDirectory;
Push-Location $dir;
Invoke-WebRequest "https://github.com/ppy/osu/releases/latest/download/install.exe" -OutFile $file;
Start-Process -FilePath $file;
while (-not (Get-Process -ErrorAction SilentlyContinue $processName)) {
Start-Sleep 1;
}
Start-Sleep 10;
Get-Process $processName | Stop-Process -Force;
Pop-Location;
Remove-Item -Recurse $dir;
Install-WingetPackage "ppy.osu";
Remove-DesktopIcon "*osu*";
};

View file

@ -202,7 +202,7 @@ begin
find "$projectPath/profiles" -type f -name "*.nix" | while read -l file
set -l CONFIG_MODULE "$file"
getConfig "valhalla.windows" --json > "$file.json"
getConfig "valhalla.windows.config" --json > "$file.json"
end
end