Tiny Core Linux

Tiny Core Extensions => TCE Bugs => Topic started by: Kingdomcome on November 21, 2009, 10:50:08 AM

Title: pcmanfm startup script
Post by: Kingdomcome on November 21, 2009, 10:50:08 AM
The startup script for pcmanfm is hardcoded with the user tc. It would be nice for it to read the username from /etc/sysconfig/tcuser.
Title: Re: pcmanfm startup script
Post by: bmarkus on November 21, 2009, 11:00:58 AM
The startup script for pcmanfm is hardcoded with the user tc. It would be nice for it to read the username from /etc/sysconfig/tcuser.

I see your point, however it is not so trivial. Startup script is executed before saved data restored ant it may overwrite /etc/sysconfig/tcuser

Also if there is a different user specified it is required to check /etc/passwd to check user exists, its home directory setting, etc. I would postpone it for a later time.

What is more trivial to add it to /root

To be honest it is not a pcmanfm business, more it is up to the gtk+ environment. It is done by pcmanfm and wicd only to fix its lack and to make them working  >:( as a victim. Possibly other applications are missing it also.
Title: Re: pcmanfm startup script
Post by: Kingdomcome on November 21, 2009, 01:43:49 PM
What I do in any script that reads or writes to home, or needs to run an app as the default user is:
Code: [Select]
#!/bin/sh
tcuser=$(cat /etc/sysconfig/tcuser)
cp -p /some/file /home/${tcuser}/file
sudo -u ${tcuser} somecommand
I see this in other extensions and believe this is somewhat of a TC standard, it allows people to use the "user=" bootcode.
Title: Re: pcmanfm startup script
Post by: Jason W on November 21, 2009, 01:46:08 PM
/etc/sysconfig/tcuser should never be overwritten by a startup script or a backup.  It is there to be referred to to find the current user.  The bootcode should be used to specify user and not by backing up /etc/sysconfig/tcuser.  This approach should be used when copying files to the home directory:

Code: [Select]
#!/bin/sh

MYUSER=`cat /etc/sysconfig/tcuser

cp file /home/"$MYUSER"/



And not using /home/tc as the home directory.

EDIT:  I see Kingdomcome has just posted the same, and it is the right approach.
Title: Re: pcmanfm startup script
Post by: bmarkus on November 21, 2009, 01:53:31 PM
The probmlem with your script that it expets to have user's home directory in /home which is not necessarily true, as user's home can be anywhere. Exact location is stored normally in /etc/passwd and this is used by other utilities.

Well, you can establish a rule for TC that a user home dir must be in /home, but this would be an unnecsary restriction.
Title: Re: pcmanfm startup script
Post by: Jason W on November 21, 2009, 05:36:44 PM
Tce-setup expects and makes the user's home directory in /home/`cat /etc/sysconfig/tcuser`.  So unless that is changed, /home is always where the user home directory is.
Title: Re: pcmanfm startup script
Post by: ^thehatsrule^ on November 24, 2009, 02:09:21 AM
The probmlem with your script that it expets to have user's home directory in /home which is not necessarily true, as user's home can be anywhere. Exact location is stored normally in /etc/passwd and this is used by other utilities.

Well, you can establish a rule for TC that a user home dir must be in /home, but this would be an unnecsary restriction.
Sure, but on the other hand having just this extra "feature" could be considered excessive.  As already pointed out, TC already uses /home... it's a standard anyways, and it could be said that probably all user home directories will be in /home.

But if this realllly bothering you, you could do something like
Code: [Select]
su -c 'echo $HOME' `cat /etc/sysconfig/tcuser`
Title: Re: pcmanfm startup script
Post by: bmarkus on November 24, 2009, 02:38:37 AM
I'm fine with this limitation or call it rule :) on TC. I asked it because in general under LINUX you can put user's home anywhere, using /home is not a technical requirement but simplyfies administration and offers some standard compatibility.
Title: Re: pcmanfm startup script
Post by: ^thehatsrule^ on November 24, 2009, 03:12:34 AM
convention seems to fit the bill

I'd say it's similar to any other path.  In a Linux based distro, you could change anything.  Why /etc/passwd?  Or /usr/bin? /root? etc...
Title: Re: pcmanfm startup script
Post by: bmarkus on November 24, 2009, 03:32:04 AM
convention seems to fit the bill
 Why /etc/passwd?  Or /usr/bin? /root? etc...

Linux Standard Base (LSB) ? http://www.linuxfoundation.org/collaborate/workgroups/lsb
Title: Re: pcmanfm startup script
Post by: ^thehatsrule^ on November 24, 2009, 04:32:17 AM
Sure, and those are conventions :)

(side note: I seem to recall FHS saying /home was optional)

... and this is getting OT heh.  Need a split?
Title: Re: pcmanfm startup script
Post by: bmarkus on November 24, 2009, 04:40:06 AM
... and this is getting OT heh.  Need a split?

Do not split, I do not want to deal with this topic now  :D