Search code examples
qtshelldebianmeego

How to remove file from user's home folder on Nokia N9 (MeeGo) on app removal


My Qt application for Nokia N9 stores some data in the my folder inside /home/user/.config. I need to delete this folder with my data when application will be uninstalled. As far as I understand this can be reached using postrm file. I use the following file:

postrm

#!/bin/sh

rm -rf /home/user/.config/mydatafolder/

exit 0

But this code doesn't work. I assume there's not enough right to remove something in the user's folder. So, I've tried to use

devel-su user -c "rm -rf /home/user/.config/mydatafolder/"

But it works only in developer mode and I need the app to work properly without it. The following code doesn't work too:

su user -c "rm -rf /home/user/.config/mydatafolder/"

Does anybody know how to remove this folder?


Solution

  • Ok, I've solved this. You don't need to use su or su-devel in this case. All pre/post rm/install scripts are running by 'root' by default. To make those scripts running by 'user' we simply need to add following strings to the aegis manifest file:

    <request context="INSTALL">
        <credential name="UID::user" />
        <credential name="GID::users" />
    </request>