Git Product home page Git Product logo

makeself's Introduction

License: GPL v2 Build Status

makeself - Make self-extractable archives on Unix

makeself.sh is a small shell script that generates a self-extractable compressed tar archive from a directory. The resulting file appears as a shell script (many of those have a .run suffix), and can be launched as is. The archive will then uncompress itself to a temporary directory and an optional arbitrary command will be executed (for example an installation script). This is pretty similar to archives generated with WinZip Self-Extractor in the Windows world. Makeself archives also include checksums for integrity self-validation (CRC and/or MD5/SHA256 checksums).

The makeself.sh script itself is used only to create the archives from a directory of files. The resultant archive is actually a compressed (using gzip, bzip2, or compress) TAR archive, with a small shell script stub at the beginning. This small stub performs all the steps of extracting the files, running the embedded command, and removing the temporary files when done. All the user has to do to install the software contained in such an archive is to "run" the archive, i.e sh nice-software.run. I recommend using the ".run" (which was introduced by some Makeself archives released by Loki Software) or ".sh" suffix for such archives not to confuse the users, so that they will know they are actually shell scripts (with quite a lot of binary data attached to them though!).

I am trying to keep the code of this script as portable as possible, i.e it is not relying on any bash-specific features and only calls commands that are installed on any functioning UNIX-compatible system. This script as well as the archives it generates should run on any Unix flavor, with any compatible Bourne shell, provided of course that the compression programs are available.

Makeself has been rewritten and tested on the following platforms :

  • Linux (all distributions)
  • Sun Solaris (8 and above)
  • HP-UX (tested on 11.0 and 11i on HPPA RISC)
  • SCO OpenUnix and OpenServer
  • IBM AIX
  • macOS (Darwin)
  • SGI IRIX 6.5
  • FreeBSD
  • OpenBSD
  • NetBSD
  • UnicOS / Cray
  • Windows (Cygwin, WSL)

If you successfully run Makeself and/or archives created with it on another system, then please let me know!

Examples of publicly available archives made using makeself are :

  • Game patches and installers for Id Software games like Quake 3 for Linux or Return To Castle Wolfenstein ;
  • All game patches released by Loki Software for the Linux version of popular games ;
  • The nVidia drivers for Linux
  • The installer for the Linux version of Google Earth
  • The VirtualBox installers for Linux
  • The Makeself distribution itself ;-)
  • and countless others...

Important note for Apache users: By default, most Web servers will think that Makeself archives are regular text files and thus they may show up as text in a Web browser. The correct way to prevent this is to add a MIME type for this file format, like so (in httpd.conf) :

AddType application/x-makeself .run

Important note for certain GNU/Linux distributions: Archives created with Makeself prior to v2.1.2 were using an old syntax for the head and tail Unix commands that is being progressively obsoleted in their GNU forms. Therefore you may have problems uncompressing some of these archives. A workaround for this is to set the environment variable $_POSIX2_VERSION to enable the old syntax, i.e. :

export _POSIX2_VERSION=199209

Usage

The syntax of makeself is the following:

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.

    • --preextract : Specify a pre-extraction script. The script is executed with the same environment and initial script_args as startup_script.

    • --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.

    • --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" ...

    • --target dir : Specify the directory where the archive will be extracted.

    • --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).

Here is an example, assuming the user has a package image stored in a /home/joe/mysoft, and he wants to generate a self-extracting package named mysoft.sh, which will launch the "setup" script initially stored in /home/joe/mysoft :

makeself.sh /home/joe/mysoft mysoft.sh "Joe's Nice Software Package" ./setup

Here is also how I created the makeself.run archive which contains the Makeself distribution :

makeself.sh --notemp makeself makeself.run "Makeself by Stephane Peter" echo "Makeself has extracted itself"

Archives generated with Makeself can be passed the following arguments:

  • --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.

Any subsequent arguments to the archive will be passed as additional arguments to the embedded command. You must explicitly use the -- special command-line construct before any such options to make sure that Makeself will not try to interpret them.

Startup Script

The startup script must be a regular Shell script.

Within the startup script, you can use the $USER_PWD variable to get the path of the folder from which the self-extracting script is executed. This is especially useful to access files that are located in the same folder as the script, as shown in the example below.

