makeself - 윈디하나의 솔라나라

목차

개요

설치

설치 파일을 받아 압축을 풀고 실행 파일 makeself.sh, makeself-header.sh을 복사해준다.
windy@wl ~/src $ wget https://github.com/megastep/makeself/archive/refs/tags/release-2.5.0.tar.gz
windy@wl ~/src $ tar xvfz makeself-release-2.5.0.tar.gz
windy@wl ~/src $ cd makeself-release-2.5.0
windy@wl ~/src/makeself-release-2.5.0 $ sudo cp makeself.sh makeself-header.sh /usr/local/bin/
windy@wl ~/src/makeself-release-2.5.0 $ sudo cp makeself.1 /usr/local/man/man1/

사용방법

아카이브 생성 옵션

makeself.sh(1) 의 사용방법은 아래와 같다.
makeself.sh [args] archive_dir file_name label startup_script [script_args]
windy@wl ~ $ makeself.sh
Usage: /usr/local/bin/makeself.sh [args] archive_dir file_name label startup_script [script_args]
args can be one or more of the following :
    --version | -v     : Print out Makeself version number and exit
    --help | -h        : Print out this help message
    --tar-quietly      : Suppress verbose output from the tar command
    --quiet | -q       : Do not print any messages other than errors.
    --gzip             : Compress using gzip (default if detected)
    --pigz             : Compress with pigz
    --zstd             : Compress with zstd
    --bzip2            : Compress using bzip2 instead of gzip
    --pbzip2           : Compress using pbzip2 instead of gzip
    --bzip3            : Compress using bzip3 instead of gzip
    --xz               : Compress using xz instead of gzip
    --lzo              : Compress using lzop instead of gzip
    --lz4              : Compress using lz4 instead of gzip
    --compress         : Compress using the UNIX 'compress' command
    --complevel lvl    : Compression level for gzip pigz zstd xz lzo lz4 bzip2 pbzip2 and bzip3 (default 9)
    --threads thds     : 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.
    --base64           : Instead of compressing, encode the data using base64
    --gpg-encrypt      : Instead of compressing, encrypt the data using GPG
    --gpg-asymmetric-encrypt-sign
                       : Instead of compressing, asymmetrically encrypt and sign the data using GPG
    --gpg-extra opt    : Append more options to the gpg command line
    --ssl-encrypt      : Instead of compressing, encrypt the data using OpenSSL
    --ssl-passwd pass  : Use the given password to encrypt the data using OpenSSL
    --ssl-pass-src src : Use the given src as the source of password to encrypt the data
                         using OpenSSL. See "PASS PHRASE ARGUMENTS" in man openssl.
                         If this option is not supplied, the user will be asked to enter
                         encryption password on the current terminal.
    --ssl-no-md        : Do not use "-md" option not supported by older OpenSSL.
    --nochown          : Do not give the target folder to the current user (default)
    --chown            : Give the target folder to the current user recursively
    --nocomp           : Do not compress the data
    --notemp           : The archive will create archive_dir in the current directory
                         and uncompress in ./archive_dir
                         Note: persistent archives do not strictly require a startup_script
    --needroot         : Check that the root user is extracting the archive before proceeding
    --copy             : Upon extraction, the archive will first copy itself to
                         a temporary directory
    --append           : Append more files to an existing Makeself archive
                         The label and startup scripts will then be ignored
    --target dir       : Extract directly to a target directory
                         directory path can be either absolute or relative
    --current          : Files will be extracted to the current directory
                         Both --current and --target imply --notemp, and do not require a startup_script
    --nooverwrite      : Do not extract the archive if the specified target directory exists
    --tar-format opt   : Specify a tar archive format (default is ustar)
    --tar-extra opt    : Append more options to the tar command line
    --untar-extra opt  : Append more options to the during the extraction of the tar archive
    --nomd5            : Don't calculate an MD5 for archive
    --nocrc            : Don't calculate a CRC for archive
    --sha256           : Compute a SHA256 checksum for the archive
    --header file      : Specify location of the header script
    --cleanup file     : Specify a cleanup script that executes on interrupt and when finished successfully.
    --follow           : Follow the symlinks in the archive
    --noprogress       : Do not show the progress during the decompression
    --nox11            : Disable automatic spawn of a xterm
    --nowait           : Do not wait for user input after executing embedded
                         program from an xterm
    --sign passphrase  : Signature private key to sign the package with
    --lsm file         : LSM file describing the package
    --license file     : Append a license file
    --help-header file : Add a header to the archive's --help output
    --packaging-date date
                       : Use provided string as the packaging date
                         instead of the current date.

    --keep-umask       : Keep the umask set to shell default, rather than overriding when executing self-extracting archive.
    --export-conf      : Export configuration variables to startup_script

