makeself 脚本使用(封装加密脚本)

本文介绍了如何使用makeself工具将目录中的文件打包成可执行脚本,包括下载、安装、命令结构以及常用参数,如压缩选项和自定义行为。
摘要由CSDN通过智能技术生成

makeself 脚本使用

        makeself是一个小型shell脚本,他可以吧特定目录下的文件打包成为一个shell脚本类似的文件,并且能够像shell脚本一样执行。例如我在test目录下创建了多个shell脚本和一些配置文件,这些脚本在执行时可能会相互调用并读取配置文件。使用makeself工具可以将这些文件统一打包成一个脚本并执行,非常的方便。

makeself使用方法:

  1. 首先makeself:http://megastep.org/makeself/makeself.run
  2. 下载完成后会得到makeself.run文件,直接运行后会得到makeself-2.1.5 文件夹,将里面的 makeself-header.sh  及makeself.sh 复制到/usr/bin/目录下,其他地方即可执行

    wget http://megastep.org/makeself/makeself.run

    chmod +x makeself.run

    ./makeself.run

     如果下载不了,通过网盘获取:链接: https://pan.baidu.com/s/1thr-fol7h7h6_az0VQptrA  密码: h9eo

3、makeself.sh [args] archive_dir file_name label startup_script [script_args]:例如makeself.sh test test.sh "hello" ./1.sh

    该命令指明需要打包的目录为test目录,打包成的文件命名为test.sh,脚本运行后输出信息为“hello”,首先执行的脚本   ./1.sh  (这个./1.sh是在test目录里的

    以下是一些常用的参数,可以作为参考:

    1. args are optional options for Makeself. The available ones are :
        1. --version : Prints the version number on stdout, then exits immediately
        2. --gzip : Use gzip for compression (is the default on platforms on which gzip is commonly available, like Linux)
        3. --bzip2 : Use bzip2 instead of gzip for better compression. The bzip2 command must be available in the command path. I recommend that you set the prefix to something like '.bz2.run' for the archive, so that potential users know that they'll need bzip2 to extract it.
        4. --compress : Use the UNIX "compress" command to compress the data. This should be the default on all platforms that don't have gzip available.
        5. --nocomp : Do not use any compression for the archive, which will then be an uncompressed TAR.
        6. --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).
        7. --current : Files will be extracted to the current directory, instead of in a subdirectory. This option implies --notemp above.
        8. --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.
        9. --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.
        10. --header : Makeself 2.0 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.
        11. --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.
        12. --nox11 : Disable the automatic spawning of a new terminal in X11.
        13. --nowait : When executed from a new X11 terminal, disable the user prompt at the end of the script execution.
        14. --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.
        15. --lsm file : Provide and 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 exemple of a LSM file is provided with Makeself.
    2. archive_dir is the name of the directory that contains the files to be archived
    3. file_name is the name of the archive to be created
    4. label is an arbitrary text string describing the package. It will be displayed while extracting the files.
    5. startup_script is the command to be executed from within the directory of extracted files. Thus, if you wish to execute a program contain in this directory, you must prefix your command with "./". For example, ./program will be fine. The script_args are additionnal arguments for this command.

  • 24
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值