my-self-extracting-script.sh --fooBarFileParameter foo.bar

Building and Testing

Clone the git repo and execute git submodule update --init --recursive to obtain all submodules.

  • To make a release: make
  • To run all tests: make test

Maven Usage

Makeself is now supported by the following maven plugin makeself-maven-plugin. Please refer to project for usage and report any bugs in regards to maven plugin on that project.

License

Makeself itself is covered by the GNU General Public License (GPL) version 2 and above. Archives generated by Makeself don't have to be placed under this license (although I encourage it ;-)), since the archive itself is merely data for Makeself.

Contributing

I will gladly consider merging your pull requests on the GitHub repository. However, please keep the following in mind:

  • One of the main purposes of Makeself is portability. Do not submit patches that will break supported platforms. The more platform-agnostic, the better.
  • Please explain clearly what the purpose of the patch is, and how you achieved it.

Download

Get the latest official distribution here (version 2.5.0).

The latest development version can be grabbed from GitHub. Feel free to submit any patches there through the fork and pull request process.

Version history

  • v1.0: Initial public release
  • v1.1: The archive can be passed parameters that will be passed on to the embedded script, thanks to John C. Quillan
  • v1.2: Cosmetic updates, support for bzip2 compression and non-temporary archives. Many ideas thanks to Francois Petitjean.
  • v1.3: More patches from Bjarni R. Einarsson and Francois Petitjean: Support for no compression (--nocomp), script is no longer mandatory, automatic launch in an xterm, optional verbose output, and -target archive option to indicate where to extract the files.
  • v1.4: Many patches from Francois Petitjean: improved UNIX compatibility, automatic integrity checking, support of LSM files to get info on the package at run time..
  • v1.5.x: A lot of bugfixes, and many other patches, including automatic verification through the usage of checksums. Version 1.5.5 was the stable release for a long time, even though the Web page didn't get updated ;-). Makeself was also officially made a part of the Loki Setup installer, and its source is being maintained as part of this package.
  • v2.0: Complete internal rewrite of Makeself. The command-line parsing was vastly improved, the overall maintenance of the package was greatly improved by separating the stub from makeself.sh. Also Makeself was ported and tested to a variety of Unix platforms.
  • v2.0.1: First public release of the new 2.0 branch. Prior versions are officially obsoleted. This release introduced the --copy argument that was introduced in response to a need for the UT2K3 Linux installer.
  • v2.1.0: Big change : Makeself can now support multiple embedded tarballs, each stored separately with their own checksums. An existing archive can be updated with the --append flag. Checksums are also better managed, and the --nochown option for archives appeared.
  • v2.1.1: Fixes related to the Unix compression (compress command). Some Linux distributions made the insane choice to make it unavailable, even though gzip is capable of uncompressing these files, plus some more bugfixes in the extraction and checksum code.
  • v2.1.2: Some bug fixes. Use head -n to avoid problems with POSIX conformance.
  • v2.1.3: Bug fixes with the command line when spawning terminals. Added --tar, --noexec for archives. Added --nomd5 and --nocrc to avoid creating checksums in archives. The embedded script is now run through "eval". The --info output now includes the command used to create the archive. A man page was contributed by Bartosz Fenski.
  • v2.1.4: Fixed --info output. Generate random directory name when extracting files to . to avoid problems. Better handling of errors with wrong permissions for the directory containing the files. Avoid some race conditions, Unset the $CDPATH variable to avoid problems if it is set. Better handling of dot files in the archive directory.
  • v2.1.5: Made the md5sum detection consistent with the header code. Check for the presence of the archive directory. Added --encrypt for symmetric encryption through gpg (Eric Windisch). Added support for the digest command on Solaris 10 for MD5 checksums. Check for available disk space before extracting to the target directory (Andreas Schweitzer). Allow extraction to run asynchronously (patch by Peter Hatch). Use file descriptors internally to avoid error messages (patch by Kay Tiong Khoo).
  • v2.1.6: Replaced one dot per file progress with a realtime progress percentage and a spinning cursor. Added --noprogress to prevent showing the progress during the decompression. Added --target dir to allow extracting directly to a target directory. (Guy Baconniere)
  • v2.2.0: First major new release in years! Includes many bugfixes and user contributions. Please look at the project page on Github for all the details.
  • v2.3.0: Support for archive encryption via GPG or OpenSSL. Added LZO and LZ4 compression support. Options to set the packaging date and stop the umask from being overriden. Optionally ignore check for available disk space when extracting. New option to check for root permissions before extracting.
  • v2.3.1: Various compatibility updates. Added unit tests for Travis CI in the GitHub repo. New --tar-extra, --untar-extra, --gpg-extra, --gpg-asymmetric-encrypt-sign options.
  • v2.4.0: Added optional support for SHA256 archive integrity checksums.
  • v2.4.2: New --cleanup and --cleanup-args arguments for cleanup scripts. Added threading support for supported compressors. Now supports zstd compression.
  • v2.4.3: Make explicit POSIX tar archives for increased compatibility.
  • v2.4.4: Fixed various compatibility issues (no longer use POSIX tar archives), Github Actions to check on Solaris and FreeBSD.
  • v2.4.5: Added --tar-format option to set the tar archive format (default is ustar)
  • v2.5.0: Expended support to NetBSD, OpenBSD, Busybox and other minimal distributions such as Alpine Linux. Added bzip3 compression support and expanded GPG arguments.

