0

I am creating a icon package named smoothX* and its in development stage, and the same is been maintained in Ubuntu PPA, every time I update or delete some of them I want the same to be reflected in the PPA .deb, for that I added a preinst script to the debian folder with the following.

#!/bin/sh
set -e
#remove old installation files
if which smoothX* >/dev/null 2>&1 ; then
    rm -Rf /usr/share/icons/smoothX*
fi

but nothing happens except it installs over that (the old altered or deleted files are still there.)

How to delete the old installed files completely with preinst script and make it to install the contents of the fresh deb file and configure it. Your help will be highly appreciated thank you.

well I managed to do, what I exactly needed since I have already uploaded to PPA and maintaining the package. with this "preinst" script,

#!/bin/sh
set -e
# remove old and obsolete files
rm -R -f /usr/share/icons/smoothX*
exit 0

also I know thats not the right way to do it, for I am a noob in bash scripting I would like to know how to do the right way, when I googled,I got:

if dpkg-maintscript-helper supports rm_conffile 2>/dev/null; then
    dpkg-maintscript-helper rm_conffile /etc/foo/conf.d/bar 1.2-1 -- "$@"
fi                                                                

which I was unable to understand, howto with dpkg-maintscript. Thankyou and hope someone could guide me.

3
  • 1
    Normally the files would be removed when you remove the .deb and normally when you install a .deb it should overwrite files. Hard to tell without looking at your .deb and contents in detail.
    – Panther
    Oct 1, 2014 at 12:38
  • I thin that this question isn't specifically related to Ubuntu and it's more adequated to Unix & Linux (unix.stackexchange.com) Oct 1, 2014 at 12:39
  • @AlexandreTeles this is relevant because of PPAs. PPAs are unique to Ubuntu right now.
    – Thomas Ward
    Oct 1, 2014 at 16:27

1 Answer 1

0

If you are trying to remove files in preinst, you should actually redesign your entire installer to overwrite, and remove only files that're gone. By default, apt-get and dpkg will overwrite any files that have a matching filename, and overwrite. If you are still dealing with old files on the target system, then the package is weird.

Ultimately, if you are always changing files continually as part of development and there's a lot of leftover bits, you should probably NOT be using a PPA for it, and just stick to building from source until you have a stable release.

1
  • well I managed to do, what I exactly needed since I have already uploaded to PPA and maintaining the package. with this "preinst" script,#!/bin/sh set -e rm -R -f /usr/share/icons/smoothX* exit 0 Oct 3, 2014 at 11:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .