2017-02-13 98 views
2

A XIP file is an analog to zip, but allows for a digital signature to be applied and verified on the receiving system, before the archive is expanded. When a XIP file is opened (by double-clicking), Archive Utility will automatically expand it (but only if the digital signature is intact).將.xip文件解壓縮到特定文件夾

基本上,.xip文件只是一個帶簽名的.zip文件,用於驗證文件自創建者保存後未發生更改。這可以防止磁盤錯誤和第三方篡改文件造成的損害。

有誰知道,如何提取該文件,例如使用終端,到一個特定的文件夾而不是到.xip文件所在的文件夾?

+0

如果是「只是一個zip」,那麼想必普通的解壓縮工具將做的伎倆。或者你想驗證簽名嗎? – halfer

回答

0

我會建議簡單的提取歸檔到該文件夾​​,你想嘗試以下操作:

xar -xf file.xip -C /path/to/target 

(和/或)

tar -zxvf file.xip -C /path/to/target 

xartar命令提取.xip「內容「和」元數據「以原始格式。

使用使用pbzx流解析器,你需要提取「內容」,這是一個LZMA壓縮的有效載荷;格式與包安裝程序中的格式類似(例如.pkg)。

pbzx -n Content | cpio -i 

您可以compile the pbzx source from here,或download the compiled binary並安裝到/usr/local/bin然後調用pbzx命令。在命令完成解析內容之後,您應該獲得.xip存檔內的任何內容的原始形式。

有用/附加信息

$ pkgutil --check-signature file.xip 

Xcode_9_beta_2.xip返回:

Package "Xcode_9_beta_2.xip": 
    Status: signed Apple Software 
    Certificate Chain: 
    1. Software Update 
     SHA1 fingerprint: 1E 34 E3 91 C6 44 37 DD 24 BE 57 B1 66 7B 2F DA 09 76 E1 FD 
     ----------------------------------------------------------------------------- 
    2. Apple Software Update Certification Authority 
     SHA1 fingerprint: FA 02 79 0F CE 9D 93 00 89 C8 C2 51 0B BC 50 B4 85 8E 6F BF 
     ----------------------------------------------------------------------------- 
    3. Apple Root CA 
     SHA1 fingerprint: 61 1E 5B 66 2C 59 3A 08 FF 58 D1 4A E2 24 52 D1 98 DF 6C 60 

Important: Starting with macOS Sierra, only XIP archives signed by Apple will be expanded. Developers who have been using XIP archives will need to move to using signed installer packages or disk images.

OS X manual page : xip

+0

我得到一個錯誤: 'Archive:Xcode_8.1.xip 找不到中央目錄結尾的簽名。這個文件不是一個zip文件,或者它構成一個多部分檔案的一個磁盤。在後一種情況下,中心目錄和zipfile註釋將在此存檔的最後一個磁盤上找到。注意:Xcode_8.1.xip可能是一個簡單的可執行文件,而不是一個歸檔文件' –

+0

當你雙擊文件時會發生什麼? –

+0

它打開默認的**歸檔工具**來驗證簽名和提取。但是,在完成驗證錯誤出現之前。 –

0

您可以打開歸檔工具本身,進入設置,並設置一個特定的目標文件夾,然後雙擊該文件。這樣你就可以將它擴展到一個特定的目的地。 ;-)