[makeself|shell] 使用makeself制作linux应用程序安装包

打包工具makeself安装

sudo apt install makeself

makeself帮助

makeself.sh [args] archive_dir file_name label startup_script [script_args]
args are optional options for Makeself. The available ones are :

--version : Prints the version number on stdout, then exits immediately
--gzip : Use gzip for compression (the default on platforms on which gzip is commonly available, like Linux)
--bzip2 : Use bzip2 instead of gzip for better compression. The bzip2 command must be available in the command path. It is recommended that the archive extension be set to something like ‘.bz2.run’, so that potential users know that they’ll need bzip2 to extract it.
--bzip3 : Use bzip3 instead of gzip for better compression.
--pbzip2 : Use pbzip2 instead of gzip for better and faster compression on machines having multiple CPUs. The pbzip2 command must be available in the command path. It is recommended that the archive extension be set to something like ‘.bz2.run’, so that potential users know that they’ll need bzip2 to extract it.
--xz : Use xz instead of gzip for better compression. The xz command must be available in the command path. It is recommended that the archive extension be set to something like ‘.xz.run’ for the archive, so that potential users know that they’ll need xz to extract it.
--lzo : Use lzop instead of gzip for better compression. The lzop command must be available in the command path. It is recommended that the archive extension be set to something like .lzo.run for the archive, so that potential users know that they’ll need lzop to extract it.
--lz4 : Use lz4 instead of gzip for better compression. The lz4 command must be available in the command path. It is recommended that the archive extension be set to something like ‘.lz4.run’ for the archive, so that potential users know that they’ll need lz4 to extract it.
--zstd : Use zstd instead of gzip for better compression. The zstd command must be available in the command path. It is recommended that the archive extension be set to something like ‘.zstd.run’ for the archive, so that potential users know that they’ll need zstd to extract it.
--pigz : Use pigz for compression.
--base64 : Encode the archive to ASCII in Base64 format instead of compressing (base64 command required).
--gpg-encrypt : Encrypt the archive using gpg -ac -z $COMPRESS_LEVEL. This will prompt for a password to encrypt with. Assumes that potential users have gpg installed.
--ssl-encrypt : Encrypt the archive using openssl aes-256-cbc -a -salt. This will prompt for a password to encrypt with. Assumes that the potential users have the OpenSSL tools installed.
--compress : Use the UNIX compress command to compress the data. This should be the default on all platforms that don’t have gzip available.
--nocomp : Do not use any compression for the archive, which will then be an uncompressed TAR.
--complevel : Specify the compression level for gzip, bzip2, pbzip2, zstd, xz, lzo or lz4. (defaults to 9)
--threads : Specify the number of threads to be used by compressors that support parallelization. Omit to use compressor’s default. Most useful (and required) for opting into xz’s threading, usually with --threads=0 for all available cores. pbzip2 and pigz are parallel by default, and setting this value allows limiting the number of threads they use.
--notemp : The generated archive will not extract the files to a temporary directory, but in a new directory created in the current directory. This is better to distribute software packages that may extract and compile by themselves (i.e. launch the compilation through the embedded script).
--current : Files will be extracted to the current directory, instead of in a subdirectory. This option implies --notemp above.
--follow : Follow the symbolic links inside of the archive directory, i.e. store the files that are being pointed to instead of the links themselves.
--append (new in 2.1.x): Append data to an existing archive, instead of creating a new one. In this mode, the settings from the original archive are reused (compression type, label, embedded script), and thus don’t need to be specified again on the command line.
--header : Makeself uses a separate file to store the header stub, called makeself-header.sh. By default, it is assumed that it is stored in the same location as makeself.sh. This option can be used to specify its actual location if it is stored someplace else.
--cleanup : Specify a script that is run when execution is interrupted or finishes successfully. The script is executed with the same environment and initial script_args as startup_script.
--copy : Upon extraction, the archive will first extract itself to a temporary directory. The main application of this is to allow self-contained installers stored in a Makeself archive on a CD, when the installer program will later need to unmount the CD and allow a new one to be inserted. This prevents “Filesystem busy” errors for installers that span multiple CDs.
--nox11 : Disable the automatic spawning of a new terminal in X11.
--nowait : When executed from a new X11 terminal, disable the user prompt at the end of the script execution.
--nomd5 and --nocrc : Disable the creation of a MD5 / CRC checksum for the archive. This speeds up the extraction process if integrity checking is not necessary.
--sha256 : Adds a SHA256 checksum for the archive. This is in addition to the MD5 / CRC checksums unless --nomd5 is also used.
--lsm file : Provide a Linux Software Map (LSM) file to makeself, that will be embedded in the generated archive. LSM files are describing a software package in a way that is easily parseable. The LSM entry can then be later retrieved using the --lsm argument to the archive. An example of a LSM file is provided with Makeself.
--tar-format opt : Specify the tar archive format (default is ustar); you may use any value accepted by your tar command (such as posix, v7, etc).
--tar-extra opt : Append more options to the tar command line.

For instance, in order to exclude the .git directory from the packaged archive directory using the GNU tar, one can use makeself.sh --tar-extra "--exclude=.git" ...

--keep-umask : Keep the umask set to shell default, rather than overriding when executing the self-extracting archive.
--packaging-date date : Use provided string as the packaging date instead of the current date.
--license file : Append a license file.
--nooverwrite : Do not extract the archive if the specified target directory already exists.
--help-header file : Add a header to the archive’s --help output.
archive_dir is the name of the directory that contains the files to be archived
file_name is the name of the archive to be created
label is an arbitrary text string describing the package. It will be displayed while extracting the files.
startup_script is the command to be executed from within the directory of extracted files. Thus, if you wish to execute a program contained in this directory, you must prefix your command with ./. For example, ./program will be fine. The script_args are additional arguments for this command. Note that startup_script and its arguments are not strictly required for archives that don’t extract in a temporary directory (i.e. when using --notemp).

要使用 makeself 包含多个文件和文件夹,您可以将所有要打包的内容放入一个临时目录中,然后对该目录运行 makeself 命令来创建自解压脚本。

以下是一个示例步骤:

  1. 创建一个临时目录,并将所有要打包的文件和文件夹复制到该目录中:

    mkdir temp_dir
    cp file1 file2 directory1 directory2 temp_dir/
    
  2. 进入临时目录:

    cd temp_dir
    
  3. 运行 makeself 命令来创建自解压脚本:

    makeself.sh --gzip . <output_file.run> "<display_name>" <startup_script>
    
    
    . 表示当前目录,这样 makeself 将会打包当前目录下的所有文件和子目录。
    <output_file.run>: 生成的自解压脚本的输出文件名。
    "<display_name>": 在脚本运行时显示的名称。
    <startup_script> (可选): 在解压后执行的启动脚本。
  4. 创建成功后,退出临时目录:

    cd ..
    

  5. 现在您可以通过运行 <output_file.run> 来进行解压缩。解压缩后的文件和文件夹将被提取到当前目录中。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值