Script to only execute during first install of a package

Posted by Jeroen on Ask Ubuntu See other posts from Ask Ubuntu or by Jeroen
Published on 2012-02-06T19:27:54Z Indexed on 2012/06/18 21:24 UTC
Read the original article Hit count: 390

I recently started packaging up some of my software and publishing it on Launchpad. The installation and removal works fine, but upgrading the package form one version to the next version is problematic.

The problem is that there are some scripts that only need to run during the first installation of the package. These scripts populate the DB, create a user, etc. They are currently called in the package.postinst configure) section. However this results in them being called during an upgrade as well as shown in the diagram.

Is there a way to include a maintainer script in a .deb package that only executes during the first installation of the package and not during an upgrade? Or what would be an elegant way to include some initial setup scripts in a .deb package?

© Ask Ubuntu or respective owner

Related posts about package-management

Related posts about packages