On 5/9/2015 11:18 AM, John Hupp wrote:
> On 5/8/2015 6:46 PM, John Hupp wrote:
>> I'm casting around for ideas on how to best detect that the current 
>> environment is on a fat client (not on a thin client or on the server 
>> itself), and then run a startup script to modify pcmanfm's volume 
>> management preferences.  The script should run whether the user is 
>> logging into the server, a thin client or a fat client, so I would 
>> probably not want to run it via an RCFILE entry in lts.conf. Maybe an 
>> upstart job (I'm on Lubuntu 14.04).
>>
>> (I'm tweaking the behavior of what happens when a USB flash drive, 
>> audio CD or data disc is inserted.  My first approach was to turn off 
>> pcmanfm's "Mount removable media automatically when they are 
>> inserted" setting for all users except user1.  I arrived at an 
>> acceptable solution in a thin-only environment that involved ltspfs 
>> notifications, but the same thing doesn't work for fat clients.)
>>
>> I know that pcmanfm's preferences are in 
>> ~/.config/pcmanfm/lubuntu/pcmanfm.conf, but don't have any slick 
>> ideas beyond that.  My first idea is to make a script that looks at 
>> whether the output of hostname contains "ltsp" or not.
>>
>> Other ideas?
> [snip]

Here is an improved upstart job (/etc/init/pcmanfm-ltsp.conf).  The 
script code is tested as working when run manually as a script, but it 
was not effective as an upstart job.  Perhaps environment variables like 
$HOME are not available to upstart jobs even though this one doesn't run 
until after the desktop session has started and $HOME should be defined 
at that point.

But given that the code works as a script, I can probably get what I 
want by setting that up with a desktop shortcut in an autostarting location.

# Edit pcmanfm Volume Management preferences at startup
#
# Set prefs based on whether the machine is a thin client or a 
server/fat client

description "Edit pcmanfm Volume Management preferences based on machine 
type"

start on desktop-session-start

script
# test for a fat client:
if [[ $(hostname | grep 'ltsp') == ltsp* ]]; then
     sed -i 's/mount_removable=0/mount_removable=1/' 
"$HOME/.config/pcmanfm/lubuntu/pcmanfm.conf"
# test for a thin client:
elif [ -n "$LTSP_CLIENT" ]; then
     sed -i 's/mount_removable=0/mount_removable=0/' 
"$HOME/.config/pcmanfm/lubuntu/pcmanfm.conf"
# machine must be the server
else
     sed -i 's/mount_removable=0/mount_removable=1/' 
"$HOME/.config/pcmanfm/lubuntu/pcmanfm.conf"
fi
end script


------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_____________________________________________________________________
Ltsp-discuss mailing list.   To un-subscribe, or change prefs, goto:
      https://lists.sourceforge.net/lists/listinfo/ltsp-discuss
For additional LTSP help,   try #ltsp channel on irc.freenode.net

Reply via email to