Re: installing an end user editable file
Hey Boyd, With regards to: Perhaps you are installing your template with permissions that are too restrictive You're totally right! This was causing my script to fail, thanks very much for pointing it out, everything is working perfectly now :) Now I've familiarized myself with the wiki on chmod hopefully I won't make that mistake again. Very pleased to get it working, for a moment it felt like I'd never get it right. Cheers. Jim. -- To UNSUBSCRIBE, email to debian-mentors-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/AANLkTikbCUDNcEX8FCFJZqwYsrZu3ty=hbmvaslq1...@mail.gmail.com
Re: Re: installing an end user editable file
Hey mentors, Firstly, thanks for all the help so far. I like the idea of having a default copy of the file used by my program, as suggested by Lars and PJ, so I've altered my source code to use a default file and allow multiple users to have their own copies of this file in their home/user/Documents folder. creating a default file in /usr/share and having the program copy it to the user's directory when it's run However, I can't open a file from /usr/share via my python script as I don't have permission to open files in a protected directory, and after reading up a bit on it, it's been suggested that it's bad form to invoke super user in a script, as it's construed as a security risk (i.e. http://tldp.org/HOWTO/Security-HOWTO/file-security.html; http://www.velocityreviews.com/forums/t346075-sudo-open-python-newbee-question.html) Do I really have to use sudo or super user privileges to just open and copy a text template? Where do packagers normally install files of this type? I thought it might be a good idea to store it in home/user/.packageName But I'm still at a loss as to how I can find a users home directory from the rules makefile :( been trying to use ~/ and $XDG_CONFIG_HOME but I just end up with everything being installed in folders called ~ or DG_CONFIG_HOME Here's the source code if you need more info: #!/usr/bin/python # Code Name: gtk-link-lizard # Created By: Jim Frize, http://sonodrome.co.uk # Copyright (C) 2011 Jim Frize, j...@sonodrome.co.uk # Licence: GTK Link Lizard is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/ # Version: 1.5 # Description: Simple GUI for storing and displaying web links # This GUI will do away with synchronizing bookmarks between browsers, web links are stored in a regular text file which is found in your documents folder. GTK Link Lizard makes it easy to edit, swap or replace a list of clickable links import pygtk pygtk.require(2.0) import gtk import sys import re import os path = os.getenv(HOME) class link_lizard(): def __init__(self): self.load_main() # # Load File # # def load_file(self): try: self.text_file = open(path + /Documents/gtk-link-lizard/links.txt,r+) except IOError: print loading links.txt from usr/share/doc/gtk-link-lizard... try: self.text_file = open(usr/share/doc/gtk-link-lizard/links.txt,r) self.text_file.write(path + /Documents/gtk-link-lizard/links.txt) self.text_file = open(path + /Documents/gtk-link-lizard/links.txt,r+) except IOError: print ERROR: link.txt not found # # Load main GUI # # def load_main(self, data=None): # Create main window self.main_window = gtk.Window(gtk.WINDOW_TOPLEVEL) # Quit main function when window is destroyed self.main_window.connect(destroy, gtk.main_quit) self.main_window.set_size_request(600, 600) self.main_window.set_position(gtk.WIN_POS_CENTER) self.main_window.set_opacity(0.9) self.main_window.set_title(GTK Link Lizard) self.main_window.set_keep_above(True) # Create scrolled window scrolled_window = gtk.ScrolledWindow() scrolled_window.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC) # Create placement boxes and dictionaries main_box = gtk.VBox(homogeneous=False) link_box = gtk.VBox(homogeneous=False) linkbutton = {} label = {} # Create edit button edit_button = gtk.Button(Edit Links) edit_button.connect(clicked, self.load_edit) # Count number of lines in text file self.load_file() number_lines = len(self.text_file.readlines()) # Reset counter and check through each line of text count = 0 while(count number_lines): self.load_file() all_lines = self.text_file.readlines() current_line = all_lines[count] match = re.search(http://;, current_line) match2 = re.search(https://;, current_line) match3 = re.search(www., current_line) # If http link is found, make a linkButton if match: current_url = match.group() # Remove http:// split_line = current_line.split(http://;)
Re: Re: installing an end user editable file
Il giorno lun, 14/02/2011 alle 19.38 +, james frize ha scritto: Hey mentors, Firstly, thanks for all the help so far. I like the idea of having a default copy of the file used by my program, as suggested by Lars and PJ, so I've altered my source code to use a default file and allow multiple users to have their own copies of this file in their home/user/Documents folder. creating a default file in /usr/share and having the program copy it to the user's directory when it's run However, I can't open a file from /usr/share via my python script as I don't have permission to open files in a protected directory, and after reading up a bit on it, it's been suggested that it's bad form to invoke super user in a script, as it's construed as a security risk (i.e. http://tldp.org/HOWTO/Security-HOWTO/file-security.html; http://www.velocityreviews.com/forums/t346075-sudo-open-python-newbee-question.html) Do I really have to use sudo or super user privileges to just open and copy a text template? No, you don't. Just try python -c print open('/usr/share/common-licenses/GPL').readline() , but more in general: just try. Where do packagers normally install files of this type? I thought it might be a good idea to store it in home/user/.packageName But I'm still at a loss as to how I can find a users home directory from the rules makefile :( You've already been explained that this is _wrong_, regardingless of how you do it. been trying to use ~/ and $XDG_CONFIG_HOME but I just end up with everything being installed in folders called ~ or DG_CONFIG_HOME Here's the source code if you need more info: #!/usr/bin/python # Code Name: gtk-link-lizard # Created By: Jim Frize, http://sonodrome.co.uk # Copyright (C) 2011 Jim Frize, j...@sonodrome.co.uk # Licence: GTK Link Lizard is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/ # Version: 1.5 # Description: Simple GUI for storing and displaying web links # This GUI will do away with synchronizing bookmarks between browsers, web links are stored in a regular text file which is found in your documents folder. GTK Link Lizard makes it easy to edit, swap or replace a list of clickable links import pygtk pygtk.require(2.0) import gtk import sys import re import os path = os.getenv(HOME) class link_lizard(): def __init__(self): self.load_main() # # Load File # # def load_file(self): try: self.text_file = open(path + /Documents/gtk-link-lizard/links.txt,r+) except IOError: print loading links.txt from usr/share/doc/gtk-link-lizard... try: self.text_file = open(usr/share/doc/gtk-link-lizard/links.txt,r) self.text_file.write(path + /Documents/gtk-link-lizard/links.txt) self.text_file = open(path + /Documents/gtk-link-lizard/links.txt,r+) except IOError: print ERROR: link.txt not found # # Load main GUI # # def load_main(self, data=None): # Create main window self.main_window = gtk.Window(gtk.WINDOW_TOPLEVEL) # Quit main function when window is destroyed self.main_window.connect(destroy, gtk.main_quit) self.main_window.set_size_request(600, 600) self.main_window.set_position(gtk.WIN_POS_CENTER) self.main_window.set_opacity(0.9) self.main_window.set_title(GTK Link Lizard) self.main_window.set_keep_above(True) # Create scrolled window scrolled_window = gtk.ScrolledWindow() scrolled_window.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC) # Create placement boxes and dictionaries main_box = gtk.VBox(homogeneous=False) link_box = gtk.VBox(homogeneous=False) linkbutton = {} label = {} # Create edit button edit_button = gtk.Button(Edit Links) edit_button.connect(clicked, self.load_edit) # Count number of lines in text file self.load_file() number_lines = len(self.text_file.readlines()) # Reset counter and check through each line of text count = 0 while(count number_lines): self.load_file() all_lines = self.text_file.readlines()
Re: Re: installing an end user editable file
2011/2/14 james frize jamesfr...@gmail.com: Hey mentors, I'm not a mentor, I just lurk on this list to learn. I like the idea of having a default copy of the file used by my program, as suggested by Lars and PJ, so I've altered my source code to use a default file and allow multiple users to have their own copies of this file in their home/user/Documents folder. creating a default file in /usr/share and having the program copy it to the user's directory when it's run However, I can't open a file from /usr/share via my python script as I don't have permission to open files in a protected directory, and after reading up a bit on it, it's been suggested that it's bad form to invoke super user in a script, as it's construed as a security risk (i.e. http://tldp.org/HOWTO/Security-HOWTO/file-security.html; http://www.velocityreviews.com/forums/t346075-sudo-open-python-newbee-question.html) Do I really have to use sudo or super user privileges to just open and copy a text template? Not at all. I was thinking along the lines of: def homedir(): '''Get current user's homedir''' home = os.getenv('HOME') if home == None: raise IOError('cannot copy links.txt: HOME not set') return home def open_links_txt(): '''Open links.txt; install for current user if necessary''' # http://standards.freedesktop.org/basedir-spec/basedir-spec-0.6.html datadir = os.getenv('XDG_DATA_HOME') if datadir == None: datadir = os.path.join(homedir(), '.local', 'share') links_txt = os.path.join(datadir, 'links.txt') if not os.path.exists(links_txt): shutil.copy('/usr/share/gtk-link-lizard/links.txt', links_txt) return open(links_txt) Notes: * UNTESTED CODE, may contain the stupidest of syntax errors or worse * contains a race condition due to the use of os.path.exists, but that shoudn't matter unless the user sets XDG_DATA_HOME to the wrong value or has a world-writable homedir (in which case s/he's doomed anyway) * I know this doesn't fit the original app particularly well, so please integrate with existing code. Where do packagers normally install files of this type? I put it in /usr/share/gtk-link-lizard for the purpose of the example. I don't know the Debian packaging rules by heart, but /usr/share/doc seems to be the wrong place; that's for documentation. It should be safe to remove documentation (sudo rm -rf /usr/share/doc) without applications suddenly starting to malfunction. I thought it might be a good idea to store it in home/user/.packageName But I'm still at a loss as to how I can find a users home directory from the rules makefile :( been trying to use ~/ and $XDG_CONFIG_HOME but I just end up with everything being installed in folders called ~ or DG_CONFIG_HOME DON'T. Users' homedirs are off limits to package managers such as dpkg. The application, when run, may install a file there, but the rules script should not. Regards, Lars -- To UNSUBSCRIBE, email to debian-mentors-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/aanlktini7anmw0fcspshj2sxpf4wyafbtl70diz8p...@mail.gmail.com
Re: Re: installing an end user editable file
Thanks very much Lars, That's massively helpful, it clarifies a lot of stuff, I reckon I should be able to get this package working properly now, phew! - I knew making your first Debian package had a reputation for taking a few attempts, but I wasn't quite ready for this! Regards. Jim. On 14 February 2011 21:28, Lars Buitinck larsm...@gmail.com wrote: 2011/2/14 james frize jamesfr...@gmail.com: Hey mentors, I'm not a mentor, I just lurk on this list to learn. I like the idea of having a default copy of the file used by my program, as suggested by Lars and PJ, so I've altered my source code to use a default file and allow multiple users to have their own copies of this file in their home/user/Documents folder. creating a default file in /usr/share and having the program copy it to the user's directory when it's run However, I can't open a file from /usr/share via my python script as I don't have permission to open files in a protected directory, and after reading up a bit on it, it's been suggested that it's bad form to invoke super user in a script, as it's construed as a security risk (i.e. http://tldp.org/HOWTO/Security-HOWTO/file-security.html; http://www.velocityreviews.com/forums/t346075-sudo-open-python-newbee-question.html) Do I really have to use sudo or super user privileges to just open and copy a text template? Not at all. I was thinking along the lines of: def homedir(): '''Get current user's homedir''' home = os.getenv('HOME') if home == None: raise IOError('cannot copy links.txt: HOME not set') return home def open_links_txt(): '''Open links.txt; install for current user if necessary''' # http://standards.freedesktop.org/basedir-spec/basedir-spec-0.6.html datadir = os.getenv('XDG_DATA_HOME') if datadir == None: datadir = os.path.join(homedir(), '.local', 'share') links_txt = os.path.join(datadir, 'links.txt') if not os.path.exists(links_txt): shutil.copy('/usr/share/gtk-link-lizard/links.txt', links_txt) return open(links_txt) Notes: * UNTESTED CODE, may contain the stupidest of syntax errors or worse * contains a race condition due to the use of os.path.exists, but that shoudn't matter unless the user sets XDG_DATA_HOME to the wrong value or has a world-writable homedir (in which case s/he's doomed anyway) * I know this doesn't fit the original app particularly well, so please integrate with existing code. Where do packagers normally install files of this type? I put it in /usr/share/gtk-link-lizard for the purpose of the example. I don't know the Debian packaging rules by heart, but /usr/share/doc seems to be the wrong place; that's for documentation. It should be safe to remove documentation (sudo rm -rf /usr/share/doc) without applications suddenly starting to malfunction. I thought it might be a good idea to store it in home/user/.packageName But I'm still at a loss as to how I can find a users home directory from the rules makefile :( been trying to use ~/ and $XDG_CONFIG_HOME but I just end up with everything being installed in folders called ~ or DG_CONFIG_HOME DON'T. Users' homedirs are off limits to package managers such as dpkg. The application, when run, may install a file there, but the rules script should not. Regards, Lars -- To UNSUBSCRIBE, email to debian-mentors-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/aanlktikqfdon5rjimrrmp9vnx+egd_ywjn1bojf8g...@mail.gmail.com
Re: installing an end user editable file
james frize wrote: However, I can't open a file from /usr/share via my python script as I don't have permission to open files in a protected directory print loading links.txt from usr/share/doc/gtk-link-lizard... try: self.text_file = open(usr/share/doc/gtk-link-lizard/links.txt,r) Check your filesystem paths carefully; unless I totally misunderstand some bizarre aspect of Python syntax, you're trying to open usr/share/doc/gtk-link-lizard/links.txt relative to whatever the code thinks the current directory is, not the absolute path /usr/share/doc/gtk-link-lizard/links.txt. -kgd -- To UNSUBSCRIBE, email to debian-mentors-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/4d59a819.4090...@vianet.ca
Re: installing an end user editable file
On Monday 14 February 2011 13:38:13 james frize wrote: However, I can't open a file from /usr/share via my python script That's wrong. Most of /usr/share should be world-readable. Perhaps you are installing your template with permissions that are too restrictive. I believe /usr/share files should mostly be 644. -- Boyd Stephen Smith Jr. ,= ,-_-. =. b...@iguanasuicide.net ((_/)o o(\_)) ICQ: 514984 YM/AIM: DaTwinkDaddy `-'(. .)`-' http://iguanasuicide.net/\_/ signature.asc Description: This is a digitally signed message part.
Re: installing an end user editable file
Check your filesystem paths carefully; unless I totally misunderstand some bizarre aspect of Python syntax, you're trying to open usr/share/doc/gtk-link-lizard/links.txt relative to whatever the code thinks the current directory is, not the absolute path /usr/share/doc/gtk-link-lizard/links.txt. Cheers Kris, Well spotted! Thankfully I'd already spotted that one! But yeah, it makes a massive difference that one / Jim. -- To UNSUBSCRIBE, email to debian-mentors-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/aanlktiksew+fogog9mgbpq1rnijxcnzcgmtxund0h...@mail.gmail.com
Re: installing an end user editable file
Kris Deugau kdeu...@vianet.ca writes: james frize wrote: However, I can't open a file from /usr/share via my python script as I don't have permission to open files in a protected directory print loading links.txt from usr/share/doc/gtk-link-lizard... try: self.text_file = open(usr/share/doc/gtk-link-lizard/links.txt,r) Check your filesystem paths carefully; unless I totally misunderstand some bizarre aspect of Python syntax, you're trying to open usr/share/doc/gtk-link-lizard/links.txt relative to whatever the code thinks the current directory is […] You understand correctly. James has confused absolute paths with relative paths. -- \ “Programs must be written for people to read, and only | `\incidentally for machines to execute.” —Abelson Sussman, | _o__) _Structure and Interpretation of Computer Programs_ | Ben Finney -- To UNSUBSCRIBE, email to debian-mentors-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/87zkpygmvh@benfinney.id.au
RE: installing an end user editable file
Hi, Got my Debian packages almost fully working now, everything installs/uninstalls without error. However, when I try to run the newly installed program it wont work properly as it lacks permission to save to file. My program loads a list of hyperlinks from a text file (links.txt), this text file is currently in usr/share/packagename (I've also tried to install it directly to home/user/Documents but that didn't work either) I want my makefile to install links.txt in a manner that will allow my end user to write to the file without permission violation. Cheers. Here's the makefile so far: #!/usr/bin/make -f # Sample debian/rules that uses debhelper. # This file is public domain software, originally written by Joey Hess. # # This version is for packages that are architecture independent. # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 icon = $(CURDIR)/link-lizard-icon.png script = $(CURDIR)/gtk-link-lizard.py launcher = $(CURDIR)/gtk-link-lizard.desktop links = $(CURDIR)/links.txt DEST1 = $(CURDIR)/debian/gtk-link-lizard/usr/share/gtk-link-lizard-1.4 DEST2 = $(CURDIR)/debian/gtk-link-lizard/usr/share/applications build: build-stamp build-stamp: dh_testdir # Add here commands to compile the package. #$(MAKE) touch build-stamp clean: dh_testdir dh_testroot rm -f build-stamp # Add here commands to clean up after the build process. #$(MAKE) clean #$(MAKE) distclean dh_clean install: build clean $(icon) $(script) $(links) $(launcher) dh_testdir dh_testroot dh_prep dh_installdirs mkdir -m 777 -p $(DEST1) mkdir -m 777 -p $(DEST2) install -m 777 $(icon) $(DEST1) install -m 777 $(script) $(DEST1) install -m 777 $(links) $(DEST1) install -m 777 $(launcher) $(DEST2) # Add here commands to install the package into debian/packagename. #$(MAKE) prefix=`pwd`/debian/`dh_listpackages`/usr install # Build architecture-independent files here. binary-indep: build install dh_testdir dh_testroot dh_installchangelogs dh_installdocs dh_installexamples # dh_installmenu # dh_installdebconf # dh_installlogrotate # dh_installemacsen # dh_installcatalogs # dh_installpam # dh_installmime # dh_installinit # dh_installcron # dh_installinfo # dh_installwm # dh_installudev # dh_lintian # dh_bugfiles # dh_undocumented dh_installman dh_link dh_compress dh_fixperms # dh_perl dh_installdeb dh_gencontrol dh_md5sums dh_builddeb # Build architecture-dependent files here. binary-arch: build install # We have nothing to do by default. binary: binary-indep binary-arch .PHONY: build clean binary-indep binary-arch binary install -- To UNSUBSCRIBE, email to debian-mentors-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/aanlktim+ycpsifcrrsxiarehzdqpm4c1o_jludk2j...@mail.gmail.com
Re: installing an end user editable file
2011/2/13 james frize jamesfr...@gmail.com: Got my Debian packages almost fully working now, everything installs/uninstalls without error. However, when I try to run the newly installed program it wont work properly as it lacks permission to save to file. My program loads a list of hyperlinks from a text file (links.txt), this text file is currently in usr/share/packagename (I've also tried to install it directly to home/user/Documents but that didn't work either) I want my makefile to install links.txt in a manner that will allow my end user to write to the file without permission violation. Sounds like the file should be installed by the program if it is not found. A default file can be placed in and copied from /usr/share/packagename if it is provided. I don't think /home/user/Documents is a good place for this; prefer ~/.packagename/links.txt instead. You'll probably have to patch up the source code. If the upstream package wants to modify something in /usr/share, it violates the Filesystem Hierarchy Standard. Regards, Lars -- To UNSUBSCRIBE, email to debian-mentors-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/aanlktik2q0x3+xeveytft4vo3sa3ajtbr--77bsgq...@mail.gmail.com
Re: installing an end user editable file
On Sun, 2011-02-13 at 17:11 +0100, Lars Buitinck wrote: [...] I don't think /home/user/Documents is a good place for this; prefer ~/.packagename/links.txt instead. You'll probably have to patch up the source code. [...] shouldn't $XDG_CONFIG_HOME (or $HOME/.config if not set) or $XDG_DATA_HOME ($HOME/.local/share) be used for this kind of data? http://standards.freedesktop.org/basedir-spec/basedir-spec-0.6.html Best Regards, Julian signature.asc Description: This is a digitally signed message part
Re: installing an end user editable file
2011/2/13 Julian Taylor jtaylor.deb...@googlemail.com: On Sun, 2011-02-13 at 17:11 +0100, Lars Buitinck wrote: [...] I don't think /home/user/Documents is a good place for this; prefer ~/.packagename/links.txt instead. You'll probably have to patch up the source code. [...] shouldn't $XDG_CONFIG_HOME (or $HOME/.config if not set) or $XDG_DATA_HOME ($HOME/.local/share) be used for this kind of data? http://standards.freedesktop.org/basedir-spec/basedir-spec-0.6.html Ah, yes, excuse me. -- To UNSUBSCRIBE, email to debian-mentors-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/AANLkTikRn5kDKmJNrg1FynWjAy-A1U-_=jziqc+5z...@mail.gmail.com
Re: Re: installing an end user editable file
Cheers Lars, I'm looking at installing the links.txt file to ~/.packagename/links.txt, but I don't seem to be able to use the ~wildcard. Using this line in my makefile: DEST3 = $(CURDIR)/debian/gtk-link-lizard/~/.gtk-link-lizard It just creates a directory called ~ on the destination drive? It doesn't seem to want to replace the wildcard with /home/user I'm also unsure what you mean by patch up the source code? Thanks -- To UNSUBSCRIBE, email to debian-mentors-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/AANLkTin1Bdh67Aq0df5QhFzNboDvkSrnen=dh-lug...@mail.gmail.com
Re: Re: installing an end user editable file
On Sun, Feb 13, 2011 at 06:24:06PM +, james frize wrote: I'm looking at installing the links.txt file to ~/.packagename/links.txt, but I don't seem to be able to use the ~wildcard. Is this in rules file? If so you cannot do that at all. It doesn't make any sense for a package to install a file in the users home directory. Generally there is a /etc/package/whatever file for defaults and any user specific files would be in /usr/share/doc/package/examples The file in examples should really tell people what to do, e.g.: # This is an example file for whatever, you can copy this to # ~/.whatever/myfile There are many problems with getting a package installer to install files in a user's home directory. Perhaps the first one I can think of is, which user's directory? - Craig -- Craig Small VK2XLZhttp://www.enc.com.au/ csmall at : enc.com.au Debian GNU/Linux http://www.debian.org/ csmall at : debian.org GPG fingerprint: 1C1B D893 1418 2AF4 45EE 95CB C76C E5AC 12CA DFA5 -- To UNSUBSCRIBE, email to debian-mentors-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/20110213213840.ga32...@enc.com.au
Re: Re: installing an end user editable file
Hey Craig, thanks for the help, Basically I'm copying over a text file that has a list of web links in, after the program is installed the file needs to be edited by the end user, so I'm trying to put the file in a place where a regular user would have permission to both read and write to the text file. Some people have suggested putting it in home/user/.packageName but I can't seem to be able to do that, been trying to use ~/ and $XDG_CONFIG_HOME but I just end up with everything being installed in folders called ~ or DG_CONFIG_HOME I need a way of finding the correct user path, I've been reading the info on this page: http://standards.freedesktop.org/basedir-spec/basedir-spec-0.6.html But I can't get my head round that either?? Here's the part of my make file where I specify the destination paths: # Icon and script go here DEST1 = $(CURDIR)/debian/gtk-link-lizard/usr/share/gtk-link-lizard-1.4 # Desktop launcher goes here DEST2 = $(CURDIR)/debian/gtk-link-lizard/usr/share/applications # Links.txt goes here DEST3 = $(CURDIR)/debian/gtk-link-lizard/SOMEHOW I NEED THE HOME/USER PATH HERE??/.gtk-link-lizard Thanks again. Jim. On 13 February 2011 21:38, Craig Small csm...@debian.org wrote: On Sun, Feb 13, 2011 at 06:24:06PM +, james frize wrote: I'm looking at installing the links.txt file to ~/.packagename/links.txt, but I don't seem to be able to use the ~wildcard. Is this in rules file? If so you cannot do that at all. It doesn't make any sense for a package to install a file in the users home directory. Generally there is a /etc/package/whatever file for defaults and any user specific files would be in /usr/share/doc/package/examples The file in examples should really tell people what to do, e.g.: # This is an example file for whatever, you can copy this to # ~/.whatever/myfile There are many problems with getting a package installer to install files in a user's home directory. Perhaps the first one I can think of is, which user's directory? - Craig -- Craig Small VK2XLZ http://www.enc.com.au/ csmall at : enc.com.au Debian GNU/Linux http://www.debian.org/ csmall at : debian.org GPG fingerprint: 1C1B D893 1418 2AF4 45EE 95CB C76C E5AC 12CA DFA5 -- To UNSUBSCRIBE, email to debian-mentors-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/AANLkTikBeVcyM4H 3-xfu4pnihq9qkczp7mlae3...@mail.gmail.com
Re: Re: installing an end user editable file
Sorry forgot to clarify, yeah it's in my rules makefile. On 13 February 2011 21:55, james frize jamesfr...@gmail.com wrote: Hey Craig, thanks for the help, Basically I'm copying over a text file that has a list of web links in, after the program is installed the file needs to be edited by the end user, so I'm trying to put the file in a place where a regular user would have permission to both read and write to the text file. Some people have suggested putting it in home/user/.packageName but I can't seem to be able to do that, been trying to use ~/ and $XDG_CONFIG_HOME but I just end up with everything being installed in folders called ~ or DG_CONFIG_HOME I need a way of finding the correct user path, I've been reading the info on this page: http://standards.freedesktop.org/basedir-spec/basedir-spec-0.6.html But I can't get my head round that either?? Here's the part of my make file where I specify the destination paths: # Icon and script go here DEST1 = $(CURDIR)/debian/gtk-link-lizard/usr/share/gtk-link-lizard-1.4 # Desktop launcher goes here DEST2 = $(CURDIR)/debian/gtk-link-lizard/usr/share/applications # Links.txt goes here DEST3 = $(CURDIR)/debian/gtk-link-lizard/SOMEHOW I NEED THE HOME/USER PATH HERE??/.gtk-link-lizard Thanks again. Jim. On 13 February 2011 21:38, Craig Small csm...@debian.org wrote: On Sun, Feb 13, 2011 at 06:24:06PM +, james frize wrote: I'm looking at installing the links.txt file to ~/.packagename/links.txt, but I don't seem to be able to use the ~wildcard. Is this in rules file? If so you cannot do that at all. It doesn't make any sense for a package to install a file in the users home directory. Generally there is a /etc/package/whatever file for defaults and any user specific files would be in /usr/share/doc/package/examples The file in examples should really tell people what to do, e.g.: # This is an example file for whatever, you can copy this to # ~/.whatever/myfile There are many problems with getting a package installer to install files in a user's home directory. Perhaps the first one I can think of is, which user's directory? - Craig -- Craig Small VK2XLZ http://www.enc.com.au/ csmall at : enc.com.au Debian GNU/Linux http://www.debian.org/ csmall at : debian.org GPG fingerprint: 1C1B D893 1418 2AF4 45EE 95CB C76C E5AC 12CA DFA5 -- To UNSUBSCRIBE, email to debian-mentors-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/AANLkTin_5DvwgAS==spfpatdqdvog7jgcy8iajjap...@mail.gmail.com
Re: Re: installing an end user editable file
On 2/13/11, Craig Small csm...@debian.org wrote: On Sun, Feb 13, 2011 at 06:24:06PM +, james frize wrote: I'm looking at installing the links.txt file to ~/.packagename/links.txt, but I don't seem to be able to use the ~wildcard. Is this in rules file? If so you cannot do that at all. It doesn't make any sense for a package to install a file in the users home directory. Generally there is a /etc/package/whatever file for defaults and any user specific files would be in /usr/share/doc/package/examples The file in examples should really tell people what to do, e.g.: # This is an example file for whatever, you can copy this to # ~/.whatever/myfile There are many problems with getting a package installer to install files in a user's home directory. Perhaps the first one I can think of is, which user's directory? An obvious answer is ALL users' directories, but the question arises, even users that don't exist yet? That's why Lars suggested creating a default file in /usr/share and having the program copy it to the user's directory when it's run. You can't do that in the Debian installer, though, so you would have to patch (i.e. modify) the source code of the application itself. Why must this file be user-modifiable? Must all users of the system be able to modify it such that everyone then uses the modified file? What are the possible consequences if one user is an asshole and makes modifications with the intent of doing damage? This can be done; many games store a high-score list that anyone can modify by playing the game. But have you thought about those issues? Is it necessary? -- -PJ -- To UNSUBSCRIBE, email to debian-mentors-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/AANLkTi=u3ygyspgo9454jq+w+wf9v2mhfciodhmfh...@mail.gmail.com
Re: installing an end user editable file
In AANLkTikBeVcyM4H=0d3-xfu4pnihq9qkczp7mlae3...@mail.gmail.com, james frize wrote: Basically I'm copying over a text file that has a list of web links in, after the program is installed the file needs to be edited by the end user, so I'm trying to put the file in a place where a regular user would have permission to both read and write to the text file. Which user? All users? Should each user have a separate copy? Normally, per-user configuration files would be created by that user. An example could go into /usr/share/packagename where a user could copy it into their home directory. You could also install something into /etc/skel; the contents of this directory are normally copied into a new user's home directory when the user is created. Keep in mind that that while many Debian installations are effectively single- user, that Debian is designed to support multiple users and to move cleanly from having one real user to many real users. -- Boyd Stephen Smith Jr. ,= ,-_-. =. b...@iguanasuicide.net ((_/)o o(\_)) ICQ: 514984 YM/AIM: DaTwinkDaddy `-'(. .)`-' http://iguanasuicide.net/\_/ signature.asc Description: This is a digitally signed message part.
Re: installing an end user editable file
Cheers PJ and Boyd, To be honest I never thought about having multiple users, just learning about the packaging process and I'm experimenting with what I can do. But I guess it's a much better idea to have a template and a copy for each user, will have to add it to the source. Thanks for the responses. Jim. -- To UNSUBSCRIBE, email to debian-mentors-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/aanlktikjh9x_knp-u719qd2ykp0ffn8owbjiz32xs...@mail.gmail.com