How to create an installer using bash and .tar.gz (Linux) [24.04.2014]

GameplayJDK's Blog

You might have noticed that some Linux programs use .sh installers. The technology behind a such installer is basic and very simple. It works like a self-extracting archive.


All you need is a .tar.gz file, a text editor and the terminal. On a Linux machine of course :D.

1. First, create or locate a .tar.gz file on your computer

2. Then open gedit or another good text editor.

3. Here is the code:

#!/bin/bash echo "Some kind of Message like: Now extracting..." # - Now look for the end of bash code (which can't be extracted and can lead to errors): SKIP=`awk '/^__TARFILE_FOLLOWS__/ { print NR + 1; exit 0; }' $0` # - Our filename: THIS=`pwd`/$0 # - Extract (using tar) tail -n +$SKIP $THIS | tar -xz # - The following code will happen after the extracted echo "Some kind of Message like: Finished extracting." # - Finish exit 0…

View original post 82 more words

Advertisements

Feel free to comment on any of my blog posts

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s