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