forked from jamflux/SUR
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSUR.bat
More file actions
1903 lines (1792 loc) · 82.2 KB
/
SUR.bat
File metadata and controls
1903 lines (1792 loc) · 82.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
::DISCLAIMER: this tool can be used for free, the credits to JamFlux and other authors must be visible where the ROM has been published
@echo off
cls
setlocal enabledelayedexpansion
set app_name=Simple Unpack and Repack - Android Tool
set app_description=Extract and Repack system formats for android 5-10
title %app_name% [v2.0.2] [64bits] %authors%
set authors=[by JamFlux]
set cecho=bins\cecho.exe
set busybox=bins\busybox.exe
mode con: cols=87 lines=16
:dragNdrop
if exist *.txt del *.txt > nul
echo ----------------------------------------------->> log.txt
echo ----- S.U.R. Tool %authors% started ----- >> log.txt
echo ----- %time% ----- >> log.txt
echo ----------------------------------------------->> log.txt
if (%1)==() goto start0
if (%~x1)==(.xz) (
echo ---- XZ compression detected: >> log.txt
echo Extracting %~nx1 >> log.txt
cls
echo.
echo ***************************************************************
%cecho% -{06}Welcome to S.U.R.{#} {03}[by JamFlux]{#}
echo.
echo ***************************************************************
echo.
%cecho% -{0a}XZ compression{#} detected, unpacking:
echo.
%cecho% -{0a}%~n1%{#}
echo.
echo.
echo.
bins\7z x "%~nx1" >nul
)
for %%a in ("*.img") do set sys_image="%%a"
ren %sys_image% system.img >nul
cls
echo.
echo ***************************************************************
%cecho% -{06}Welcome to S.U.R.{#} {03}[by JamFlux]{#}
echo.
echo ***************************************************************
echo.
%cecho% -{0a}Extracting{#} system image:
echo.
%cecho% -{0a}%sys_image%{#}
echo.
echo.
echo.
call :make_dirs
echo ---- imgextractor.exe: %time% -Unpacking system.img >> log.txt
bins\imgextractor.exe "system.img" >> log.txt
if exist system move /y system 01-Project\ >nul 2>nul
if exist system_fs_config move /y system_fs_config 01-Project\temp\fs_config >nul 2>nul
if exist system_file_contexts move /y system_file_contexts 01-Project\temp\file_contexts >nul 2>nul
if exist system_size.txt move /y system_size.txt 01-Project\temp\sys_size >nul 2>nul
if exist system.raw.img !busybox! rm -rf system.raw.img >nul
if exist system.img move /y system.img 01-Project\1-Sources\ >nul 2>nul
set /p size=<"01-Project\temp\sys_size"
if exist 01-Project\1-Sources\system.img echo system.img format found >> 01-Project\temp\system.img.txt
if exist 01-Project\system\system\build.prop echo SAR: System As Root ROM >> 01-Project\temp\SAR
if exist 01-Project\temp\SAR if exist 01-Project\system\system\vendor\bin\hw (
!busybox! rm -rf 01-Project\temp\SAR >nul
call :fc_finder
)
if exist 01-Project\temp\SAR call :fs_generator
if exist 01-Project\1-Sources\system.img !busybox! rm -rf 01-Project\1-Sources\system.img >nul 2>nul
goto ROMs_menu
:start0
mode con: cols=45 lines=3
REM .bat con permisos de administrador - Admin privileges
:-------------------------------------
REM --> Analizando los permisos
IF "%PROCESSOR_ARCHITECTURE%" EQU "amd64" (
>nul 2>&1 "%SYSTEMROOT%\SysWOW64\cacls" "%SYSTEMROOT%\SysWOW64\config\system"
) ELSE (
>nul 2>&1 "%SYSTEMROOT%\system32\cacls" "%SYSTEMROOT%\system32\config\system"
)
REM --> Si hay error es que no hay permisos de administrador.
if '%errorlevel%' NEQ '0' (
echo Requesting administrative privileges...
goto UACPrompt
) else ( goto gotAdmin )
:UACPrompt
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
set params = %*:"=""
echo UAC.ShellExecute "cmd", "/c ""%~s0"" %params%", "", "runas", 1 >> "%temp%\getadmin.vbs"
"%temp%\getadmin.vbs"
del "%temp%\getadmin.vbs"
exit /B
:gotAdmin
pushd "%CD%"
CD /D "%~dp0"
:--------------------------------------
::New script
mode con: cols=78 lines=14
:files_checker
if not exist "bins\file.list" (
cls
echo.
echo ***************************************************************
%cecho% -{06}Welcome to S.U.R.{#} {03}[by JamFlux]{#}
echo.
echo ***************************************************************
echo.
%cecho% -Can't continue, {04}[files.txt]{#} is missing
echo.
echo.
%cecho% -Please, {0a}reinstall{#} this tool.
echo.
echo.
echo.
pause>nul
exit
)
set verificando=null
cls
echo.
echo ***************************************************************
%cecho% -{06}Welcome to S.U.R.{#} {03}[by JamFlux]{#}
echo.
echo ***************************************************************
echo.
%cecho% -{04}Error found:{#}
echo.
echo.
for /f "delims=" %%a in ('type bins\file.list') do if not exist "%%a" (
set verificando=y
%cecho% -Can't continue, {04}[%%~na%%~xa]{#} is missing
echo.
)
if "!verificando!"=="y" (
echo.
%cecho% -Please, {0a}reinstall{#} this tool.
echo.
pause>nul
exit
)
:description
cls
echo.
echo ***************************************************************
%cecho% -{06}Welcome to S.U.R.{#} {03}[by JamFlux]{#}
echo.
echo ***************************************************************
echo.
echo.
echo.
%cecho% {4f}%app_description%{#}
echo.
echo.
echo.
timeout /t 3 /nobreak > nul
:check_1
set system=01-Project\system\system
if exist 01-Project\system\build.prop set system=01-Project\system
if exist %system%\build.prop echo ---- Exists a previous ROM: >> log.txt
if exist %system%\build.prop (goto found_project) else (goto start)
:found_project
call :get_ROMs_name
call :get_ROMs_name
echo %rname% >> log.txt
call :detect_vendor
cls
echo.
echo ***************************************************************
%cecho% -{06}Welcome to S.U.R.{#} {03}[by JamFlux]{#}
echo.
echo ***************************************************************
echo.
%cecho% -ROM detected, named: {0b}!rname!{#}
echo.
echo.
echo -Please, decide:
echo.
echo 1. Work on it 2. New project
echo.
set /p number=* Select an option:
if "%number%"=="1" goto ROMs_menu
if "%number%"=="2" goto start
if not "%number%"=="1" if not "%number%"=="2" goto found_project
:start
if exist %rname% echo %rname% [Skipped] >> log.txt
set STARTTIME=%TIME%
echo ---- New project started: %time% >> log.txt
if exist 01-Project rmdir /q /s 01-Project
if exist 02-Output rmdir /q /s 02-Output
cls
echo.
echo ***************************************************************
%cecho% -{06}Welcome to S.U.R.{#} {03}[by JamFlux]{#}
echo.
echo ***************************************************************
echo.
%cecho% -Please, {0a}select{#} a ROMs .zip file
echo.
echo.
echo.
set dialog="about:<input type=file id=FILE><script>FILE.click();new ActiveXObject
set dialog=%dialog%('Scripting.FileSystemObject').GetStandardStream(1).WriteLine(FILE.value);
set dialog=%dialog%close();resizeTo(0,0);</script>"
for /f "tokens=* delims=" %%p in ('mshta %dialog%') do set "file=%%p"
echo ---- The selected ROM's zip file is: >> log.txt
echo %file% >> log.txt
call :make_dirs
cls
echo.
echo ***************************************************************
%cecho% -{06}Welcome to S.U.R.{#} {03}[by JamFlux]{#}
echo.
echo ***************************************************************
echo.
%cecho% -{0a}Extracting{#} ROMs files...
echo.
echo.
echo.
echo ---- Extracting ROMs files: >> log.txt
::--->commands
bins\7z x "%file%" -o01-Project\1-Sources >nul
::bins\7z x "%file%" -o01-Project\1-Sources META-INF >nul
::bins\7z e "%file%" n file_contexts -o01-Project\1-Sources >nul
::<---commands
for /r 01-Project\1-Sources %%a in (*) do (
echo %%~nxa [OK] >> log.txt
)
if exist 01-Project\1-Sources\vendor.* (goto un_vendor) else goto identify_format
:un_vendor
echo ---- Vendor image detected: >> log.txt
for /l %%N in (30 -1 1) do (
set /a "min=%%N/60, sec=%%N%%60, n-=1"
if !sec! lss 10 set sec=0!sec!
cls
echo.
echo ***************************************************************
%cecho% -{06}Welcome to S.U.R.{#} {03}[by JamFlux]{#}
echo.
echo ***************************************************************
echo.
%cecho% -{0a}Vendor{#} image detected. Please, decide:
echo.
echo.
echo U. Unpack S. Skip
echo.
echo.
choice /c:SU1 /n /m "* Unpack in !min!:!sec! - Please, decide: " /t:1 /d:1
if not errorlevel 3 goto :break
)
:break
if errorlevel 2 (goto un_vendor_ok) else goto identify_format
:un_vendor_ok
echo Extracting vendor image... >> log.txt
cls
echo.
echo ***************************************************************
%cecho% -{06}Welcome to S.U.R.{#} {03}[by JamFlux]{#}
echo.
echo ***************************************************************
echo.
%cecho% -Unpacking {0a}vendor{#} image...
echo.
echo.
echo.
::--->commands
echo ---- brotli.exe: %time% -Decrypting brotli compression... >> log.txt
if exist 01-Project\1-Sources\vendor.new.dat.br bins\brotli -dj 01-Project\1-Sources\vendor.new.dat.br >nul
echo ---- sdat2img.exe: %time% -Converting sparse android data image [.DAT] to EXT4 vendor image >> log.txt
if exist 01-Project\1-Sources\vendor.new.dat bins\sdat2img 01-Project\1-Sources\vendor.transfer.list 01-Project\1-Sources\vendor.new.dat 01-Project\1-Sources\vendor.img >> log.txt
echo ---- imgextractor.exe: %time% -Unpacking vendor.img >> log.txt
if exist 01-Project\1-Sources\vendor.img bins\imgextractor 01-Project\1-Sources\vendor.img 01-Project\vendor >>log.txt
::<---commands
move /y 01-Project\vendor_size.txt 01-Project\temp\vend_size >nul 2>nul
if exist 01-Project\temp\vend_size set /p vsize=<"01-Project\temp\vend_size"
if exist 01-Project\1-Sources\vendor.new.dat !busybox! rm -rf 01-Project\1-Sources\vendor.new.dat >nul
if exist 01-Project\1-Sources\vendor.transfer.list !busybox! rm -rf 01-Project\1-Sources\vendor.transfer.list >nul
if exist 01-Project\1-Sources\vendor.img !busybox! rm -rf 01-Project\1-Sources\vendor.img >nul
if exist 01-Project\1-Sources\vendor_fs_config move /y 01-Project\1-Sources\vendor_fs_config 01-Project\temp\fs_configv >nul 2>nul
move /y 01-Project\1-Sources\vendor_file_contexts 01-Project\temp\file_contextsv >nul 2>nul
if exist 01-Project\vendor\lib\hw echo Vendor image extracted [OK] >> log.txt
:identify_format
echo ---- System compression format is: >> log.txt
::Looking for system compression format
if exist 01-Project\1-Sources\*.tar.md5 echo Possible Samsung's stock ROM format found >> 01-Project\temp\tar.md5.txt
if exist 01-Project\1-Sources\system.new.dat.br echo new.dat.br format found >> 01-Project\temp\system.new.dat.br.txt
if exist 01-Project\1-Sources\system.new.dat echo new.dat format found >> 01-Project\temp\system.new.dat.txt
if exist 01-Project\1-Sources\system.img echo system.img format found >> 01-Project\temp\system.img.txt
if exist 01-Project\1-Sources\payload.bin echo payload.bin format found >> 01-Project\temp\system.img.txt
if exist 01-Project\1-Sources\payload.bin echo payload.bin format found >> 01-Project\temp\payload.info
for /r 01-Project\temp %%a in (*txt) do set format=%%~na
echo %format% >> log.txt
if not "%format%"=="system.new.dat.br" if not "%format%"=="system.new.dat" if not "%format%"=="system.img" if not "%format%"=="tar.md5" goto not_supported
if "%format%"=="tar.md5" call :un_tar
if exist 01-Project\1-Sources\payload.bin call :un_payload
if exist 01-Project\1-Sources\system.img call :Extract_SYS
if exist 01-Project\1-Sources\system.new.dat call :un_pack_dat
if exist 01-Project\1-Sources\system.new.dat.br call :un_brotli
:not_supported
if exist 01-Project rmdir /q /s 01-Project
cls
echo.
echo ***************************************************************
%cecho% -{06}Welcome to S.U.R.{#} {03}[by JamFlux]{#}
echo.
echo ***************************************************************
echo.
%cecho% -Sorry, format {04}not supported{#}
echo.
echo.
echo.
timeout /t 3 /nobreak > nul & exit
:already_deodexed
cls
echo.
echo ***************************************************************
%cecho% -{06}Welcome to S.U.R.{#} {03}[by JamFlux]{#}
echo.
echo ***************************************************************
echo.
%cecho% -{0a}Can't proceed:{#}
echo.
echo.
%cecho% -{0a}It seems that the ROM was already deodexed{#}
echo.
echo.
echo.
timeout /t 2 /nobreak > nul & goto ROMs_menu
:Extract_SYS
echo ---- Extracting system.img files: >> log.txt
cls
echo.
echo ***************************************************************
%cecho% -{06}Welcome to S.U.R.{#} {03}[by JamFlux]{#}
echo.
echo ***************************************************************
echo.
%cecho% -Extracting {0a}system{#} Image...
echo.
echo.
echo.
::--->commands
echo ---- imgextractor.exe: %time% -Unpacking system.img >> log.txt
if exist 01-Project\1-Sources\system.img bins\imgextractor 01-Project\1-Sources\system.img 01-Project\system >> log.txt
::<---commands
::vendor extraction::
if exist 01-Project\1-Sources\vendor.img echo ---- imgextractor.exe: %time% -Unpacking vendor.img >> log.txt
if exist 01-Project\1-Sources\vendor.img (
cls
echo.
echo ***************************************************************
%cecho% -{06}Welcome to S.U.R.{#} {03}[by JamFlux]{#}
echo.
echo ***************************************************************
echo.
%cecho% -Extracting {0a}vendor{#} Image...
echo.
echo.
bins\imgextractor 01-Project\1-Sources\vendor.img 01-Project\vendor >>log.txt
move /y 01-Project\vendor_size.txt 01-Project\temp\vend_size >nul 2>nul
if exist 01-Project\temp\vend_size set /p vsize=<"01-Project\temp\vend_size"
if exist 01-Project\1-Sources\vendor.img !busybox! rm -rf 01-Project\1-Sources\vendor.img >nul
if exist 01-Project\1-Sources\vendor_fs_config move /y 01-Project\1-Sources\vendor_fs_config 01-Project\temp\fs_configv >nul 2>nul
move /y 01-Project\1-Sources\vendor_file_contexts 01-Project\temp\file_contextsv >nul 2>nul
if exist 01-Project\vendor\lib\hw echo Vendor image extracted [OK] >> log.txt
)
::odm extraction::
if exist 01-Project\1-Sources\odm.img echo ---- imgextractor.exe: %time% -Unpacking odm.img >> log.txt
if exist 01-Project\1-Sources\odm.img (
cls
echo.
echo ***************************************************************
%cecho% -{06}Welcome to S.U.R.{#} {03}[by JamFlux]{#}
echo.
echo ***************************************************************
echo.
%cecho% -Extracting {0a}odm{#} Image...
echo.
echo.
bins\imgextractor 01-Project\1-Sources\odm.img 01-Project\odm >>log.txt
move /y 01-Project\odm_size.txt 01-Project\temp\odm_size >nul 2>nul
if exist 01-Project\1-Sources\odm.img !busybox! rm -rf 01-Project\1-Sources\odm.img >nul
if exist 01-Project\1-Sources\odm_fs_config move /y 01-Project\1-Sources\odm_fs_config 01-Project\temp\fs_config_odm >nul 2>nul
move /y 01-Project\1-Sources\odm_file_contexts 01-Project\temp\file_contexts_odm >nul 2>nul
if exist 01-Project\odm\app echo Odm image extracted [OK] >> log.txt
)
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
echo ---- ROM's files extraction finished: %time% >> log.txt
set ENDTIME=%TIME%
call :time
echo Elapsed Time: %DURATION% >> log.txt
call :boot_status
call :detect_vendor
if exist 01-Project\system\system\build.prop echo system.img extracted [OK] [SAR] >> log.txt
if exist 01-Project\system\build.prop echo system.img extracted [OK] [AOnly] >> log.txt
move /y 01-Project\system_size.txt 01-Project\temp\sys_size >nul 2>nul
move /y 01-Project\1-Sources\system_file_contexts 01-Project\temp\file_contexts >nul 2>nul
if exist 01-Project\temp\file_contextsv type 01-Project\temp\file_contextsv >> 01-Project\temp\file_contexts
if exist 01-Project\1-Sources\system_fs_config move /y 01-Project\1-Sources\system_fs_config 01-Project\temp\fs_config >nul 2>nul
set /p size=<"01-Project\temp\sys_size"
if exist 01-Project\system\system\build.prop echo SAR: System As Root ROM >> 01-Project\temp\SAR
if exist 01-Project\temp\SAR if exist 01-Project\system\system\vendor\bin\hw (
!busybox! rm -rf 01-Project\temp\SAR >nul
call :fc_finder
)
if exist 01-Project\temp\SAR call :fs_generator
if exist 01-Project\1-Sources\system.img !busybox! rm -rf 01-Project\1-Sources\system.img >nul 2>nul
if exist 01-Project\1-Sources\system.new.dat !busybox! rm -rf 01-Project\1-Sources\system.new.dat >nul
if exist 01-Project\1-Sources\system.transfer.list !busybox! rm -rf 01-Project\1-Sources\system.transfer.list >nul
goto ROMs_menu
:un_tar
cls
echo.
echo ***************************************************************
%cecho% -{06}Welcome to S.U.R.{#} {03}[by JamFlux]{#}
echo.
echo ***************************************************************
echo.
%cecho% -Extracting stock {0a}tar.md5{#} files...
echo.
echo.
echo.
echo ---- Stock tar.md5 format found: >> log.txt
echo Extracting compressed files... >> log.txt
if not exist "01-Project\temp\untar" mkdir "01-Project\temp\untar" >nul
if not exist 01-Project\temp\untar\all mkdir 01-Project\temp\untar\all >nul
if not exist 01-Project\temp\untar\sparse mkdir 01-Project\temp\untar\sparse >nul
for /r 01-Project\1-Sources %%a in (*tar.md5) do (
cls
echo.
echo ***************************************************************
%cecho% -{06}Welcome to S.U.R.{#} {03}[by JamFlux]{#}
echo.
echo ***************************************************************
echo.
%cecho% -Extracting stock {0a}tar.md5{#} files...
echo.
%cecho% -{0a}Processing: {#}
echo.
echo %%~na
echo.
bins\7z e "%%a" -o01-Project\temp\untar\all -y >nul
echo Extracting %%~na.md5 >> log.txt
)
for /r 01-Project\temp\untar\all %%a in (*img.lz4) do (
cls
echo.
echo ***************************************************************
%cecho% -{06}Welcome to S.U.R.{#} {03}[by JamFlux]{#}
echo.
echo ***************************************************************
echo.
%cecho% -Decoding {0a}lz4{#} compression...
echo.
%cecho% -Processing: {0a}%%~na{#}
echo.
echo.
bins\7z x "%%a" -o01-Project\temp\untar\sparse >nul
::bins\lz4 -d -f %%a %%~naflux >nul 2>nul
echo Decoding lz4 %%~na >> log.txt
)
if exist 01-Project\temp\untar\all !busybox! rm -rf 01-Project\temp\untar\all >nul
for /r 01-Project\1-Sources %%a in (*.tar.md5) do (
del %%a >nul
)
cls
echo.
echo ***************************************************************
%cecho% -{06}Welcome to S.U.R.{#} {03}[by JamFlux]{#}
echo.
echo ***************************************************************
echo.
%cecho% -Converting to {0a}ext4{#} image...
echo.
if exist 01-Project\temp\untar\sparse\system.img bins\simg2img 01-Project\temp\untar\sparse\system.img 01-Project\1-Sources\system.img >nul 2>nul
if exist 01-Project\1-Sources\system.img echo system.img convertion [OK] >> log.txt
if exist 01-Project\temp\untar\sparse\vendor.img bins\simg2img 01-Project\temp\untar\sparse\vendor.img 01-Project\1-Sources\vendor.img >nul 2>nul
if exist 01-Project\1-Sources\vendor.img echo vendor.img convertion [OK] >> log.txt
if exist 01-Project\temp\untar\sparse\odm.img bins\simg2img 01-Project\temp\untar\sparse\odm.img 01-Project\1-Sources\odm.img >nul 2>nul
if exist 01-Project\1-Sources\odm.img echo odm.img convertion [OK] >> log.txt
if exist 01-Project\temp\untar\sparse\boot.img copy /y 01-Project\temp\untar\sparse\boot.img 01-Project\1-Sources >nul 2>nul
if exist 01-Project\1-Sources\boot.img echo boot.img extraction [OK] >> log.txt
if exist 01-Project\temp\untar !busybox! rm -rf 01-Project\temp\untar >nul
goto:eof
:un_payload
cls
echo.
echo ***************************************************************
%cecho% -{06}Welcome to S.U.R.{#} {03}[by JamFlux]{#}
echo.
echo ***************************************************************
echo.
%cecho% -Extracting {0a}payload.bin{#} images...
echo.
echo.
echo.
echo ---- Payload.bin format found: >> log.txt
echo Extracting inside payload images... >> log.txt
if not exist "01-Project\temp\payload" mkdir "01-Project\temp\payload"
::--->commands
echo ---- payload_dumper.exe: %time% -Unpacking payload.bin >> log.txt
if exist 01-Project\1-Sources\payload.bin bins\payload_dumper --out 01-Project\temp\payload 01-Project\1-Sources\payload.bin >> log.txt
::<---commands
echo ---- The extracted images were: >> log.txt
if exist 01-Project\temp\payload\system.img echo Extracted system.img EXT4 [OK] >> log.txt
if exist 01-Project\temp\payload\vendor.img echo Extracted vendor.img EXT4 [OK] >> log.txt
if exist 01-Project\temp\payload\boot.img echo Extracted boot.img EXT4 [OK] >> log.txt
if exist 01-Project\temp\payload\system.img move /y 01-Project\temp\payload\system.img 01-Project\1-Sources >nul 2>nul
if exist 01-Project\temp\payload\vendor.img move /y 01-Project\temp\payload\vendor.img 01-Project\1-Sources >nul 2>nul
if exist 01-Project\temp\payload\boot.img move /y 01-Project\temp\payload\boot.img 01-Project\1-Sources >nul 2>nul
if exist 01-Project\temp\payload rmdir /q /s 01-Project\temp\payload
if exist 01-Project\1-Sources\payload.bin !busybox! rm -rf 01-Project\1-Sources\payload.bin >nul
goto:eof
:un_brotli
cls
echo.
echo ***************************************************************
%cecho% -{06}Welcome to S.U.R.{#} {03}[by JamFlux]{#}
echo.
echo ***************************************************************
echo.
%cecho% -Decompressing {0a}brotli{#} format...
echo.
echo.
echo.
echo ---- Decompressing brotli format >> log.txt
::--->commands
echo ---- brotli.exe: %time% -Decrypting brotli compression... >> log.txt
bins\brotli -dj 01-Project/1-Sources/system.new.dat.br >nul
::<---commands
if exist 01-Project/1-Sources/system.new.dat echo Extracted system.new.dat [OK] >> log.txt
goto un_pack_dat
:un_pack_dat
cls
echo.
echo ***************************************************************
%cecho% -{06}Welcome to S.U.R.{#} {03}[by JamFlux]{#}
echo.
echo ***************************************************************
echo.
%cecho% -Extracting {0a}sparse{#} system format...
echo.
echo.
echo.
echo ---- sdat2img.exe: %time% -Converting sparse android data image [.DAT] to EXT4 system image >> log.txt
::--->commands
bins\sdat2img 01-Project\1-Sources\system.transfer.list 01-Project\1-Sources\system.new.dat 01-Project\1-Sources\system.img >>log.txt
::<---commands
if exist 01-Project/1-Sources/system.img echo Extracted system.img EXT4 [OK] >> log.txt
goto Extract_SYS
:ROMs_menu
if exist 02-Output rmdir /q /s 02-Output
set system=01-Project\system\system
if exist 01-Project\system\build.prop set system=01-Project\system
if exist system !busybox! rm -rf system >nul
call :boot_status
call :get_ROMs_name
call :rom_info
if exist system.img !busybox! rm -rf system.img >nul
::Know api SDK version
for /f "Tokens=2* Delims==" %%# in (
'type "%system%\build.prop" ^| findstr "ro.build.version.sdk="'
) do (
set "api=%%#"
)
echo ROM's name is: %rname% >> log.txt
echo Deodexed: %status% - Format: %format% - System size: %size% - Api: %api% >> log.txt
cls
echo.
echo ***************************************************************
%cecho% -{06}Welcome to S.U.R.{#} {03}[by JamFlux]{#}
echo.
echo ***************************************************************
%cecho% {0a}ROM's Info{#}
echo.
%cecho% -Name: {0b}!rname!{#} -Deodexed: {0b}!status!{#} -DM Verity: {0b}!boot_status!{#}
echo.
%cecho% -Format: {0b}!format!{#} -System size: {0b}!size!{#} -Api: {0b}!api!{#}
echo.
echo.
echo 1. ROM Options 2. Resize system image 3. Rebuild ROM
echo.
set /p number=* Select an option:
if "%number%"=="1" goto rom_option
if "%number%"=="2" goto resize
if "%number%"=="3" goto rebuild
if not "%number%"=="1" if not "%number%"=="2" if not "%number%"=="3" goto ROMs_menu
:resize
cls
echo.
echo ***************************************************************
%cecho% -{06}Welcome to S.U.R.{#} {03}[by JamFlux]{#}
echo.
echo ***************************************************************
%cecho% {0a}ROM's Info{#}
echo.
%cecho% -Name: {0b}!rname!{#} -Deodexed: {0b}!status!{#}
echo.
%cecho% -Format: {0b}!format!{#} -System size: {0b}!size!{#} -Api: {0b}!api!{#}
echo.
echo.
::--->commands
set /p size=* Change system image size to:
if exist 01-Project\temp\sys_size !busybox! rm -rf 01-Project\temp\sys_size >nul
echo %size% >> 01-Project\temp\sys_size
set /p size=<"01-Project\temp\sys_size"
::<---commands
goto ROMs_menu
:rom_option
call :get_ROMs_name
call :rom_info
cls
echo.
echo ***************************************************************
%cecho% -{06}Welcome to S.U.R.{#} {03}[by JamFlux]{#}
echo.
echo ***************************************************************
%cecho% {0a}ROM's Info{#}
echo.
%cecho% -Name: {0b}!rname!{#} -Deodexed: {0b}!status!{#}
echo.
%cecho% -Format: {0b}!format!{#} -System size: {0b}!size!{#} -Api: {0b}!api!{#}
echo.
echo.
echo 1. Change ROM's name 2. Add 1-DNS 3. Deodex 8+
echo.
echo 4. Remove DM verity 5. Zipalign apks 6. Go Back
echo.
set /p number=* Select an option:
if "%number%"=="1" goto rom_name
if "%number%"=="2" goto dns_1
if "%number%"=="3" goto deodexer
if "%number%"=="4" goto patch_boot
if "%number%"=="5" goto zipaligning
if "%number%"=="6" goto ROMs_menu
if not "%number%"=="1" if not "%number%"=="2" if not "%number%"=="3" if not "%number%"=="4" if not "%number%"=="5" if not "%number%"=="6" goto rom_option
:rom_name
cls
echo.
echo ***************************************************************
%cecho% -{06}Welcome to S.U.R.{#} {03}[by JamFlux]{#}
echo.
echo ***************************************************************
%cecho% {0a}ROM's Info{#}
echo.
%cecho% -Name: {0b}!rname!{#} -Deodexed: {0b}!status!{#}
echo.
%cecho% -Format: {0b}!format!{#} -System size: {0b}!size!{#} -Api: {0b}!api!{#}
echo.
echo.
set /p new_rname=* Change the ROM's name for:
::--->commands
if exist %system%\build.prop bins\sfk replace %system%\build.prop "/ro.build.display.id=!rname!/ro.build.display.id=!new_rname!/" -yes > nul
::<---commands
call :get_ROMs_name
echo ---- ROM's name changed to: %rname% >> log.txt
goto rom_option
:dns_1
if exist 01-Project\system\build.prop !busybox! sed '/dns/d' 01-Project\system\build.prop >> build.prop
if exist 01-Project\system\system\build.prop !busybox! sed '/dns/d' 01-Project\system\system\build.prop >> build.prop
if exist 01-Project\system\system\build.prop !busybox! mv build.prop 01-Project\system\system
if exist build.prop !busybox! mv build.prop 01-Project\system
timeout /t 1 /nobreak > nul
if exist %system%\build.prop echo net.dns1=1.1.1.1 >> %system%\build.prop
if exist %system%\build.prop echo net.dns2=1.0.0.1 >> %system%\build.prop
timeout /t 1 /nobreak > nul
::--->commands
if exist %system%\build.prop bins\dos2unix -q 01-Project\system\build.prop
::<---commands
echo ---- Added 1.1.1.1 DNS to build.prop >> log.txt
goto rom_option
:patch_boot
::--->commands
bins\rmverity 01-Project\1-Sources\boot.img >nul 2>nul
if exist %vendor%\default.prop bins\sfk replace %vendor%\default.prop "/secure=0/secure=1/" -yes > nul
if exist %vendor%\etc\fstab.qcom bins\sfk replace %vendor%\etc\fstab.qcom "/,verify//" -yes > nul
if exist %vendor%\etc\fstab.qcom bins\sfk replace %vendor%\etc\fstab.qcom "/forceencrypt=/encryptable=/" -yes > nul
if exist %vendor%\etc\fstab.qcom bins\sfk replace %vendor%\etc\fstab.qcom "/forcefdeorfbe=/encryptable=/" -yes > nul
if exist %vendor%\etc\fstab.qcom bins\sfk replace %vendor%\etc\fstab.qcom "/fileencryption=/encryptable=/" -yes > nul
if exist %vendor%\etc\fstab.qcom bins\sfk replace %vendor%\etc\fstab.qcom "/.dmverity=true/.dmverity=false/" -yes > nul
if exist %system%\recovery-from-boot.p !busybox! rm -rf %system%\recovery-from-boot.p > nul
::<---commands
echo ---- DM Verity removed >> log.txt
goto rom_option
:zipaligning
cls
echo.
echo ***************************************************************
%cecho% -{06}Welcome to S.U.R.{#} {03}[by JamFlux]{#}
echo.
echo ***************************************************************
echo.
%cecho% -{0a}Zipaligning{#} ROM's apks and jars...
echo.
echo.
echo.
echo ---- Zipaligning apks and jars... >> log.txt
::--->commands
for /R %%X in (*.jar) do bins\zipalign -f 4 "%%X" "%%~dpX%%~nX.newjar" >nul 2>nul
for /R %%X in (*.newjar) do move /Y "%%X" "%%~dpX%%~nX.jar" >nul 2>nul
for /R %%X in (*.apk) do bins\zipalign -f 4 "%%X" "%%~dpX%%~nX.new" >nul 2>nul
for /R %%X in (*.new) do move /Y "%%X" "%%~dpX%%~nX.apk" >nul 2>nul
::<---commands
echo All apks and jars were zipaligned [OK] >> log.txt
goto rom_option
:file_contexts_finder
echo file_contexts not found, looking for it... >> log.txt
if exist 01-Project\1-Sources\file_contexts !busybox! rm -rf 01-Project\1-Sources\file_contexts >nul 2>nul
if exist 01-Project\temp\file_contexts !busybox! rm -rf 01-Project\temp\file_contexts >nul 2>nul
::--->commands
bins\fc_finder "01-Project" "01-Project\temp\un_file_contexts" "plat_file_contexts|vendor_file_contexts|nonplat_file_contexts"
if exist 01-Project\temp\un_file_contexts !busybox! sort -u < 01-Project\temp\un_file_contexts >> 01-Project/temp/file_contexts
if exist 01-Project\temp\un_file_contexts !busybox! rm -rf 01-Project\temp\un_file_contexts >nul 2>nul
if exist 01-Project\temp\file_contexts bins\dos2unix -q 01-Project\temp\file_contexts
::<---commands
if exist 01-Project\temp\file_contexts goto rebuild_yes
:rebuild
echo ---- Rebuild process started: %time% >> log.txt
set STARTTIME=%TIME%
echo Checking requisites... >> log.txt
if exist 01-Project\temp\file_contexts (goto rebuild_yes) else (goto file_contexts_finder)
:rebuild_yes
echo file_contexts exists [OK] >> log.txt
if exist 01-Project\temp\1.version !busybox! rm -rf 01-Project\temp\1.version
if exist 01-Project\temp\2.version !busybox! rm -rf 01-Project\temp\2.version
if exist 01-Project\temp\3.version !busybox! rm -rf 01-Project\temp\3.version
if exist 01-Project\temp\4.version !busybox! rm -rf 01-Project\temp\4.version
if %api% equ 21 echo 1 >> 01-Project\temp\1.version
if %api% equ 22 echo 2 >> 01-Project\temp\2.version
if %api% equ 23 echo 3 >> 01-Project\temp\3.version
if %api% geq 24 echo 4 >> 01-Project\temp\4.version
for /r 01-Project\temp %%a in (*version) do set version=%%~na
echo Sparse compression value is: %version% (No needed for system.img format) >> log.txt
if exist 01-Project\temp\payload.info goto make_payload
if "!boot_status!"=="Null" goto make_img_without_zipping
if "!format!"=="tar.md5" goto make_img_without_zipping
if "!format!"=="system.img" goto make_img
if "!format!"=="system.new.dat" goto make_dat
if "!format!"=="system.new.dat.br" goto make_dat_br
:img_mover
for /r 01-Project\1-Sources %%a in (*.img) do (
move /y %%a 02-Output >nul 2>nul
)
if exist 02-Output\boot.img copy /y 02-Output\boot.img 01-Project\1-Sources >nul 2>nul
goto:eof
:make_payload
call :get_ROMs_name
if not exist 02-Output mkdir 02-Output
cls
echo.
echo ***************************************************************
%cecho% -{06}Welcome to S.U.R.{#} {03}[by JamFlux]{#}
echo.
echo ***************************************************************
%cecho% {0a}ROM's Info{#}
echo.
%cecho% -Name: {0b}!rname!{#} -Deodexed: {0b}!status!{#}
echo.
%cecho% -Format: {0b}!format!{#} -System size: {0b}!size!{#} -Api: {0b}!api!{#}
echo.
echo.
%cecho% -{0a}Repacking{#} to its original format...
echo.
echo.
::--->commands
if exist 01-Project\temp\SAR (
echo Repacking to: %format% format... [SAR] >> log.txt
bins\make_ext4fs -T 2009110000 -S 01-Project/temp/file_contexts -C 01-Project\temp\fs_config -l %size% -L / -a / -s 01-Project/1-Sources/system.img "01-Project/system/" >nul 2>nul>> log.txt
) else (
echo Repacking to: %format% format... [Aonly] >> log.txt
bins\make_ext4fs -s -L system -T 2009110000 -S 01-Project\temp\file_contexts -C 01-Project\temp\fs_config -l %size% -a system 01-Project\1-Sources\system.img 01-Project\system\ >nul 2>nul>> log.txt
)
::<---commands
if not exist 01-Project\1-Sources\system.img echo Repacking system to: %format% [Failed] >> log.txt
if not exist 01-Project\1-Sources\system.img goto ROMs_menu
if exist 01-Project\1-Sources\system.img echo Repacking to: %format% [OK] >> log.txt
if exist 01-Project\vendor call :build_vendor2
call :img_mover
if exist bins\fastboot.7z bins\7z e bins\fastboot.7z -o02-Output >nul
goto finish
:make_img_without_zipping
call :get_ROMs_name
if not exist 02-Output mkdir 02-Output
cls
echo.
echo ***************************************************************
%cecho% -{06}Welcome to S.U.R.{#} {03}[by JamFlux]{#}
echo.
echo ***************************************************************
%cecho% {0a}ROM's Info{#}
echo.
%cecho% -Name: {0b}!rname!{#} -Deodexed: {0b}!status!{#}
echo.
%cecho% -Format: {0b}system.img{#} -System size: {0b}!size!{#} -Api: {0b}!api!{#}
echo.
echo.
%cecho% -{0a}Repacking{#} to its original format...
echo.
echo.
::--->commands
if exist 01-Project\temp\SAR (
echo Repacking to: system.img format... [SAR] >> log.txt
bins\make_ext4fs -T 2009110000 -S 01-Project/temp/file_contexts -C 01-Project\temp\fs_config -l %size% -L / -a / 01-Project/1-Sources/system.img "01-Project/system/" >nul 2>nul>> log.txt
) else (
echo Repacking to: system.img format... [Aonly] >> log.txt
bins\make_ext4fs -s -L system -T 2009110000 -S 01-Project\temp\file_contexts -C 01-Project\temp\fs_config -l %size% system 01-Project\1-Sources\system.img 01-Project\system\ >nul 2>nul>> log.txt
)
::<---commands
if not exist 01-Project\1-Sources\system.img echo Repacking system to: system.img [Failed] >> log.txt
if not exist 01-Project\1-Sources\system.img goto ROMs_menu
if exist 01-Project\1-Sources\system.img echo Repacking to: system.img [OK] >> log.txt
if exist 01-Project\vendor call :build_vendor2
if exist 01-Project\odm call :build_odm
call :img_mover
goto finish
:make_img
call :get_ROMs_name
if not exist 02-Output mkdir 02-Output
cls
echo.
echo ***************************************************************
%cecho% -{06}Welcome to S.U.R.{#} {03}[by JamFlux]{#}
echo.
echo ***************************************************************
%cecho% {0a}ROM's Info{#}
echo.
%cecho% -Name: {0b}!rname!{#} -Deodexed: {0b}!status!{#}
echo.
%cecho% -Format: {0b}!format!{#} -System size: {0b}!size!{#} -Api: {0b}!api!{#}
echo.
echo.
%cecho% -{0a}Repacking{#} to its original format...
echo.
echo.
::--->commands
if exist 01-Project\temp\SAR (
echo Repacking to: %format% format... [SAR] >> log.txt
bins\make_ext4fs -T 2009110000 -S 01-Project/temp/file_contexts -C 01-Project\temp\fs_config -l %size% -L / -a / 01-Project/1-Sources/system.img "01-Project/system/" >nul 2>nul>> log.txt
) else (
echo Repacking to: %format% format... [Aonly] >> log.txt
bins\make_ext4fs -L system -T 2009110000 -S 01-Project\temp\file_contexts -C 01-Project\temp\fs_config -l %size% -a system 01-Project\1-Sources\system.img 01-Project\system\ >nul 2>nul>> log.txt
)
::<---commands
if not exist 01-Project\1-Sources\system.img echo Repacking system to: %format% [Failed] >> log.txt
if not exist 01-Project\1-Sources\system.img goto ROMs_menu
if exist 01-Project\1-Sources\system.img echo Repacking to: %format% [OK] >> log.txt
if exist 01-Project\vendor call :build_vendor2
call :img_mover
call :just_zip
goto finish
:make_dat
call :get_ROMs_name
if not exist 02-Output mkdir 02-Output
cls
echo.
echo ***************************************************************
%cecho% -{06}Welcome to S.U.R.{#} {03}[by JamFlux]{#}
echo.
echo ***************************************************************
%cecho% {0a}ROM's Info{#}
echo.
%cecho% -Name: {0b}!rname!{#} -Deodexed: {0b}!status!{#}
echo.
%cecho% -Format: {0b}!format!{#} -System size: {0b}!size!{#} -Api: {0b}!api!{#}
echo.
echo.
%cecho% -{0a}Repacking{#} to its original format...
echo.
echo.
::--->commands
if exist 01-Project\temp\SAR (
echo Repacking to: %format% format... [SAR] >> log.txt
bins\make_ext4fs -T 2009110000 -S 01-Project/temp/file_contexts -C 01-Project\temp\fs_config -l %size% -L / -a / -s 01-Project/1-Sources/system.img "01-Project/system/" >nul 2>nul>> log.txt
) else (
echo Repacking to: %format% format... [Aonly] >> log.txt
bins\make_ext4fs -s -L system -T 2009110000 -S 01-Project\temp\file_contexts -C 01-Project\temp\fs_config -l %size% -a system 01-Project\1-Sources\system.img 01-Project\system\ >nul 2>nul>> log.txt
)
::<---commands
if not exist 01-Project\1-Sources\system.img echo Repacking system.img [Failed] >> log.txt
if not exist 01-Project\1-Sources\system.img goto ROMs_menu
if exist 01-Project\1-Sources\system.img echo Repacking system.img [OK] >> log.txt
if exist 01-Project\vendor call :build_vendor
::--------------new.dat part--------------::
timeout /t 1 /nobreak >nul
echo ---- img2sdat.exe: %time% -Repacking to sparse android data image [system.new.DAT] >> log.txt
if exist 01-Project\1-Sources\system.img bins\img2sdat 01-Project\1-Sources\system.img -o 01-Project\1-Sources -v %version% >> log.txt
timeout /t 1 /nobreak >nul
if exist 01-Project\1-Sources\vendor.img echo img2sdat.exe: %time% -Repacking to sparse android data image [vendor.new.DAT] >> log.txt
if exist 01-Project\1-Sources\vendor.img bins\img2sdat 01-Project\1-Sources\vendor.img -o 01-Project\1-Sources -v %version% -p vendor >> log.txt
timeout /t 1 /nobreak >nul
if not exist 01-Project\1-Sources\system.new.dat echo Repacking system.new.dat [Failed] >> log.txt
if not exist 01-Project\1-Sources\system.new.dat goto ROMs_menu
if exist 01-Project\1-Sources\system.new.dat echo Repacking system.new.dat [OK] >> log.txt
if exist 01-Project\1-Sources\vendor.new.dat echo Repacking vendor.new.dat [OK] >> log.txt
::--------------new.dat part--------------::
if exist 01-Project\1-Sources\system.img !busybox! rm -rf 01-Project\1-Sources\system.img >nul
if exist 01-Project\1-Sources\vendor.img !busybox! rm -rf 01-Project\1-Sources\vendor.img >nul
::--->commands
if exist 01-Project\system fsutil file createnew 01-Project\1-Sources\system.patch.dat 0 >nul
if exist 01-Project\vendor fsutil file createnew 01-Project\1-Sources\vendor.patch.dat 0 >nul
::<---commands
call :just_zip
goto finish
:make_dat_br
call :get_ROMs_name
if not exist 02-Output mkdir 02-Output
cls
echo.
echo ***************************************************************
%cecho% -{06}Welcome to S.U.R.{#} {03}[by JamFlux]{#}
echo.
echo ***************************************************************
%cecho% {0a}ROM's Info{#}
echo.
%cecho% -Name: {0b}!rname!{#} -Deodexed: {0b}!status!{#}
echo.
%cecho% -Format: {0b}!format!{#} -System size: {0b}!size!{#} -Api: {0b}!api!{#}
echo.
echo.
%cecho% -{0a}Repacking{#} to its original format...
echo.
echo.
::--->commands
if exist 01-Project\temp\SAR (
echo Repacking to: %format% format... [SAR] >> log.txt
bins\make_ext4fs -T 2009110000 -S 01-Project/temp/file_contexts -C 01-Project\temp\fs_config -l %size% -L / -a / -s 01-Project/1-Sources/system.img "01-Project/system/" >nul 2>nul>> log.txt
) else (
echo Repacking to: %format% format... [Aonly] >> log.txt
bins\make_ext4fs -s -L system -T 2009110000 -S 01-Project\temp\file_contexts -C 01-Project\temp\fs_config -l %size% -a system 01-Project\1-Sources\system.img 01-Project\system\ >nul 2>nul>> log.txt
)
::<---commands
if not exist 01-Project\1-Sources\system.img echo Repacking system.img [Failed] >> log.txt
if not exist 01-Project\1-Sources\system.img goto ROMs_menu
if exist 01-Project\1-Sources\system.img echo Repacking system.img [OK] >> log.txt
if exist 01-Project\vendor call :build_vendor
::--------------new.dat part--------------::
timeout /t 1 /nobreak >nul