; ------------------------------------------------------------------------- ; creates fli4l-files and archives __FLI4LVER__ ; ; Creation: lanspezi 2005-04-04 ; $Id$ ; ------------------------------------------------------------------------- #include-once Dim $kernel_version Dim $file Dim $archive Dim $mode Dim $flags Dim $uid Dim $gid Dim $name Dim $type Dim $prefix Dim $final Dim $file_list Dim $kernel_version Dim $comp_type_kernel Dim $comp_type_rootfs Dim $comp_type_opt Dim $bool_recover="no" Dim $lzma_root_dictionary_size=20 Dim $lzma_opt_dictionary_size=20 Func update_version () ; not implement in windows-build EndFunc Func get_one_val () ; windows build use "read_var_from_rc_cfg" EndFunc Func gen_md5_sums () $msg = build_time () & $MSG_04_generating_md5sums & " " fli4lbuild_msg ($msg,0) Dim $md5files[5][2] $md5files[0][0] = "rc.cfg" $md5files[0][1] = "FLI4L_MD5_RC_CFG=" $md5files[1][0] = "KERNEL" $md5files[1][1] = "FLI4L_MD5_KERNEL=" $md5files[2][0] = "ROOTFS.IMG" $md5files[2][1] = "FLI4L_MD5_ROOTFS_IMG=" $md5files[3][0] = "OPT.IMG" $md5files[3][1] = "FLI4L_MD5_OPT_IMG=" $md5files[4][0] = "SYSLINUX.CFG" $md5files[4][1] = "FLI4L_MD5_SYSLINUX_CFG=" FileCopy ($dir_base & "\windows\scripts\md5.pif", $glob_dir_tmpbuild, 1) ; needed for W9x For $_n = 0 to 4 $md5file = $md5files[$_n][0] If FileExists($glob_dir_tmpbuild & "\" & $md5file) then $run_call = StringFormat ('"%s\\windows\\md5sum.exe" %s > md5.tmp',$dir_base, $md5file) FileWriteLine ($glob_dir_tmpbuild & "\md5.bat", $run_call) $val = RunWait ($glob_dir_tmpbuild & "\md5.bat", $glob_dir_tmpbuild , @SW_HIDE) $line = FileReadLine ($glob_dir_tmpbuild & "\md5.tmp") $md5 = StringLeft ($line, 32) FileWriteLine ($glob_dir_tmpbuild & "\rc.cfg", $md5files[$_n][1] & "'" & $md5 & "'" & @LF) FileDelete ($glob_dir_tmpbuild & "\md5.bat") FileDelete ($glob_dir_tmpbuild & "\md5.tmp") $md5="" EndIf Next FileDelete ($glob_dir_tmpbuild & "\md5.pif") fli4lbuild_msg ($MSG_finished & @CRLF,0) EndFunc Func get_config_values () read_var_from_rc_cfg ("COMP_TYPE_KERNEL", $comp_type_kernel) read_var_from_rc_cfg ("COMP_TYPE_ROOTFS", $comp_type_rootfs) read_var_from_rc_cfg ("COMP_TYPE_OPT", $comp_type_opt) read_var_from_rc_cfg ("KERNEL_VERSION", $kernel_version) If ("$remotehostname" = "") then read_var_from_rc_cfg ("HOSTNAME", $remotehostname) EndIf read_var_from_rc_cfg ("OPT_RECOVER", $bool_recover) EndFunc Func append_file ($file) If $name = "" then $final = $file If StringLeft ($final, StringLen ($prefix)) = $prefix then $final = StringTrimLeft ($final, StringLen ($prefix)) EndIf If StringLeft ($final, 6) = "files/" then $final = StringTrimLeft ($final, 6) EndIf If StringInStr ($final, "/mybin/") then $final = StringReplace ($final, "/mybin/", "/bin/") EndIf If StringInStr ($final, "/mylib/") then $final = StringReplace ($final, "/mylib/", "/lib/") EndIf Else $final = $name EndIf Select Case $final = "" return Case $final = "img" return Case $final = "opt" return Case $final = "files" return Case $final = "opt/files" return EndSelect $dir_config_slash = StringReplace ($dir_config, "\", "/") ; only subdirs of $dir_config needed - not the parent dirs If ($final = $dir_config_slash) then return EndIf ; if final-filename includes name of config-dir - remove config-dir If StringInStr ($final, $dir_config_slash) then $final = StringRight ($final, StringLen ($final) - StringLen ($dir_config_slash & "/")) ;msgbox (1,"DEBUG","config-dir in append_file" & @CRLF & $final & @CRLF & $file) EndIf Select Case $flags = "utxt" $conversion = "ufile" Case $flags = "dtxt" $conversion = "dfile" Case $flags = "sh" If $bool_squeeze = "true" then $conversion = "sfile" Else $conversion = "ufile" EndIf Case Else $conversion = "file" EndSelect ; replace / with \ $file_bs = StringReplace ($file, "/", "\") If $mode = "" then If FileExists ($file_bs) then If NOT StringInStr(FileGetAttrib($file_bs), "D") Then FileWrite ($file_list, $conversion & " " & $final & " '" & $file_bs & "' 644 " & $uid & " " & $gid & @LF) Else FileWrite ($file_list, "dir " & $final & " 755 " & $uid & " " & $gid & @LF) EndIf Else MsgBox (0, $MSG_msgbox_Error, $file_bs & " doesn't exist - please check rights/.... for file!") $bool_error = "true" exit_fli4l_build () EndIf Else FileWrite ($file_list, $conversion & " " & $final & " '" & $file_bs & "' " & $mode & " " & $uid & " " & $gid & @LF) EndIf EndFunc Func append_my_files ($dir) $dir_bs = StringReplace ($dir, "/", "\") $search = FileFindFirstFile($dir_bs & "\*.*") If $search <> -1 then While 1 $f = FileFindNextFile($search) If @error Then ExitLoop If $f <> "." And $f <> ".." And $f <> "dummy" then If StringRight ($f,3) = ".sh" then $flags = "utxt" Else $flags = "none" EndIf append_file ($dir & "/" & $f) EndIf Wend EndIf FileClose($search) EndFunc Func create_archive_list ($_archive) $file_opt_full = FileOpen ($glob_dir_tmptar & "\opt_full.tmp",0) If $file_opt_full = - 1 Then MsgBox (0, $MSG_msgbox_Error, $glob_dir_tmptar & "\opt_full.tmp doesn't exist") $bool_error = "true" exit_fli4l_build () Else Dim $array_passwd Dim $array_group read_passwd_group ($dir_base & "\opt\etc\passwd", $array_passwd) read_passwd_group ($dir_base & "\opt\etc\group", $array_group) While 1 $file = "" $archive = "" $mode = "" $flags = "" $uid = "0" $gid = "0" $name = "" $type = "file" $_line = FileReadLine ($file_opt_full) If @error = - 1 Then ExitLoop ; find second ' in $_line $_pos = StringInStr ($_line, "'",0,2) $_line1 = StringLeft ($_line, $_pos) $_line2 = StringTrimLeft ($_line, $_pos +1) $_array1a = StringSplit ($_line1, "=") If $_array1a[0] = 2 then Assign ($_array1a[1], $_array1a[2]) EndIf $_array1 = StringSplit ($_line2, " ") For $_n1 = 1 To $_array1[0] $_array2 = StringSplit ($_array1[$_n1], "=") If $_array2[0] = 2 then Assign ($_array2[1], $_array2[2]) EndIf Next If $_archive <> $archive AND $_archive <> "ALL" then ContinueLoop EndIf If $uid <> "0" and not ($uid > 0) then For $_n = 0 To $array_passwd[0] If StringInStr ($array_passwd[$_n], $uid & ":") then ExitLoop EndIf Next $_start = StringInStr($array_passwd[$_n],":",0,2) + 1 $_end = StringInStr($array_passwd[$_n],":",0,3) $uid = StringMid ($array_passwd[$_n], $_start, $_end - $_start) EndIf If $gid <> "0" and not ($gid > 0) then For $_n = 0 To $array_group[0] If StringInStr ($array_group[$_n], $gid & ":") then ExitLoop EndIf Next $_start = StringInStr($array_group[$_n],":",0,2) + 1 $_end = StringInStr($array_group[$_n],":",0,3) $gid = StringMid ($array_group[$_n], $_start, $_end - $_start) EndIf $file = StringReplace ($file, "'", "") Select Case StringLeft ($file, 4) = "opt/" $prefix = "opt/" Case StringLeft ($file, 4) = "img/" $prefix = "img/" Case Else $prefix = StringReplace ($dir_config, "\", "/") & "/" EndSelect Select Case StringInStr($file, "/mybin") $mode = "755" append_my_files ($file) Case StringInStr ($file, "/mylib") $mode = "644" append_my_files ($file) Case Else append_file ($file) EndSelect Wend EndIf FileClose ($file_opt_full) EndFunc Func copy_kernel ($ext) If FileExists ($dir_config & "\img\kernel-" & $kernel_version & "." &$ext) then FileCopy ($dir_config & "\img\kernel-" & $kernel_version & "." &$ext, $glob_dir_tmpbuild & "\kernel",1) Else If FileExists ("img\kernel-" & $kernel_version & "." &$ext) then FileCopy ("img\kernel-" & $kernel_version & "." &$ext, $glob_dir_tmpbuild & "\kernel",1) Else if ( $ext = "uncompressed" and FileExists ("img\vmlinux-"& $kernel_version)) then FileCopy ("img\vmlinux-" & $kernel_version, $glob_dir_tmpbuild & "\kernel",1) Else $msg = "Warning: Can't find kernel-" & $kernel_version & "." &$ext & _ ", either use a different kernel version or a different compression method." fli4lbuild_errmsg ($msg, 1) $bool_error = "true" exit_fli4l_build () EndIf EndIf EndIf EndFunc Func mkopt () ;fix problem with new cygwin compiled binary - prob is \ in pathnames $dir_config_r = StringReplace ($dir_config, "\", "/") $glob_dir_tmptar_r = StringReplace ($glob_dir_tmptar, "\", "/") $glob_dir_tmpbuild_r = StringReplace ($glob_dir_tmpbuild, "\", "/") $glob_dir_tmplog_r = StringReplace ($glob_dir_tmplog, "\", "/") $glob_dir_tmptemp_r = StringReplace ($glob_dir_tmptemp, "\", "/") msg_lang_read ("mkopt") $msg = @CRLF & $MSG_LINE & @CRLF & build_time () & $MSG_04_start & " " fli4lbuild_msg ($msg,1) $progressbar = GUICtrlCreateProgress (70,425,520,20) GUICtrlSetData ($progressbar,0) $icon = GUICtrlCreateIcon ("windows\scripts\ico_build.ico",-1, 20,422,32,32) $msg = @CRLF & build_time () & $MSG_04_confdir & $dir_config & "' " & @CRLF & _ build_time () & $MSG_04_builddir & $dir_build & "'" & @CRLF fli4lbuild_msg ($msg,0) GUICtrlSetData ($progressbar,10) If FileExists ($glob_dir_tmpbuild & "\modules.alias") then FileDelete ($glob_dir_tmpbuild & "\modules.alias") EndIf If FileExists ($glob_dir_tmpbuild & "\modules.dep") then FileDelete ($glob_dir_tmpbuild & "\modules.dep") EndIF ; remove old version of all fli4l-files in build-dir cleanup_fli4lfiles () If NOT FileExists ($dir_config & "\etc") then fli_DirCreate ($dir_config & "\etc") EndIf If NOT FileExists ($dir_config & "\etc\rc.cfg") then $file = FileOpen ($dir_config & "\etc\rc.cfg",2) FileClose($file) EndIf ;parse config-files - check configuration and generate filelist for archives $msg = build_time () & $MSG_04_readcheckconf & " " fli4lbuild_msg ($msg,0) If ( $mkfli4l_debug_option <> "" ) then $run_call = StringFormat ('windows\\mkfli4l.exe %s -c "%s" -t "%s" -b "%s" -l "%s\\mkfli4l.log"', _ $mkfli4l_debug_option, $dir_config_r, $glob_dir_tmptar_r, $glob_dir_tmpbuild_r, $glob_dir_tmplog_r) else $run_call = StringFormat ('windows\\mkfli4l.exe -c "%s" -t "%s" -b "%s" -l "%s\\mkfli4l.log"', _ $dir_config_r, $glob_dir_tmptar_r, $glob_dir_tmpbuild_r, $glob_dir_tmplog_r) EndIf $val = RunWait ($run_call, @WorkingDir, @SW_HIDE) GUICtrlSetData ($progressbar,20) If $val = 0 then ; fli4l-config OK - now build $message = read_mkfli4l_log () $wline = "---------------------------------------------------------" $wline = $wline & "---------------------------------------------------------------------------" $warn = StringInStr ($message, "Warning:") If Stringlen($message)>60000 Then $message = StringLeft($message, 60000) & @CRLF & @CRLF & "Log too large to show, use log-file: '" & $dir_build & "\mkfli4l.log'" & @CRLF EndIf If $warn AND $verbose = "false" Then fli4lbuild_msg (@CRLF & $wline & @CRLF& $message & $wline & @CRLF,1) Else If $warn Then fli4lbuild_msg ($MSG_finished & @CRLF & $wline & @CRLF & $message & $wline & @CRLF,0) Else fli4lbuild_msg ($MSG_finished & @CRLF,0) EndIf EndIf $split_dir_config = StringSplit ( $dir_config, "\") FileWriteLine ( $glob_dir_tmpbuild & "\rc.cfg", "FLI4L_BUILDDIR='" & $split_dir_config[$split_dir_config[0]] &"'" & @LF ) FileWriteLine ( $glob_dir_tmpbuild & "\rc.cfg", "FLI4L_BUILDDATE='" & @YEAR & "-" & @MON & "-" & @MDAY &"'" & @LF ) FileWriteLine ( $glob_dir_tmpbuild & "\rc.cfg", "FLI4L_BUILDTIME='" & @HOUR & ":" & @MIN & ":" & @SEC &"'" & @LF ) FileWriteLine ( $glob_dir_tmpbuild & "\rc.cfg", "FLI4L_VERSION='" & FileReadLine ($dir_base & "\version.txt") & "'" & @LF ) FileCopy ( $glob_dir_tmpbuild & "\rc.cfg", $dir_config & "\etc\rc.cfg", 1) GUICtrlSetData ($progressbar,30) get_config_values () Select Case (StringLeft ($kernel_version, 3) = "2.6") $rootfs_format = "cpio" Case Else $rootfs_format = "tar" EndSelect Select Case $opt_type = "integrated" $file_list = $glob_dir_tmpbuild & "\rootfs.list" $msg = build_time () & $MSG_04_create_rootfs & " " fli4lbuild_msg ($msg ,0) FileCopy ("img\rootfs_distrib.list", $file_list,1) FileSetAttrib ($file_list, "-RSH") FileWrite ($file_list, "file boot/rc.cfg " & $glob_dir_tmpbuild_r & "/rc.cfg 600 0 0" & @LF) FileWrite ($file_list, "dir lib/modules/" & $kernel_version & " 755 0 0" & @LF) FileWrite ($file_list, "file lib/modules/" & $kernel_version & "/modules.dep '" & $glob_dir_tmpbuild_r & "/modules.dep' 600 0 0" & @LF) If FileExists ($glob_dir_tmpbuild & "\modules.alias") then FileWrite ($file_list, "file lib/modules/" & $kernel_version & "/modules.alias '" & $glob_dir_tmpbuild_r & "/modules.alias' 600 0 0" & @LF) EndIf create_archive_list ("ALL") If FileExists ($dir_config & "\hosts.extra") then FileWrite ($file_list, "ufile etc/hosts.extra '" & $dir_config_r & "/hosts.extra' 644 0 0" & @LF) EndIf If FileExists ($hostsglobalfile) then FileWrite ($file_list, "ufile etc/hosts.global '" & $hostsglobalfile & "' 644 0 0" & @LF) EndIf GUICtrlSetData ($progressbar,50) ;fli4lbuild_msg ("building root filesystem image ....",0) $run_call = StringFormat ('windows\\gen_init_%s.exe -t "%s" -o "%s" "%s"',$rootfs_format , $glob_dir_tmptemp_r ,$glob_dir_tmpbuild_r & "/rootfs" ,$file_list) $val = RunWait ($run_call, @WorkingDir, @SW_HIDE) If $val <> 0 then fli4lbuild_errmsg ("Error by call of gen_init_" & $rootfs_format & ".exe integrated rootfs" & @CRLF & "exit Build now!", 1) $bool_error = "true" exit_fli4l_build () EndIf fli4lbuild_msg ($MSG_finished & @CRLF,0) GUICtrlSetData ($progressbar,70) Case Else $file_list = $glob_dir_tmpbuild & "\opt.list" $msg = build_time () & $MSG_04_create_rootfsandopt & @CRLF fli4lbuild_msg ($msg,0) create_archive_list ("opt.tar") If FileExists ($dir_config & "\hosts.extra") then FileWrite ($file_list, "ufile etc/hosts.extra '" & $dir_config_r & "/hosts.extra' 644 0 0" & @LF) EndIf If FileExists ($hostsglobalfile) then FileWrite ($file_list, "ufile etc/hosts.global '" & $hostsglobalfile & "' 644 0 0" & @LF) EndIf GUICtrlSetData ($progressbar,40) $run_call = StringFormat ('windows\\gen_init_tar.exe -t "%s" -o "%s" "%s"', $glob_dir_tmptemp_r ,$glob_dir_tmpbuild_r & "/opt.tar", $file_list) $val = RunWait ($run_call, @WorkingDir, @SW_HIDE) If $val <> 0 then fli4lbuild_errmsg ("Error (" & $val & ") by call of gen_init_tar.exe for OPT-Archiv" & @CRLF & "exit Build now!", 1) $bool_error = "true" exit_fli4l_build () EndIf GUICtrlSetData ($progressbar,50) If $opt_type <> "tar" then compress_opt () EndIf $file_list = $glob_dir_tmpbuild & "\rootfs.list" FileCopy ("img\rootfs_distrib.list", $file_list,1) FileSetAttrib ($file_list, "-RSH") FileWrite ($file_list, "dir lib/modules/" & $kernel_version & " 755 0 0" & @LF) FileWrite ($file_list, "file lib/modules/" & $kernel_version & "/modules.dep '" & $glob_dir_tmpbuild_r & "/modules.dep' 600 0 0" & @LF) If FileExists ($glob_dir_tmpbuild & "\modules.alias") then FileWrite ($file_list, "file lib/modules/" & $kernel_version & "/modules.alias '" & $glob_dir_tmpbuild_r & "/modules.alias' 600 0 0" & @LF) EndIf Select Case $opt_type = "attached" FileWrite ($file_list, "file boot/opt.img " & $glob_dir_tmpbuild_r & " /opt.img 600 0 0" & @LF) EndSelect create_archive_list ("rootfs.tar") GUICtrlSetData ($progressbar,60) $run_call = StringFormat ('windows\\gen_init_%s.exe -t "%s" -o "%s" "%s"',$rootfs_format , $glob_dir_tmptemp_r ,$glob_dir_tmpbuild_r & "/rootfs" ,$file_list) $val = RunWait ($run_call, @WorkingDir, @SW_HIDE) If $val <> 0 then fli4lbuild_errmsg ("Error by call of gen_init_" & $rootfs_format & ".exe for Rootfs-Archiv" & @CRLF & "exit Build now!", 1) $bool_error = "true" exit_fli4l_build () EndIf GUICtrlSetData ($progressbar,70) Select Case $opt_type = "attached" FileDelete ($glob_dir_tmpbuild & " \opt.img") EndSelect fli4lbuild_msg (build_time () & $MSG_finished & @CRLF,0) EndSelect compress_rootfs () GUICtrlSetData ($progressbar,80) ;copy kernel defined by config to build-dir Select Case $comp_type_kernel = "bzip2" copy_kernel ("bz2") Case $comp_type_kernel = "gzip" copy_kernel ("gz") Case $comp_type_kernel = "lzma" copy_kernel ("lzma") Case $comp_type_kernel = "uncompressed" copy_kernel ("uncompressed") EndSelect GUICtrlSetData ($progressbar,90) ;generating md5sum of files gen_md5_sums () ;copy all files (rc.cfg, opt.tar/opt.img, syslinux.cfg, rootfs.img, kernel and rc_full.cfg to build dir FileCopy ($glob_dir_tmpbuild & "\kernel", $dir_build & "\KERNEL",1) FileCopy ($glob_dir_tmpbuild & "\rootfs.img", $dir_build & "\ROOTFS.IMG",1) FileCopy ($glob_dir_tmpbuild & "\rc.cfg", $dir_build & "\rc.cfg",1) FileCopy ($glob_dir_tmpbuild & "\syslinux.cfg", $dir_build & "\SYSLINUX.CFG", 1) If FileExists ($glob_dir_tmpbuild & "\opt.tar") then FileCopy ($glob_dir_tmpbuild & "\opt.tar", $dir_build & "\OPT.TAR",1) EndIf If FileExists ($glob_dir_tmpbuild & "\opt.img") then FileCopy ($glob_dir_tmpbuild & "\opt.img", $dir_build & "\OPT.IMG",1) EndIf FileCopy ($glob_dir_tmpbuild & "\full_rc.cfg", $dir_build & "\full_rc.cfg", 1) If $bool_recover <> "no" then FileCopy ($dir_base & "\img\boot.msg", $dir_build & "\BOOT.MSG", 1) FileCopy ($dir_base & "\img\boot_s.msg", $dir_build & "\BOOT_S.MSG", 1) FileCopy ($dir_base & "\img\boot_z.msg", $dir_build & "\BOOT_Z.MSG", 1) FileCopy ($dir_base & "\img\boot.msg", $glob_dir_tmpbuild & "\BOOT.MSG", 1) FileCopy ($dir_base & "\img\boot_s.msg", $glob_dir_tmpbuild & "\BOOT_S.MSG", 1) FileCopy ($dir_base & "\img\boot_z.msg", $glob_dir_tmpbuild & "\BOOT_Z.MSG", 1) EndIf If $verbose = "true" then $msg = $MSG_04_finished & @CRLF & $MSG_LINE & @CRLF Else $msg = $MSG_finished & @CRLF & $MSG_LINE & @CRLF EndIf fli4lbuild_msg (build_time () & $msg,1) GUICtrlSetData ($progressbar,100) WinActivate("fli4l-Build","") else ;error in check of fli4l-config fli4lbuild_msg ($MSG_cancel & @CRLF , 1) $msg = read_mkfli4l_log () fli4l_log_error ($MSG_04_msgboxerror & @CRLF & $MSG_LINE & @CRLF) fli4l_log_error ($msg) If StringLen ($msg) > 1500 then $msg1 = StringLeft ($msg, 1500) $msg1 = $msg1 & @CRLF & @CRLF & " - please read complete output in " If $verbose ="true" Then $msg1 = $msg1 & "main window or in " EndIf $msg1 = $msg1 & "log-file!" Else $msg1=$msg EndIf MsgBox(48 + 4096, $MSG_04_msgboxerror, $msg1) If Stringlen($msg)>60000 Then $msg=StringLeft($msg, 60000) & @CRLF & @CRLF & "Log too large to show, use log-file: '" & $dir_build & "\mkfli4l_error.log'" & @CRLF EndIf fli4lbuild_msg ($MSG_LINE & @CRLF & $msg,0) ; show errormessage in build-window if verbose $bool_error = "true" EndIf sleep (2000) GUICtrlDelete ($progressbar) GUICtrlDelete ($icon) EndFunc ; ------------------------------- ; Functions only in windows-build ; ------------------------------- Func compress_opt () Select Case $comp_type_opt = "bzip2" $msg = build_time () & " --- " &$MSG_04_compressopt & " " fli4lbuild_msg ($msg ,0) $run_call = StringFormat ('"%s\\windows\\bzip2.exe" -v9 opt.tar',$dir_base) $val = RunWait ($run_call, $glob_dir_tmpbuild, @SW_HIDE) FileMove ($glob_dir_tmpbuild & "\opt.tar.bz2", $glob_dir_tmpbuild & "\opt.img",1) fli4lbuild_msg ($MSG_finished & @CRLF,0) Case $comp_type_opt = "lzma" $msg = build_time () & " --- " &$MSG_04_compressopt_lzma & " " fli4lbuild_msg ($msg ,0) $run_call = StringFormat ('"%s\\windows\\lzma.exe" e -d%s opt.tar opt.tar.lzma',$dir_base, $lzma_opt_dictionary_size) $val = RunWait ($run_call, $glob_dir_tmpbuild, @SW_HIDE) FileMove ($glob_dir_tmpbuild & "\opt.tar.lzma", $glob_dir_tmpbuild & "\opt.img",1) FileDelete ($glob_dir_tmpbuild & "\opt.tar") fli4lbuild_msg ($MSG_finished & @CRLF,0) EndSelect EndFunc Func compress_rootfs () Select Case $comp_type_rootfs = "bzip2" $msg = build_time () & $MSG_04_compressrootfs_bz2 & " " fli4lbuild_msg ($msg,0) $run_call = StringFormat ('"%s\\windows\\bzip2.exe" -v9 rootfs', $dir_base) $val = RunWait ($run_call, $glob_dir_tmpbuild, @SW_Hide) fli4lbuild_msg ($MSG_finished & @CRLF,0) FileMove ($glob_dir_tmpbuild & "\rootfs.bz2", $glob_dir_tmpbuild & "\rootfs.img", 1) Case $comp_type_rootfs = "gzip" $msg = build_time () & $MSG_04_compressrootfs & " " fli4lbuild_msg ($msg,0) $run_call = StringFormat ('"%s\\windows\\gzip.exe" -v9 rootfs', $dir_base) $val = RunWait ($run_call, $glob_dir_tmpbuild, @SW_HIDE) fli4lbuild_msg ($MSG_finished & @CRLF,0) FileMove ($glob_dir_tmpbuild & "\rootfs.gz", $glob_dir_tmpbuild & "\rootfs.img", 1) Case $comp_type_rootfs = "lzma" $msg = build_time () & $MSG_04_compressrootfs_lzma & " " fli4lbuild_msg ($msg,0) $run_call = StringFormat ('"%s\\windows\\lzma.exe" e -d%s rootfs rootfs.lzma', $dir_base, $lzma_root_dictionary_size) $val = RunWait ($run_call, $glob_dir_tmpbuild, @SW_HIDE) fli4lbuild_msg ($MSG_finished & @CRLF,0) FileMove ($glob_dir_tmpbuild & "\rootfs.lzma", $glob_dir_tmpbuild & "\rootfs.img", 1) EndSelect EndFunc Func read_mkfli4l_log () Dim $msg , $_msg , $file $file = FileOpen($glob_dir_tmplog & "\mkfli4l.log", 0) ; Check if file opened for reading OK If $file = -1 Then $msg = $MSG_04_nologfile & @CRLF & "'" & $glob_dir_tmpbuild & "\mkfli4l.log'." MsgBox(0, $MSG_msgbox_error, $msg) FileClose($file) Return $msg Else ; Read in lines of text until the EOF is reached While 1 $_msg = FileReadLine($file) ; abort on EOF, strip unnessecary mkfli4l output If (@error = -1) or (StringLeft ($_msg,22) = "Error in configuration") or (StringLeft ($_msg,5) = "total") or (StringLeft ($_msg,14) = " total") Then ExitLoop ; strip empty lines if $_msg <> "" Then $msg = $msg & $_msg & @CRLF Wend FileClose($file) Return $msg EndIf FileClose($file) EndFunc Func read_passwd_group ($file_src, ByRef $array) $file = FileOpen($file_src, 0) If $file <> -1 Then $array = StringSplit( FileRead($file, FileGetSize($file_src)), @LF) EndIf FileClose($file) EndFunc Func read_var_from_rc_cfg ($var, ByRef $parameter) Dim $result Dim $line Dim $val Dim $file Dim $len Dim $end $len = StringLen($var) $file = FileOpen($glob_dir_tmpbuild & "\rc.cfg", 0) ; Check if file opened for reading OK If $file = -1 Then MsgBox(0, "Error", "Unable to open file '"& $glob_dir_tmpbuild & "\rc.cfg") else ; Read in lines of text until the EOF is reached While 1 $line = FileReadLine($file) If @error = -1 Then ExitLoop If StringLeft($line, $len) = $var then $end = StringInStr($line, "'", 1, 2) $result = StringMid ($line, $len + 3, $end - $len - 3) ExitLoop EndIf Wend FileClose($file) If $result <> "" then $parameter = $result EndIf Return $result EndIf EndFunc