Translate

Wednesday, June 12, 2013

How to create self installable packages using Makeself

How to create self installable packages using Makeself

You probably have downloaded a program and noticed that the file extension was ".sh". If you ever wondered how to create your own installable package, you'll love to play with the Makeself tool.

This is a very short introduction on how to make your own installable packages.

You can download it from the web here, or install it by using your package manager. For Debian, just type apt-get install makeself and hit ENTER.

The program syntax is very easy, as you can see bellow:

makeself [args] app_directory installer_file descriptive_text startup_script [script_args]

  • args: Makeself options. Here are some of them:
    • --gzip: uses gzip for compression
    • --bzip2: uzes bzip2 for compression (cool, but takes more time to compress)
    • --nocomp: uses no compression
    • --append: updates an existing package with new files
  • app_directory: Directory with all the files to be included in the package
  • installer_file: This will be the file name for the created package
  • descriptive_text: This is a simple string that tells users a little more about your package ;-)
  • startup_script: This is the script the installer invokes to install your program
  • script_args: These can be passed to the startup_script
Now that you have a good knowledge on the subject, let's create a simple installer. For this example we're going to create a wallpaper file installer.

The required steps are:
  1. Create the root directory for the program. The one to be passed for the installer.
  2. Create the wallpaper file(s) directory.
  3. Place the desired wallpaper(s) inside the directory.
  4. Pack the wallpaper dir inside the root directory (this will generate the "payload" file)
  5. Create the startup script
  6. Pack! :)
Ok, let's do it!
  1. mkdir my_wallpaper_installer
  2. mkdir my_wallpaper_installer/wallpapers
  3. cp Downloads/*.jpg my_wallpaper_installer/wallpapers
  4. cd my_wallpaper_installer/ && tar cjf data.tar.bz2 wallpapers
  5. echo '#!/bin/bash' > my_wallpaper_installer/setup.sh && echo 'tar xjf data.tar.bz2 -C /usr/share/' >> my_wallpaper_installer/setup.sh 
  6. makeself --nocomp my_wallpaper_installer WallPaperInstaller.sh "This is my awesome wallpaper installer" ./setup.sh 
Have fun! =)

No comments:

Post a Comment