搜尋 Mozilla 技術支援網站

防止技術支援詐騙。我們絕對不會要求您撥打電話或發送簡訊,或是提供個人資訊。請用「回報濫用」功能回報可疑的行為。

Learn More

firefox keeps updating the same mar file

  • 3 回覆
  • 1 有這個問題
  • 19 次檢視
  • 最近回覆由 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.