Links

  • Check out the "Loki Setup" installer, used to install many Linux games and other applications, and of which I am the co-author. Since the demise of Loki, I am now the official maintainer of the project, and it is now being hosted here on GitHub.
  • Bjarni R. Einarsson also wrote the setup.sh installer script, inspired by Makeself. Check it out !

Contact

This script was written by Stéphane Peter (megastep at megastep.org). Any enhancements and suggestions are welcome.

Contributions were included from John C. Quillan, Bjarni R. Einarsson, Francois Petitjean, Ryan C. Gordon, and many contributors on GitHub. If you think I forgot your name, don't hesitate to contact me.

This project is now hosted on GitHub. Feel free to submit patches and bug reports on the project page.


Stephane Peter

makeself's People

Contributors

aeppert avatar andyneff avatar asoc avatar atoomic avatar belonesox avatar bracketttc avatar dridi avatar hemnstill avatar icculus avatar illumion avatar lordbaco avatar megastep avatar mephi42 avatar mikedld avatar mirkovich0 avatar mpoberezhniy avatar nohuhu avatar ose-support-ros avatar pdietl avatar peterwhittaker avatar pinotree avatar rbcrwd avatar realtime-neil avatar rjeczalik avatar seslattery avatar shaunr avatar vlad1mir-d avatar vutny avatar ymattw avatar zero-pytagoras avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

makeself's Issues

LSM required not optional

Hello,
I created archive with simple command from examples but start of script has lines:
No LSM. EOLSM exit 0
Which basically means unless I provide LSM file I cannot create archive. The manual points to LSM as being option.

Aggressive chown

A few minutes ago my system became practically unusable due to the fact that "chown/chmod" changed permissions on every file on my system. I needed to extract files to a particular location in /etc directory. When I ran the test script with sudo permissions I expected the sudo to be used for writing to the target directory, not to change ownership of files completely unrelated to what I was doing. I suggest to change the default behavior of the script to NOT change ownership of any files unless the user sets a flag to do that explicitly.

makeself-2.3.0 incompatible with Solaris 10 (perhaps others)

Change 436cf30 added a call to "id -u", which is not supported in Solaris 10. The /usr/xpg4/bin/id binary does support the "-u" option, but that's not called explicitly.

This may be bypassed, of course, by fiddling with $PATH order. Unfortunately, pure-Bourne shell doesn't populate the $UID variable, so it seems the right answer will be slightly more complex than I'd wish.

chown / chmod is too greedy

When creating a makeself archive of the current dir '.' and then extracting this, the chown and chmod apply to '.' - which means anything already in the current dir where the archive is extracted get chown / chmod'd as well (and all their descendants) as it is done recursively.

Cursor not found errors in Ubuntu Natty

./makeself.sh /home/joev/mysrc code.sh "Test archive" echo "Hi"
Header is 458 lines long

About to compress 8 KB of data...
Adding files to archive named "code.sh"...
./
./super.txt
CRC: 347548649
MD5: b447088cd980784c585516967ff30f86