Do not forget to give a fully qualified startup script name
(i.e. with a ./ prefix if inside the archive).

아카이브 해제 옵션

생성한 아카이브 실행시 사용할 수 있는 옵션이다.
    --keep : Prevent the files to be extracted in a temporary directory that will be removed after the embedded script’s execution. The files will then be extracted in the current working directory and will stay here until you remove them.
    --verbose : Will prompt the user before executing the embedded command
    --target dir : Allows to extract the archive in an arbitrary place.
    --nox11 : Do not spawn a X11 terminal.
    --confirm : Prompt the user for confirmation before running the embedded command.
    --info : Print out general information about the archive (does not extract).
    --lsm : Print out the LSM entry, if it is present.
    --list : List the files in the archive.
    --check : Check the archive for integrity using the embedded checksums. Does not extract the archive.
    --nochown : By default, a chown -R command is run on the target directory after extraction, so that all files belong to the current user. This is mostly needed if you are running as root, as tar will then try to recreate the initial user ownerships. You may disable this behavior with this flag.
    --tar : Run the tar command on the contents of the archive, using the following arguments as parameter for the command.
    --noexec : Do not run the embedded script after extraction.
    --noexec-cleanup : Do not run the embedded cleanup script.
    --nodiskspace : Do not check for available disk space before attempting to extract.
    --cleanup-args : Specify arguments to be passed to the cleanup script. Wrap value in quotes to specify multiple arguments.

아카이브 생성과 실행

  1. 우선 임의의 디렉토리에 하나로 묶을 파일들을 저장해 놓자.
    windy@wl ~ $ ls -al ./test
    -rw-r--r--   1 windy    staff          9 11월  4 10:50 README.md
    -rwxr-xr-x   1 windy    staff         27 11월  4 10:49 startup.sh
    windy@wl ~ $ cat test/startup.sh
    #!/bin/bash
    echo StartUp!
    
    
  2. makeself.sh(1)명령을 실행해 test.bz2.run파일을 생성한다. 아래 예제에서는 스타트업 스크립트로 startup.sh 을 지정했다.
    windy@wl ~ $ makeself.sh --bzip2 test/ test.bz2.run "test Installer" ./startup.sh
    Header is 715 lines long
    
    About to compress 48 KB of data...
    Adding files to archive named "test.bz2.run"...
    ./README.md
    ./startup.sh
    CRC: 220009291
    MD5: e3f6d0d0eb51ed932b24726606b844db
    
    Self-extractable archive "test.bz2.run" successfully created.
    windy@wl ~ $ ls -alh test.bz2.run
    -rwxr-xr-x   1 windy    staff      18.4K 11월  4 11:42 test.bz2.run
    windy@wl ~ $ file test.bz2.run
    test.bz2.run:   executable shell script
    
    생성한 파일을 살펴보면 앞부분에 makeself-header.sh 파일이 들어있고, 뒷부분에 압축된 아카이브 바이너리가 붙어있는걸 확인할 수 있다. 뒷부분을 확인하려면 윈디하나의 솔라나라: bvi 와 같은 바이너리 에디터를 사용해야 한다.
    windy@wl ~ $ head test.bz2.run
    #!/bin/sh
    # This script was generated using Makeself 2.5.0
    # The license covering this archive and its contents, if any, is wholly independent of the Makeself license (GPL)
    
    ORIG_UMASK=`umask`
    if test "n" = n; then
        umask 077
    fi
    
    CRCsum="220009291"
    
  3. 생성한 파일을 실행하면, 압축이 ./test디렉토리에 풀리고 생성시 스타트업 스크립트로 지정한 startup.sh이 실행된다.
    windy@wl ~ $ ./test.bz2.run
    Verifying archive integrity...  100%   MD5 checksums are OK. All good.
    Uncompressing test Installer  100%
    StartUp!
    

기타

RSS ATOM XHTML 5 CSS3