Copy pwsh to newly setup windows systems

This commit is contained in:
Manuel Thalmann 2024-07-31 14:47:42 +02:00
parent ef773d993c
commit 1012705160
3 changed files with 20 additions and 11 deletions

View file

@ -26,5 +26,4 @@ function Restore-Apps {
Write-Host "Starting Restoration of Windows";
[Context]$context = [Context]::new();
Invoke-WindowsInstallation $context;
Restart-Computer -Force;
Start-WindowsInstallation;

View file

@ -59,8 +59,12 @@ function Start-Setup {
)')))"
}
function Get-PathInjection($path) {
"(Join-Path `$env:SystemDrive $(Get-Injection $path))"
}
function Get-ScriptPathInjection($path) {
"(Join-Path `$env:SystemDrive $(Get-Injection (Get-RemoteScriptPath $path)))"
Get-PathInjection (Get-RemoteScriptPath $path)
}
function Get-DiskConfig {
@ -209,9 +213,10 @@ function Start-Setup {
$newCommand.SelectSingleNode("./ua:CommandLine", $namespace).InnerText = `
"powershell -Command " + `
"`$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);" + `
"Invoke-Expression $(Get-ScriptPathInjection "$PSScriptRoot/InitialBoot.ps1");";
"& (Join-Path `$env:PWSH_PATH pwsh) `$env:INSTALLER_SCRIPT;";
$orderElement = $newCommand.SelectSingleNode("./ua:Order", $namespace);
$orderElement.InnerText = ([int]($orderElement.InnerText) + 1);

View file

@ -15,7 +15,9 @@ begin
set -l setupLabel "winiso-valhalla"
set -l projectPath "PortValhalla"
set -l localProjectPath "sources/\$OEM\$/\$1/$projectPath"
set -l systemDrivePath "sources/\$OEM\$/\$1"
set -l pwshPath "pwsh"
set -l localProjectPath "$systemDrivePath/$projectPath"
set -l cacheDir ~/.cache/winiso-valhalla
set -l winpe "$cacheDir/winpe.iso"
set -l winPath "/media/win"
@ -76,6 +78,7 @@ begin
"$file" \
"$dir" \
"$name" \
"$target" \
"$winPath"
mkdir -p (dirname "$file")
@ -102,10 +105,10 @@ begin
end
end
set -l intel $files[1..4]
set -l marvell $files[5..8]
set -l git $files[9..12]
set -l pwsh $files[13..16]
set -l intel $files[1..5]
set -l marvell $files[6..10]
set -l git $files[11..15]
set -l pwsh $files[16..20]
cp -r "$dir/winpefs"/* "$winpeOverlay"
@ -117,7 +120,7 @@ begin
set -l path
for sw in git pwsh
set -a path $$sw[1][4]
set -a path $$sw[1][5]
end
printf %s\n \
@ -125,9 +128,10 @@ begin
string join ";" \
"set PATH=%PATH%" \
$path \
"$git[4]\\bin"
"$git[5]\\bin"
) \
"set SETUP_LABEL=$setupLabel" \
"set PWSH_PATH=$(echo "$pwshPath" | mkWinPath)" \
"set LOCAL_PROJECT_PATH=$(echo "$localProjectPath" | mkWinPath)" \
"set REMOTE_PROJECT_PATH=$(echo "$projectPath" | mkWinPath)" \
"echo Loading Drivers..." \
@ -175,6 +179,7 @@ begin
chmod u+w "$rootDir"
mkdir -p "$projectPath"
cp -r "$pwsh[4]" "$winOverlay/$systemDrivePath/$pwshPath"
source "$dir/../scripts/copy-repo.fish" "$projectPath"
rm -rf "$projectPath/archiso"