Self-extractible archive "code.sh" successfully created.
~/makeself $ ./code.sh
Verifying archive integrity... All good.
Uncompressing Test archive./code.sh: 435: cursor[0]=\055: not found
./code.sh: 435: cursor[1]=\134: not found
./code.sh: 435: cursor[2]=\174: not found
./code.sh: 435: cursor[3]=\057: not found
100%
gzip: stdin: unexpected end of file
Extraction failed.
Signal caught, cleaning up

Script arguments get split on spaces, passed as multiple arguments

If an argument passed to my script contains spaces, even if the argument is quoted, my script receives each space-separated segment as a separate argument.

Ordinarily I would backslash-escape the spaces, but I'm running this self-contained .run file from an installer tool that doesn't give me that option.

Please update makerun to support script arguments with spaces, so I can e.g., pass in file paths with spaces in them and actually use makerun in my installer :)

I expect it's as simple as wrapping each argument in quotes inside $SCRIPTARGS?

/tmp/mkselftest 11:29:46 spiffytech@spiffywork _

$ cat src/echotest.sh 
#!/bin/bash

echo $1
echo $2
echo $3
echo $4


/tmp/mkselftest 11:29:49 spiffytech@spiffywork _

$ makeself-2.2.0/makeself.sh src test.run "Multi-arg test" './echotest.sh'                                                                                                                                                                    
Header is 498 lines long

WARNING: Overwriting existing file: test.run
About to compress 8 KB of data...
Adding files to archive named "test.run"...
./
./echotest.sh
CRC: 1342037018
MD5: 974773a52a5dc2a1614ef9ba8a80eeef

Self-extractable archive "test.run" successfully created.


/tmp/mkselftest 11:29:59 spiffytech@spiffywork _

$ ./test.run One "Two Args" Three                                     
Verifying archive integrity... All good.
Uncompressing Multi-arg test  100%  
One
Two
Args
Three


/tmp/mkselftest 11:32:01 spiffytech@spiffywork _

$ ./src/echotest.sh One "Two Args" Three
One
Two Args
Three

Dependencies of makeself

Hello Stephane,

thanks for your great job done the last years. We would like to use makeself to install our software on embedded systems and while testing the setup natively on the boxes eval has been marked as missing.

I will asked the boxes distributor to add all missing dependencies. Do you have a list of them? Checking them on a debian derivate only shows bzip2 as a dependency. Eval as a part of bash which means bash is required at all?

Best regards,

Erik

reproducible results: use stat instead of du

du is an estimate of the size of the files. (man du).
This estimate can vary greatly from run to run, and thus provide different results when trying to get a reproducible build.
USIZE=du $DU_ARGS "$archdir" | awk '{print $1}'
should be changed to use stat instead.

Extract files from installer without running it?

Hello! I think Makeself has been really great, but I really think there should be some way to extract the files without executing the installer.

I did some Googling and I couldn't find anything, except for this: #37 but they apparently had a different issue since —noexec helped them. I agree however that there should be something like makeself --extract installer.run

Is there some simple-ish script I can use to extract the contents of the installer without having to execute it? I'll be working on a script in the meanwhile and I'll post it here if I get there first, but help would be nice! I also think implementing a makeself --extract option would be great.

Thanks :)

Feature Request: Expose original working directory to startup script

I need a way to determine in my startup script from what directory the archive script was called. I need to know the original working directory, if you will. As far as I can tell there's not a way to do this currently.

Scenario:

My archive script is located at /home/scott/deploy.run. I need to passthrough a --configFile argument to my startup script. My config file is located at /home/scott/config.yml.

It's perfectly reasonable for the person executing my archive script to expect to pass a relative config file path, like so:

./deploy.run -- --configFile config.yml

When that command is executed, my archive is extracted to /var/folders/wm/_blahblah/T/selfgz1234, which is what my startup script sees as the working directory.

The problem is that my startup script has a config file value of 'config.yml', but has no way to know the archive script was called from /home/scott. I need to be able to determine that original working directory so I can resolve the fully qualified path of the config file.

One Possible Solution:

I've worked around this in my project by modifying makeself-header.sh to export a MAKESELF_PWD environment variable. My startup script uses that variable to resolve file paths. I suppose the original working directory could also be passed as an argument to the startup script, but that might not be backward compatible.

I'd be glad to put together a pull request if others agree this would be a useful addition, and there's consensus on the best solution.

