View Single Post
Saturn's Avatar
Posts: 1,648 | Thanked: 2,122 times | Joined on Mar 2007 @ UNKLE's Never Never Land
#101
Originally Posted by flotron View Post
I packaged a theme and it installs without problems in its own folder, ok thats done. But i want To know for ex. I modify some file in the base folder, but when i uninstall (the theme) i want that the base folder go back to previous state, i mean that if any file was edited or deleted in the deb installing process when uninstall restore all that.
How can i tell meego that remember that when someone uninstall restore those files previous state?
Debian packaging allows you to have a file that is executed in the uninstallation. Put it in the debian folder and name it as postrm

here is an advanced example of something I'm using (it will execute different options depending on what the user asked, i.e. upgrade, remove or purge):

Code:
#!/bin/sh
echo "BEGIN postremove"

case "$1" in
upgrade*)
    echo Leaving files for use by upgrading version. 1>&2
    ;;
remove*)
    rm -f /etc/sudoers.d/cleven.sudoers
    update-sudoers
    ;;
purge*)
    rm -rf /opt/cleven
    rm -rf /home/user/.cleven
    update-sudoers
    ;;
esac
echo "  END of postremove"
 

The Following User Says Thank You to Saturn For This Useful Post: