On 5/13/2015 8:30 AM, Israel wrote:
Hi John
(inline)
On 05/09/2015 03:47 PM, John Hupp wrote:
..
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.

You could try setting something like:
MY_HOME=$(xdg-user-dir HOME)

sed -i 's/mount_removable=0/mount_removable=1/'
"$MY_HOME/.config/pcmanfm/lubuntu/pcmanfm.conf"

You could also save the script as a file in your $PATH (like /usr/bin)
and use:
exec scriptname
in your conf file

But this is maybe more of a style preference thing :)

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




Hi, Israel. Interesting thoughts. Someone on the Ubuntu list thought that the upstart approach probably wouldn't work because 1) $HOME is not part of the upstart environment (which I believe is true, and which you would attempt to work around), and 2) the upstart job would run as root, so even if available, $HOME wouldn't have the value I wanted. If #2 is correct, then I imagine 'xdg-user-dir HOME' likewise would not return the value I wanted.

But he did acknowledge that he was not highly knowledgeable about upstart, so maybe #2 is suspect.

In any case, when the upstart job was not working for me, I bolted and used a script + autostarting desktop shortcut, which did work.

--
Lubuntu-users mailing list
Lubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/lubuntu-users

Reply via email to