搜索 | 用户支持

防范以用户支持为名的诈骗。我们绝对不会要求您拨打电话或发送短信,及提供任何个人信息。请使用“举报滥用”选项报告涉及违规的行为。

详细了解

firefox keeps updating the same mar file

  • 3 个回答
  • 1 人有此问题
  • 5 次查看
  • 最后回复者为 zbence

more options

Hi,

I have made an update server following the article: https://firefox-source-docs.mozilla.org/taskcluster/setting-up-an-update-server.html The server works perfectly, my clients can see the update.xml and the mar file, but even after the client updates itself, it can not identify the update as the same and tries to update again and again...

My update xml is like this: <updates>

  <update type="minor" displayVersion="83.0" appVersion="83.0" platformVersion="83.0" buildID="21181002100236">
Hi, I have made an update server following the article: https://firefox-source-docs.mozilla.org/taskcluster/setting-up-an-update-server.html The server works perfectly, my clients can see the update.xml and the mar file, but even after the client updates itself, it can not identify the update as the same and tries to update again and again... My update xml is like this: <?xml version="1.0" encoding="utf-8"?> <updates> <update type="minor" displayVersion="83.0" appVersion="83.0" platformVersion="83.0" buildID="21181002100236"> <patch type="complete" URL="http://<myserver>/firefox-83.0.complete.mar" hashFunction="sha512" hashValue="A8B8FEDEAEE383D2D712B8303C2BEBC88133939A7B691E7BA7CC3D4A220BDE22D33FA0D57BD0060036BC533AAD69F972D1BB6F8EFB385E5B59C8BBE3A6734A52" size="61899176" /> </update> </updates>
已附加屏幕截图

被采纳的解决方案

Hi, It seems that the MAR file does not contains the build number directly. It contains the "application.ini", which holds this information. I have written a powershell script which can extract the file for me, 7zip can extract that ini file so I could parse it's content. As long this information stays in there, I'm happy.

The relevant part of this script:

$file = [System.IO.File]::ReadAllBytes($localfile) function Read-4bytes{ Param ( [int]$offset ) Process { return $file[$offset]*256*256*256+$file[$offset+1]*256*256+$file[$offset+2]*256+$file[$offset+3] } } $indexoffset = Read-4bytes(4) $indexsize = Read-4bytes($indexoffset) $remaining = $indexsize $pointer = $indexoffset + 4 while($remaining -gt 0){ $filename = "" $contentoffset = Read-4bytes($pointer) $contentsize = Read-4bytes($pointer+4) $flags = Read-4bytes($pointer+8) $pointer+=12 while($file[$pointer] -gt 0){ $filename += [char]$file[$pointer] $pointer++ $remaining-- } $pointer++ $remaining-=13 if($filename -eq "application.ini"){$remaining=0} } $content = @() for($i = 0; $i -lt $contentsize; $i++){ $content += $file[$contentoffset+$i] } $tempout = $localfolder + "temp.i" [System.IO.File]::WriteAllBytes($tempout, $content) $unzipfile = $localfolder + "temp" c:\tools\7z.exe e $tempout -o"$localfolder" $appini=Get-Content $unzipfile $buildID = ($appini -like "buildid*").split("=")[1] remove-item $tempout remove-item $unzipfile

It is not bulletproof, but works.

定位到答案原位置 👍 0

所有回复 (3)

more options

It seems that the xml content is not showing correctly, so I've attached a screenshot of it.

more options

Hi, I could find out why it is keep updating itself. The buildID in the update.xml is much higher than in the real update file. If I can put the correct buildID in the xml, it stops the update cycle. Now my question - how could I get the correct buildID from the MAR file itself?

more options

选择的解决方案

Hi, It seems that the MAR file does not contains the build number directly. It contains the "application.ini", which holds this information. I have written a powershell script which can extract the file for me, 7zip can extract that ini file so I could parse it's content. As long this information stays in there, I'm happy.

The relevant part of this script:

$file = [System.IO.File]::ReadAllBytes($localfile) function Read-4bytes{ Param ( [int]$offset ) Process { return $file[$offset]*256*256*256+$file[$offset+1]*256*256+$file[$offset+2]*256+$file[$offset+3] } } $indexoffset = Read-4bytes(4) $indexsize = Read-4bytes($indexoffset) $remaining = $indexsize $pointer = $indexoffset + 4 while($remaining -gt 0){ $filename = "" $contentoffset = Read-4bytes($pointer) $contentsize = Read-4bytes($pointer+4) $flags = Read-4bytes($pointer+8) $pointer+=12 while($file[$pointer] -gt 0){ $filename += [char]$file[$pointer] $pointer++ $remaining-- } $pointer++ $remaining-=13 if($filename -eq "application.ini"){$remaining=0} } $content = @() for($i = 0; $i -lt $contentsize; $i++){ $content += $file[$contentoffset+$i] } $tempout = $localfolder + "temp.i" [System.IO.File]::WriteAllBytes($tempout, $content) $unzipfile = $localfolder + "temp" c:\tools\7z.exe e $tempout -o"$localfolder" $appini=Get-Content $unzipfile $buildID = ($appini -like "buildid*").split("=")[1] remove-item $tempout remove-item $unzipfile

It is not bulletproof, but works.