Extract files from .run without executing it

Is there a way to simply extract the files distributed with a .run file without without executing it? Implementing such a function would be nice, something like makeself --extract installer.run

Failing on non-ext filesystems

Hi,

I've noticed that extraction is intermittently failing on VFAT (FAT32) and NTFS file systems when started from Linux. I've tried on both ARM and x86 architectures - sometimes it deadloops and sometimes it does extract the files (not sure if their integrity is good), but fails with the following message:

Verifying archive integrity... All good.
Uncompressing FW v1.0........Extraction failed.
Terminated 

Are NTFS and/or FAT going to be supported in the future?

Release new version?

I'm quite impressed with makeself, it's a perfect solution for its use-case, and I'm also glad that it's available in Ubuntu repositories.

But... latest version is 2.1.5, he same as in... Ubuntu 10.04! 3 years! That a long time for no releases. I assumed project was dead, but github shows otherwise: it's alive and healthy, constant updates, many pulls, and new features.

I specially liked the option to encode in base64, introduced an year ago. Keeping it ASCII-only is nice!

So... when can we expect a new release? Is there any reason (instability, insecure) for not making the new features official?

Thanks!

Extraction progress breaks archives on HP-UX

This is pretty serious, apparently the code in MS_dd_progress() doesn't get handled well on HP-UX, as it makes the entire extraction process fail. It works fine if using --noprogress when extracting.

Update web site

Version 2.2.0 was released 4 months ago but the web site says the latest version is 2.1.5 and only mentions github as a source of development versions.

Add a test for root before copying/extracting files

I would like to suggest adding an option to allow to check that the user is "root", either because using "sudo" or actually root, before performing any kind of copying/extracting.

In fact, if the installer requires root privileges, but those are not available, this could save quite some time if the installer is big.

base64 options not valid on OS X

attempting to decompress a base64 encoded file results in an error on macOS 10.12:

Uncompressing /Users/[me]/Desktop/bytes/install.shbase64: invalid option -- d
Usage:	base64 [-hvD] [-b num] [-i in_file] [-o out_file]
  -h, --help     display this message
  -D, --decode   decodes input
  -b, --break    break encoded string into num character lines
  -i, --input    input file (default: "-" for stdin)
  -o, --output   output file (default: "-" for stdout)
  100%  

replacing base64 -D -i with base64 -d in the decompression script seems to work.
This is probably just an OS X thing... FYI.

ER: Add command-line option to strip some of the "info" fields.

Would there be any opposition to me filing a pull request for an extra option to filter some of the data included in the --info field that is included in the final output (ie: my_installer.run)? One thing I'd like to remove is the fields showing the full command used to generate the installer, which includes the full path to the source locations (ie: my home folder). I'd like to strip those out of "production" installers. In my case, I'd like to prevent the following from appearing in a production installer:

	echo Built with Makeself version 2.3.0 on 
	echo Build command was: "./makeself.sh \\
    \"/home/ford_prefect/installer\" \\
    \"/home/ford_prefect/installer.run\" \\
    \"42\" \\
    \"./42.sh\""

Mimetype task on Ubuntu 14.04

The symptom is that the update-desktop-database utility is not working properly with makeself on Ubuntu 14.04. What does that have to do with makeself? I'm not entirely sure, but please read on...

This is an extremely strange bug and I'd like some help isolating the cause. I'll start by explaining my use-case... and the downstream bug report.

  1. Script echos a foo.desktop file to /usr/share/applications/foo.desktop

    foo-install.sh

    #!/bin/bash
    
    # CREATE MIMETYPE FILE
    echo "[Desktop Entry]
    Type=Application
    Name=Foo
    Exec=x-terminal-emulator
    Path=/
    Icon=utilities-terminal
    MimeType=application/x-foo;x-scheme-handler/foo;
    Terminal=false
    Comment=Foo Comment" > /usr/share/applications/foo.desktop
    chmod 755 /usr/share/applications/foo.desktop
    
    # REGISTER MIMETYPE FILE
    update-desktop-database


    ... then...

    makeself . foo-1.0.0.run "Foo Installer" "./foo-install.sh"
  2. Test results

    xdg-open foo:bar
    Ubuntu Version Makeself Version Test Results
    12.04 x64 2.1.5 ✅ Pass
    14.04 x64 2.2.0 ⛔ Fail

