Monthly Archives: July 2017

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 <email id>
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

Problem with #define from other libraries

While building a qt project with libxdo xdo.h I faced some strange problems with qt enum names conflicting with X #define macros.

There is no standard way of including headers the one which works is the best. For Qt I think it is recommended to include qt headers first then your files and other library files. This worked for me. To begin with I started to do #undef before include for each terms which was getting really bad as there were many conflicts.

 

 

undefined reference to `xdo_new(char*)’

Inline with xdo.h I was including it in C++ project. libxdo is C project and it doesn’t have extern “C” declaration as other libraries have.

 

extern "C" {
#include <xdo.h>
}