I have created a debian package and added the following code in the postinst script:
path="$HOME/sample"
echo "$path"
if [ -d "$path" ]
then
rm -rf "$path"
echo 'File deleted successfully :)'
fi
so that if the path is present, it would delete it during installation. It works perfectly when I install my .deb package through dpkg
. But while installing through Ubuntu software centre, none of it works. Why does this happen?
For background, I have made an app that would create a directory in the home directory of the user or root installing to the system .So if I am reinstalling or installing again after uninstalling, I need to check if the directory is present or not; if present, I need to delete it. I have distributed the app as a Debian package. So the question is how to check if the directory is present in the home directory? The directory is not created while installing the app. It is externally created while running the app. Also note that I cannot change it to a different folder because the app cannot be changed.