maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Development (https://talk.maemo.org/forumdisplay.php?f=13)
-   -   Need help making .deb package - file owner/permissions (https://talk.maemo.org/showthread.php?t=18672)

rally25rs 2008-04-03 16:47

Need help making .deb package - file owner/permissions
 
Just a quick question to those of you who understand how the debian packaging system works (sorry, I'm normally a Java and .NET programmer, and deal typically with windows installs for work).

What would be the apropriate way to chown / chgrp / chmod a file that is being installed?

For example, I want my program to run on a config file located in the users home dir. Lets call it:
~/.myConfig

Currently, this file ends up in the correct location (/home/user/.myConfig) but is owned by root. How do I, at install time, chown it to 'user', chgrp it to 'users' (or the curent user/group, really) and possibly chmod it?

Thanks for any advice!

kernelpanic 2008-04-03 17:39

Re: Need help making .deb package - file owner/permissions
 
Quote:

Originally Posted by rally25rs (Post 164550)
What would be the apropriate way to chown / chgrp / chmod a file that is being installed?

create a shell script in your debian directory called 'postinst' that does it...


Cheers,
kernelpanic

m_stolle 2008-04-03 18:20

Re: Need help making .deb package - file owner/permissions
 
It seems to me a really bad idea for your program to rely on the install to create user settings. What if there is more than one user? In principle, user settings should created by the program when it is run by a user, not by the installer... Either embed the default config in your program or put it in /usr/share/something and copy it to ~/.something when the program is first run...

How does your program react if the user deletes his .something? It should have reasonable behavior in that case anyways (which also means you don't have to create that file during the installation).

If you want to set up some system-wide defaults, you should put that into /etc/something (and then ownership by "root" is required anyways)

Martin

rally25rs 2008-04-04 02:52

Re: Need help making .deb package - file owner/permissions
 
m_stolle, you're right, I should have the defaults in the app. Thats what I normally do, but this is my 1st Python app, so I wasn't doing everything like I normally would.
The only goofy thing would be that the app won't run if you don't edit the settings file first (user needs to enter a URL, username, and pwd). If the file doesn't exist, I just dump a 'settings file not found' message to stdout and exit.

kernelpanic, thanks for the tip. There was a postint.ex already inexistance. Since this is my 1st deb package, I didn't realize that I had to copy or rename that file and remove the ".ex" for it to actually do anything.

Thanks both of you!


All times are GMT. The time now is 06:01.

vBulletin® Version 3.8.8