如何從 AppImage 中提取檔案?

如何從 AppImage 中提取檔案?

簡單的問題,如何從 AppImage 中提取檔案?

GUI、CLI,沒關係,只要能完成工作即可。

如果重要的話我正在使用 openSUSE Tumbleweed

答案1

第一的,查看您的 AppImage 檔案是否使用其內部格式的最新版本:

/path/to/your.AppImage --appimage-help

如果您在輸出中看到以下行:

--appimage-extract              Extract content from embedded filesystem image

您可以自行決定如何繼續。在這種情況下,你有一個(較新的)2型AppImage 格式就在您面前。 (命令的“路徑”部分可以是相對的或絕對的。)

第二,如果第一個命令不起作用,您可以使用輔助工具。但是,您需要 sudo/root 權限才能執行此操作:下載appimagetool(當然可以作為 AppImage 提供)。使其可執行並運行:

/path/to/appimagetool-x86_64.AppImage --list /path/to/your.AppImage

這應該為您提供所有文件及其嵌入的(相對)路徑的列表你的.AppImage。提取你的.AppImage進入名為並位於的目錄/路徑/到/somedir, 跑步

mkdir /path/to/somedir
/path/to/appimagetool-x86_64.AppImage /path/to/your.AppImage /path/to/somedir

第三,您也可以在不使用輔助工具的情況下安裝 AppImages(類型 1 和類型 2):

  • 類型1:

    mkdir mountpoint
    sudo mount -o loop my.AppImage mountpoint/
    
    # You can now inspect the contents
    # You can now also copy the contents to a writable location of your hard disk
    
    sudo umount mountpoint/
    # Do not forget the umount step!
    # If you do forget it, your system may exhibit unwanted behavior.
    
  • 類型2:

    mkdir mountpoint
    my.AppImage --appimage-offset
    123456   # This is just an example output
    
    sudo mount my.AppImage mountpoint/ -o offset=123456
    
    # you can now inspect the contents
    
    sudo umount mountpoint/
    # Do not forget the umount step!
    # If you do forget it, your system may exhibit unwanted behavior.
    

對「偏執狂」的提示:如果您不想信任AppImage,則最好使用第三種方法。因為運行(對於類型 2 AppImage)the.AppImage --appimage-extract或或the.AppImage --appimage-mount意味著the.AppImage --appimage-offset您實際上正在執行 AppImage(儘管不是其內容)。

更新:

在下面的評論中回答@jayarjo的問題(修改後如何重新打包AppImage?):

  1. 您可以使用應用影像工具不僅僅是將現有的 AppImage 提取到 AppDir 中。您也可以使用它將 AppDir(可能在進行一些更改後)重新打包回(修改後的)AppImage。

  2. 趕緊跑

     appimagetool -v /path/to/AppDir
    

    觀察命令的輸出(透過-v)取得新建立的 AppImage 的位置和名稱。就是這樣。

答案2

將副檔名重新命名為 .7z

$ mv file.AppImage file.7z

使用文件滾輪提取

$ file-roller --extract-here file.7z 

在 Linux Mint 上測試。

答案3

我只用右鍵重命名,例如:

壓縮pdf-v0.1-x86_64.AppImage

到:

壓縮pdf-v0.1-x86_64.zip

然後右鍵單擊

“提取到這裡”

和工作

將所有文件提取到一個資料夾中

答案4

根據這裡的答案,我創建了這個簡單的 bash 腳本。但我從未遇到過可以使用循環設備提取的 AppImage。編輯:剛剛做了:“wxHexEditor”

這裡:

#!/bin/bash

APP="$2"
UNPK="$(echo $APP | sed 's/\.AppImage//')"

case "$1" in
  -a)
      chmod +x $APP;
      ./$APP --appimage-extract
      mv squashfs-root $UNPK
      ;;
  -b)
      mkdir -p /tmp/$UNPK
      sudo mount -o loop $APP /tmp/$UNPK &>/dev/null
      mkdir -p ~/Desktop/$UNPK
      cp -R /tmp/$UNPK/* ~/Desktop/$UNPK &>/dev/null
      sudo umount /tmp/$UNPK
      ;;
  *)
      echo
      echo "   Usage: appunpack [option] AppImageFile"
      echo 
      echo "   Options: -a  Unpack using --appimage-extract"
      echo "            -b  Unpack using a loop device"
      ;;
esac

相關內容