Now I've tried many, many different test scenarios, such as using install, nohup, spawning a new process, etc, but the only thing that seems to fix the bug is to build the .run package from Ubuntu 12.04.

The expected behavior is that xdg-open foo:bar attempts to open x-terminal-emulator with the parameter bar, which is a registered URI/Mimetype for a web browser to use (similar in how Ubuntu registers apt:// for the Software Center).

The actual behavior is that the update-desktop-database command executes properly (I can pipe its output to a file and see it is executing) but the Ubuntu desktop doesn't register the command properly.

  1. If a user manually runs sudo update-desktop-database from an interactive terminal after install, the Mimetype is registered properly, every single time.
  2. To revert the mimetype installation for subsequent testing, remove /usr/share/applications/foo.desktop and run update-desktop-database again which will unregister the foo: mimetype.

So my question is... how does one begin troubleshooting a bug like this?

Again, the packages created on 12.04 don't experience this problem, even when being run on 14.04, so this leads me to believe it is a packaging bug somewhere, but I'm not sure how to debug further.

Use sha256sum instead of md5sum for verifying file integrity

MD5 has been widely considered unsafe for use for the past 15-20 years, and as of today it provides absolutely no security at all.

I would strongly recommend switching to SHA256 (command sha256sum instead of md5sum) to verify the integrity of files, since MD5 is very easily falsified.

pipe to sh

Is there any way to make the resulting file executable by piping to sh? Some tools use the following style command for running scripts and it would be really nice to be able to send in a makeself archive to those tools.

curl URL | sh

I zeroed out the checksums, but the script still seems to reference $0. I know arx can do it, but I imagine it combines the binary data with the shell script differently.

makeself sets restrictive umask

Since commit 842dedf, makeself sets a very restrictive umask 077 on the files that it unpacks. This is especially bothersome when building archives with --notemp and --target to specify the location of the extracted archive, with the expected permissions.

Is it possible to override the umask through some additional option set at packaging-time?

Request : support for multiple volumn file

Hello,
First of all, I always appreciate to you.
I request one additonal feature.
That is for multiple volumn file.
For example, if the outfile of makeself script is very large size, it might not be transferred via ftp in very slow or weak environment.

So, I kindly request you to support multiple volumn file.
Thank you.

Multiple compatibility issues

With the busybox tools on Linux:
-the ibs, obs and sync options to dd are optional, and must be enabled at compile time. They aren't enabled on OpenWRT 8.09 for example, so makeself won't work on my router
-df command does not support the '-P' option

On Solaris 10:
-the 'df' command in /usr/bin does not support the '-P' option. Makeself also checks for binaries in /usr/xpg4/bin, but those are only available if the SUNWxcu4 package is installed. Script fails with a syntax error
-id/chgrp/chmod also fail because of unsupported options, but the script keeps going on

I'm trying to fix the df bug at the moment.
The dd bug would require to rely on if/of/bs/count/skip/seek only, or by removing dd altogether.

tar failure during archive build is not recognized

When the tar command cannot pack a file and exits with 1 during the build step, makeself.sh ignores that and says "Self-extractable archive "..." successfully created." Errors of the tar in the pipe can be caught by replacing
OLD: ( tar $TAR_EXTRA -$TAR_ARGS - . | eval "$GZIP_CMD" >&3 )
with
NEW: ( tar $TAR_EXTRA -$TAR_ARGS - . | eval "$GZIP_CMD" >&3 && test $PIPESTATUS = 0 )
BTW: makeself is a great tool and I love it!

base64 arg listed twice.

I'm writing a maven plugin to wrap this and noticed base64 arg is listed twice on the readme. Can you take a look at that?

Feature: Ability to extract some files from archive

I am trying to patch up nixstaller which uses makeself to produce unix installers. However the issue I am now running into is that with LARGE games (1+GB sh archives) the amount of tmp space required is getting to be a problem. So my thinking is to modify makeself such that it ONLY extracts out some of the file contents (e.g the installer executable and configuration) and leaves the game install archive (the 1.7GB portion in one example) in the ".sh" archive. Then somehow pass the path to where the SH file is originally locate to the startup script so that the installer can locate and simply extract the archive directly from the original SH file.

Any suggestions/ideas on how to modify makeself to accomplish this would be greatly appreciate. I am perfectly find with modifying and submitting a pull-request. I just would like your thoughts on how to attack this issue cleanly.

Support for gpg / ssl signed archives

I see there is support for encrypting an archive with gpg or ssl, but I would like to add on a digital signature that the script verifies before unpacking.

Permission denied on startup_script

Any idea why I get a Permission denied error when trying to execute the .run program made with makeself:

./compile/exe/linux/test.run 
Verifying archive integrity... All good.
Uncompressing Installer for test software.....
./compile/exe/linux/test.run: 1: eval: ./post_extract.sh: Permission denied

post_extract.sh contains just an echo

#!/bin/sh

echo "foo"

No test to validate executable

'eval' is called on the launched script without any inspection to see if the target $tmpdir is executable.

makeself-header.sh

In cases where (.e.g) /tmp is a ext3 filesystem mounted with noexec, which is frankly not uncommon, we see errors such as.

$ ./s.sh
Verifying archive integrity... All good.
Uncompressing Application App version other........................
./s.sh : line 387: ./installer.sh: Permission denied

At the very least, it should trap a more indicative error.

No example of how to use tar-extra.

I cannot get --tar-extra to work.

Could you please add a usage example to your README.

I have a tried simply ...

makeself --tar-extra --preserve-permissions  etc etc

... but the result is a new archive created called --preserve-permissions and the following error :

tar: -: Cannot stat: No such file or directory
tar: ./--preserve-permissions: file is the archive; not dumped
tar: Exiting with failure status due to previous errors

Add --nooutput or similar flag for binaries

I'm using makeself in a situation where I'd only like warnings and errors printed to console like -q when executing the outputted binary and not the

Verifying archive integrity... All good.
Uncompressing *

text currently present. This would allow piping the output of binaries to other commands/text files the same as if the startup_script has been run by itself. It would also imply the --noprogress flag. Is this something others would be interested in?

Normalize use of whitespace

The various files making up makeself have mixed tabs and spaces for indentation, as well as random trailing whitespace.

It would be useful to convert all tabs to spaces (or vice versa) - pick one and document it, please!

Also, remove all trailing whitespace.

Error in MD5 checksums when I use the --quiet argument

Hi!
Firstly, I want to thank you for your work :)
I'm making a makeself archive with this command line:

