EagerToLearn
EagerToLearn

Reputation: 147

Setup a debian package to perform actions on install

I am trying to configure a debian package to perform some actions on install (more specifically, I want to set up some application preferences using gconftool-2) that only need to be performed once. I have never worked with debian packages before, and I am not sure if there is an 'on install do this' property. Any help is appreciated.

Upvotes: 2

Views: 181

Answers (2)

Alexis Wilke
Alexis Wilke

Reputation: 20720

In the Debian folder, you create a postinst shell script and perform your modification from that script. If you have a different tool to make the modification to preferences, then call that tool from your script.

#!/bin/sh -e

#DEBHELPER#

# Source debconf library.
. /usr/share/debconf/confmodule

if [ "$1" = "configure" ]
then
    # Do your work here
    # (the following gconftool-2 example is not valid, but it gives an idea)
    gconftool-2 mouse swap-buttons
fi

VERY IMPORTANT: the #DEBHELPER# pattern will be replaced by debian scripts as required. It is very important to have it in your script. It is generally expected to appear first although you could have some code before, it's rare to see such.

Upvotes: 0

tripleee
tripleee

Reputation: 189317

You are looking for the configure script, or possibly the post-install script. You should probably be reading one of the packaging tutorials.

Upvotes: 1

Related Questions