Creating Ubuntu debian pakage

 

You can check any debian package to get an idea about what goes inside the package.

.deb file can be opened in Linux with Archive manager. Actually .deb is just a zip.

There are two important directories:

DEBIAN

and usrin general can have other directories or may not have usr directory.

Screen Shot 2017-07-02 at 5.21.45 PM

myApplication inside /usr/local/bin contains all the executable and .so etc related to my application.

You can literally see into any .deb file and get to know what kind of content is inside each of the files in DEBIAN directory.


control file

 

Package: myApplication
Version: 1.1.0
Section: admin
Priority: optional
Installed-Size: 415000
Architecture: amd64
Depends:xdotool,curl,libav-tools,libv4l-dev
Maintainer: Company name 
Description: Blah blah .. blah software..

 


postinst

 

 

#!/bin/bash

#This installer installs myApplication

#give permission to startup script for IntelliSpace
chmod 755 /usr/local/bin/myApplication/myApplication.sh

#create application entry for IntelliSpace

echo "
#!/usr/bin/env xdg-open

[Desktop Entry]
Version=1.1
Type=Application
Terminal=false
StartupNotify=true
Name=myApplication
Exec=/usr/local/bin/myApplication/myApplication.sh
Icon=/usr/local/bin/IntelliSpace/myApplication.ico
Comment=blah blah blah
Categories=blah;
" > /usr/share/applications/myApplication.desktop

xdg-desktop-menu install --novendor /usr/share/applications/myApplication.desktop

#Creating desktop icons
for user in /home/*
do
cp /usr/share/applications/myApplication.desktop ${user}/Desktop/
chmod 777 ${user}//Desktop/myApplication.desktop
done

cd /usr/local/bin/myApplication
chmod -R 777 *

 


prerm

 

#!/bin/bash
#remove myApplication startup
rm /usr/local/bin/myApplication/myApplication.sh

#delete all configurations
#rm -rf ~/.local/share/calibs #wrong folder
#uninstall application entry
xdg-desktop-menu uninstall usr/share/applications/myApplication.desktop

 

The file names are descriptive I think. prerm this will be run when application will be removed so for cleaning. postinst will run at time of installation when all your files are copied and dependencies installed.

md5sums is created when package is created you do not have to worry for this.

 

Command to create package:

 

fakeroot dpkg-deb --build myApplication

where myApplication is the name of folder which has all the content.

 

You may need to install dpkg-deb

 

To test either double click and install the .deb file created in above step by Ubuntu Software center or use below command

sudo dpkg -i myApplication.deb

 

Advertisements

Leave a Reply

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 )

Google+ photo

You are commenting using your Google+ 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 )

w

Connecting to %s