Compare commits
9 commits
4fe9b57b53
...
75bc8765d4
Author | SHA1 | Date | |
---|---|---|---|
Manuel Thalmann | 75bc8765d4 | ||
Manuel Thalmann | 578ec6dbd0 | ||
Manuel Thalmann | 4df4f3e249 | ||
Manuel Thalmann | 2ac049dd72 | ||
Manuel Thalmann | ab616491e6 | ||
Manuel Thalmann | 83d85c45c8 | ||
Manuel Thalmann | 034992b370 | ||
Manuel Thalmann | e8f75d608e | ||
Manuel Thalmann | f8c8d043d2 |
|
@ -91,23 +91,23 @@
|
|||
windows.users = mkOption {
|
||||
type = types.attrsOf winUserType;
|
||||
description = "The users to create on the Windows machine.";
|
||||
default = (lib.attrsets.concatMapAttrs (
|
||||
name: options:
|
||||
if builtins.elem name (builtins.attrNames linuxOptions)
|
||||
then {}
|
||||
else {
|
||||
${capitalize name} = (lib.attrsets.concatMapAttrs (
|
||||
name: value:
|
||||
if builtins.elem name (builtins.attrNames linuxOptions)
|
||||
then {}
|
||||
else {
|
||||
${name} = value;
|
||||
}
|
||||
) options) // {
|
||||
groups = [];
|
||||
};
|
||||
}) cfg.users);
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
valhalla.windows.users = (lib.attrsets.concatMapAttrs (
|
||||
name: options: {
|
||||
${capitalize name} = (lib.attrsets.concatMapAttrs (
|
||||
name: value:
|
||||
if builtins.elem name (builtins.attrNames linuxOptions)
|
||||
then {}
|
||||
else {
|
||||
${name} = value;
|
||||
}
|
||||
) options) // {
|
||||
groups = [];
|
||||
};
|
||||
}) cfg.users);
|
||||
};
|
||||
}
|
||||
|
|
|
@ -39,6 +39,10 @@ $null = New-Module {
|
|||
|
||||
$result = Receive-Job -Wait $job;
|
||||
|
||||
if ((Split-Path -Leaf $Path) -ne (Split-Path -Leaf $result)) {
|
||||
Write-Error "The result of the path conversion of ``$Path`` was unexpacted: ``$result``";
|
||||
}
|
||||
|
||||
if ($job.State -ne ([System.Management.Automation.JobState]::Completed)) {
|
||||
Write-Error "An error occurred while converting ``$Path`` to a Linux path.`nOutput: ``$result``";
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
. "$PSScriptRoot/../Types/OneShotTask.ps1";
|
||||
. "$PSScriptRoot/../../Windows/Scripts/PowerManagement.ps1";
|
||||
. "$PSScriptRoot/../../Windows/Scripts/Registry.ps1";
|
||||
. "$PSScriptRoot/../../Windows/Scripts/Security.ps1";
|
||||
|
||||
$null = New-Module {
|
||||
. "$PSScriptRoot/../Types/OneShotTask.ps1";
|
||||
|
@ -104,8 +105,10 @@ $null = New-Module {
|
|||
};
|
||||
|
||||
Write-EventLog -LogName $logName -Source $logName -EventId $oneShotTrigger -Message "Starting OneShot task ``$(Get-OneShotTask)``…";
|
||||
Remove-Event -EventIdentifier (Wait-Event -SourceIdentifier $identifier).EventIdentifier;
|
||||
$null = Wait-Event -SourceIdentifier $identifier;
|
||||
|
||||
for ($i = 0; $i -lt 2; $i++) {
|
||||
Remove-Event -EventIdentifier (Wait-Event -SourceIdentifier $identifier).EventIdentifier;
|
||||
}
|
||||
};
|
||||
|
||||
Set-Stage $currentStage;
|
||||
|
@ -133,6 +136,7 @@ $null = New-Module {
|
|||
}
|
||||
catch {
|
||||
Set-Content -Path $errorPath -Value $Error;
|
||||
Set-UserPermissions $errorPath;
|
||||
}
|
||||
finally {
|
||||
Set-Stage ([SetupStage]::Idle);
|
||||
|
|
|
@ -26,7 +26,7 @@ $null = New-Module {
|
|||
[string] $path;
|
||||
|
||||
if ($UserKey) {
|
||||
$path = "$($UserKey.PSPath)\$runOncePath";
|
||||
$path = Join-Path ($UserKey.PSPath) $runOncePath;
|
||||
} else {
|
||||
$path = $systemRunOncePath;
|
||||
}
|
||||
|
@ -153,21 +153,24 @@ $null = New-Module {
|
|||
#>
|
||||
function Restart-Intermediate {
|
||||
param(
|
||||
[switch] $DefaultUser
|
||||
[Parameter(ParameterSetName="Default", Mandatory)]
|
||||
[switch] $DefaultUser,
|
||||
[Parameter(ParameterSetName="Current", Mandatory)]
|
||||
[switch] $CurrentUser
|
||||
)
|
||||
|
||||
$register = { param($UserKey) Register-Setup @PSBoundParameters; };
|
||||
|
||||
if ($DefaultUser) {
|
||||
if ($DefaultUser.ToBool()) {
|
||||
Edit-DefaultUserKey {
|
||||
param(
|
||||
[RegistryKey] $Key
|
||||
)
|
||||
|
||||
& $register $Key;
|
||||
Register-Setup -UserKey $Key;
|
||||
}
|
||||
} elseif ($CurrentUser.ToBool()) {
|
||||
Register-Setup -User;
|
||||
} else {
|
||||
& $register;
|
||||
Register-Setup;
|
||||
}
|
||||
|
||||
Restart-Computer -Force;
|
||||
|
|
|
@ -55,7 +55,13 @@ $null = New-Module {
|
|||
[FileSystemAccessRule]::new(
|
||||
[SecurityIdentifier]::new([WellKnownSidType]::BuiltinUsersSid, $null),
|
||||
[FileSystemRights]::FullControl,
|
||||
[InheritanceFlags]::ObjectInherit -bor [InheritanceFlags]::ContainerInherit,
|
||||
(& {
|
||||
if (Test-Path -PathType Container $Path) {
|
||||
[InheritanceFlags]::ObjectInherit -bor [InheritanceFlags]::ContainerInherit
|
||||
} else {
|
||||
0
|
||||
}
|
||||
}),
|
||||
[PropagationFlags]::InheritOnly,
|
||||
[AccessControlType]::Allow));
|
||||
|
||||
|
|
Loading…
Reference in a new issue