Project

General

Profile

Bug #11940

.deb postinst and postrm scripts: create and remove /var/log/bung

Added by Charles Atkinson 10 months ago. Updated 10 months ago.

Status:
Closed
Priority:
Normal
Start date:
26/03/2021
Due date:
% Done:

0%

Close

History

#1 Updated by Charles Atkinson 10 months ago

  • Subject changed from .deb postinst script: create /va/log/bung to .deb postinst script: create /var/log/bung

#2 Updated by Charles Atkinson 10 months ago

  • Subject changed from .deb postinst script: create /var/log/bung to .deb postinst and postrm scripts: create and remove /var/log/bung
Found examples at /var/lib/dpkg/info/*.postinst, "/home/c/d/Auroville/Blue Light/bung/Archive/bung_packaging git/apt/binary-deb/control/postinst" and equivalent postrm paths
  • /var/lib/dpkg/info/emacs-common.postinst

From https://feeding.cloud.geek.nz/posts/whats-in-a-debian-directory/

debian/dirs

usr/sbin
etc/fcheck
This file contains a list of directories that dh_installdirs will create in the build directory.
The reason why these directories need to be created is that files are copied into these directories in the install target of the debian/rules file.
Note that this is different from directories which are created at the time of installation of the package. In that case, the directory (e.g. /var/log/fcheck/) must be created in the postinst script and removed in the postrm script.

Example: https://itectec.com/ubuntu/ubuntu-how-to-create-directory-and-change-its-owner-with-the-deb-package/

Testing https://askubuntu.com/questions/855816/error-running-postinst-script-in-debian-package

You can extract the maintenance scripts from your deb with

mkdir tmp   
dpkg-deb -R mypackage_1.0-1_all.deb tmp
Now you can run tmp/DEBIAN/postinst with a "configure" argument to simulate a package install

Which directory for the scripts?

Did not find a definitive reference (some said debian/ some said DEBIAN/, confusing as debian/DEBIAN is created during build) so examined http://deb.debian.org/debian/pool/main/e/emacs/emacs_26.1+1-3.2+deb10u2.debian.tar.xz which showed directly under debian so same as debian/rules

Created version 3.0.4 (required anyway for some source changes) as logged in #11861#note-20

Added postinst and postrm scripts. Commit bung3|3643b8ff

#3 Updated by Charles Atkinson 10 months ago

  • Status changed from New to Closed

Issue closed pending any bugs

Also available in: Atom PDF