makeself.sh \
     --notemp \
     --bzip2 \
     "files/" \
     "my_archive.bz2.run" \
     "Hello" \
     ./setup.sh "some-arguments"

When I run my installer with the --check argument, no problem:

sh my_archive.bz2.run --check
Verifying archive integrity...  100%   MD5 checksums are OK. All good.

When I run my installer without argument, the installation is done right:

sh my_archive.bz2.run
Creating directory files
Verifying archive integrity...  100%   All good.
Uncompressing Hello 100%

But when I run my installer with the --quiet argument, a problem occurs:

sh my_archive.bz2.run --quiet
Error in MD5 checksums: d41d8cd98f00b204e9800998ecf8427e is different from 09d483a36f78a640666b9e3ff19503af

very small run file 'unexpected end of file'

(from a fresh pull on github...)

Trying to debug an issue with small .run files, I made a very small run file, with only a simple small setup.sh in there.

./makeself creates the .run file successfully.
Header is 498 lines long

About to compress 20 KB of data...
Adding files to archive named "/home/erikb/Desktop/ok.run"...
./
./setup.sh
CRC: 1463274277
MD5: 9ecfdabf8e98605753dea465bd67aa6b

Self-extractible archive "/home/erikb/Desktop/ok.run" successfully created.

However, when I try to run the resultant .run....

Verifying archive integrity... All good.
Uncompressing OKTHEN 100%  
gzip: stdin: unexpected end of file
Extraction failed.
Signal caught, cleaning up

archive size computed incorrectly on net-mounted filesystem

I've been testing makeself version 2.2.0. I noticed that --info always shows "Uncompressed size: 1 KB", no matter how much stuff is in the source directory. I added set -x and set -v to makeself.sh and saw that "du -sk " was returning 1. Running by hand does the same. The problem appears to be that I am building on a net-mounted filesystem, and du doesn't seem to get accurate block count for directories in that case. Moving off the net seems to fix it.

