Shell-Script

如何在不執行的情況下列出 makeself 存檔的內容?

  • December 2, 2020

我有一個自製檔案,我想看看裡面有什麼,即。哪些文件將被提取,而不是實際執行其腳本部分。我怎麼做?

我寧願不實際提取任何內容,但如果這是唯一的方法,那麼我願意進行提取 - 只要其中沒有任何 (ba)sh 程式碼實際執行。

生成的存檔有一個--list選項,您可以使用該選項列出其內容。

作為參考,我說的是 Debian 中的這個版本:

ii  makeself       2.2.0-1      all          utility to generate self-extractables

在腳本中生成這個塊:

MS_Help()
{   
   cat << EOH >&2 
Makeself version 2.2.0 
1) Getting help or info about $0 : 
 $0 --help   Print this message 
 $0 --info   Print embedded info : title, default target directory, embedded script ... 
 $0 --lsm    Print embedded lsm entry (or no LSM) 
 $0 --list   Print the list of files in the archive 
 $0 --check  Checks integrity of the archive 

2) Running $0 : 
 $0 [options] [--] [additional arguments to embedded script] 
 with following options (in that order) 
 --confirm             Ask before running embedded script 
 --quiet               Do not print anything except error messages 
 --noexec              Do not run embedded script 
 --keep                Do not erase target directory after running 
                       the embedded script 
 --noprogress          Do not show the progress during the decompression 
 --nox11               Do not spawn an xterm 
 --nochown             Do not give the extracted files to the current user 
 --target dir          Extract directly to a target directory 
                       directory path can be either absolute or relative 
 --tar arg1 [arg2 ...] Access the contents of the archive through the tar command 
 --                    Following arguments will be passed to the embedded script 
EOH
}

它的手冊頁需要一些工作,但腳本很容易閱讀 - 請參閱git 儲存庫

進一步閱讀:makeself - 在 Unix 上製作自解壓檔案

引用自:https://unix.stackexchange.com/questions/309049