Tiny Core Base > TCB Talk

hacking .X.d

<< < (6/7) > >>

maro:
jur: I really think you are "missing something" (which has come up in this forum multiple times). The simple way for 'root' to run something as user 'tc' is via su -c COMMAND tc

As a proof of concept I've done:

--- Code: ---tc@box:~$ echo 'su -c "tce-load -w conky && tce-load -i conky" tc' >> /opt/bootlocal.sh
tc@box:~$ echo 'su -c "tce-load -w tint2 && tce-load -i tint2" tc' >> /opt/bootlocal.sh
tc@box:~$ echo '( while [ ! $( which conky 2> /dev/null ) ] ; do sleep 1 ; done ; conky ) &' > .X.d/conky
tc@box:~$ echo '( while [ ! $( which tint2 2> /dev/null ) ] ; do sleep 1 ; done ; tint2 ) &' > .X.d/tint2
tc@box:~$ filetool.sh -b && sudo reboot

--- End code ---

I believe that it is what you want: It starts the X server as early as possible and 'conky' and 'tint2' are showing up whenever they are available. I personally believe it's better to create in '~/.X.d' a file for each application, but I've tried to come up with a command sequence that should also work if you "squeeze" everthing into a single file.

As a side note: The test was conducted using a VM (i.e. QEMU without KQEMU). It was rather slow for 'the applications to start and I'm putting this down to being forced into loading 'wireless_tools.tcz' and the wireless kernel modules on a (virtual) system that will never have any such hardware.

Frank:

--- Quote from: /etc/skel/.xsession ---[ -d ".X.d" ] && find ".X.d" -type f -print | while read F; do . "$F"; done

--- End quote ---

The last line of .xsession runs the scripts and programs in .X.d as shown above. The most universal solution would be a minor rewrite of the line, such that it starts all scripts and programs in the background. Which, obviously, is a suggestion for roberts, not for jur.

gerald_clark:
That would prohibit not backgrounding where a race condition may exist.

Frank:
The present solution with its unpredictable order of script execution doesn't prevent race conditions either -- so we are no worse off with my suggestion.

A few posts further up in this thread someone showed the proper way of preventing race conditions. Oh, that was you ...

jur:
OK, I have taken all the good advice in this thread on board and come up with the following. Please feel free to point out any problems, as I am really still in early learning phase:

.X.d has a single file with

--- Code: ---conky &
tint2 &

--- End code ---
,profile has an extra inclusion

--- Code: ---if [ -f "$HOME/.startup" ]; then
   . "$HOME/.startup"
fi

--- End code ---
.startup:

--- Code: ---export GDK_NATIVE_WINDOWS=true
(
        sleep 5
loadapp iptables && sudo basic-firewall noprompt
loadapp volumeicon && volumeicon &
loadapp iptables && sudo basic-firewall noprompt
loadapp hwmon-2.6.33.3-tinycore.tcz
loadapp pci-hotplug-2.6.33.3-tinycore.tcz
loadapp hicolor-icon-theme.tcz
loadapp gtk2_prefs
loadapp zenity
        amixer sset 'Master' 64 >/dev/null
        amixer sset 'Headphone' 55 >/dev/null
        amixer sset 'Speaker' 55 >/dev/null
        loadapp wine
updates
) &

--- End code ---

The reason I am sticking with my loadapp script is that it contains all checking; I can start a new setup from scratch, all necessary extensions will be auto-downloaded.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version