1

So, I'm trying to package my Python app, Virtuam. My question is simple: how can I set the commands which run when I remove the program using apt-get?

tgm4883
  • 8,062
Xerz
  • 4,591

1 Answers1

2

You will need to use maintainer scripts to do things during the removal of your app (specifically prerm and postrm).

You may want to take a look at Debian packaging policy http://www.debian.org/doc/debian-policy/ch-maintainerscripts.html

Below is an example prerm script that I had previously used when removing the mythbuntu-repos package, in order to remove the added repository and key information as well.

#!/bin/sh

case "$1" in
    remove|purge)
    if [ -x /usr/bin/apt-key ]; then
        /usr/bin/apt-key del EEED06D0 2>/dev/null || true
        /usr/bin/apt-key del 1504888C 2>/dev/null || true
    fi
    rm /etc/apt/sources.list.d/mythbuntu-repos.list 2>/dev/null || true
    ;;
esac
tgm4883
  • 8,062