Use Makeself to create an installation file
Makeself.shis a small shellscript used to generate a self-decompressed tar.gz compressed package from a directory. The result file is displayed as a shell script (most with. run as the suffix) and can be run automatically. This document will decompress itself to a temporary directory and execute an optional command (for example, an installation script ). It is very similar to the files generated by Winzip Self-extracting in Windows. The Makeself documentation also includes checksum for integration of subverification (CRC or MD5 checksum ).
The Makeself. sh script is only used to create a document from the file directory. The generated document is actually a compressed (gzip, bzip2, or compressed) TAR file. Add a small Shell script at the beginning of the file. This is a small Stub script used to extract files, run embedded commands, and delete temporary files. To install software contained in this document, you only need to run the document, for example, sh nice-software.rum. I recommend that these files use "run" or "sh" as the suffix. Do not confuse users because they know that it is actually a Shell script with a considerable amount of binary data.
Makeself has been rewritten since 2.1 and tested on the following Platform:
1. Linux (all releases)
2. Sun Solaris (version 8 or later)
3. HP-UX (11.0 and 11i on the HPPA server)
4. SCO OpenUnix and OpenServer
5. ibm aix 5.1L
6 MacOS X (Dario)
7. sg irix 6.5
8. FreeBSD
9. UnicOS/Cray
10. Cygwin (Windows)
Home Page (Latest Version 2.2.0 ):
Https://github.com/megastep/makeself
Http://megastep.org/makeself/
Source code download:
Https://github.com/megastep/makeself/archive/release-2.2.0.tar.gz
Download the latest official release:
Http://cdn.megastep.org/makeself/makeself-2.2.0.run
Makeself Installation
To install makeself on Linux, download the latest archive format file, execute the downloaded file, when the file is self-extracted, it will create a new directory under the current directory called makeself-2.2.0, copy all shell scripts to the/usr/bin directory to complete the installation.
$ Wgethttp: // megastep.org/makeself/makeself-2.2.0.run
$ Chmod 755 makeself-2.2.0.run
$./Makeself-2.2.2.run
$ Makeself-2.2.0 cd
$ Sudo cp *. sh/usr/bin
Usage
The basic usage of makeself. sh is as follows:
Makeself. sh [args] archive_dir file_namelabel startup_script [script_args]
The "label" parameter is the message printed during SFX decompression. "start_script" specifies the script and command to be executed after the SFX archive file is decompressed successfully. It is useful when you want to create a self-extracting Installation File. Generally, the startup script copies and installs the extracted content to the appropriate target directory. The Startup Script must be in the packaged directory, so the script is included in the SFX archive file.
1. args is an optional parameter of Makeself, which can be:
-- Vesion: print the version information to the console and exit immediately;
--- Gzip: Use GZIP for compression (default option)
--- Bzip2: Use bzip2 for compression
--- Compress: Use the compress command of Unix to compress data.
--- Nocomp: no compression
--- Notemp: you do not need to compress the file to a temporary directory, but create a new subdirectory under the current directory.
--- Current: the file will be decompressed to the current directory, instead of sub-directories, and the -- notemp option is hidden.
--- Follow: follow all symbolic links and package the symbolic link files.
--- Append: recent data is stored in an existing document, instead of creating a new data.
--- Header: Makeself2.0 can start with a standalone file storage header stub, called a makeelf-header.sh, which is assumed to be located in the same location as makeself.
--- Copy :....
2. archive_dir: directory name that contains the archive file
3. file_name: name of the created archive file
4. label: describes any text string of the software package. It is displayed when the file is decompressed.
5. startup_script: command in the extract file directory, so if you want to execute
In the program in this directory, you must add the prefix "./" before your command. For example,./program is correct, and script_args is an additional parameter for modifying the command.
Here is an example. Assume that the user has a package image stored in the/home/joe/mysoft directory, and it wants to generate a self-extracting mysoft. sh package, which will start the setup script stored in the/home/joe/mysoft directory and execute the following command:
Makeself. sh/home/joe/mysoft. sh "Joe's Nice Software Package"./setup
The following is a command to create the Makeself. run document containing the makeself release:
Makeself. sh -- notempmakeself makeself. run "Makeself by Stephen ane Peter" echo "Makeself has extracted itself"
The document generated by makeself can pass the following parameters:
--- Keep: place the file and decompress it to a temporary directory (it will be deleted after the embedded script is executed ). The file is directly decompressed to the current working directory until you delete it.
--- Verbose: prompt the user before executing the embedded command
--- Target: allows you to extract directories to any location.
--- Confirm: prompt the user to confirm before running the embedded command
--- Info: Print general information about the document (pressure-free)
--- Lsm: Print LSM entries
--- Check: Use the embedded checksum to check the document.
--- Nochown: by default, after decompression, run the "chown-R" command in the target directory so that all files belong to the current user. If you need to run most of the tasks as a root user, tar will try to re-create and initialize the user owner. You can disable this behavior.
--- Tar: run the tar command on the document content and use the following parameters as command parameters.
--- Noexec: Do not run the embedded script after decompression.
Parameters following any document will be passed as additional parameters to embedded commands. Before any of these options, you should use the -- dedicated command line structure to ensure that Makeself will not try to explain them.
For more details, please continue to read the highlights on the next page: