Przeglądaj źródła

update winimager and wintermsfx build

Tobias Simetsreiter 2 lat temu
rodzic
commit
e7eee3f0b2
4 zmienionych plików z 85 dodań i 52 usunięć
  1. 14 50
      build.ps1
  2. 21 0
      mk/winimager.ps1
  3. 44 0
      mk/wintermsfx.ps1
  4. 6 2
      wintermsfx/main.ps1

+ 14 - 50
build.ps1

@@ -1,56 +1,20 @@
+#requires -Version 3
+
 param(
-    $sevenzip = "C:\Program Files\7-Zip\7z.exe"
+    $Command
 )
-cd $PSSCriptRoot
-
-$dist = "dist"
-$src = "WinImager"
-$sfx = "sfx"
-
-$szfile = "$dist/WinImager.7z"
-$exefile = "$dist/WinImager.exe"
-
-New-Item -itemtype directory -Path $dist -Force
-Remove-Item -Force $szfile
-
-&$sevenzip a $szfile $src "-xr0!*.log"
-
-Get-Content -Encoding Byte -Read 512 -Path "$sfx/7zsd_All_x64.sfx","$sfx/sfx_config.txt",$szfile |
-    Set-Content -Encoding Byte $exefile
-
-
-$PSVERSION="7.2.5"
-$PSFILE="PowerShell-$PSVERSION-win-x64.zip"
-$PSURL="https://github.com/PowerShell/PowerShell/releases/download/v$PSVERSION/$PSFILE" 
 
-$PSTOOLSFILE="PSTools.zip"
-$PSTOOLSURL="https://download.sysinternals.com/files/$PSTOOLSFILE"
-$wintermsfx_build="wintermsfx\build"
-New-Item -itemtype directory -Path $wintermsfx_build -Force
-
-if ($null -eq (Get-Item "$wintermsfx_build\windowsterminal")){
-    .\wintermsfx\wintermportable.ps1
-}
-Copy-Item -Force .\wintermsfx\main.ps1 "$wintermsfx_build\main.ps1"
-
-cd $wintermsfx_build
-Remove-Item -Force windowsterminal.7z
-
-
-if ($null -eq (Get-Item $PSFILE)){
-    Invoke-WebRequest -Uri $PSURL -OutFile $PSFILE
+if (!$Command) {
+    foreach($_ in Get-ChildItem $PSScriptRoot\mk -Name) {
+        [System.IO.Path]::GetFileNameWithoutExtension($_)
+    }
+    return
 }
-if ($null -eq (Get-Item $PSTOOLSFILE)){
-    Invoke-WebRequest -Uri $PSTOOLSURL -OutFile $PSTOOLSFILE
+if ($Command -eq "all"){
+    foreach($_ in Get-ChildItem $PSScriptRoot\mk -File) {
+        & $_.FullName
+    }
+    return
 }
 
-Remove-Item -Recurse -Force windowsterminal\powershell\
-Expand-Archive $PSFILE -DestinationPath windowsterminal\powershell\
-Expand-Archive $PSTOOLSFILE -DestinationPath windowsterminal\powershell\
-
-&$sevenzip a windowsterminal.7z main.ps1 windowsterminal
-
-cd $PSSCriptRoot
-
-Get-Content -Encoding Byte -Read 512 $sfx/7zsd_All_x64.sfx,$sfx/sfx_main.txt,wintermsfx\build\windowsterminal.7z |
-    Set-Content -Encoding Byte "$dist\wintermsfx.exe"
+& "$PSScriptRoot\mk\$Command.ps1" @args

+ 21 - 0
mk/winimager.ps1

@@ -0,0 +1,21 @@
+
+param(
+    $sevenzip = "C:\Program Files\7-Zip\7z.exe"
+)
+
+Set-Location $PSSCriptRoot\..
+
+$dist = "dist"
+$src = "WinImager"
+$sfx = "sfx"
+
+$szfile = "$dist/WinImager.7z"
+$exefile = "$dist/WinImager.exe"
+
+New-Item -itemtype directory -Path $dist -Force
+Remove-Item -Force $szfile
+
+&$sevenzip a $szfile $src "-xr0!*.log"
+
+Get-Content -AsByteStream -Read 512 -Path "$sfx/7zsd_All_x64.sfx","$sfx/sfx_config.txt",$szfile |
+    Set-Content -AsByteStream  $exefile

+ 44 - 0
mk/wintermsfx.ps1

@@ -0,0 +1,44 @@
+param(
+    $sevenzip = "C:\Program Files\7-Zip\7z.exe"
+)
+
+Set-Location "$PSSCriptRoot\.."
+
+$dist = "dist"
+$sfx = "sfx"
+
+$PSVERSION="7.2.5"
+$PSFILE="PowerShell-$PSVERSION-win-x64.zip"
+$PSURL="https://github.com/PowerShell/PowerShell/releases/download/v$PSVERSION/$PSFILE" 
+
+$PSTOOLSFILE="PSTools.zip"
+$PSTOOLSURL="https://download.sysinternals.com/files/$PSTOOLSFILE"
+$wintermsfx_build="wintermsfx\build"
+New-Item -itemtype directory -Path $wintermsfx_build -Force
+
+if ($null -eq (Get-Item "$wintermsfx_build\windowsterminal")){
+    .\wintermsfx\wintermportable.ps1
+}
+Copy-Item -Force .\wintermsfx\main.ps1 "$wintermsfx_build\main.ps1"
+
+cd $wintermsfx_build
+Remove-Item -Force windowsterminal.7z
+
+
+if ($null -eq (Get-Item $PSFILE)){
+    Invoke-WebRequest -Uri $PSURL -OutFile $PSFILE
+}
+if ($null -eq (Get-Item $PSTOOLSFILE)){
+    Invoke-WebRequest -Uri $PSTOOLSURL -OutFile $PSTOOLSFILE
+}
+
+Remove-Item -Recurse -Force windowsterminal\powershell\
+Expand-Archive $PSFILE -DestinationPath windowsterminal\powershell\
+Expand-Archive $PSTOOLSFILE -DestinationPath windowsterminal\powershell\
+
+&$sevenzip a windowsterminal.7z main.ps1 windowsterminal
+
+cd $PSSCriptRoot
+
+Get-Content -AsByteStream -Read 512 $sfx/7zsd_All_x64.sfx,$sfx/sfx_main.txt,wintermsfx\build\windowsterminal.7z |
+    Set-Content -AsByteStream "$dist\wintermsfx.exe"

+ 6 - 2
wintermsfx/main.ps1

@@ -1,4 +1,8 @@
 
 cd $PSScriptRoot
-.\windowsterminal\wt.exe .\windowsterminal\powershell\pwsh.exe 
-sleep 2
+
+$app = Start-Process -passthru (.\windowsterminal\wt.exe .\windowsterminal\powershell\pwsh.exe -ExecutionPolicy RemoteSigned)
+
+Wait-Process $app.Id
+
+pause