Use two-space indentation everywhere
This commit is contained in:
parent
6c66473209
commit
24a2e60f02
9 changed files with 1277 additions and 1277 deletions
|
|
@ -14,12 +14,12 @@ call :SetTitle Tools Copier
|
||||||
rem Set variables using settings\main.py file
|
rem Set variables using settings\main.py file
|
||||||
set "SETTINGS=%bin%\Scripts\settings\main.py"
|
set "SETTINGS=%bin%\Scripts\settings\main.py"
|
||||||
for %%v in (ARCHIVE_PASSWORD KIT_NAME_FULL) do (
|
for %%v in (ARCHIVE_PASSWORD KIT_NAME_FULL) do (
|
||||||
set "var=%%v"
|
set "var=%%v"
|
||||||
for /f "tokens=* usebackq" %%f in (`findstr "!var!=" "%SETTINGS%"`) do (
|
for /f "tokens=* usebackq" %%f in (`findstr "!var!=" "%SETTINGS%"`) do (
|
||||||
set "_v=%%f"
|
set "_v=%%f"
|
||||||
set "_v=!_v:*'=!"
|
set "_v=!_v:*'=!"
|
||||||
set "%%v=!_v:~0,-1!"
|
set "%%v=!_v:~0,-1!"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
rem Set ARCH to 32 as a gross assumption and check for x86_64 status
|
rem Set ARCH to 32 as a gross assumption and check for x86_64 status
|
||||||
set ARCH=32
|
set ARCH=32
|
||||||
|
|
@ -28,9 +28,9 @@ set "SEVEN_ZIP=%bin%\7-Zip\7za.exe"
|
||||||
set "CON=%bin%\ConEmu\ConEmu.exe"
|
set "CON=%bin%\ConEmu\ConEmu.exe"
|
||||||
set "FASTCOPY=%bin%\FastCopy\FastCopy.exe"
|
set "FASTCOPY=%bin%\FastCopy\FastCopy.exe"
|
||||||
if %ARCH% equ 64 (
|
if %ARCH% equ 64 (
|
||||||
set "SEVEN_ZIP=%bin%\7-Zip\7za64.exe"
|
set "SEVEN_ZIP=%bin%\7-Zip\7za64.exe"
|
||||||
set "CON=%bin%\ConEmu\ConEmu64.exe"
|
set "CON=%bin%\ConEmu\ConEmu64.exe"
|
||||||
set "FASTCOPY=%bin%\FastCopy\FastCopy64.exe"
|
set "FASTCOPY=%bin%\FastCopy\FastCopy64.exe"
|
||||||
)
|
)
|
||||||
set "fastcopy_args=/cmd=diff /no_ui /auto_close"
|
set "fastcopy_args=/cmd=diff /no_ui /auto_close"
|
||||||
rem Set %client_dir%
|
rem Set %client_dir%
|
||||||
|
|
@ -42,14 +42,14 @@ set "dest=%client_dir%\Tools"
|
||||||
|
|
||||||
:RelaunchInConEmu
|
:RelaunchInConEmu
|
||||||
if not defined IN_CONEMU (
|
if not defined IN_CONEMU (
|
||||||
if not defined L_NCMD (
|
if not defined L_NCMD (
|
||||||
set "con_args=-new_console:n"
|
set "con_args=-new_console:n"
|
||||||
rem If in DEBUG state then force ConEmu to stay open
|
rem If in DEBUG state then force ConEmu to stay open
|
||||||
if defined DEBUG (set "con_args=!con_args! -new_console:c")
|
if defined DEBUG (set "con_args=!con_args! -new_console:c")
|
||||||
set IN_CONEMU=True
|
set IN_CONEMU=True
|
||||||
start "" "%CON%" -run ""%~0" %*" !con_args! || goto ErrorUnknown
|
start "" "%CON%" -run ""%~0" %*" !con_args! || goto ErrorUnknown
|
||||||
exit /b 0
|
exit /b 0
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
:CopyBin
|
:CopyBin
|
||||||
echo Copying .bin...
|
echo Copying .bin...
|
||||||
|
|
@ -102,7 +102,7 @@ goto Exit
|
||||||
rem Loops through all arguments to check for accepted flags
|
rem Loops through all arguments to check for accepted flags
|
||||||
set DEBUG=
|
set DEBUG=
|
||||||
for %%f in (%*) do (
|
for %%f in (%*) do (
|
||||||
if /i "%%f" == "/DEBUG" (@echo on & set "DEBUG=/DEBUG")
|
if /i "%%f" == "/DEBUG" (@echo on & set "DEBUG=/DEBUG")
|
||||||
)
|
)
|
||||||
@exit /b 0
|
@exit /b 0
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,12 +21,12 @@ call :DeQuote L_TYPE
|
||||||
rem Set variables using settings\main.py file
|
rem Set variables using settings\main.py file
|
||||||
set "SETTINGS=%bin%\Scripts\settings\main.py"
|
set "SETTINGS=%bin%\Scripts\settings\main.py"
|
||||||
for %%v in (ARCHIVE_PASSWORD KIT_NAME_FULL OFFICE_SERVER_IP QUICKBOOKS_SERVER_IP) do (
|
for %%v in (ARCHIVE_PASSWORD KIT_NAME_FULL OFFICE_SERVER_IP QUICKBOOKS_SERVER_IP) do (
|
||||||
set "var=%%v"
|
set "var=%%v"
|
||||||
for /f "tokens=* usebackq" %%f in (`findstr "!var!=" "%SETTINGS%"`) do (
|
for /f "tokens=* usebackq" %%f in (`findstr "!var!=" "%SETTINGS%"`) do (
|
||||||
set "_v=%%f"
|
set "_v=%%f"
|
||||||
set "_v=!_v:*'=!"
|
set "_v=!_v:*'=!"
|
||||||
set "%%v=!_v:~0,-1!"
|
set "%%v=!_v:~0,-1!"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
rem Set ARCH to 32 as a gross assumption and check for x86_64 status
|
rem Set ARCH to 32 as a gross assumption and check for x86_64 status
|
||||||
set ARCH=32
|
set ARCH=32
|
||||||
|
|
@ -37,21 +37,21 @@ set "FASTCOPY=%bin%\FastCopy\FastCopy.exe"
|
||||||
set "POWERSHELL=%systemroot%\system32\WindowsPowerShell\v1.0\powershell.exe"
|
set "POWERSHELL=%systemroot%\system32\WindowsPowerShell\v1.0\powershell.exe"
|
||||||
set "PYTHON=%bin%\Python\x32\python.exe"
|
set "PYTHON=%bin%\Python\x32\python.exe"
|
||||||
if %ARCH% equ 64 (
|
if %ARCH% equ 64 (
|
||||||
set "SEVEN_ZIP=%bin%\7-Zip\7za64.exe"
|
set "SEVEN_ZIP=%bin%\7-Zip\7za64.exe"
|
||||||
set "CON=%bin%\ConEmu\ConEmu64.exe"
|
set "CON=%bin%\ConEmu\ConEmu64.exe"
|
||||||
set "FASTCOPY=%bin%\FastCopy\FastCopy64.exe"
|
set "FASTCOPY=%bin%\FastCopy\FastCopy64.exe"
|
||||||
set "PYTHON=%bin%\Python\x64\python.exe"
|
set "PYTHON=%bin%\Python\x64\python.exe"
|
||||||
)
|
)
|
||||||
|
|
||||||
:UpdateTitle
|
:UpdateTitle
|
||||||
rem Sets title using KIT_NAME_FULL from settings\main.py (unless %window_title% already set)
|
rem Sets title using KIT_NAME_FULL from settings\main.py (unless %window_title% already set)
|
||||||
if defined window_title (
|
if defined window_title (
|
||||||
title %window_title%
|
title %window_title%
|
||||||
) else (
|
) else (
|
||||||
set "window_title=%*"
|
set "window_title=%*"
|
||||||
if not defined window_title set "window_title=Launcher"
|
if not defined window_title set "window_title=Launcher"
|
||||||
set "window_title=%KIT_NAME_FULL%: %window_title%"
|
set "window_title=%KIT_NAME_FULL%: %window_title%"
|
||||||
title %window_title%
|
title %window_title%
|
||||||
)
|
)
|
||||||
|
|
||||||
:CheckUsage
|
:CheckUsage
|
||||||
|
|
@ -66,28 +66,28 @@ if /i not "%L__CLI%" == "True" (set "L__CLI=")
|
||||||
|
|
||||||
:RelaunchInConEmu
|
:RelaunchInConEmu
|
||||||
set RELOAD_IN_CONEMU=True
|
set RELOAD_IN_CONEMU=True
|
||||||
if defined ConEmuBuild set "RELOAD_IN_CONEMU="
|
if defined ConEmuBuild set "RELOAD_IN_CONEMU="
|
||||||
if defined L_NCMD set "RELOAD_IN_CONEMU="
|
if defined L_NCMD set "RELOAD_IN_CONEMU="
|
||||||
if "%L_TYPE%" == "Executable" set "RELOAD_IN_CONEMU="
|
if "%L_TYPE%" == "Executable" set "RELOAD_IN_CONEMU="
|
||||||
if "%L_TYPE%" == "PSScript" set "RELOAD_IN_CONEMU="
|
if "%L_TYPE%" == "PSScript" set "RELOAD_IN_CONEMU="
|
||||||
if "%L_TYPE%" == "PyScript" set "RELOAD_IN_CONEMU="
|
if "%L_TYPE%" == "PyScript" set "RELOAD_IN_CONEMU="
|
||||||
|
|
||||||
if defined RELOAD_IN_CONEMU (
|
if defined RELOAD_IN_CONEMU (
|
||||||
set "con_args=-new_console:n"
|
set "con_args=-new_console:n"
|
||||||
rem If in DEBUG state then force ConEmu to stay open
|
rem If in DEBUG state then force ConEmu to stay open
|
||||||
if defined DEBUG (set "con_args=!con_args! -new_console:c")
|
if defined DEBUG (set "con_args=!con_args! -new_console:c")
|
||||||
start "" "%CON%" -run ""%~0" %*" !con_args! || goto ErrorUnknown
|
start "" "%CON%" -run ""%~0" %*" !con_args! || goto ErrorUnknown
|
||||||
exit /b 0
|
exit /b 0
|
||||||
)
|
)
|
||||||
|
|
||||||
:CheckLaunchType
|
:CheckLaunchType
|
||||||
rem Jump to the selected launch type or show usage
|
rem Jump to the selected launch type or show usage
|
||||||
if /i "%L_TYPE%" == "Executable" (goto LaunchExecutable)
|
if /i "%L_TYPE%" == "Executable" (goto LaunchExecutable)
|
||||||
if /i "%L_TYPE%" == "Folder" (goto LaunchFolder)
|
if /i "%L_TYPE%" == "Folder" (goto LaunchFolder)
|
||||||
if /i "%L_TYPE%" == "Office" (goto LaunchOffice)
|
if /i "%L_TYPE%" == "Office" (goto LaunchOffice)
|
||||||
if /i "%L_TYPE%" == "PSScript" (goto LaunchPSScript)
|
if /i "%L_TYPE%" == "PSScript" (goto LaunchPSScript)
|
||||||
if /i "%L_TYPE%" == "PyScript" (goto LaunchPyScript)
|
if /i "%L_TYPE%" == "PyScript" (goto LaunchPyScript)
|
||||||
if /i "%L_TYPE%" == "QuickBooks" (goto LaunchQuickBooksSetup)
|
if /i "%L_TYPE%" == "QuickBooks" (goto LaunchQuickBooksSetup)
|
||||||
goto Usage
|
goto Usage
|
||||||
|
|
||||||
:LaunchExecutable
|
:LaunchExecutable
|
||||||
|
|
@ -97,7 +97,7 @@ call :ExtractOrFindPath || goto ErrorProgramNotFound
|
||||||
rem Check for 64-bit prog (if running on 64-bit system)
|
rem Check for 64-bit prog (if running on 64-bit system)
|
||||||
set "prog=%_path%\%L_ITEM%"
|
set "prog=%_path%\%L_ITEM%"
|
||||||
if %ARCH% equ 64 (
|
if %ARCH% equ 64 (
|
||||||
if exist "%_path%\%L_ITEM:.=64.%" set "prog=%_path%\%L_ITEM:.=64.%"
|
if exist "%_path%\%L_ITEM:.=64.%" set "prog=%_path%\%L_ITEM:.=64.%"
|
||||||
)
|
)
|
||||||
if not exist "%prog%" goto ErrorProgramNotFound
|
if not exist "%prog%" goto ErrorProgramNotFound
|
||||||
|
|
||||||
|
|
@ -105,9 +105,9 @@ rem Run
|
||||||
popd && pushd "%_path%"
|
popd && pushd "%_path%"
|
||||||
if defined L__CLI goto LaunchExecutableCLI
|
if defined L__CLI goto LaunchExecutableCLI
|
||||||
if defined L_ELEV (
|
if defined L_ELEV (
|
||||||
goto LaunchExecutableElev
|
goto LaunchExecutableElev
|
||||||
) else (
|
) else (
|
||||||
goto LaunchExecutableUser
|
goto LaunchExecutableUser
|
||||||
)
|
)
|
||||||
|
|
||||||
:LaunchExecutableCLI
|
:LaunchExecutableCLI
|
||||||
|
|
@ -153,9 +153,9 @@ set "_odt=False"
|
||||||
if %L_PATH% equ 2016 (set "_odt=True")
|
if %L_PATH% equ 2016 (set "_odt=True")
|
||||||
if %L_PATH% equ 2019 (set "_odt=True")
|
if %L_PATH% equ 2019 (set "_odt=True")
|
||||||
if "%_odt%" == "True" (
|
if "%_odt%" == "True" (
|
||||||
goto LaunchOfficeODT
|
goto LaunchOfficeODT
|
||||||
) else (
|
) else (
|
||||||
goto LaunchOfficeSetup
|
goto LaunchOfficeSetup
|
||||||
)
|
)
|
||||||
|
|
||||||
:LaunchOfficeODT
|
:LaunchOfficeODT
|
||||||
|
|
@ -202,14 +202,14 @@ start "" /wait "%FASTCOPY%" %fastcopy_args% "%source%" /to="%dest%\"
|
||||||
|
|
||||||
rem Run
|
rem Run
|
||||||
if exist "%dest%\%product_name%\setup.exe" (
|
if exist "%dest%\%product_name%\setup.exe" (
|
||||||
start "" "%dest%\%product_name%\setup.exe" || goto ErrorUnknown
|
start "" "%dest%\%product_name%\setup.exe" || goto ErrorUnknown
|
||||||
) else if "%product_name:~-3,3%" == "exe" (
|
) else if "%product_name:~-3,3%" == "exe" (
|
||||||
start "" "%dest%\%product_name%" || goto ErrorUnknown
|
start "" "%dest%\%product_name%" || goto ErrorUnknown
|
||||||
) else if "%product_name:~-3,3%" == "msi" (
|
) else if "%product_name:~-3,3%" == "msi" (
|
||||||
start "" "%dest%\%product_name%" || goto ErrorUnknown
|
start "" "%dest%\%product_name%" || goto ErrorUnknown
|
||||||
) else (
|
) else (
|
||||||
rem Office source not supported by this script
|
rem Office source not supported by this script
|
||||||
goto ErrorOfficeUnsupported
|
goto ErrorOfficeUnsupported
|
||||||
)
|
)
|
||||||
goto Exit
|
goto Exit
|
||||||
|
|
||||||
|
|
@ -225,9 +225,9 @@ if not exist "%script%" goto ErrorScriptNotFound
|
||||||
rem Run
|
rem Run
|
||||||
popd && pushd "%_path%"
|
popd && pushd "%_path%"
|
||||||
if defined L_ELEV (
|
if defined L_ELEV (
|
||||||
goto LaunchPSScriptElev
|
goto LaunchPSScriptElev
|
||||||
) else (
|
) else (
|
||||||
goto LaunchPSScriptUser
|
goto LaunchPSScriptUser
|
||||||
)
|
)
|
||||||
|
|
||||||
:LaunchPSScriptElev
|
:LaunchPSScriptElev
|
||||||
|
|
@ -238,10 +238,10 @@ rem Create VB script
|
||||||
mkdir "%bin%\tmp" 2>nul
|
mkdir "%bin%\tmp" 2>nul
|
||||||
echo Set UAC = CreateObject^("Shell.Application"^) > "%bin%\tmp\Elevate.vbs"
|
echo Set UAC = CreateObject^("Shell.Application"^) > "%bin%\tmp\Elevate.vbs"
|
||||||
if defined L_NCMD (
|
if defined L_NCMD (
|
||||||
rem use Powershell's window instead of %CON%
|
rem use Powershell's window instead of %CON%
|
||||||
echo UAC.ShellExecute "%POWERSHELL%", "%ps_args% -File "%script%"", "", "runas", 3 >> "%bin%\tmp\Elevate.vbs"
|
echo UAC.ShellExecute "%POWERSHELL%", "%ps_args% -File "%script%"", "", "runas", 3 >> "%bin%\tmp\Elevate.vbs"
|
||||||
) else (
|
) else (
|
||||||
echo UAC.ShellExecute "%CON%", "-run %POWERSHELL% %ps_args% -File "%script%" -new_console:n", "", "runas", 1 >> "%bin%\tmp\Elevate.vbs"
|
echo UAC.ShellExecute "%CON%", "-run %POWERSHELL% %ps_args% -File "%script%" -new_console:n", "", "runas", 1 >> "%bin%\tmp\Elevate.vbs"
|
||||||
)
|
)
|
||||||
|
|
||||||
rem Run
|
rem Run
|
||||||
|
|
@ -251,9 +251,9 @@ goto Exit
|
||||||
:LaunchPSScriptUser
|
:LaunchPSScriptUser
|
||||||
rem Run
|
rem Run
|
||||||
if defined L_NCMD (
|
if defined L_NCMD (
|
||||||
start "" "%POWERSHELL%" %ps_args% -File "%script%" || goto ErrorUnknown
|
start "" "%POWERSHELL%" %ps_args% -File "%script%" || goto ErrorUnknown
|
||||||
) else (
|
) else (
|
||||||
start "" "%CON%" -run "%POWERSHELL%" %ps_args% -File "%script%" -new_console:n || goto ErrorUnknown
|
start "" "%CON%" -run "%POWERSHELL%" %ps_args% -File "%script%" -new_console:n || goto ErrorUnknown
|
||||||
)
|
)
|
||||||
goto Exit
|
goto Exit
|
||||||
|
|
||||||
|
|
@ -268,9 +268,9 @@ if not exist "%script%" goto ErrorScriptNotFound
|
||||||
|
|
||||||
rem Run
|
rem Run
|
||||||
if defined L_ELEV (
|
if defined L_ELEV (
|
||||||
goto LaunchPyScriptElev
|
goto LaunchPyScriptElev
|
||||||
) else (
|
) else (
|
||||||
goto LaunchPyScriptUser
|
goto LaunchPyScriptUser
|
||||||
)
|
)
|
||||||
|
|
||||||
:LaunchPyScriptElev
|
:LaunchPyScriptElev
|
||||||
|
|
@ -281,9 +281,9 @@ rem Create VB script
|
||||||
mkdir "%bin%\tmp" 2>nul
|
mkdir "%bin%\tmp" 2>nul
|
||||||
echo Set UAC = CreateObject^("Shell.Application"^) > "%bin%\tmp\Elevate.vbs"
|
echo Set UAC = CreateObject^("Shell.Application"^) > "%bin%\tmp\Elevate.vbs"
|
||||||
if defined L_NCMD (
|
if defined L_NCMD (
|
||||||
echo UAC.ShellExecute "%PYTHON%", """%script%"" %L_ARGS%", "", "runas", 3 >> "%bin%\tmp\Elevate.vbs"
|
echo UAC.ShellExecute "%PYTHON%", """%script%"" %L_ARGS%", "", "runas", 3 >> "%bin%\tmp\Elevate.vbs"
|
||||||
) else (
|
) else (
|
||||||
echo UAC.ShellExecute "%CON%", "-run ""%PYTHON%"" ""%script%"" %L_ARGS% -new_console:n", "", "runas", 1 >> "%bin%\tmp\Elevate.vbs"
|
echo UAC.ShellExecute "%CON%", "-run ""%PYTHON%"" ""%script%"" %L_ARGS% -new_console:n", "", "runas", 1 >> "%bin%\tmp\Elevate.vbs"
|
||||||
)
|
)
|
||||||
|
|
||||||
rem Run
|
rem Run
|
||||||
|
|
@ -292,9 +292,9 @@ goto Exit
|
||||||
|
|
||||||
:LaunchPyScriptUser
|
:LaunchPyScriptUser
|
||||||
if defined L_NCMD (
|
if defined L_NCMD (
|
||||||
start "" "%PYTHON%" "%script%" %L_ARGS% || goto ErrorUnknown
|
start "" "%PYTHON%" "%script%" %L_ARGS% || goto ErrorUnknown
|
||||||
) else (
|
) else (
|
||||||
start "" "%CON%" -run "%PYTHON%" "%script%" %L_ARGS% -new_console:n || goto ErrorUnknown
|
start "" "%CON%" -run "%PYTHON%" "%script%" %L_ARGS% -new_console:n || goto ErrorUnknown
|
||||||
)
|
)
|
||||||
goto Exit
|
goto Exit
|
||||||
|
|
||||||
|
|
@ -317,12 +317,12 @@ start "" /wait "%FASTCOPY%" %fastcopy_args% "%source%" /to="%dest%\"
|
||||||
|
|
||||||
rem Run
|
rem Run
|
||||||
if exist "%dest%\%product_name%\Setup.exe" (
|
if exist "%dest%\%product_name%\Setup.exe" (
|
||||||
pushd "%dest%\%product_name%"
|
pushd "%dest%\%product_name%"
|
||||||
start "" "%dest%\%product_name%\Setup.exe" || goto ErrorUnknown
|
start "" "%dest%\%product_name%\Setup.exe" || goto ErrorUnknown
|
||||||
popd
|
popd
|
||||||
) else (
|
) else (
|
||||||
rem QuickBooks source not supported by this script
|
rem QuickBooks source not supported by this script
|
||||||
goto ErrorQuickBooksUnsupported
|
goto ErrorQuickBooksUnsupported
|
||||||
)
|
)
|
||||||
goto Exit
|
goto Exit
|
||||||
|
|
||||||
|
|
@ -331,16 +331,16 @@ echo.
|
||||||
echo.Usage (via defined variables):
|
echo.Usage (via defined variables):
|
||||||
echo. L_TYPE L_PATH L_ITEM L_ARGS
|
echo. L_TYPE L_PATH L_ITEM L_ARGS
|
||||||
echo. Executable Working Dir Program Args [L_7ZIP] [L_ELEV] [L__CLI]
|
echo. Executable Working Dir Program Args [L_7ZIP] [L_ELEV] [L__CLI]
|
||||||
echo. Folder Folder '.' [L_7ZIP]
|
echo. Folder Folder '.' [L_7ZIP]
|
||||||
echo. Office Year Product [L_7ZIP]
|
echo. Office Year Product [L_7ZIP]
|
||||||
echo. PSScript Scripts Script [L_7ZIP] [L_ELEV] [L_NCMD]
|
echo. PSScript Scripts Script [L_7ZIP] [L_ELEV] [L_NCMD]
|
||||||
echo. PyScript Scripts Script Args [L_7ZIP] [L_ELEV] [L_NCMD]
|
echo. PyScript Scripts Script Args [L_7ZIP] [L_ELEV] [L_NCMD]
|
||||||
echo. QuickBooks Year Product [L_7ZIP]
|
echo. QuickBooks Year Product [L_7ZIP]
|
||||||
echo.
|
echo.
|
||||||
echo.L_7ZIP: Extra arguments for 7-Zip (in the :ExtractCBin label)
|
echo.L_7ZIP: Extra arguments for 7-Zip (in the :ExtractCBin label)
|
||||||
echo.L_ELEV: Elevate to run as Admin
|
echo.L_ELEV: Elevate to run as Admin
|
||||||
echo.L_NCMD: Do not run script inside ConEmu (i.e. use the native window)
|
echo.L_NCMD: Do not run script inside ConEmu (i.e. use the native window)
|
||||||
echo.L__CLI: Run executable in ConEmu
|
echo.L__CLI: Run executable in ConEmu
|
||||||
echo.
|
echo.
|
||||||
goto Abort
|
goto Abort
|
||||||
|
|
||||||
|
|
@ -392,15 +392,15 @@ set "%1=%_tmp%"
|
||||||
|
|
||||||
:ExtractOrFindPath
|
:ExtractOrFindPath
|
||||||
rem Test L_PATH in the following order:
|
rem Test L_PATH in the following order:
|
||||||
rem 1: %cbin%\L_PATH.7z (which will be extracted to %bin%\L_PATH)
|
rem 1: %cbin%\L_PATH.7z (which will be extracted to %bin%\L_PATH)
|
||||||
rem 2: %bin%\L_PATH
|
rem 2: %bin%\L_PATH
|
||||||
rem 3. %L_PATH% (i.e. treat L_PATH as an absolute path)
|
rem 3. %L_PATH% (i.e. treat L_PATH as an absolute path)
|
||||||
rem NOTE: This function should be called as 'call :ExtractOrFindPath || goto ErrorProgramNotFound' to catch invalid paths.
|
rem NOTE: This function should be called as 'call :ExtractOrFindPath || goto ErrorProgramNotFound' to catch invalid paths.
|
||||||
set _path=
|
set _path=
|
||||||
if exist "%cbin%\%L_PATH%.7z" (
|
if exist "%cbin%\%L_PATH%.7z" (
|
||||||
call :ExtractCBin
|
call :ExtractCBin
|
||||||
) else if exist "%cbin%\%L_PATH%\%L_ITEM:~0,-4%.7z" (
|
) else if exist "%cbin%\%L_PATH%\%L_ITEM:~0,-4%.7z" (
|
||||||
call :ExtractCBin
|
call :ExtractCBin
|
||||||
)
|
)
|
||||||
if exist "%bin%\%L_PATH%" (set "_path=%bin%\%L_PATH%")
|
if exist "%bin%\%L_PATH%" (set "_path=%bin%\%L_PATH%")
|
||||||
if not defined _path (set "_path=%L_PATH%")
|
if not defined _path (set "_path=%L_PATH%")
|
||||||
|
|
@ -476,9 +476,9 @@ goto Abort
|
||||||
:Abort
|
:Abort
|
||||||
rem Handle color theme for both the native console and ConEmu
|
rem Handle color theme for both the native console and ConEmu
|
||||||
if defined ConEmuBuild (
|
if defined ConEmuBuild (
|
||||||
color c4
|
color c4
|
||||||
) else (
|
) else (
|
||||||
color 4e
|
color 4e
|
||||||
)
|
)
|
||||||
echo Aborted.
|
echo Aborted.
|
||||||
echo.
|
echo.
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ goto Exit
|
||||||
rem Loops through all arguments to check for accepted flags
|
rem Loops through all arguments to check for accepted flags
|
||||||
set DEBUG=
|
set DEBUG=
|
||||||
for %%f in (%*) do (
|
for %%f in (%*) do (
|
||||||
if /i "%%f" == "/DEBUG" (@echo on & set "DEBUG=/DEBUG")
|
if /i "%%f" == "/DEBUG" (@echo on & set "DEBUG=/DEBUG")
|
||||||
)
|
)
|
||||||
@exit /b 0
|
@exit /b 0
|
||||||
|
|
||||||
|
|
@ -70,9 +70,9 @@ popd
|
||||||
rem Sets title using KIT_NAME_FULL from settings\main.py
|
rem Sets title using KIT_NAME_FULL from settings\main.py
|
||||||
set "SETTINGS=%bin%\Scripts\settings\main.py"
|
set "SETTINGS=%bin%\Scripts\settings\main.py"
|
||||||
for /f "tokens=* usebackq" %%f in (`findstr KIT_NAME_FULL "%SETTINGS%"`) do (
|
for /f "tokens=* usebackq" %%f in (`findstr KIT_NAME_FULL "%SETTINGS%"`) do (
|
||||||
set "_v=%%f"
|
set "_v=%%f"
|
||||||
set "_v=!_v:*'=!"
|
set "_v=!_v:*'=!"
|
||||||
set "KIT_NAME_FULL=!_v:~0,-1!"
|
set "KIT_NAME_FULL=!_v:~0,-1!"
|
||||||
)
|
)
|
||||||
set "window_title=%*"
|
set "window_title=%*"
|
||||||
if not defined window_title set "window_title=Launcher"
|
if not defined window_title set "window_title=Launcher"
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
## Init ##
|
## Init ##
|
||||||
#Requires -Version 3.0
|
#Requires -Version 3.0
|
||||||
if (Test-Path Env:\DEBUG) {
|
if (Test-Path Env:\DEBUG) {
|
||||||
Set-PSDebug -Trace 1
|
Set-PSDebug -Trace 1
|
||||||
}
|
}
|
||||||
$Host.UI.RawUI.WindowTitle = "Wizard Kit: Build Tool"
|
$Host.UI.RawUI.WindowTitle = "Wizard Kit: Build Tool"
|
||||||
$WD = $(Split-Path $MyInvocation.MyCommand.Path)
|
$WD = $(Split-Path $MyInvocation.MyCommand.Path)
|
||||||
|
|
@ -21,47 +21,47 @@ $Host.UI.RawUI.ForegroundColor = "white"
|
||||||
|
|
||||||
## Functions ##
|
## Functions ##
|
||||||
function Abort {
|
function Abort {
|
||||||
Write-Host -ForegroundColor "Red" "`nAborted."
|
Write-Host -ForegroundColor "Red" "`nAborted."
|
||||||
WKPause "Press Enter to exit..."
|
WKPause "Press Enter to exit..."
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
function DownloadFile ($Path, $Name, $Url) {
|
function DownloadFile ($Path, $Name, $Url) {
|
||||||
$OutFile = "{0}\{1}" -f $Path, $Name
|
$OutFile = "{0}\{1}" -f $Path, $Name
|
||||||
|
|
||||||
Write-Host ("Downloading: $Name")
|
Write-Host ("Downloading: $Name")
|
||||||
New-Item -Type Directory $Path 2>&1 | Out-Null
|
New-Item -Type Directory $Path 2>&1 | Out-Null
|
||||||
try {
|
try {
|
||||||
Invoke-WebRequest -Uri $Url -OutFile $OutFile
|
Invoke-WebRequest -Uri $Url -OutFile $OutFile
|
||||||
}
|
}
|
||||||
catch {
|
catch {
|
||||||
Write-Host (" ERROR: Failed to download file." ) -ForegroundColor "Red"
|
Write-Host (" ERROR: Failed to download file." ) -ForegroundColor "Red"
|
||||||
$global:DownloadErrors += 1
|
$global:DownloadErrors += 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function FindDynamicUrl ($SourcePage, $RegEx) {
|
function FindDynamicUrl ($SourcePage, $RegEx) {
|
||||||
# Get source page
|
# Get source page
|
||||||
Invoke-Webrequest -Uri $SourcePage -OutFile "tmp_page"
|
Invoke-Webrequest -Uri $SourcePage -OutFile "tmp_page"
|
||||||
|
|
||||||
# Search for real url
|
# Search for real url
|
||||||
$Url = Get-Content "tmp_page" | Where-Object {$_ -imatch $RegEx}
|
$Url = Get-Content "tmp_page" | Where-Object {$_ -imatch $RegEx}
|
||||||
$Url = $Url -ireplace '.*(a |)href="([^"]+)".*', '$2'
|
$Url = $Url -ireplace '.*(a |)href="([^"]+)".*', '$2'
|
||||||
$Url = $Url -ireplace ".*(a |)href='([^']+)'.*", '$2'
|
$Url = $Url -ireplace ".*(a |)href='([^']+)'.*", '$2'
|
||||||
|
|
||||||
# Remove tmp_page
|
# Remove tmp_page
|
||||||
Remove-Item "tmp_page"
|
Remove-Item "tmp_page"
|
||||||
|
|
||||||
$Url | Select-Object -First 1
|
$Url | Select-Object -First 1
|
||||||
}
|
}
|
||||||
function WKPause ($Message = "Press Enter to continue... ") {
|
function WKPause ($Message = "Press Enter to continue... ") {
|
||||||
Write-Host $Message -NoNewLine
|
Write-Host $Message -NoNewLine
|
||||||
Read-Host
|
Read-Host
|
||||||
}
|
}
|
||||||
|
|
||||||
## Safety Check ##
|
## Safety Check ##
|
||||||
if ($PSVersionTable.PSVersion.Major -eq 6 -and $PSVersionTable.OS -imatch "Windows 6.1") {
|
if ($PSVersionTable.PSVersion.Major -eq 6 -and $PSVersionTable.OS -imatch "Windows 6.1") {
|
||||||
Write-Host "`nThis script doesn't support PowerShell 6.0 on Windows 7."
|
Write-Host "`nThis script doesn't support PowerShell 6.0 on Windows 7."
|
||||||
Write-Host "Press Enter to exit... " -NoNewLine
|
Write-Host "Press Enter to exit... " -NoNewLine
|
||||||
Abort
|
Abort
|
||||||
}
|
}
|
||||||
|
|
||||||
## PowerShell equivalent of Python's "if __name__ == '__main__'"
|
## PowerShell equivalent of Python's "if __name__ == '__main__'"
|
||||||
|
|
@ -71,160 +71,160 @@ if ($PSVersionTable.PSVersion.Major -eq 6 -and $PSVersionTable.OS -imatch "Windo
|
||||||
# Asked by: https://stackoverflow.com/users/65164/mark-mascolino
|
# Asked by: https://stackoverflow.com/users/65164/mark-mascolino
|
||||||
# Answer by: https://stackoverflow.com/users/696808/bacon-bits
|
# Answer by: https://stackoverflow.com/users/696808/bacon-bits
|
||||||
if ($MyInvocation.InvocationName -ne ".") {
|
if ($MyInvocation.InvocationName -ne ".") {
|
||||||
Clear-Host
|
Clear-Host
|
||||||
Write-Host "Wizard Kit: Build Tool`n`n`n`n`n"
|
Write-Host "Wizard Kit: Build Tool`n`n`n`n`n"
|
||||||
|
|
||||||
## Download ##
|
|
||||||
$DownloadErrors = 0
|
|
||||||
$Path = $Temp
|
|
||||||
|
|
||||||
# 7-Zip
|
## Download ##
|
||||||
DownloadFile -Path $Path -Name "7z-installer.msi" -Url "https://www.7-zip.org/a/7z1900.msi"
|
$DownloadErrors = 0
|
||||||
DownloadFile -Path $Path -Name "7z-extra.7z" -Url "https://www.7-zip.org/a/7z1900-extra.7z"
|
$Path = $Temp
|
||||||
|
|
||||||
# ConEmu
|
# 7-Zip
|
||||||
$Url = "https://github.com/Maximus5/ConEmu/releases/download/v19.03.10/ConEmuPack.190310.7z"
|
DownloadFile -Path $Path -Name "7z-installer.msi" -Url "https://www.7-zip.org/a/7z1900.msi"
|
||||||
DownloadFile -Path $Path -Name "ConEmuPack.7z" -Url $Url
|
DownloadFile -Path $Path -Name "7z-extra.7z" -Url "https://www.7-zip.org/a/7z1900-extra.7z"
|
||||||
|
|
||||||
# Notepad++
|
# ConEmu
|
||||||
$Url = "https://notepad-plus-plus.org/repository/7.x/7.6.4/npp.7.6.4.bin.minimalist.7z"
|
$Url = "https://github.com/Maximus5/ConEmu/releases/download/v19.03.10/ConEmuPack.190310.7z"
|
||||||
DownloadFile -Path $Path -Name "npp.7z" -Url $Url
|
DownloadFile -Path $Path -Name "ConEmuPack.7z" -Url $Url
|
||||||
|
|
||||||
# Python
|
# Notepad++
|
||||||
$Url = "https://www.python.org/ftp/python/3.7.2/python-3.7.2.post1-embed-win32.zip"
|
$Url = "https://notepad-plus-plus.org/repository/7.x/7.6.4/npp.7.6.4.bin.minimalist.7z"
|
||||||
DownloadFile -Path $Path -Name "python32.zip" -Url $Url
|
DownloadFile -Path $Path -Name "npp.7z" -Url $Url
|
||||||
$Url = "https://www.python.org/ftp/python/3.7.2/python-3.7.2.post1-embed-amd64.zip"
|
|
||||||
DownloadFile -Path $Path -Name "python64.zip" -Url $Url
|
|
||||||
|
|
||||||
# Python: psutil
|
# Python
|
||||||
$DownloadPage = "https://pypi.org/project/psutil/"
|
$Url = "https://www.python.org/ftp/python/3.7.2/python-3.7.2.post1-embed-win32.zip"
|
||||||
$RegEx = "href=.*-cp37-cp37m-win32.whl"
|
DownloadFile -Path $Path -Name "python32.zip" -Url $Url
|
||||||
$Url = FindDynamicUrl $DownloadPage $RegEx
|
$Url = "https://www.python.org/ftp/python/3.7.2/python-3.7.2.post1-embed-amd64.zip"
|
||||||
DownloadFile -Path $Path -Name "psutil32.whl" -Url $Url
|
DownloadFile -Path $Path -Name "python64.zip" -Url $Url
|
||||||
$RegEx = "href=.*-cp37-cp37m-win_amd64.whl"
|
|
||||||
$Url = FindDynamicUrl $DownloadPage $RegEx
|
|
||||||
DownloadFile -Path $Path -Name "psutil64.whl" -Url $Url
|
|
||||||
|
|
||||||
# Python: requests & dependancies
|
# Python: psutil
|
||||||
$RegEx = "href=.*.py3-none-any.whl"
|
$DownloadPage = "https://pypi.org/project/psutil/"
|
||||||
foreach ($Module in @("chardet", "certifi", "idna", "urllib3", "requests")) {
|
$RegEx = "href=.*-cp37-cp37m-win32.whl"
|
||||||
$DownloadPage = "https://pypi.org/project/$Module/"
|
$Url = FindDynamicUrl $DownloadPage $RegEx
|
||||||
$Name = "$Module.whl"
|
DownloadFile -Path $Path -Name "psutil32.whl" -Url $Url
|
||||||
$Url = FindDynamicUrl -SourcePage $DownloadPage -RegEx $RegEx
|
$RegEx = "href=.*-cp37-cp37m-win_amd64.whl"
|
||||||
DownloadFile -Path $Path -Name $Name -Url $Url
|
$Url = FindDynamicUrl $DownloadPage $RegEx
|
||||||
}
|
DownloadFile -Path $Path -Name "psutil64.whl" -Url $Url
|
||||||
|
|
||||||
# Visual C++ Runtimes
|
# Python: requests & dependancies
|
||||||
$Url = "https://aka.ms/vs/15/release/vc_redist.x86.exe"
|
$RegEx = "href=.*.py3-none-any.whl"
|
||||||
DownloadFile -Path $Path -Name "vcredist_x86.exe" -Url $Url
|
foreach ($Module in @("chardet", "certifi", "idna", "urllib3", "requests")) {
|
||||||
$Url = "https://aka.ms/vs/15/release/vc_redist.x64.exe"
|
$DownloadPage = "https://pypi.org/project/$Module/"
|
||||||
DownloadFile -Path $Path -Name "vcredist_x64.exe" -Url $Url
|
$Name = "$Module.whl"
|
||||||
|
$Url = FindDynamicUrl -SourcePage $DownloadPage -RegEx $RegEx
|
||||||
## Bail ##
|
DownloadFile -Path $Path -Name $Name -Url $Url
|
||||||
# If errors were encountered during downloads
|
}
|
||||||
if ($DownloadErrors -gt 0) {
|
|
||||||
Abort
|
|
||||||
}
|
|
||||||
|
|
||||||
## Install ##
|
# Visual C++ Runtimes
|
||||||
# Visual C++ Runtimes
|
$Url = "https://aka.ms/vs/15/release/vc_redist.x86.exe"
|
||||||
$ArgumentList = @("/install", "/passive", "/norestart")
|
DownloadFile -Path $Path -Name "vcredist_x86.exe" -Url $Url
|
||||||
Start-Process -FilePath "$Temp\vcredist_x86.exe" -ArgumentList $ArgumentList -Wait
|
$Url = "https://aka.ms/vs/15/release/vc_redist.x64.exe"
|
||||||
Start-Process -FilePath "$Temp\vcredist_x64.exe" -ArgumentList $ArgumentList -Wait
|
DownloadFile -Path $Path -Name "vcredist_x64.exe" -Url $Url
|
||||||
Remove-Item "$Temp\vcredist*.exe"
|
|
||||||
|
|
||||||
## Extract ##
|
|
||||||
# 7-Zip
|
|
||||||
Write-Host "Extracting: 7-Zip"
|
|
||||||
try {
|
|
||||||
$ArgumentList = @("/a", "$Temp\7z-installer.msi", "TARGETDIR=$Temp\7zi", "/qn")
|
|
||||||
Start-Process -FilePath "$System32\msiexec.exe" -ArgumentList $ArgumentList -Wait
|
|
||||||
$SevenZip = "$Temp\7zi\Files\7-Zip\7z.exe"
|
|
||||||
$ArgumentList = @(
|
|
||||||
"x", "$Temp\7z-extra.7z", "-o$Bin\7-Zip",
|
|
||||||
"-aoa", "-bso0", "-bse0", "-bsp0",
|
|
||||||
"-x!x64\*.dll", "-x!Far", "-x!*.dll")
|
|
||||||
Start-Process -FilePath $SevenZip -ArgumentList $ArgumentList -NoNewWindow -Wait
|
|
||||||
Start-Sleep 1
|
|
||||||
Move-Item "$Bin\7-Zip\x64\7za.exe" "$Bin\7-Zip\7za64.exe"
|
|
||||||
Remove-Item "$Bin\7-Zip\x64" -Recurse
|
|
||||||
Remove-Item "$Temp\7z*" -Recurse
|
|
||||||
$SevenZip = "$Bin\7-Zip\7za.exe"
|
|
||||||
}
|
|
||||||
catch {
|
|
||||||
Write-Host (" ERROR: Failed to extract files." ) -ForegroundColor "Red"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Notepad++
|
## Bail ##
|
||||||
Write-Host "Extracting: Notepad++"
|
# If errors were encountered during downloads
|
||||||
try {
|
if ($DownloadErrors -gt 0) {
|
||||||
$ArgumentList = @(
|
Abort
|
||||||
"x", "$Temp\npp.7z", "-o$Bin\NotepadPlusPlus",
|
}
|
||||||
"-aoa", "-bso0", "-bse0", "-bsp0")
|
|
||||||
Start-Process -FilePath $SevenZip -ArgumentList $ArgumentList -NoNewWindow -Wait
|
|
||||||
Remove-Item "$Temp\npp.7z"
|
|
||||||
Move-Item "$Bin\NotepadPlusPlus\notepad++.exe" "$Bin\NotepadPlusPlus\notepadplusplus.exe"
|
|
||||||
}
|
|
||||||
catch {
|
|
||||||
Write-Host (" ERROR: Failed to extract files." ) -ForegroundColor "Red"
|
|
||||||
}
|
|
||||||
|
|
||||||
# ConEmu
|
## Install ##
|
||||||
Write-Host "Extracting: ConEmu"
|
# Visual C++ Runtimes
|
||||||
try {
|
$ArgumentList = @("/install", "/passive", "/norestart")
|
||||||
$ArgumentList = @(
|
Start-Process -FilePath "$Temp\vcredist_x86.exe" -ArgumentList $ArgumentList -Wait
|
||||||
"x", "$Temp\ConEmuPack.7z", "-o$Bin\ConEmu",
|
Start-Process -FilePath "$Temp\vcredist_x64.exe" -ArgumentList $ArgumentList -Wait
|
||||||
"-aoa", "-bso0", "-bse0", "-bsp0")
|
Remove-Item "$Temp\vcredist*.exe"
|
||||||
Start-Process -FilePath $SevenZip -ArgumentList $ArgumentList -NoNewWindow -Wait
|
|
||||||
Remove-Item "$Temp\ConEmuPack.7z"
|
|
||||||
}
|
|
||||||
catch {
|
|
||||||
Write-Host (" ERROR: Failed to extract files." ) -ForegroundColor "Red"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Python
|
## Extract ##
|
||||||
foreach ($Arch in @("32", "64")) {
|
# 7-Zip
|
||||||
Write-Host "Extracting: Python (x$Arch)"
|
Write-Host "Extracting: 7-Zip"
|
||||||
$Files = @(
|
try {
|
||||||
"python$Arch.zip",
|
$ArgumentList = @("/a", "$Temp\7z-installer.msi", "TARGETDIR=$Temp\7zi", "/qn")
|
||||||
"certifi.whl",
|
Start-Process -FilePath "$System32\msiexec.exe" -ArgumentList $ArgumentList -Wait
|
||||||
"chardet.whl",
|
$SevenZip = "$Temp\7zi\Files\7-Zip\7z.exe"
|
||||||
"idna.whl",
|
$ArgumentList = @(
|
||||||
"psutil$Arch.whl",
|
"x", "$Temp\7z-extra.7z", "-o$Bin\7-Zip",
|
||||||
"requests.whl",
|
"-aoa", "-bso0", "-bse0", "-bsp0",
|
||||||
"urllib3.whl"
|
"-x!x64\*.dll", "-x!Far", "-x!*.dll")
|
||||||
)
|
Start-Process -FilePath $SevenZip -ArgumentList $ArgumentList -NoNewWindow -Wait
|
||||||
try {
|
|
||||||
foreach ($File in $Files) {
|
|
||||||
$ArgumentList = @(
|
|
||||||
"x", "$Temp\$File", "-o$Bin\Python\x$Arch",
|
|
||||||
"-aoa", "-bso0", "-bse0", "-bsp0")
|
|
||||||
Start-Process -FilePath $SevenZip -ArgumentList $ArgumentList -NoNewWindow -Wait
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch {
|
|
||||||
Write-Host (" ERROR: Failed to extract files." ) -ForegroundColor "Red"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
Copy-Item -Path "$System32\vcruntime140.dll" -Destination "$Bin\Python\x64\vcruntime140.dll" -Force
|
|
||||||
Copy-Item -Path "$SysWOW64\vcruntime140.dll" -Destination "$Bin\Python\x32\vcruntime140.dll" -Force
|
|
||||||
}
|
|
||||||
catch {
|
|
||||||
Write-Host (" ERROR: Failed to copy Visual C++ Runtime DLLs." ) -ForegroundColor "Red"
|
|
||||||
}
|
|
||||||
Remove-Item "$Temp\python*.zip"
|
|
||||||
Remove-Item "$Temp\*.whl"
|
|
||||||
|
|
||||||
## Configure ##
|
|
||||||
Write-Host "Configuring kit"
|
|
||||||
WKPause "Press Enter to open settings..."
|
|
||||||
$Cmd = "$Bin\NotepadPlusPlus\notepadplusplus.exe"
|
|
||||||
Start-Process -FilePath $Cmd -ArgumentList @("$Bin\Scripts\settings\main.py") -Wait
|
|
||||||
Start-Sleep 1
|
Start-Sleep 1
|
||||||
|
Move-Item "$Bin\7-Zip\x64\7za.exe" "$Bin\7-Zip\7za64.exe"
|
||||||
|
Remove-Item "$Bin\7-Zip\x64" -Recurse
|
||||||
|
Remove-Item "$Temp\7z*" -Recurse
|
||||||
|
$SevenZip = "$Bin\7-Zip\7za.exe"
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Write-Host (" ERROR: Failed to extract files." ) -ForegroundColor "Red"
|
||||||
|
}
|
||||||
|
|
||||||
## Done ##
|
# Notepad++
|
||||||
Pop-Location
|
Write-Host "Extracting: Notepad++"
|
||||||
$ArgumentList = @("-run", "$Bin\Python\x32\python.exe", "$Bin\Scripts\update_kit.py", "-new_console:n")
|
try {
|
||||||
Start-Process -FilePath "$Bin\ConEmu\ConEmu.exe" -ArgumentList $ArgumentList -verb RunAs
|
$ArgumentList = @(
|
||||||
|
"x", "$Temp\npp.7z", "-o$Bin\NotepadPlusPlus",
|
||||||
|
"-aoa", "-bso0", "-bse0", "-bsp0")
|
||||||
|
Start-Process -FilePath $SevenZip -ArgumentList $ArgumentList -NoNewWindow -Wait
|
||||||
|
Remove-Item "$Temp\npp.7z"
|
||||||
|
Move-Item "$Bin\NotepadPlusPlus\notepad++.exe" "$Bin\NotepadPlusPlus\notepadplusplus.exe"
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Write-Host (" ERROR: Failed to extract files." ) -ForegroundColor "Red"
|
||||||
|
}
|
||||||
|
|
||||||
|
# ConEmu
|
||||||
|
Write-Host "Extracting: ConEmu"
|
||||||
|
try {
|
||||||
|
$ArgumentList = @(
|
||||||
|
"x", "$Temp\ConEmuPack.7z", "-o$Bin\ConEmu",
|
||||||
|
"-aoa", "-bso0", "-bse0", "-bsp0")
|
||||||
|
Start-Process -FilePath $SevenZip -ArgumentList $ArgumentList -NoNewWindow -Wait
|
||||||
|
Remove-Item "$Temp\ConEmuPack.7z"
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Write-Host (" ERROR: Failed to extract files." ) -ForegroundColor "Red"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Python
|
||||||
|
foreach ($Arch in @("32", "64")) {
|
||||||
|
Write-Host "Extracting: Python (x$Arch)"
|
||||||
|
$Files = @(
|
||||||
|
"python$Arch.zip",
|
||||||
|
"certifi.whl",
|
||||||
|
"chardet.whl",
|
||||||
|
"idna.whl",
|
||||||
|
"psutil$Arch.whl",
|
||||||
|
"requests.whl",
|
||||||
|
"urllib3.whl"
|
||||||
|
)
|
||||||
|
try {
|
||||||
|
foreach ($File in $Files) {
|
||||||
|
$ArgumentList = @(
|
||||||
|
"x", "$Temp\$File", "-o$Bin\Python\x$Arch",
|
||||||
|
"-aoa", "-bso0", "-bse0", "-bsp0")
|
||||||
|
Start-Process -FilePath $SevenZip -ArgumentList $ArgumentList -NoNewWindow -Wait
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Write-Host (" ERROR: Failed to extract files." ) -ForegroundColor "Red"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
Copy-Item -Path "$System32\vcruntime140.dll" -Destination "$Bin\Python\x64\vcruntime140.dll" -Force
|
||||||
|
Copy-Item -Path "$SysWOW64\vcruntime140.dll" -Destination "$Bin\Python\x32\vcruntime140.dll" -Force
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Write-Host (" ERROR: Failed to copy Visual C++ Runtime DLLs." ) -ForegroundColor "Red"
|
||||||
|
}
|
||||||
|
Remove-Item "$Temp\python*.zip"
|
||||||
|
Remove-Item "$Temp\*.whl"
|
||||||
|
|
||||||
|
## Configure ##
|
||||||
|
Write-Host "Configuring kit"
|
||||||
|
WKPause "Press Enter to open settings..."
|
||||||
|
$Cmd = "$Bin\NotepadPlusPlus\notepadplusplus.exe"
|
||||||
|
Start-Process -FilePath $Cmd -ArgumentList @("$Bin\Scripts\settings\main.py") -Wait
|
||||||
|
Start-Sleep 1
|
||||||
|
|
||||||
|
## Done ##
|
||||||
|
Pop-Location
|
||||||
|
$ArgumentList = @("-run", "$Bin\Python\x32\python.exe", "$Bin\Scripts\update_kit.py", "-new_console:n")
|
||||||
|
Start-Process -FilePath "$Bin\ConEmu\ConEmu.exe" -ArgumentList $ArgumentList -verb RunAs
|
||||||
}
|
}
|
||||||
|
|
|
||||||
1190
scripts/build_pe.ps1
1190
scripts/build_pe.ps1
File diff suppressed because it is too large
Load diff
|
|
@ -10,12 +10,12 @@ if not defined bin (goto Abort)
|
||||||
:: Credit to SS64.com Code taken from http://ss64.com/nt/syntax-getdate.html
|
:: Credit to SS64.com Code taken from http://ss64.com/nt/syntax-getdate.html
|
||||||
:: Use WMIC to retrieve date and time in ISO 8601 format.
|
:: Use WMIC to retrieve date and time in ISO 8601 format.
|
||||||
for /f "skip=1 tokens=1-6" %%G in ('WMIC Path Win32_LocalTime Get Day^,Hour^,Minute^,Month^,Second^,Year /Format:table') do (
|
for /f "skip=1 tokens=1-6" %%G in ('WMIC Path Win32_LocalTime Get Day^,Hour^,Minute^,Month^,Second^,Year /Format:table') do (
|
||||||
if "%%~L"=="" goto s_done
|
if "%%~L"=="" goto s_done
|
||||||
set _yyyy=%%L
|
set _yyyy=%%L
|
||||||
set _mm=00%%J
|
set _mm=00%%J
|
||||||
set _dd=00%%G
|
set _dd=00%%G
|
||||||
set _hour=00%%H
|
set _hour=00%%H
|
||||||
set _minute=00%%I
|
set _minute=00%%I
|
||||||
)
|
)
|
||||||
:s_done
|
:s_done
|
||||||
:: Pad digits with leading zeros
|
:: Pad digits with leading zeros
|
||||||
|
|
@ -28,9 +28,9 @@ set iso_date=%_yyyy%-%_mm%-%_dd%
|
||||||
:SetVars
|
:SetVars
|
||||||
set "SETTINGS=%bin%\Scripts\settings\main.py"
|
set "SETTINGS=%bin%\Scripts\settings\main.py"
|
||||||
for /f "tokens=* usebackq" %%f in (`findstr KIT_NAME_SHORT "%SETTINGS%"`) do (
|
for /f "tokens=* usebackq" %%f in (`findstr KIT_NAME_SHORT "%SETTINGS%"`) do (
|
||||||
set "_v=%%f"
|
set "_v=%%f"
|
||||||
set "_v=!_v:*'=!"
|
set "_v=!_v:*'=!"
|
||||||
set "KIT_NAME_SHORT=!_v:~0,-1!"
|
set "KIT_NAME_SHORT=!_v:~0,-1!"
|
||||||
)
|
)
|
||||||
set "client_dir=%systemdrive%\%KIT_NAME_SHORT%"
|
set "client_dir=%systemdrive%\%KIT_NAME_SHORT%"
|
||||||
set "log_dir=%client_dir%\Logs\%iso_date%"
|
set "log_dir=%client_dir%\Logs\%iso_date%"
|
||||||
|
|
@ -43,20 +43,20 @@ set _quarantine=
|
||||||
set _quickbooks=
|
set _quickbooks=
|
||||||
set _transfer=
|
set _transfer=
|
||||||
for %%f in (%*) do (
|
for %%f in (%*) do (
|
||||||
if /i "%%f" == "/DEBUG" (@echo on)
|
if /i "%%f" == "/DEBUG" (@echo on)
|
||||||
if /i "%%f" == "/Backups" set _backups=True
|
if /i "%%f" == "/Backups" set _backups=True
|
||||||
if /i "%%f" == "/Logs" set _logs=True
|
if /i "%%f" == "/Logs" set _logs=True
|
||||||
if /i "%%f" == "/Office" set _office=True
|
if /i "%%f" == "/Office" set _office=True
|
||||||
if /i "%%f" == "/Quarantine" set _quarantine=True
|
if /i "%%f" == "/Quarantine" set _quarantine=True
|
||||||
if /i "%%f" == "/QuickBooks" set _quickbooks=True
|
if /i "%%f" == "/QuickBooks" set _quickbooks=True
|
||||||
if /i "%%f" == "/Transfer" set _transfer=True
|
if /i "%%f" == "/Transfer" set _transfer=True
|
||||||
)
|
)
|
||||||
|
|
||||||
:CreateDirs
|
:CreateDirs
|
||||||
if defined _backups mkdir "%client_dir%\Backups">nul 2>&1
|
if defined _backups mkdir "%client_dir%\Backups">nul 2>&1
|
||||||
if defined _logs (
|
if defined _logs (
|
||||||
mkdir "%log_dir%\%KIT_NAME_FULL%">nul 2>&1
|
mkdir "%log_dir%\%KIT_NAME_FULL%">nul 2>&1
|
||||||
mkdir "%log_dir%\Tools">nul 2>&1)
|
mkdir "%log_dir%\Tools">nul 2>&1)
|
||||||
if defined _office mkdir "%client_dir%\Office">nul 2>&1
|
if defined _office mkdir "%client_dir%\Office">nul 2>&1
|
||||||
if defined _quarantine mkdir "%client_dir%\Quarantine">nul 2>&1
|
if defined _quarantine mkdir "%client_dir%\Quarantine">nul 2>&1
|
||||||
if defined _quickbooks mkdir "%client_dir%\QuickBooks">nul 2>&1
|
if defined _quickbooks mkdir "%client_dir%\QuickBooks">nul 2>&1
|
||||||
|
|
|
||||||
|
|
@ -20,493 +20,493 @@ SKEL_DIR="$LIVE_DIR/airootfs/etc/skel"
|
||||||
TEMP_DIR="$BUILD_DIR/temp"
|
TEMP_DIR="$BUILD_DIR/temp"
|
||||||
MIRRORLIST_SOURCE='https://www.archlinux.org/mirrorlist/?country=US&protocol=http&protocol=https&ip_version=4&use_mirror_status=on'
|
MIRRORLIST_SOURCE='https://www.archlinux.org/mirrorlist/?country=US&protocol=http&protocol=https&ip_version=4&use_mirror_status=on'
|
||||||
if which nano >/dev/null 2>&1; then
|
if which nano >/dev/null 2>&1; then
|
||||||
EDITOR=nano
|
EDITOR=nano
|
||||||
elif which vim >/dev/null 2>&1; then
|
elif which vim >/dev/null 2>&1; then
|
||||||
EDITOR=vim
|
EDITOR=vim
|
||||||
else
|
else
|
||||||
EDITOR=vi
|
EDITOR=vi
|
||||||
fi
|
fi
|
||||||
if [ ! -z ${SUDO_USER+x} ]; then
|
if [ ! -z ${SUDO_USER+x} ]; then
|
||||||
REAL_USER="$SUDO_USER"
|
REAL_USER="$SUDO_USER"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
function ask() {
|
function ask() {
|
||||||
while :; do
|
while :; do
|
||||||
read -p "$1 [Y/N] " -r answer
|
read -p "$1 [Y/N] " -r answer
|
||||||
if echo "$answer" | egrep -iq '^(y|yes|sure)$'; then
|
if echo "$answer" | egrep -iq '^(y|yes|sure)$'; then
|
||||||
return 0
|
return 0
|
||||||
elif echo "$answer" | egrep -iq '^(n|no|nope)$'; then
|
elif echo "$answer" | egrep -iq '^(n|no|nope)$'; then
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
function cleanup() {
|
function cleanup() {
|
||||||
for d in "$TEMP_DIR" "$LIVE_DIR"; do
|
for d in "$TEMP_DIR" "$LIVE_DIR"; do
|
||||||
if [[ -d "$d" ]]; then
|
if [[ -d "$d" ]]; then
|
||||||
if ask "Remove: ${d}?"; then
|
if ask "Remove: ${d}?"; then
|
||||||
rm -Rf "$d"
|
rm -Rf "$d"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
mkdir -p "$BUILD_DIR" 2>/dev/null
|
mkdir -p "$BUILD_DIR" 2>/dev/null
|
||||||
mkdir -p "$LOG_DIR" 2>/dev/null
|
mkdir -p "$LOG_DIR" 2>/dev/null
|
||||||
mkdir -p "$OUT_DIR" 2>/dev/null
|
mkdir -p "$OUT_DIR" 2>/dev/null
|
||||||
mkdir -p "$TEMP_DIR" 2>/dev/null
|
mkdir -p "$TEMP_DIR" 2>/dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
function fix_kit_permissions() {
|
function fix_kit_permissions() {
|
||||||
# GitHub zip archives don't preserve the correct permissions
|
# GitHub zip archives don't preserve the correct permissions
|
||||||
for d in docs images scripts setup; do
|
for d in docs images scripts setup; do
|
||||||
find "$ROOT_DIR/$d" -type d -exec chmod 755 "{}" \;
|
find "$ROOT_DIR/$d" -type d -exec chmod 755 "{}" \;
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
function load_settings() {
|
function load_settings() {
|
||||||
# Check if settings already loaded
|
# Check if settings already loaded
|
||||||
## Code based on StackOverflow Q&A
|
## Code based on StackOverflow Q&A
|
||||||
## Question: https://stackoverflow.com/q/3601515
|
## Question: https://stackoverflow.com/q/3601515
|
||||||
## Asked by: https://stackoverflow.com/users/260127/prosseek
|
## Asked by: https://stackoverflow.com/users/260127/prosseek
|
||||||
## Edited by: https://stackoverflow.com/users/3924118/nbro
|
## Edited by: https://stackoverflow.com/users/3924118/nbro
|
||||||
## Answer: https://stackoverflow.com/a/13864829
|
## Answer: https://stackoverflow.com/a/13864829
|
||||||
## Answer by: https://stackoverflow.com/users/1633643/lionel
|
## Answer by: https://stackoverflow.com/users/1633643/lionel
|
||||||
## Answer edit: https://stackoverflow.com/users/-1/community
|
## Answer edit: https://stackoverflow.com/users/-1/community
|
||||||
_main_path="$BUILD_DIR/main.py"
|
_main_path="$BUILD_DIR/main.py"
|
||||||
if [ ! -z ${KIT_NAME_FULL+x} ]; then
|
if [ ! -z ${KIT_NAME_FULL+x} ]; then
|
||||||
# KIT_NAME_FULL is set
|
# KIT_NAME_FULL is set
|
||||||
return 0 # Skip loading settings from main.py
|
return 0 # Skip loading settings from main.py
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "${1:-}" == "--edit" ]]; then
|
||||||
|
# Copy settings
|
||||||
|
if [[ ! -e "$BUILD_DIR/main.py" ]] || ask "Overwrite main.py?"; then
|
||||||
|
cp -bv "$ROOT_DIR/scripts/wk/cfg/main.py" "$BUILD_DIR/main.py"
|
||||||
|
dos2unix "$BUILD_DIR/main.py"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "${1:-}" == "--edit" ]]; then
|
# Edit settings
|
||||||
# Copy settings
|
read -p "Press Enter to open settings... " -r
|
||||||
if [[ ! -e "$BUILD_DIR/main.py" ]] || ask "Overwrite main.py?"; then
|
"$EDITOR" "$BUILD_DIR/main.py"
|
||||||
cp -bv "$ROOT_DIR/scripts/wk/cfg/main.py" "$BUILD_DIR/main.py"
|
else
|
||||||
dos2unix "$BUILD_DIR/main.py"
|
# Load settings from $LIVE_DIR
|
||||||
fi
|
_main_path="$LIVE_DIR/airootfs/usr/local/bin/wk/cfg/main.py"
|
||||||
|
fi
|
||||||
|
|
||||||
# Edit settings
|
# Load settings
|
||||||
read -p "Press Enter to open settings... " -r
|
while read line; do
|
||||||
"$EDITOR" "$BUILD_DIR/main.py"
|
if echo "$line" | egrep -q "^\w+='"; then
|
||||||
else
|
line="$(echo "$line" | sed -r 's/[\r\n]+//')"
|
||||||
# Load settings from $LIVE_DIR
|
eval "$line"
|
||||||
_main_path="$LIVE_DIR/airootfs/usr/local/bin/wk/cfg/main.py"
|
|
||||||
fi
|
fi
|
||||||
|
done < "$_main_path"
|
||||||
# Load settings
|
|
||||||
while read line; do
|
|
||||||
if echo "$line" | egrep -q "^\w+='"; then
|
|
||||||
line="$(echo "$line" | sed -r 's/[\r\n]+//')"
|
|
||||||
eval "$line"
|
|
||||||
fi
|
|
||||||
done < "$_main_path"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function copy_live_env() {
|
function copy_live_env() {
|
||||||
echo "Copying Archlinux files..."
|
echo "Copying Archlinux files..."
|
||||||
rsync -aI /usr/share/archiso/configs/releng/ "$LIVE_DIR/"
|
rsync -aI /usr/share/archiso/configs/releng/ "$LIVE_DIR/"
|
||||||
|
|
||||||
# Remove items
|
# Remove items
|
||||||
rm "$LIVE_DIR/airootfs/etc/systemd/scripts/choose-mirror"
|
rm "$LIVE_DIR/airootfs/etc/systemd/scripts/choose-mirror"
|
||||||
rmdir "$LIVE_DIR/airootfs/etc/systemd/scripts" --ignore-fail-on-non-empty
|
rmdir "$LIVE_DIR/airootfs/etc/systemd/scripts" --ignore-fail-on-non-empty
|
||||||
rm "$LIVE_DIR/airootfs/etc/systemd/system/choose-mirror.service"
|
rm "$LIVE_DIR/airootfs/etc/systemd/system/choose-mirror.service"
|
||||||
rm "$LIVE_DIR/airootfs/etc/systemd/system/etc-pacman.d-gnupg.mount"
|
rm "$LIVE_DIR/airootfs/etc/systemd/system/etc-pacman.d-gnupg.mount"
|
||||||
rm "$LIVE_DIR/airootfs/etc/systemd/system/pacman-init.service"
|
rm "$LIVE_DIR/airootfs/etc/systemd/system/pacman-init.service"
|
||||||
rm "$LIVE_DIR/airootfs/etc/udev/rules.d/81-dhcpcd.rules"
|
rm "$LIVE_DIR/airootfs/etc/udev/rules.d/81-dhcpcd.rules"
|
||||||
rmdir "$LIVE_DIR/airootfs/etc/udev/rules.d" --ignore-fail-on-non-empty
|
rmdir "$LIVE_DIR/airootfs/etc/udev/rules.d" --ignore-fail-on-non-empty
|
||||||
rmdir "$LIVE_DIR/airootfs/etc/udev" --ignore-fail-on-non-empty
|
rmdir "$LIVE_DIR/airootfs/etc/udev" --ignore-fail-on-non-empty
|
||||||
rm "$LIVE_DIR/isolinux"/*.cfg
|
rm "$LIVE_DIR/isolinux"/*.cfg
|
||||||
rm "$LIVE_DIR/syslinux"/*.cfg "$LIVE_DIR/syslinux"/*.png
|
rm "$LIVE_DIR/syslinux"/*.cfg "$LIVE_DIR/syslinux"/*.png
|
||||||
|
|
||||||
# Add items
|
# Add items
|
||||||
rsync -aI "$ROOT_DIR/setup/linux/include/" "$LIVE_DIR/"
|
rsync -aI "$ROOT_DIR/setup/linux/include/" "$LIVE_DIR/"
|
||||||
if [[ "${1:-}" != "--minimal" ]]; then
|
if [[ "${1:-}" != "--minimal" ]]; then
|
||||||
rsync -aI "$ROOT_DIR/setup/linux/include_x/" "$LIVE_DIR/"
|
rsync -aI "$ROOT_DIR/setup/linux/include_x/" "$LIVE_DIR/"
|
||||||
fi
|
fi
|
||||||
mkdir -p "$LIVE_DIR/airootfs/usr/local/bin"
|
mkdir -p "$LIVE_DIR/airootfs/usr/local/bin"
|
||||||
rsync -aI "$ROOT_DIR/scripts/" "$LIVE_DIR/airootfs/usr/local/bin/"
|
rsync -aI "$ROOT_DIR/scripts/" "$LIVE_DIR/airootfs/usr/local/bin/"
|
||||||
cp -a "$BUILD_DIR/main.py" "$LIVE_DIR/airootfs/usr/local/bin/wk/cfg/"
|
cp -a "$BUILD_DIR/main.py" "$LIVE_DIR/airootfs/usr/local/bin/wk/cfg/"
|
||||||
}
|
}
|
||||||
|
|
||||||
function run_elevated() {
|
function run_elevated() {
|
||||||
prog="$1"
|
prog="$1"
|
||||||
shift
|
shift
|
||||||
if which sudo >/dev/null 2>&1; then
|
if which sudo >/dev/null 2>&1; then
|
||||||
if ! sudo "$prog" $*; then
|
if ! sudo "$prog" $*; then
|
||||||
echo "ERROR: Failed to run '$prog'"
|
echo "ERROR: Failed to run '$prog'"
|
||||||
if ask "Retry?"; then
|
if ask "Retry?"; then
|
||||||
sudo "$prog" $*
|
sudo "$prog" $*
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo -n "Root "
|
|
||||||
if ! su -c "export REAL_USER=$USER && '$prog' $*"; then
|
|
||||||
echo "ERROR: Failed to run '$prog'"
|
|
||||||
if ask "Retry?"; then
|
|
||||||
su -c "export REAL_USER=$USER && '$prog' $*"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
echo -n "Root "
|
||||||
|
if ! su -c "export REAL_USER=$USER && '$prog' $*"; then
|
||||||
|
echo "ERROR: Failed to run '$prog'"
|
||||||
|
if ask "Retry?"; then
|
||||||
|
su -c "export REAL_USER=$USER && '$prog' $*"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function update_live_env() {
|
function update_live_env() {
|
||||||
hostname="$(echo "${KIT_NAME_SHORT}-linux" | tr "[:upper:]" "[:lower:]")"
|
hostname="$(echo "${KIT_NAME_SHORT}-linux" | tr "[:upper:]" "[:lower:]")"
|
||||||
username="tech"
|
username="tech"
|
||||||
label="${KIT_NAME_SHORT}_LINUX"
|
label="${KIT_NAME_SHORT}_LINUX"
|
||||||
|
|
||||||
# Boot config (legacy)
|
# Boot config (legacy)
|
||||||
mkdir -p "$LIVE_DIR/arch"
|
mkdir -p "$LIVE_DIR/arch"
|
||||||
cp "$ROOT_DIR/images/Pxelinux.png" "$LIVE_DIR/arch/pxelinux.png"
|
cp "$ROOT_DIR/images/Pxelinux.png" "$LIVE_DIR/arch/pxelinux.png"
|
||||||
cp "$ROOT_DIR/images/Syslinux.png" "$LIVE_DIR/arch/syslinux.png"
|
cp "$ROOT_DIR/images/Syslinux.png" "$LIVE_DIR/arch/syslinux.png"
|
||||||
sed -i -r "s/_+/$KIT_NAME_FULL/" "$LIVE_DIR/syslinux/wk_head.cfg"
|
sed -i -r "s/_+/$KIT_NAME_FULL/" "$LIVE_DIR/syslinux/wk_head.cfg"
|
||||||
mkdir -p "$TEMP_DIR" 2>/dev/null
|
mkdir -p "$TEMP_DIR" 2>/dev/null
|
||||||
curl -Lo "$TEMP_DIR/wimboot.zip" "http://git.ipxe.org/releases/wimboot/wimboot-latest.zip"
|
curl -Lo "$TEMP_DIR/wimboot.zip" "http://git.ipxe.org/releases/wimboot/wimboot-latest.zip"
|
||||||
7z e -aoa "$TEMP_DIR/wimboot.zip" -o"$LIVE_DIR/arch/boot" 'wimboot*/LICENSE.txt' 'wimboot*/README.txt' 'wimboot*/wimboot'
|
7z e -aoa "$TEMP_DIR/wimboot.zip" -o"$LIVE_DIR/arch/boot" 'wimboot*/LICENSE.txt' 'wimboot*/README.txt' 'wimboot*/wimboot'
|
||||||
|
|
||||||
# Boot config (UEFI)
|
# Boot config (UEFI)
|
||||||
mkdir -p "$LIVE_DIR/EFI/boot"
|
mkdir -p "$LIVE_DIR/EFI/boot"
|
||||||
cp "/usr/share/refind/refind_x64.efi" "$LIVE_DIR/EFI/boot/bootx64.efi"
|
cp "/usr/share/refind/refind_x64.efi" "$LIVE_DIR/EFI/boot/bootx64.efi"
|
||||||
cp "$ROOT_DIR/images/rEFInd.png" "$LIVE_DIR/EFI/boot/rEFInd.png"
|
cp "$ROOT_DIR/images/rEFInd.png" "$LIVE_DIR/EFI/boot/rEFInd.png"
|
||||||
rsync -aI "/usr/share/refind/drivers_x64/" "$LIVE_DIR/EFI/boot/drivers_x64/"
|
rsync -aI "/usr/share/refind/drivers_x64/" "$LIVE_DIR/EFI/boot/drivers_x64/"
|
||||||
rsync -aI "/usr/share/refind/icons/" "$LIVE_DIR/EFI/boot/icons/" --exclude "/usr/share/refind/icons/svg"
|
rsync -aI "/usr/share/refind/icons/" "$LIVE_DIR/EFI/boot/icons/" --exclude "/usr/share/refind/icons/svg"
|
||||||
sed -i "s/%ARCHISO_LABEL%/${label}/" "$LIVE_DIR/EFI/boot/refind.conf"
|
sed -i "s/%ARCHISO_LABEL%/${label}/" "$LIVE_DIR/EFI/boot/refind.conf"
|
||||||
|
|
||||||
# Customize_airootfs.sh
|
# Customize_airootfs.sh
|
||||||
sed -i -r 's/set -e -u/set -o errexit\nset -o errtrace\nset -o nounset\nset -o pipefail/' "$LIVE_DIR/airootfs/root/customize_airootfs.sh"
|
sed -i -r 's/set -e -u/set -o errexit\nset -o errtrace\nset -o nounset\nset -o pipefail/' "$LIVE_DIR/airootfs/root/customize_airootfs.sh"
|
||||||
|
|
||||||
# Memtest86
|
# Memtest86
|
||||||
mkdir -p "$LIVE_DIR/EFI/memtest86/Benchmark"
|
mkdir -p "$LIVE_DIR/EFI/memtest86/Benchmark"
|
||||||
mkdir -p "$TEMP_DIR/memtest86"
|
mkdir -p "$TEMP_DIR/memtest86"
|
||||||
curl -Lo "$TEMP_DIR/memtest86/memtest86-usb.zip" "https://www.memtest86.com/downloads/memtest86-usb.zip"
|
curl -Lo "$TEMP_DIR/memtest86/memtest86-usb.zip" "https://www.memtest86.com/downloads/memtest86-usb.zip"
|
||||||
7z e -aoa "$TEMP_DIR/memtest86/memtest86-usb.zip" -o"$TEMP_DIR/memtest86" "memtest86-usb.img"
|
7z e -aoa "$TEMP_DIR/memtest86/memtest86-usb.zip" -o"$TEMP_DIR/memtest86" "memtest86-usb.img"
|
||||||
7z e -aoa "$TEMP_DIR/memtest86/memtest86-usb.img" -o"$TEMP_DIR/memtest86" "MemTest86.img"
|
7z e -aoa "$TEMP_DIR/memtest86/memtest86-usb.img" -o"$TEMP_DIR/memtest86" "MemTest86.img"
|
||||||
7z x -aoa "$TEMP_DIR/memtest86/MemTest86.img" -o"$TEMP_DIR/memtest86"
|
7z x -aoa "$TEMP_DIR/memtest86/MemTest86.img" -o"$TEMP_DIR/memtest86"
|
||||||
rm "$TEMP_DIR/memtest86/EFI/BOOT/BOOTIA32.efi"
|
rm "$TEMP_DIR/memtest86/EFI/BOOT/BOOTIA32.efi"
|
||||||
mv "$TEMP_DIR/memtest86/EFI/BOOT/BOOTX64.efi" "$LIVE_DIR/EFI/memtest86/memtestx64.efi"
|
mv "$TEMP_DIR/memtest86/EFI/BOOT/BOOTX64.efi" "$LIVE_DIR/EFI/memtest86/memtestx64.efi"
|
||||||
mv "$TEMP_DIR/memtest86/EFI/BOOT"/* "$LIVE_DIR/EFI/memtest86"/
|
mv "$TEMP_DIR/memtest86/EFI/BOOT"/* "$LIVE_DIR/EFI/memtest86"/
|
||||||
mv "$TEMP_DIR/memtest86/help"/* "$LIVE_DIR/EFI/memtest86"/
|
mv "$TEMP_DIR/memtest86/help"/* "$LIVE_DIR/EFI/memtest86"/
|
||||||
mv "$TEMP_DIR/memtest86/license.rtf" "$LIVE_DIR/EFI/memtest86"/
|
mv "$TEMP_DIR/memtest86/license.rtf" "$LIVE_DIR/EFI/memtest86"/
|
||||||
|
|
||||||
# build.sh
|
# build.sh
|
||||||
if ! grep -iq 'wizardkit additions' "$LIVE_DIR/build.sh"; then
|
if ! grep -iq 'wizardkit additions' "$LIVE_DIR/build.sh"; then
|
||||||
sed -i -r 's/^(run_once make_iso)$/# wizardkit additions\n\1/' "$LIVE_DIR/build.sh"
|
sed -i -r 's/^(run_once make_iso)$/# wizardkit additions\n\1/' "$LIVE_DIR/build.sh"
|
||||||
sed -i '/# wizardkit additions/r .linux_items/build_additions.txt' "$LIVE_DIR/build.sh"
|
sed -i '/# wizardkit additions/r .linux_items/build_additions.txt' "$LIVE_DIR/build.sh"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Hostname
|
# Hostname
|
||||||
echo "$hostname" > "$LIVE_DIR/airootfs/etc/hostname"
|
echo "$hostname" > "$LIVE_DIR/airootfs/etc/hostname"
|
||||||
echo "127.0.1.1 $hostname.localdomain $hostname" >> "$LIVE_DIR/airootfs/etc/hosts"
|
echo "127.0.1.1 $hostname.localdomain $hostname" >> "$LIVE_DIR/airootfs/etc/hosts"
|
||||||
|
|
||||||
# Live packages
|
# Live packages
|
||||||
while read -r p; do
|
while read -r p; do
|
||||||
sed -i "/$p/d" "$LIVE_DIR/packages.x86_64"
|
sed -i "/$p/d" "$LIVE_DIR/packages.x86_64"
|
||||||
done < "$ROOT_DIR/setup/linux/packages/live_remove"
|
done < "$ROOT_DIR/setup/linux/packages/live_remove"
|
||||||
cat "$ROOT_DIR/setup/linux/packages/live_add" >> "$LIVE_DIR/packages.x86_64"
|
cat "$ROOT_DIR/setup/linux/packages/live_add" >> "$LIVE_DIR/packages.x86_64"
|
||||||
if [[ "${1:-}" == "--minimal" ]]; then
|
if [[ "${1:-}" == "--minimal" ]]; then
|
||||||
cat "$ROOT_DIR/setup/linux/packages/live_add_min" >> "$LIVE_DIR/packages.x86_64"
|
cat "$ROOT_DIR/setup/linux/packages/live_add_min" >> "$LIVE_DIR/packages.x86_64"
|
||||||
else
|
else
|
||||||
cat "$ROOT_DIR/setup/linux/packages/live_add_x" >> "$LIVE_DIR/packages.x86_64"
|
cat "$ROOT_DIR/setup/linux/packages/live_add_x" >> "$LIVE_DIR/packages.x86_64"
|
||||||
fi
|
fi
|
||||||
echo "[custom]" >> "$LIVE_DIR/pacman.conf"
|
echo "[custom]" >> "$LIVE_DIR/pacman.conf"
|
||||||
echo "SigLevel = Optional TrustAll" >> "$LIVE_DIR/pacman.conf"
|
echo "SigLevel = Optional TrustAll" >> "$LIVE_DIR/pacman.conf"
|
||||||
echo "Server = file://$REPO_DIR" >> "$LIVE_DIR/pacman.conf"
|
echo "Server = file://$REPO_DIR" >> "$LIVE_DIR/pacman.conf"
|
||||||
echo "" >> "$LIVE_DIR/pacman.conf"
|
echo "" >> "$LIVE_DIR/pacman.conf"
|
||||||
|
|
||||||
# Mirrors
|
# Mirrors
|
||||||
sed -i -r 's/^(.*mirrorlist.*)$/#NOPE#\1/' "$LIVE_DIR/airootfs/root/customize_airootfs.sh"
|
sed -i -r 's/^(.*mirrorlist.*)$/#NOPE#\1/' "$LIVE_DIR/airootfs/root/customize_airootfs.sh"
|
||||||
echo "curl -o '/etc/pacman.d/mirrorlist' '$MIRRORLIST_SOURCE'" >> "$LIVE_DIR/airootfs/root/customize_airootfs.sh"
|
echo "curl -o '/etc/pacman.d/mirrorlist' '$MIRRORLIST_SOURCE'" >> "$LIVE_DIR/airootfs/root/customize_airootfs.sh"
|
||||||
echo "sed -i 's/#Server/Server/g' /etc/pacman.d/mirrorlist" >> "$LIVE_DIR/airootfs/root/customize_airootfs.sh"
|
echo "sed -i 's/#Server/Server/g' /etc/pacman.d/mirrorlist" >> "$LIVE_DIR/airootfs/root/customize_airootfs.sh"
|
||||||
|
|
||||||
# MOTD
|
# MOTD
|
||||||
sed -i -r "s/_+/$KIT_NAME_FULL Linux Environment/" "$LIVE_DIR/airootfs/etc/motd"
|
sed -i -r "s/_+/$KIT_NAME_FULL Linux Environment/" "$LIVE_DIR/airootfs/etc/motd"
|
||||||
|
|
||||||
# Oh My ZSH
|
# Oh My ZSH
|
||||||
git clone --depth=1 https://github.com/robbyrussell/oh-my-zsh.git "$SKEL_DIR/.oh-my-zsh"
|
git clone --depth=1 https://github.com/robbyrussell/oh-my-zsh.git "$SKEL_DIR/.oh-my-zsh"
|
||||||
rm -Rf "$SKEL_DIR/.oh-my-zsh/.git"
|
rm -Rf "$SKEL_DIR/.oh-my-zsh/.git"
|
||||||
curl -o "$SKEL_DIR/.oh-my-zsh/themes/lean.zsh-theme" https://raw.githubusercontent.com/miekg/lean/master/prompt_lean_setup
|
curl -o "$SKEL_DIR/.oh-my-zsh/themes/lean.zsh-theme" https://raw.githubusercontent.com/miekg/lean/master/prompt_lean_setup
|
||||||
|
|
||||||
if [[ "${1:-}" != "--minimal" ]]; then
|
if [[ "${1:-}" != "--minimal" ]]; then
|
||||||
# Openbox theme
|
# Openbox theme
|
||||||
git clone --depth=1 https://github.com/addy-dclxvi/Openbox-Theme-Collections.git "$TEMP_DIR/ob-themes"
|
git clone --depth=1 https://github.com/addy-dclxvi/Openbox-Theme-Collections.git "$TEMP_DIR/ob-themes"
|
||||||
mkdir -p "$LIVE_DIR/airootfs/usr/share/themes"
|
mkdir -p "$LIVE_DIR/airootfs/usr/share/themes"
|
||||||
cp -a "$TEMP_DIR/ob-themes/Triste-Orange" "$LIVE_DIR/airootfs/usr/share/themes/"
|
cp -a "$TEMP_DIR/ob-themes/Triste-Orange" "$LIVE_DIR/airootfs/usr/share/themes/"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Services
|
# Services
|
||||||
sed -i -r 's/^(.*pacman-init.*)$/#NOPE#\1/' "$LIVE_DIR/airootfs/root/customize_airootfs.sh"
|
sed -i -r 's/^(.*pacman-init.*)$/#NOPE#\1/' "$LIVE_DIR/airootfs/root/customize_airootfs.sh"
|
||||||
sed -i -r 's/^(.*choose-mirror.*)$/#NOPE#\1/' "$LIVE_DIR/airootfs/root/customize_airootfs.sh"
|
sed -i -r 's/^(.*choose-mirror.*)$/#NOPE#\1/' "$LIVE_DIR/airootfs/root/customize_airootfs.sh"
|
||||||
|
|
||||||
# Shutdown stall fix
|
# Shutdown stall fix
|
||||||
echo "sed -i -r 's/^.*(DefaultTimeoutStartSec)=.*$/\1=15s/' /etc/systemd/system.conf" >> "$LIVE_DIR/airootfs/root/customize_airootfs.sh"
|
echo "sed -i -r 's/^.*(DefaultTimeoutStartSec)=.*$/\1=15s/' /etc/systemd/system.conf" >> "$LIVE_DIR/airootfs/root/customize_airootfs.sh"
|
||||||
echo "sed -i -r 's/^.*(DefaultTimeoutStopSec)=.*$/\1=15s/' /etc/systemd/system.conf" >> "$LIVE_DIR/airootfs/root/customize_airootfs.sh"
|
echo "sed -i -r 's/^.*(DefaultTimeoutStopSec)=.*$/\1=15s/' /etc/systemd/system.conf" >> "$LIVE_DIR/airootfs/root/customize_airootfs.sh"
|
||||||
|
|
||||||
# SSH
|
# SSH
|
||||||
mkdir -p "$SKEL_DIR/.ssh"
|
mkdir -p "$SKEL_DIR/.ssh"
|
||||||
ssh-keygen -b 4096 -C "$username@$hostname" -N "" -f "$SKEL_DIR/.ssh/id_rsa"
|
ssh-keygen -b 4096 -C "$username@$hostname" -N "" -f "$SKEL_DIR/.ssh/id_rsa"
|
||||||
echo 'rm /root/.ssh/id*' >> "$LIVE_DIR/airootfs/root/customize_airootfs.sh"
|
echo 'rm /root/.ssh/id*' >> "$LIVE_DIR/airootfs/root/customize_airootfs.sh"
|
||||||
echo 'rm /root/.zlogin' >> "$LIVE_DIR/airootfs/root/customize_airootfs.sh"
|
echo 'rm /root/.zlogin' >> "$LIVE_DIR/airootfs/root/customize_airootfs.sh"
|
||||||
sed -i -r '/.*PermitRootLogin.*/d' "$LIVE_DIR/airootfs/root/customize_airootfs.sh"
|
sed -i -r '/.*PermitRootLogin.*/d' "$LIVE_DIR/airootfs/root/customize_airootfs.sh"
|
||||||
echo "sed -i -r '/.*PermitRootLogin.*/d' /etc/ssh/sshd_config" >> "$LIVE_DIR/airootfs/root/customize_airootfs.sh"
|
echo "sed -i -r '/.*PermitRootLogin.*/d' /etc/ssh/sshd_config" >> "$LIVE_DIR/airootfs/root/customize_airootfs.sh"
|
||||||
cp "$ROOT_DIR/setup/linux/authorized_keys" "$SKEL_DIR/.ssh/authorized_keys"
|
cp "$ROOT_DIR/setup/linux/authorized_keys" "$SKEL_DIR/.ssh/authorized_keys"
|
||||||
|
|
||||||
# Root user
|
# Root user
|
||||||
echo "echo 'root:$ROOT_PASSWORD' | chpasswd" >> "$LIVE_DIR/airootfs/root/customize_airootfs.sh"
|
echo "echo 'root:$ROOT_PASSWORD' | chpasswd" >> "$LIVE_DIR/airootfs/root/customize_airootfs.sh"
|
||||||
|
|
||||||
# Sudo
|
# Sudo
|
||||||
echo "echo '%wheel ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers" >> "$LIVE_DIR/airootfs/root/customize_airootfs.sh"
|
echo "echo '%wheel ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers" >> "$LIVE_DIR/airootfs/root/customize_airootfs.sh"
|
||||||
|
|
||||||
# Tech user
|
# Tech user
|
||||||
echo "groupadd -r autologin" >> "$LIVE_DIR/airootfs/root/customize_airootfs.sh"
|
echo "groupadd -r autologin" >> "$LIVE_DIR/airootfs/root/customize_airootfs.sh"
|
||||||
echo "useradd -m -s /bin/zsh -G autologin,power,storage,wheel -U $username" >> "$LIVE_DIR/airootfs/root/customize_airootfs.sh"
|
echo "useradd -m -s /bin/zsh -G autologin,power,storage,wheel -U $username" >> "$LIVE_DIR/airootfs/root/customize_airootfs.sh"
|
||||||
echo "echo '$username:$TECH_PASSWORD' | chpasswd" >> "$LIVE_DIR/airootfs/root/customize_airootfs.sh"
|
echo "echo '$username:$TECH_PASSWORD' | chpasswd" >> "$LIVE_DIR/airootfs/root/customize_airootfs.sh"
|
||||||
|
|
||||||
# Tech user autologin
|
# Tech user autologin
|
||||||
mkdir -p "$LIVE_DIR/airootfs/etc/systemd/system/getty@tty1.service.d"
|
mkdir -p "$LIVE_DIR/airootfs/etc/systemd/system/getty@tty1.service.d"
|
||||||
echo "[Service]" > "$LIVE_DIR/airootfs/etc/systemd/system/getty@tty1.service.d/autologin.conf"
|
echo "[Service]" > "$LIVE_DIR/airootfs/etc/systemd/system/getty@tty1.service.d/autologin.conf"
|
||||||
echo "ExecStart=" >> "$LIVE_DIR/airootfs/etc/systemd/system/getty@tty1.service.d/autologin.conf"
|
echo "ExecStart=" >> "$LIVE_DIR/airootfs/etc/systemd/system/getty@tty1.service.d/autologin.conf"
|
||||||
echo "ExecStart=-/sbin/agetty --autologin $username --noclear %I 38400 linux" >> "$LIVE_DIR/airootfs/etc/systemd/system/getty@tty1.service.d/autologin.conf"
|
echo "ExecStart=-/sbin/agetty --autologin $username --noclear %I 38400 linux" >> "$LIVE_DIR/airootfs/etc/systemd/system/getty@tty1.service.d/autologin.conf"
|
||||||
|
|
||||||
# Timezone
|
# Timezone
|
||||||
echo "ln -sf '/usr/share/zoneinfo/$LINUX_TIME_ZONE' '/etc/localtime'" >> "$LIVE_DIR/airootfs/root/customize_airootfs.sh"
|
echo "ln -sf '/usr/share/zoneinfo/$LINUX_TIME_ZONE' '/etc/localtime'" >> "$LIVE_DIR/airootfs/root/customize_airootfs.sh"
|
||||||
echo 'sed -i "s/#FallbackNTP/NTP/" /etc/systemd/timesyncd.conf' >> "$LIVE_DIR/airootfs/root/customize_airootfs.sh"
|
echo 'sed -i "s/#FallbackNTP/NTP/" /etc/systemd/timesyncd.conf' >> "$LIVE_DIR/airootfs/root/customize_airootfs.sh"
|
||||||
|
|
||||||
# udevil fix
|
# udevil fix
|
||||||
echo "mkdir /media" >> "$LIVE_DIR/airootfs/root/customize_airootfs.sh"
|
echo "mkdir /media" >> "$LIVE_DIR/airootfs/root/customize_airootfs.sh"
|
||||||
|
|
||||||
if [[ "${1:-}" != "--minimal" ]]; then
|
if [[ "${1:-}" != "--minimal" ]]; then
|
||||||
# VNC password
|
# VNC password
|
||||||
echo "mkdir '/home/$username/.vnc'" >> "$LIVE_DIR/airootfs/root/customize_airootfs.sh"
|
echo "mkdir '/home/$username/.vnc'" >> "$LIVE_DIR/airootfs/root/customize_airootfs.sh"
|
||||||
echo "echo '$TECH_PASSWORD' | vncpasswd -f > '/home/$username/.vnc/passwd'" >> "$LIVE_DIR/airootfs/root/customize_airootfs.sh"
|
echo "echo '$TECH_PASSWORD' | vncpasswd -f > '/home/$username/.vnc/passwd'" >> "$LIVE_DIR/airootfs/root/customize_airootfs.sh"
|
||||||
|
|
||||||
# Wallpaper
|
# Wallpaper
|
||||||
mkdir -p "$LIVE_DIR/airootfs/usr/share/wallpaper"
|
mkdir -p "$LIVE_DIR/airootfs/usr/share/wallpaper"
|
||||||
cp "$ROOT_DIR/images/Linux.png" "$LIVE_DIR/airootfs/usr/share/wallpaper/burned.in"
|
cp "$ROOT_DIR/images/Linux.png" "$LIVE_DIR/airootfs/usr/share/wallpaper/burned.in"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# WiFi
|
# WiFi
|
||||||
cp "$ROOT_DIR/setup/linux/known_networks" "$LIVE_DIR/airootfs/root/known_networks"
|
cp "$ROOT_DIR/setup/linux/known_networks" "$LIVE_DIR/airootfs/root/known_networks"
|
||||||
echo "add-known-networks --user=$username" >> "$LIVE_DIR/airootfs/root/customize_airootfs.sh"
|
echo "add-known-networks --user=$username" >> "$LIVE_DIR/airootfs/root/customize_airootfs.sh"
|
||||||
}
|
}
|
||||||
|
|
||||||
function update_repo() {
|
function update_repo() {
|
||||||
if [[ "$EUID" -eq 0 ]]; then
|
if [[ "$EUID" -eq 0 ]]; then
|
||||||
echo "This section not meant to be run as root."
|
echo "This section not meant to be run as root."
|
||||||
echo "Aborted."
|
echo "Aborted."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
echo "Updating custom repo..."
|
echo "Updating custom repo..."
|
||||||
|
|
||||||
# Archive current files
|
# Archive current files
|
||||||
if [[ -d "$REPO_DIR" ]]; then
|
if [[ -d "$REPO_DIR" ]]; then
|
||||||
mkdir -p "$BUILD_DIR/Archive" 2>/dev/null
|
mkdir -p "$BUILD_DIR/Archive" 2>/dev/null
|
||||||
archive="$BUILD_DIR/Archive/$(date "+%F_%H%M%S")"
|
archive="$BUILD_DIR/Archive/$(date "+%F_%H%M%S")"
|
||||||
mv -bv "$REPO_DIR" "$archive"
|
mv -bv "$REPO_DIR" "$archive"
|
||||||
fi
|
fi
|
||||||
sleep 1s
|
sleep 1s
|
||||||
|
|
||||||
# Build custom repo packages
|
# Build custom repo packages
|
||||||
mkdir -p "$REPO_DIR" 2>/dev/null
|
mkdir -p "$REPO_DIR" 2>/dev/null
|
||||||
mkdir -p "$TEMP_DIR" 2>/dev/null
|
mkdir -p "$TEMP_DIR" 2>/dev/null
|
||||||
pushd "$TEMP_DIR" >/dev/null
|
pushd "$TEMP_DIR" >/dev/null
|
||||||
while read -r p; do
|
while read -r p; do
|
||||||
echo "Building: $p"
|
echo "Building: $p"
|
||||||
curl -LsfO https://aur.archlinux.org/cgit/aur.git/snapshot/$p.tar.gz
|
curl -LsfO https://aur.archlinux.org/cgit/aur.git/snapshot/$p.tar.gz
|
||||||
tar xf $p.tar.gz
|
tar xf $p.tar.gz
|
||||||
pushd $p >/dev/null
|
pushd $p >/dev/null
|
||||||
makepkg -d
|
makepkg -d
|
||||||
popd >/dev/null
|
|
||||||
mv -n $p/*xz "$REPO_DIR"/
|
|
||||||
done < "$ROOT_DIR/setup/linux/packages/aur"
|
|
||||||
popd >/dev/null
|
popd >/dev/null
|
||||||
|
mv -n $p/*xz "$REPO_DIR"/
|
||||||
|
done < "$ROOT_DIR/setup/linux/packages/aur"
|
||||||
|
popd >/dev/null
|
||||||
|
|
||||||
# Build custom repo database
|
# Build custom repo database
|
||||||
pushd "$REPO_DIR" >/dev/null
|
pushd "$REPO_DIR" >/dev/null
|
||||||
repo-add custom.db.tar.gz *xz
|
repo-add custom.db.tar.gz *xz
|
||||||
popd >/dev/null
|
popd >/dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
function install_deps() {
|
function install_deps() {
|
||||||
echo "Installing dependencies..."
|
echo "Installing dependencies..."
|
||||||
packages=
|
packages=
|
||||||
while read -r line; do
|
while read -r line; do
|
||||||
packages="$packages $line"
|
packages="$packages $line"
|
||||||
done < "$ROOT_DIR/setup/linux/packages/dependencies"
|
done < "$ROOT_DIR/setup/linux/packages/dependencies"
|
||||||
run_elevated pacman -Syu --needed --noconfirm $packages
|
run_elevated pacman -Syu --needed --noconfirm $packages
|
||||||
}
|
}
|
||||||
|
|
||||||
function build_all() {
|
function build_all() {
|
||||||
if [[ "$EUID" -ne 0 ]]; then
|
if [[ "$EUID" -ne 0 ]]; then
|
||||||
echo "This section is meant to be run as root."
|
echo "This section is meant to be run as root."
|
||||||
echo "Aborted."
|
echo "Aborted."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Prep for build
|
# Prep for build
|
||||||
cleanup
|
cleanup
|
||||||
fix_kit_permissions
|
fix_kit_permissions
|
||||||
install_deps
|
install_deps
|
||||||
load_settings --edit
|
load_settings --edit
|
||||||
update_repo
|
update_repo
|
||||||
|
|
||||||
# Build (full)
|
# Build (full)
|
||||||
copy_live_env
|
copy_live_env
|
||||||
update_live_env
|
update_live_env
|
||||||
# Rerun script as root to start Archiso build process
|
# Rerun script as root to start Archiso build process
|
||||||
run_elevated "$(realpath "$0")" --build-iso
|
run_elevated "$(realpath "$0")" --build-iso
|
||||||
# Cleanup
|
# Cleanup
|
||||||
mv -nv "$LIVE_DIR" "${LIVE_DIR}.full"
|
mv -nv "$LIVE_DIR" "${LIVE_DIR}.full"
|
||||||
perl-rename -v "s/(${KIT_NAME_SHORT}-Linux)-(${DATE}.*)/\1-Full-\2/" "$OUT_DIR"/*
|
perl-rename -v "s/(${KIT_NAME_SHORT}-Linux)-(${DATE}.*)/\1-Full-\2/" "$OUT_DIR"/*
|
||||||
|
|
||||||
# Build (minimal)
|
# Build (minimal)
|
||||||
copy_live_env --minimal
|
copy_live_env --minimal
|
||||||
update_live_env --minimal
|
update_live_env --minimal
|
||||||
# Rerun script as root to start Archiso build process
|
# Rerun script as root to start Archiso build process
|
||||||
run_elevated "$(realpath "$0")" --build-iso
|
run_elevated "$(realpath "$0")" --build-iso
|
||||||
# Cleanup
|
# Cleanup
|
||||||
mv -nv "$LIVE_DIR" "${LIVE_DIR}.minimal"
|
mv -nv "$LIVE_DIR" "${LIVE_DIR}.minimal"
|
||||||
perl-rename -v "s/(${KIT_NAME_SHORT}-Linux)-(${DATE}.*)/\1-Minimal-\2/" "$OUT_DIR"/*
|
perl-rename -v "s/(${KIT_NAME_SHORT}-Linux)-(${DATE}.*)/\1-Minimal-\2/" "$OUT_DIR"/*
|
||||||
}
|
}
|
||||||
|
|
||||||
function build_iso() {
|
function build_iso() {
|
||||||
if [[ "$EUID" -ne 0 ]]; then
|
if [[ "$EUID" -ne 0 ]]; then
|
||||||
echo "This section is meant to be run as root."
|
echo "This section is meant to be run as root."
|
||||||
echo "Aborted."
|
echo "Aborted."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Set permissions
|
# Set permissions
|
||||||
echo "Setting permissions..."
|
echo "Setting permissions..."
|
||||||
chown root:root "$LIVE_DIR" -R
|
chown root:root "$LIVE_DIR" -R
|
||||||
chmod 700 "$LIVE_DIR/airootfs/etc/skel/.ssh"
|
chmod 700 "$LIVE_DIR/airootfs/etc/skel/.ssh"
|
||||||
chmod 600 "$LIVE_DIR/airootfs/etc/skel/.ssh/id_rsa"
|
chmod 600 "$LIVE_DIR/airootfs/etc/skel/.ssh/id_rsa"
|
||||||
|
|
||||||
# Removing cached (and possibly outdated) custom repo packages
|
# Removing cached (and possibly outdated) custom repo packages
|
||||||
for package in $(cat "$ROOT_DIR/setup/linux/packages/aur"); do
|
for package in $(cat "$ROOT_DIR/setup/linux/packages/aur"); do
|
||||||
for p in /var/cache/pacman/pkg/*${package}*; do
|
for p in /var/cache/pacman/pkg/*${package}*; do
|
||||||
if [[ -f "${p}" ]]; then
|
if [[ -f "${p}" ]]; then
|
||||||
rm "${p}"
|
rm "${p}"
|
||||||
fi
|
fi
|
||||||
done
|
|
||||||
done
|
done
|
||||||
|
done
|
||||||
|
|
||||||
# Build ISO
|
# Build ISO
|
||||||
prefix="${KIT_NAME_SHORT}-Linux"
|
prefix="${KIT_NAME_SHORT}-Linux"
|
||||||
label="${KIT_NAME_SHORT}_LINUX"
|
label="${KIT_NAME_SHORT}_LINUX"
|
||||||
"$LIVE_DIR/build.sh" -N "$prefix" -V "$DATE" -L "$label" -w "$TEMP_DIR/Linux" -o "$OUT_DIR" -v | tee -a "$LOG_DIR/$DATETIME.log"
|
"$LIVE_DIR/build.sh" -N "$prefix" -V "$DATE" -L "$label" -w "$TEMP_DIR/Linux" -o "$OUT_DIR" -v | tee -a "$LOG_DIR/$DATETIME.log"
|
||||||
|
|
||||||
# Cleanup
|
# Cleanup
|
||||||
echo "Removing temp files..."
|
echo "Removing temp files..."
|
||||||
rm "$TEMP_DIR/Linux" -Rf | tee -a "$LOG_DIR/$DATETIME.log"
|
rm "$TEMP_DIR/Linux" -Rf | tee -a "$LOG_DIR/$DATETIME.log"
|
||||||
|
|
||||||
echo "Reverting permissions..."
|
echo "Reverting permissions..."
|
||||||
chown $REAL_USER:$REAL_USER "$LIVE_DIR" -R
|
chown $REAL_USER:$REAL_USER "$LIVE_DIR" -R
|
||||||
chown $REAL_USER:$REAL_USER "$OUT_DIR" -R
|
chown $REAL_USER:$REAL_USER "$OUT_DIR" -R
|
||||||
}
|
}
|
||||||
|
|
||||||
function build_full() {
|
function build_full() {
|
||||||
if [[ "$EUID" -eq 0 ]]; then
|
if [[ "$EUID" -eq 0 ]]; then
|
||||||
echo "This section not meant to be run as root."
|
echo "This section not meant to be run as root."
|
||||||
echo "Aborted."
|
echo "Aborted."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Prep for build
|
# Prep for build
|
||||||
cleanup
|
cleanup
|
||||||
fix_kit_permissions
|
fix_kit_permissions
|
||||||
install_deps
|
install_deps
|
||||||
load_settings --edit
|
load_settings --edit
|
||||||
update_repo
|
update_repo
|
||||||
copy_live_env
|
copy_live_env
|
||||||
update_live_env
|
update_live_env
|
||||||
# Rerun script as root to start Archiso build process
|
# Rerun script as root to start Archiso build process
|
||||||
run_elevated "$(realpath "$0")" --build-iso
|
run_elevated "$(realpath "$0")" --build-iso
|
||||||
# Cleanup
|
# Cleanup
|
||||||
perl-rename -v "s/(${KIT_NAME_SHORT}-Linux)-(${DATE}.*)/\1-Full-\2/" "$OUT_DIR"/*
|
perl-rename -v "s/(${KIT_NAME_SHORT}-Linux)-(${DATE}.*)/\1-Full-\2/" "$OUT_DIR"/*
|
||||||
}
|
}
|
||||||
|
|
||||||
function build_minimal() {
|
function build_minimal() {
|
||||||
if [[ "$EUID" -eq 0 ]]; then
|
if [[ "$EUID" -eq 0 ]]; then
|
||||||
echo "This section not meant to be run as root."
|
echo "This section not meant to be run as root."
|
||||||
echo "Aborted."
|
echo "Aborted."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Prep for build
|
# Prep for build
|
||||||
cleanup
|
cleanup
|
||||||
fix_kit_permissions
|
fix_kit_permissions
|
||||||
install_deps
|
install_deps
|
||||||
load_settings --edit
|
load_settings --edit
|
||||||
update_repo
|
update_repo
|
||||||
copy_live_env --minimal
|
copy_live_env --minimal
|
||||||
update_live_env --minimal
|
update_live_env --minimal
|
||||||
# Rerun script as root to start Archiso build process
|
# Rerun script as root to start Archiso build process
|
||||||
run_elevated "$(realpath "$0")" --build-iso
|
run_elevated "$(realpath "$0")" --build-iso
|
||||||
# Cleanup
|
# Cleanup
|
||||||
perl-rename -v "s/(${KIT_NAME_SHORT}-Linux)-(${DATE}.*)/\1-Minimal-\2/" "$OUT_DIR"/*
|
perl-rename -v "s/(${KIT_NAME_SHORT}-Linux)-(${DATE}.*)/\1-Minimal-\2/" "$OUT_DIR"/*
|
||||||
}
|
}
|
||||||
|
|
||||||
# Check input
|
# Check input
|
||||||
case ${1:-} in
|
case ${1:-} in
|
||||||
-a|--build-all)
|
-a|--build-all)
|
||||||
build_all
|
build_all
|
||||||
echo Done
|
echo Done
|
||||||
;;
|
;;
|
||||||
|
|
||||||
-b|--build-full)
|
-b|--build-full)
|
||||||
build_full
|
build_full
|
||||||
echo Done
|
echo Done
|
||||||
;;
|
;;
|
||||||
|
|
||||||
-f|--fix-perms)
|
-f|--fix-perms)
|
||||||
fix_kit_permissions
|
fix_kit_permissions
|
||||||
echo Done
|
echo Done
|
||||||
;;
|
;;
|
||||||
|
|
||||||
-i|--install-deps)
|
-i|--install-deps)
|
||||||
install_deps
|
install_deps
|
||||||
echo Done
|
echo Done
|
||||||
;;
|
;;
|
||||||
|
|
||||||
-m|--prep-minimal-env)
|
-m|--prep-minimal-env)
|
||||||
load_settings --edit
|
load_settings --edit
|
||||||
copy_live_env --minimal
|
copy_live_env --minimal
|
||||||
update_live_env --minimal
|
update_live_env --minimal
|
||||||
echo Done
|
echo Done
|
||||||
;;
|
;;
|
||||||
|
|
||||||
-o|--build-iso)
|
-o|--build-iso)
|
||||||
load_settings
|
load_settings
|
||||||
build_iso
|
build_iso
|
||||||
echo Done
|
echo Done
|
||||||
;;
|
;;
|
||||||
|
|
||||||
-p|--prep-live-env)
|
-p|--prep-live-env)
|
||||||
load_settings --edit
|
load_settings --edit
|
||||||
copy_live_env
|
copy_live_env
|
||||||
update_live_env
|
update_live_env
|
||||||
echo Done
|
echo Done
|
||||||
;;
|
;;
|
||||||
|
|
||||||
-u|--update-repo)
|
-u|--update-repo)
|
||||||
update_repo
|
update_repo
|
||||||
echo Done
|
echo Done
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
echo "Usage: $(basename "$0") [OPTIONS]"
|
echo "Usage: $(basename "$0") [OPTIONS]"
|
||||||
echo ""
|
echo ""
|
||||||
echo "Options:"
|
echo "Options:"
|
||||||
echo " -a --build-all Perform all tasks to build all isos"
|
echo " -a --build-all Perform all tasks to build all isos"
|
||||||
echo " -b --build-full Perform all tasks to build the full iso"
|
echo " -b --build-full Perform all tasks to build the full iso"
|
||||||
echo " -m --build-minimal Perform all tasks to build the minimal iso"
|
echo " -m --build-minimal Perform all tasks to build the minimal iso"
|
||||||
echo " -h --help Show usage"
|
echo " -h --help Show usage"
|
||||||
echo ""
|
echo ""
|
||||||
echo "Advanced options:"
|
echo "Advanced options:"
|
||||||
echo " -f --fix-perms Fix folder permissions"
|
echo " -f --fix-perms Fix folder permissions"
|
||||||
echo " -i --install-deps Install build dependencies"
|
echo " -i --install-deps Install build dependencies"
|
||||||
echo " -n --prep-minimal-env Prep live & airootfs folders (minimal packages)"
|
echo " -n --prep-minimal-env Prep live & airootfs folders (minimal packages)"
|
||||||
echo " -o --build-iso Build ISO (using current setup)"
|
echo " -o --build-iso Build ISO (using current setup)"
|
||||||
echo " -p --prep-live-env Prep live & airootfs folders"
|
echo " -p --prep-live-env Prep live & airootfs folders"
|
||||||
echo " -u --update-repo Update custom pacman repo"
|
echo " -u --update-repo Update custom pacman repo"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,9 +36,9 @@ rem Edited by: https://stackoverflow.com/users/330315/a-horse-with-no-name
|
||||||
rem Answer by: https://stackoverflow.com/users/3198799/and31415
|
rem Answer by: https://stackoverflow.com/users/3198799/and31415
|
||||||
fsutil dirty query %systemdrive% >nul
|
fsutil dirty query %systemdrive% >nul
|
||||||
if %errorlevel% neq 0 (
|
if %errorlevel% neq 0 (
|
||||||
call :RequestElevation
|
call :RequestElevation
|
||||||
rem reset errorlevel to 1 to abort the current non-elevated script
|
rem reset errorlevel to 1 to abort the current non-elevated script
|
||||||
color 00
|
color 00
|
||||||
)
|
)
|
||||||
@exit /b %errorlevel%
|
@exit /b %errorlevel%
|
||||||
|
|
||||||
|
|
@ -46,7 +46,7 @@ if %errorlevel% neq 0 (
|
||||||
rem Loops through all arguments to check for accepted flags
|
rem Loops through all arguments to check for accepted flags
|
||||||
set DEBUG=
|
set DEBUG=
|
||||||
for %%f in (%*) do (
|
for %%f in (%*) do (
|
||||||
if /i "%%f" == "/DEBUG" (@echo on & set "DEBUG=/DEBUG")
|
if /i "%%f" == "/DEBUG" (@echo on & set "DEBUG=/DEBUG")
|
||||||
)
|
)
|
||||||
@exit /b 0
|
@exit /b 0
|
||||||
|
|
||||||
|
|
@ -59,12 +59,12 @@ rem Check registry for WADK
|
||||||
set "r_path=HKLM\Software\Wow6432Node\Microsoft\Windows Kits\Installed Roots"
|
set "r_path=HKLM\Software\Wow6432Node\Microsoft\Windows Kits\Installed Roots"
|
||||||
reg query "%r_path%" /v %r_vname% >nul 2>&1 && set "found=True"
|
reg query "%r_path%" /v %r_vname% >nul 2>&1 && set "found=True"
|
||||||
if not defined found (
|
if not defined found (
|
||||||
rem 32-bit systems?
|
rem 32-bit systems?
|
||||||
set "r_path=HKLM\Software\Microsoft\Windows Kits\Installed Roots"
|
set "r_path=HKLM\Software\Microsoft\Windows Kits\Installed Roots"
|
||||||
reg query "!r_path!" /v %r_vname% >nul 2>&1 && set "found=True"
|
reg query "!r_path!" /v %r_vname% >nul 2>&1 && set "found=True"
|
||||||
)
|
)
|
||||||
for /f "skip=2 tokens=2*" %%i in ('reg query "%r_path%" /v %r_vname%') do (
|
for /f "skip=2 tokens=2*" %%i in ('reg query "%r_path%" /v %r_vname%') do (
|
||||||
set adk_root=%%j\Assessment and Deployment Kit
|
set adk_root=%%j\Assessment and Deployment Kit
|
||||||
)
|
)
|
||||||
rem Set errorlevel if necessary
|
rem Set errorlevel if necessary
|
||||||
if not defined adk_root color 00
|
if not defined adk_root color 00
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ goto Exit
|
||||||
rem Loops through all arguments to check for accepted flags
|
rem Loops through all arguments to check for accepted flags
|
||||||
set DEBUG=
|
set DEBUG=
|
||||||
for %%f in (%*) do (
|
for %%f in (%*) do (
|
||||||
if /i "%%f" == "/DEBUG" (@echo on & set "DEBUG=/DEBUG")
|
if /i "%%f" == "/DEBUG" (@echo on & set "DEBUG=/DEBUG")
|
||||||
)
|
)
|
||||||
@exit /b 0
|
@exit /b 0
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue