0

I have the following postint script in the dpkg package:

rm -f /SOMEDIRECTORY/current
ln -s /SOMEDIRECTORY/releases/RELEASESHA /SOMEDIRECTORY/current
ln -s /SOMEDIRECTORY/shared/config/config.json /SOMEDIRECTORY/releases/RELEASESHA/config/config.json

This is a directory tree before the install:

drwxr-xr-x 2 user user 4096 May 12 15:21 config
drwxr-xr-x 3 user user 4096 May 14 08:56 shared
drwxr-xr-x 6 user user 4096 May 14 10:06 releases
lrwxrwxrwx 1 root          root            49 May 14 10:14 current -> /SOMEDIRECTORY/releases/RELEASESHA

When I try to install the deb package it is trying to remove a directory symlink is pointing to as oppose to JUST THE SYMLINK:

dpkg: warning: unable to delete old directory '/SOMEDIRECTORY/releases/OLD_RELEASESHA': Directory not empty

When I run the rm -f command manually it works as expected but what's going on when postinst is running that it changes that command to something else what is trying to remove the directory to which the symlink points to and not just the symlink itself ?

Anyone idea ? Thanks

0

That error message is not coming from any commands in the postinst.

You haven't given much information, but my guess is that when you try to install the deb package, there is already an older version of the package on the system. In that case, dpkg would try to clear out the old version before installing the new. It expected /SOMEDIRECTORY/releases/OLD_RELEASESHA to be empty at that point, since no other packages have files in there, so it tried to remove it, but there were some files in it, unowned by any package. This is fine, it's just not expected, so dpkg outputs a warning.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.