e

How To Build a .bod File

Experience Level: Intermediate

Prerequisites: Comfortable using the command line and familiarity with Zenity, while not necessary, certainly will help to understand the installer script below

Whether you are new to Linux or not you may have wondered what exactly are the bod files available for download on Bodhi's Add Software page. If you are familiar with Linux you are probably aware that some Linux Distributions have rpm files, others have deb, but bod files seem unique to Bodhi Linux. It is apparent how to use a bod file, they are provided primarily for offline usage and allow one to install software including all of the dependencies the software requires without having to download a lot of deb files. However, it is not obvious that bod files accept some command line arguments, for more information see .Bod File Command Line Arguments. But in this guide I am going to assume you already know how to use a bod file but instead try to answer two questions: what is a bod file precisely and how can we create one for our own use or perhaps to contribute to the community.

Introduction to bod Files

The current .bods are fairly hackish package up of a whole bunch of .deb files. Jeff Hoogland

If one downloads a bod file and opens it in a text editor you will notice that it appears to be a shell script with some binary code attached to the end of it. That is exactly what a bod file is, a shell script with a self-extracting archive attached which executes an installation script contained within the archive. In this way it is comparable to self extracting Zip files which you may be familiar with if you have ever installed much software in Windows. You will also notice if you have examined a bod file the line:

# This script was generated using Makeself 2.1.5

This provides us with a clue as how a bod file is created. Makeself is a program which

is a small shell script that generates a self-extractable tar.gz 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 checksums).

Which brings us to our next question, how exactly do we use makeself to create a bod file like the ones on Bodhi's get software page?

Creating a bod File

According to Jeff, Lead Developer for Bodhi Linux:

my offline installers are built using a combination of Zenity, MakeSelf, apt-get, and some clever shell scripting.

Before we can begin to create a bod file we need to install makeself

sudo apt-get install makeself

Now for this example I am going to create a bod file for Liferea. Since makeself creates the archives from a directory of files, first we need to create the directory, have apt-get generate the list of all the needed .debs for a given package and download the required debs. This process probably should be done on clean install of Bodhi, but in my case I used a LiveCd.

mkdir liferea
cd liferea/
apt-get -qq --print-uris install liferea > liferea
awk '{gsub("\x27", "", $0); print $1}' < liferea > liferea.sh
wget -i liferea.sh

We also need to copy the current apt sources so they can later be unziped onto the system you are installing on.

cp -r /var/lib/apt/lists .
cd ..

Now we have to create an installation script for our bod file:

installer
#!/bin/bash
echo ""
echo "Bodhi Application Installer"
echo "Liferea"
echo ""
 
zenity --question --title="Bodhi Application Installer" --text="Would you like to install Liferea?"
if [ $? == 1 ]
then
        zenity --info --title="Bodhi Application Installer" --text="Liferea was <i>not</i> installed. Thanks for using Bodhi!"
        exit 1
fi
zenity --info --title="Bodhi Application Installer" --text="Click <b>OK</b> and enter your password to install Liferea"
 
gksudo echo "Gaining root..."
sudo rm -rf /var/lib/apt/lists/*
sudo mkdir /var/lib/apt/lists/partial
sudo rm -rf /var/cache/apt/archives/*
sudo mkdir /var/cache/apt/archives/partial
if [ "$1" == debug ]
then
        echo "Moving data into apt cache"
        sudo cp -f lists/* /var/lib/apt/lists/
        sudo cp *.deb /var/cache/apt/archives/ | zenity --progress --pulsate --auto-kill --title="Bodhi Application Installer" --text="<i>Preparing Files...</i>" --width=600
 
        echo "Installing Liferea via apt"
        sudo apt-get -y --force-yes --no-download --ignore-missing install liferea | zenity --text-info --title="Bodhi Application Installer" --width=800 --height=600
        exit 0
fi
 
sudo cp -f lists/* /var/lib/apt/lists/
sudo cp *.deb /var/cache/apt/archives/ | zenity --progress --pulsate --auto-kill --title="Bodhi Application Installer" --text="<i>Preparing Files...</i>" --width=600
 
sudo apt-get -y --force-yes --no-download --ignore-missing install liferea | zenity --progress --pulsate --auto-kill --title="Bodhi Application Installer" --text="<i>Installing Liferea...</i>" --width=600
 
zenity --info --title="Bodhi Application Installer" --text="<b>Liferea Installed</b>\nFind it in your applications menu under <i>Internet</i>"
exit 0

Save this file, installer in the liferea directory we made above and make it executable.

And finally to create the bod file 1):

makeself --nox11 --bzip2 /home/bodhi/liferea liferea.bod "Liferea RSS Reader" ./installer

This should create a liferea.bod file in whatever directory you execute it in.

If you want to use the installer script for another application and don't fancy manually changing the words liferea to whatever application you want to .bod then you can do

 sed -i 's/liferea/appname/gI' installer
 

Where appname is the name of the application you want to bod.

Much thanks to Jeff Hoogland for helping me to understand this process.


User Feedback

how_to_build_a_.bod_file
Did you find this article helpful?
Yes, right on the money!
 
11%(2)
Somewhat. Needs work.
 
84%(16)
Not really
 
5%(1)
Not at all.
0%(0)

If you would like to comment or make further suggestions, please leave a note on our Comments page (you will have to Create an Account if you haven't already).

1) adjust the path in the makeself to whatever path the liferea directory is on your system
 
bod_files_-_howto_build.txt · Last modified: 2012/08/09 11:47 by rbtylee · [Old revisions]


© Copyright Bodhi Linux 2012. All Rights Reserved - Hosted by vaultnetworks