linux - Why does postinst script not execute commands while installing a debian package through Ubuntu software centre? -
I created a Debian package and added the following code to the postinst script:
path = "$ HOME / Sample" echo "$ path" if [-d "$ path"] then RM-RF "$ path" echo 'successfully deleted file' 'fi' So that the path exists, it will remove it during the installation. It works perfectly when I install my .deb package via dpkg . But when Ubuntu installs through the software center, none of this works, why is it?
For the background, I have created an app that will create a system in the user's home directory or root it on the system. So if I'm installing or installing again after uninstallation, I have to check whether the directory exists or not; If present, then I have to delete it. I've delivered the app as a Debian package. So the question is whether the directory is present in the Home Directory or not? The directory is not created when app is installed. It is made externally while running the app. Also keep in mind that I can not convert it to a different folder because the app can not be changed.
The problem is not, with Ubuntu, but HOST of With your use of in postinst This is apparently to work with sudo dpkg from your account (though in some settings, sudo then your promotion of HOME But it is not supported or not well defined.
Home is not understood in any way by the Debian package, because it is a system-wide installation, and HOME is a per-user variable is.
If I understand your requirement correctly, then you need to loop through all the users' home directories, and delete the sample folder from each code. Present.
# ad-hoc passwords received passwd | Cut-D: -sf6 | While reading DIR; Test- d "$ dir" || RM-RVF "$ dir / sample" done done This suppresser is extremely , so you should actually try to change the app instead - If a user is a directory designated for any other reason sample ? Instead, the app should use the name of a particular location ( .appname-sample ?), Or store your per user data in that system location where it should be managed properly by the system Could.
In fact, in the meantime, your postinst script might just be something like sample directory to .sample.dpkg-old Should be taken. This is no less intrusive, but at least it avoids deleting your users' data completely by mistake.
Comments
Post a Comment