Browse Source

Переделано под новые реалии сборки

master
paravis 2 years ago
parent
commit
c41f34cec1
  1. 353
      setup.au3

353
setup.au3

@ -1,232 +1,121 @@
#include <Array.au3> #include <GUIConstantsEx.au3>
#include <File.au3> #include <GuiConstants.au3>
#include <GUIConstantsEx.au3> #include <file.au3>
#include <WindowsConstants.au3> #NoTrayIcon
#include <WinAPI.au3> #RequireAdmin
#NoTrayIcon
#pragma compile(Stripper, True)
Global $aArray = DriveGetDrive($DT_ALL), $sDisk, $iBtn11, $iBtn10, $iBtn7, $PathEr, $sDisk, $sDiskS, $UN11, $UN10x64, $UN10x86, $UN7x64, $UN7x86 #pragma compile(ProductVersion, 3.0.0)
#pragma compile(ProductName, "Change bootLoader")
For $i = 1 To $aArray[0] #pragma compile(FileDescription, CBL)
$aFileList = _FileListToArrayRec($aArray[$i] & "\WindowsESD", "NOT.DEL", $FLTAR_FILES, $FLTAR_RECUR, $FLTAR_NOSORT, $FLTAR_FULLPATH) #pragma compile(LegalCopyright, paravis.ru@2023)
If Not @error Then #pragma compile(CompanyName, paravis.ru@2023)
$sDisk = $aArray[$i] & "\WindowsESD\"
$PathEr = 1 Opt("ExpandEnvStrings", 1)
ExitLoop
EndIf $sDisk = StringLeft(@ScriptDir, 2)
Next $boot = ($sDisk & "efi\Paravis\Boot")
$kitchen = ($sDisk & "efi\Paravis\Boot\kitchen")
For $i = 1 To $aArray[0] $bootice = ($sDisk & "efi\Paravis\Boot\kitchen\bootice.exe")
$aFileList = _FileListToArrayRec($aArray[$i] & "\efi\Paravis\Windows", "NOT.DEL", $FLTAR_FILES, $FLTAR_RECUR, $FLTAR_NOSORT, $FLTAR_FULLPATH) $main = GUICreate("Change BootLoader", 390, 125, 318, 213)
If Not @error Then GUICtrlCreateGroup("Legacy BIOS", 3, 3, 384, 61)
$sDisk = $aArray[$i] & "\efi\Paravis\Windows\" GUICtrlSetFont(-1, 8, 800, 0, "Tahoma")
$PathEr += 1 $xor = GUICtrlCreateButton("Install XorBoot", 8, 20, 121, 33)
ExitLoop GUICtrlSetFont(-1, 8, 800, 0, "Tahoma")
EndIf $bmgr = GUICtrlCreateButton("Install Bootmgr", 134, 20, 121, 33)
Next GUICtrlSetFont(-1, 8, 800, 0, "Tahoma")
$g4d = GUICtrlCreateButton("Install Grub4Dos", 261, 20, 121, 33)
If $PathEr > 1 Then GUICtrlSetFont(-1, 8, 800, 0, "Tahoma")
MsgBox(48, 'Предупреждение!', 'В системе больше одной папки с образами. Проверьте и удалите лишние (читаем ReadMe.txt). Система будет перезагружена.') GUICtrlCreateGroup("", -99, -99, 1, 1)
Exit GUICtrlCreateGroup("UEFI", 3, 62, 384, 61)
EndIf GUICtrlSetFont(-1, 8, 800, 0, "Tahoma")
$bmgru = GUICtrlCreateButton("Install Bootmgr (SecureBoot ON)", 8, 80, 180, 33)
For $i = 1 To $aArray[0] GUICtrlSetFont(-1, 8, 800, 0, "Tahoma")
$aFileList = _FileListToArrayRec($aArray[$i] & "\efi\Paravis\Boot\kitchen", "NOT.DEL", $FLTAR_FILES, $FLTAR_RECUR, $FLTAR_NOSORT, $FLTAR_FULLPATH) $xoru = GUICtrlCreateButton("Install Xorboot (SecureBoot OFF)", 200, 80, 180, 33)
If Not @error Then GUICtrlSetFont(-1, 8, 800, 0, "Tahoma")
$sDiskS = $aArray[$i] & "\efi\Paravis\Boot\" GUISetState(@SW_SHOW, $main)
ExitLoop
EndIf Func _hide()
Next GUICtrlSetState($xor, $gui_disable)
GUICtrlSetState($bmgr, $gui_disable)
$ESD11 = $sDisk & "install_11.esd" GUICtrlSetState($g4d, $gui_disable)
$ESD10x64 = $sDisk & "install_10_x64.esd" GUICtrlSetState($bmgru, $gui_disable)
$ESD10x86 = $sDisk & "install_10_x86.esd" GUICtrlSetState($xoru, $gui_disable)
$ESD7x64 = $sDisk & "install_7_x64.esd" EndFunc
$ESD7x86 = $sDisk & "install_7_x86.esd"
If FileExists ($sDisk & "autounattend\unattend11.xml") Then Func _show()
$UN11 = " /unattend:" & $sDisk & "autounattend\unattend11.xml" GUICtrlSetState($xor, $gui_enable)
Else GUICtrlSetState($bmgr, $gui_enable)
$UN11 = '' GUICtrlSetState($g4d, $gui_enable)
EndIf GUICtrlSetState($bmgru, $gui_enable)
If FileExists ($sDisk & "autounattend\unattend10x64.xml") Then GUICtrlSetState($xoru, $gui_enable)
$UN10x64 = " /unattend:" & $sDisk & "autounattend\unattend10x64.xml" EndFunc
Else
$UN10x64 = ''
EndIf While 1
If FileExists ($sDisk & "autounattend\unattend10x86.xml") Then Switch GUIGetMsg()
$UN10x86 = " /unattend:" & $sDisk & "autounattend\unattend10x86.xml" Case $gui_event_close
Else ExitLoop
$UN10x86 = '' Case $xor
EndIf _hide()
If FileExists ($sDisk & "autounattend\unattend7x64.xml") Then FileDelete($sDisk & "\bootmgr")
$UN7x64 = " /unattend:" & $sDisk & "autounattend\unattend7x64.xml" FileDelete($sDisk & "\grldr")
Else RunWait($bootice & " /DEVICE=" & $sDisk & " /mbr /restore /file=" & $boot & "\xor\xmbr.bin /keep_dpt /quiet")
$UN7x64 = '' RunWait($bootice & " /DEVICE=" & $sDisk & " /pbr /restore /file=" & $boot & "\xor\xpbr.bin /keep_bpb /quiet")
EndIf MsgBox(0 + 64 + 262144, "Xorboot", "bootloader successfully changed!")
If FileExists ($sDisk & "autounattend\unattend7x86.xml") Then _show()
$UN7x86 = " /unattend:" & $sDisk & "autounattend\unattend7x86.xml" Case $bmgr
Else _hide()
$UN7x86 = '' FileDelete(@ScriptDir & "Paravis")
EndIf FileDelete($sDisk & "\bootmgr")
$OEM11 = " /m:" & $sDisk & "$OEM11$" FileDelete($sDisk & "\grldr")
$OEM10x64 = " /m:" & $sDisk & "$OEM10x64$" FileCopy($boot & "\mgr\bootmgr", $sDisk & "bootmgr")
$OEM10x86 = " /m:" & $sDisk & "$OEM10x86$" RunWait($bootice & " /DEVICE=" & $sDisk & " /mbr /install /type=nt60 /quiet")
$OEM7x64 = " /m:" & $sDisk & "$OEM7x64$" RunWait($bootice & " /DEVICE=" & $sDisk & " /pbr /install /type=bootmgr /quiet")
$OEM7x86 = " /m:" & $sDisk & "$OEM7x86$" MsgBox(0 + 64 + 262144, "Bootmgr", "bootloader successfully changed!")
$setup = "X:\sources\setup.exe /installfrom:" _show()
Case $g4d
_hide()
If FileExists(@WindowsDir & "\SYSWOW64") Then FileDelete($sDisk & "\bootmgr")
RunWait($sDiskS & "src_x64.exe auto2") FileDelete($sDisk & "\grldr")
_x64() FileCopy($boot & "\g4d\grldr", $sDisk & "grldr")
Else RunWait($bootice & " /DEVICE=" & $sDisk & " /mbr /install /type=GRUB4DOS /quiet")
RunWait($sDiskS & "src_x86.exe auto2") RunWait($bootice & " /DEVICE=" & $sDisk & " /pbr /install /type=GRUB4DOS /quiet")
_x86() MsgBox(0 + 64 + 262144, "Grub4Dos", "Bootloader successfully changed!")
EndIf _show()
Case $bmgru
Func _x86() _hide()
$detect_efi = EnvGet("firmware_type") FileDelete($sDisk & "\efi\boot\bootx64.efi")
If $detect_efi = "Legacy" Then FileDelete($sDisk & "\efi\boot\bootia32.efi")
$hGUI = GUICreate("Windows Setup by Paravis", 410, 250, -1, -1, $WS_POPUP, $WS_EX_LAYERED) FileDelete($sDisk & "\efi\boot\bx86.pf")
GUISetBkColor(0xABCDEF) FileDelete($sDisk & "\efi\boot\hx86.pf")
GUICtrlSetState(-1, $GUI_DISABLE) FileDelete($sDisk & "\efi\boot\x86.pf")
GUISetState() FileDelete($sDisk & "\efi\boot\bx64.pf")
_WinAPI_SetLayeredWindowAttributes($hGUI, 0xABCDEF, 255) FileDelete($sDisk & "\efi\boot\hx64.pf")
$font = "Segoe UI" FileDelete($sDisk & "\efi\boot\x64.pf")
$iBtn10 = GUICtrlCreateButton("Установить Windows 10", 5, 5, 350, 40) FileCopy($kitchen & "\UEFIx64\mgrx64.efi", $sDisk & "\efi\boot\bootx64.efi")
GUICtrlSetFont(-1, 16, 500, 0, $font) FileCopy($kitchen & "\UEFIx86\mgrx86.efi", $sDisk & "\efi\boot\bootia32.efi")
$iBtn7 = GUICtrlCreateButton("Установить Windows 7", 5, 45, 350, 40) MsgBox(0 + 64 + 262144, "UEFI Bootmgr", "Bootloader successfully changed!")
GUICtrlSetFont(-1, 16, 500, 0, $font) _show()
$iBtnTC = GUICtrlCreateButton("Запустить Total Commander", 5, 105, 350, 40) Case $xoru
GUICtrlSetFont(-1, 16, 500, 0, $font) _hide()
$iBtnR = GUICtrlCreateButton("Перезагрузка", 5, 145, 350, 40) FileDelete($sDisk & "\efi\boot\bootx64.efi")
GUICtrlSetFont(-1, 16, 500, 0, $font) FileDelete($sDisk & "\efi\boot\bootia32.efi")
GUISetState() FileDelete($sDisk & "\efi\boot\bx86.pf")
FileDelete($sDisk & "\efi\boot\hx86.pf")
_checkesd86() FileDelete($sDisk & "\efi\boot\x86.pf")
FileDelete($sDisk & "\efi\boot\bx64.pf")
While 1 FileDelete($sDisk & "\efi\boot\hx64.pf")
Switch GUIGetMsg() FileDelete($sDisk & "\efi\boot\x64.pf")
Case $GUI_EVENT_CLOSE FileCopy($kitchen & "\UEFIx64\bootx64.efi", $sDisk & "\efi\boot\bootx64.efi")
;~ exit FileCopy($kitchen & "\UEFIx86\bootia32.efi", $sDisk & "\efi\boot\bootia32.efi")
Case $iBtn10 FileCopy($kitchen & "\UEFIx86\bx86.pf", $sDisk & "\efi\boot\bx86.pf")
GUISetState(@SW_HIDE) FileCopy($kitchen & "\UEFIx86\hx86.pf", $sDisk & "\efi\boot\hx86.pf")
RunWait($setup & $ESD10x86 & $OEM10x86 & $UN10x86) FileCopy($kitchen & "\UEFIx86\x86.pf", $sDisk & "\efi\boot\x86.pf")
GUISetState(@SW_SHOW) FileCopy($kitchen & "\UEFIx64\bx64.pf", $sDisk & "\efi\boot\bx64.pf")
Case $iBtn7 FileCopy($kitchen & "\UEFIx64\hx64.pf", $sDisk & "\efi\boot\hx64.pf")
GUISetState(@SW_HIDE) FileCopy($kitchen & "\UEFIx64\x64.pf", $sDisk & "\efi\boot\x64.pf")
RunWait($setup & $ESD7x86 & $OEM7x86 & $UN7x86) MsgBox(0 + 64 + 262144, "UEFI Xorboot", "Bootloader successfully changed!")
GUISetState(@SW_SHOW) _show()
Case $iBtnTC EndSwitch
GUISetState(@SW_HIDE) WEnd
RunWait($sDiskS & 'kitchen\TotalCommander\TOTALCMD.EXE /I="%%COMMANDER_PATH%%\tcmdmain.ini"')
GUISetState(@SW_SHOW)
Case $iBtnR
Exit
EndSwitch
WEnd
Else
If Not FileExists($sDisk & "install_10_x86.esd") Then
MsgBox(48, 'Предупреждение!', 'Не найден образ Windows 10 x86. Система будет перезагружена.')
Exit
EndIf
$hGUI = GUICreate("Windows Setup by Paravis", 360, 190, -1, -1, $WS_POPUP, $WS_EX_LAYERED)
GUISetBkColor(0xABCDEF)
GUICtrlSetState(-1, $GUI_DISABLE)
GUISetState()
_WinAPI_SetLayeredWindowAttributes($hGUI, 0xABCDEF, 255)
$font = "Segoe UI"
$iBtn10 = GUICtrlCreateButton("Установить Windows 10", 5, 5, 350, 40)
GUICtrlSetFont(-1, 16, 500, 0, $font)
$iBtnTC = GUICtrlCreateButton("Запустить Total Commander", 5, 65, 350, 40)
GUICtrlSetFont(-1, 16, 500, 0, $font)
$iBtnR = GUICtrlCreateButton("Перезагрузка", 5, 105, 350, 40)
GUICtrlSetFont(-1, 16, 500, 0, $font)
GUISetState()
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
;~ exit
Case $iBtn10
GUISetState(@SW_HIDE)
RunWait($setup & $ESD10x86 & $OEM10x86 & $UN10x86)
GUISetState(@SW_SHOW)
Case $iBtnTC
GUISetState(@SW_HIDE)
RunWait($sDiskS & 'kitchen\TotalCommander\TOTALCMD.EXE /I="%%COMMANDER_PATH%%\tcmdmain.ini"')
GUISetState(@SW_SHOW)
Case $iBtnR
Exit
EndSwitch
WEnd
EndIf
EndFunc
Func _x64()
$hGUI = GUICreate("Windows Setup by Paravis", 410, 250, -1, -1, $WS_POPUP, $WS_EX_LAYERED)
GUISetBkColor(0xABCDEF)
GUICtrlSetState(-1, $GUI_DISABLE)
GUISetState()
_WinAPI_SetLayeredWindowAttributes($hGUI, 0xABCDEF, 255)
$font = "Segoe UI"
$iBtn11 = GUICtrlCreateButton("Установить Windows 11", 5, 5, 350, 40)
GUICtrlSetFont(-1, 16, 500, 0, $font)
$iBtn10 = GUICtrlCreateButton("Установить Windows 10", 5, 45, 350, 40)
GUICtrlSetFont(-1, 16, 500, 0, $font)
$iBtn7 = GUICtrlCreateButton("Установить Windows 7", 5, 85, 350, 40)
GUICtrlSetFont(-1, 16, 500, 0, $font)
$iBtnTC = GUICtrlCreateButton("Запустить Total Commander", 5, 145, 350, 40)
GUICtrlSetFont(-1, 16, 500, 0, $font)
$iBtnR = GUICtrlCreateButton("Перезагрузка", 5, 185, 350, 40)
GUICtrlSetFont(-1, 16, 500, 0, $font)
GUISetState()
_checkesd64()
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
;~ exit
Case $iBtn11
GUISetState(@SW_HIDE)
RunWait($setup & $ESD11 & $OEM11 & $UN11)
GUISetState(@SW_SHOW)
Case $iBtn10
GUISetState(@SW_HIDE)
RunWait($setup & $ESD10x64 & $OEM10x64 & $UN10x64)
GUISetState(@SW_SHOW)
Case $iBtn7
GUISetState(@SW_HIDE)
RunWait($setup & $ESD7x64 & $OEM7x64 & $UN7x64)
GUISetState(@SW_SHOW)
Case $iBtnTC
GUISetState(@SW_HIDE)
RunWait($sDiskS & 'kitchen\TotalCommander\TOTALCMD64.EXE /I="%%COMMANDER_PATH%%\tcmdmain.ini"')
GUISetState(@SW_SHOW)
Case $iBtnR
Exit
EndSwitch
WEnd
EndFunc
Func _checkesd64()
If Not FileExists($sDisk & "install_11.esd") Then
GUICtrlSetState($iBtn11, $GUI_DISABLE)
EndIf
If Not FileExists($sDisk & "install_10_x64.esd") Then
GUICtrlSetState($iBtn10, $GUI_DISABLE)
EndIf
If Not FileExists($sDisk & "install_7_x64.esd") Then
GUICtrlSetState($iBtn7, $GUI_DISABLE)
EndIf
EndFunc
Func _checkesd86()
If Not FileExists($sDisk & "install_10_x86.esd") Then
GUICtrlSetState($iBtn10, $GUI_DISABLE)
EndIf
If Not FileExists($sDisk & "install_7_x86.esd") Then
GUICtrlSetState($iBtn7, $GUI_DISABLE)
EndIf
EndFunc
Loading…
Cancel
Save