In the first example below note that "ls -l --blocksize=K" gives accurate block sizes for files on the net mount, but incorrectly gives 0 as the total size. "ls -ld --blocksize=K" gives "1" as the directory size, which matches the "du -sk" value, but disagrees with "ls -ld" on a non-net mount.

In the second (non-net) example the "du -sk" value is - correctly - the sum of the "ls -l" and "ls -ld" values. So, on my net mount both "du" and "ls -ld" return bogus total sizes, but "ls -l" can be relied on to return valid file sizes that can be added up. I don't know how to get a good directory sizing on the net mount.

Full disclosure: the filesystem is shared between VMWare VMs on a MacBook Pro, over localhost. Since the underlying medium is SSD, and the blocksize is virtualized, this may affect behavior.


Here's what I get on the net mount:

me@ubuntu:/devshare/someplace/install/SXI-Linux$ du -sk source-files
1 source-files
me@ubuntu:
/devshare/someplace/install/SXI-Linux$ ls -l --block-size=K source-files
total 0K
-rwxr-xr-x 1 501 dialout 6K Aug 6 14:57 config.sh
-rwxr-xr-x 1 501 dialout 7K Aug 3 19:20 isysvd
-rwxr-xr-x 1 501 dialout 142K Aug 3 14:53 pqos.exe
-rwxr-xr-x 1 501 dialout 1K Aug 3 12:09 pqosSvc.env
-rw-r--r-- 1 501 dialout 7K Aug 3 12:09 README
me@ubuntu:~/devshare/someplacel/SXI-Linux$ ls -ld --block-size=K source-files
drwxr-xr-x 1 501 dialout 1K Aug 6 14:57 source-files


Here's what I get on a non-net-mount:

me@ubuntu:/tmp$ du -sk source-files
176 source-files
me@ubuntu:/tmp$ ls -l --block-size=K source-files
total 172K
-rwxr-xr-x 1 me me 6K Aug 6 16:33 config.sh
-rwxr-xr-x 1 me me 7K Aug 6 16:33 isysvd
-rwxr-xr-x 1 me me 142K Aug 6 16:33 pqos.exe
-rwxr-xr-x 1 me me 1K Aug 6 16:33 pqosSvc.env
-rw-r--r-- 1 me me 7K Aug 6 16:33 README
me@ubuntu:/tmp$ ls -ld --block-size=K source-files
drwxr-xr-x 2 me garybjerke 4K Aug 6 16:33 source-files

Finding MD5 binary fails if `which` is not available

It seems that the method makeself.sh uses to find md5sum, md5 or digest is not working correctly if which is not present. It falls back to type, which can output a human-readable message ("md5sum is /some/path/to/md5sum") rather than a path, which then gets passed to test -x. This means makeself prints "none, MD5 command not found" even though md5sum is available.

Replacing this snippet...

MD5_PATH=`exec <&- 2>&-; which md5sum || type md5sum`
test -x "$MD5_PATH" || MD5_PATH=`exec <&- 2>&-; which md5 || type md5`
test -x "$MD5_PATH" || MD5_PATH=`exec <&- 2>&-; which digest || type digest`

...by this snippet...

MD5_PATH=`command -v md5sum 2>/dev/null`
test -x "$MD5_PATH" || MD5_PATH=`command -v md5 2>/dev/null`
test -x "$MD5_PATH" || MD5_PATH=`command -v digest 2>/dev/null`

...seems to fix the issue on my machine (ref).

header file listed twice on readme

Another one - header file is listed twice. The first one I assumed was to have file afterwards. The second one confirms that assumption.

As I get a little deeper into building a maven plugin around this I'll start looking in the source. At the moment, I have the baseline working and I'm just in the process of building out support for all elements.

No option to suppress tar output but keep other useful message

May I suggest to implement a new option to suppress output from tar -cvf but keep other useful message such as Self-extractable archive "foo-1.0.bin" successfully created.?

Currently option 'v' for tar is enabled by default and can be disabled by option --quiet but that also suppress other useful message.

append option breaks archive integrity

Hi.

FYI, with master revision, the --append option seems to be breaking the archive integrity. When trying to open the resulting file, we get an MD5 checksum error.

It's ok with the 2.2.0.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.