unit gitupdateunit; {$mode objfpc}{$H+} interface uses Classes, SysUtils; implementation uses process, systemunit, lowlevelunit, refreshExecutableUnit; var updated: boolean; output: string; args,gitDirs: tStringArray; i: longint; initialization updated:=false; setlength(gitDirs,2); gitDirs[0]:=extractFilePath(paramstr(0)); gitDirs[1]:=extractFilePath(leftStr(gitDirs[0],length(gitDirs[0])-1))+'units/'; output:=''; for i:=0 to length(gitDirs)-1 do begin setlength(args,2); args[0]:='pull'; args[1]:='--all'; if not runCommandInDir(gitDirs[i],'git',args,output) then continue; output:=trim(output); while pos(#10,output)>0 do erstesArgument(output,#10); updated:=updated or (output<>'Already up-to-date.') or (sourceSha512Sum(gitDirs[i])<>binarySha512Sum(i)); end; if updated then refreshExecutable(gitDirs); setlength(args,0); end.