Active Topics

 


Reply
Thread Tools
Posts: 32 | Thanked: 4 times | Joined on Jul 2007
#1
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!
 

The Following User Says Thank You to rally25rs For This Useful Post:
Posts: 179 | Thanked: 90 times | Joined on Dec 2007
#2
Originally Posted by rally25rs View Post
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
 
Posts: 118 | Thanked: 26 times | Joined on Feb 2008
#3
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
 
Posts: 32 | Thanked: 4 times | Joined on Jul 2007
#4
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!
 
Reply


 
Forum Jump


All times are GMT. The time now is 21:53.