support options to build

This commit is contained in:
slore 2019-11-08 01:01:53 +08:00
parent 51f3724613
commit 50217139d9
8 changed files with 100 additions and 8 deletions

View File

@ -2,6 +2,9 @@
cd /d "%~dp0"
title WimBuilder(%cd%)
if /i "x%1"=="x-h" goto :SHOW_HELP
if /i "x%1"=="x--help" goto :SHOW_HELP
set "WB_ROOT=%cd%"
if "x%WB_ROOT:~-1%"=="x\" set WB_ROOT=%WB_ROOT:~0,-1%
@ -79,6 +82,9 @@ rem ========================
set "V=%WB_ROOT%\vendor"
call :PARSE_OPTIONS %*
rem set WB_OPT_
rem mount winre.wim/boot.wim with wimlib, otherwise dism
set USE_WIMLIB=0
if not "%PROCESSOR_ARCHITECTURE%"=="AMD64" goto :Normal_Start
@ -88,3 +94,43 @@ goto :EOF
:Normal_Start
start WimBuilder_UI.hta %*
goto :EOF
:SHOW_HELP
echo Usage: %~nx0 [-h^|--help] [^<Options^>...]
echo.
echo ^<Options^>
echo --verbose
echo --build^|--build-with-log
echo --project {name}
echo --preset {preset}
echo --make-iso
rem echo --close-ui
echo.
goto :EOF
:PARSE_OPTIONS
if /i "x%1"=="x" goto :EOF
if /i "x%1"=="x--build" (
set WB_OPT_BUILD=CMD
) else if /i "x%1"=="x--build-with-log" (
set WB_OPT_BUILD=LOG
) else if /i "x%1"=="x--verbose" (
set WB_OPT_VERBOSE=1
) else if /i "x%1"=="x--project" (
set WB_OPT_PROJECT=%2
SHIFT
) else if /i "x%1"=="x--preset" (
set WB_OPT_PRESET=%2
SHIFT
) else if /i "x%1"=="x--make-iso" (
set WB_OPT_MAKE_ISO=1
) else if /i "x%1"=="x--close-ui" (
set WB_OPT_CLOSE_UI=1
)
SHIFT
goto :PARSE_OPTIONS
goto :EOF

View File

@ -8,6 +8,7 @@
<title>Wim Builder</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- <script>var $wb_commandline = oWimBuilderUI.commandline;</script> -->
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<link rel="stylesheet" href="assets/vendor/pure-min.css" />
<link rel="stylesheet" href="assets/vendor/jstree/themes/default/style.min.css" />

View File

@ -46,7 +46,7 @@ function auto_save_settings() {
}
function do_quick_build() {
function do_quick_build(mode) {
var jump_page = '';
if ($wb_base == 'winre.wim') {
if (!$('#wb_auto_winre').prop('checked')) {
@ -67,12 +67,13 @@ function do_quick_build() {
return;
}
$('#menu_patch').click();
if (mode == null) $('#menu_patch').click();
$('#menu_build').click();
var mode = 'exec';
if ($('#quick_build_mode_run').prop('checked')) mode = 'run';
if (mode == null) {
mode = 'exec';
if ($('#quick_build_mode_run').prop('checked')) mode = 'run';
}
cleanup(false, mode != 'exec');
window.setTimeout(function(){wait_and_build(mode);}, 500);

View File

@ -1,5 +1,10 @@
var $wb_root = null;
var $wb_opt_build = null;
var $wb_opt_project = null;
var $wb_opt_preset = null;
var $wb_opt_makeiso = null;
(function startup_check() {
var env = wsh.Environment("PROCESS");
$wb_root = env('WB_ROOT');
@ -9,6 +14,26 @@ var $wb_root = null;
self.close();
}
//$wb_root = $wb_root.substring(0, $wb_root.length - 1);
$wb_opt_build = env('WB_OPT_BUILD')
$wb_opt_project = env('WB_OPT_PROJECT');
$wb_opt_preset = env('WB_OPT_PRESET');
$wb_opt_makeiso = env('WB_OPT_MAKE_ISO');
if ($wb_opt_build != '') {
$wb_skip_project_page = true;
if ($wb_opt_build == 'LOG') {
$wb_opt_build = 'exec';
} else {
$wb_opt_build = 'run';
}
} else {
$wb_opt_build = null;
}
if ($wb_opt_project != '') $wb_default_project = $wb_opt_project;
if ($wb_opt_preset == '') $wb_opt_preset = null;
if ($wb_opt_makeiso != '') $wb_auto_makeiso = true;
})();
page_init();

View File

@ -15,6 +15,9 @@ $('#menu_patch').click(function(){
$('#patch_project_name').text(selected_project);
update_preset_list();
show_patches_settings();
if ($wb_opt_build) {
do_quick_build($wb_opt_build);
}
});
$('#menu_build').click(function(){

View File

@ -61,7 +61,7 @@ function regist_event() {
var project = $obj_project;
if (last_selected_project != selected_project) {
project = reload_project(name);
project = reload_project(name, $wb_opt_preset);
}
$('#project_desc').html('<p>' + project.desc.replace(/\r\n/g, '<br/>') + '</p>');
if (project.desc) {

View File

@ -49,7 +49,10 @@ function start_page_init() {
$('#wb_base_idx_opt').val($wb_base_index);
check_wim_file();
_auto_saved_settings = get_current_settings();
auto_save_trigger = true;
// disable auto save options with build option
if ($wb_opt_build == null) auto_save_trigger = true;
user_trigger = true;
if (!$wb_auto_config_created) {
$_wb_first_run = true;

View File

@ -1,6 +1,19 @@
Set objShellApp = CreateObject("Shell.Application")
If Wscript.Arguments.Count > 0 Then
p = ""
If Wscript.Arguments.Count > 1 Then p = Wscript.Arguments(1)
If Wscript.Arguments.Count > 1 Then p = GetArguments(Wscript.Arguments)
objShellApp.ShellExecute Wscript.Arguments(0), p, "", "runas", 1
End If
Function GetArguments(objArgs)
Dim s, i
s = ""
For i = 1 To objArgs.Count - 1
If InStr(1, objArgs(i), " ") > 0 Then
s = s & """" & objArgs(i) & """ "
Else
s = s & objArgs(i) & " "
End If
Next
GetArguments = s
End Function