WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: scripts put in .X.d by an extension don't get executed.  (Read 2790 times)

Offline bj0

  • Newbie
  • *
  • Posts: 1
scripts put in .X.d by an extension don't get executed.
« on: January 12, 2011, 04:53:08 PM »
The .xsession script that executes scripts in /home/tc/.X.d/ use "find .X.d -type f", which doesn't include symlinks.  If extensions try to put script files in this directory to get executed when X starts, it becomes a symlink and doesn't get executed.

Offline maro

  • Hero Member
  • *****
  • Posts: 1228
Re: scripts put in .X.d by an extension don't get executed.
« Reply #1 on: January 12, 2011, 05:15:35 PM »
Just as a matter of interest, which extension from the repository appears to exhibit this problem?

If it is a private extension (e.g. 'my_ext.tcz') I'd simply include in this extension a startup-script (e.g. '/usr/local/tce.installed/my_ext') in which I'd search for such links and replace the symbolic link by a copy of the file in question. Or (probably eaiser) as the file in '~/.X.d' is assumed to be quite small I'd use something like 'echo "COMMANDS" > ~/.X.d/my_script' in said startup script.

Offline tinypoodle

  • Hero Member
  • *****
  • Posts: 3857
Re: scripts put in .X.d by an extension don't get executed.
« Reply #2 on: January 13, 2011, 03:38:12 AM »
Code: [Select]
--- etc/skel/.xsession  Thu Jan 13 10:23:33 2011                                                                                             
+++ etc/skel/.xsession.ln       Thu Jan 13 10:28:56 2011                                                                                     
@@ -9,4 +9,4 @@                                                                                                                               
 fi                                                                                                                                           
 [ -x ./.mouse_config ] && ./.mouse_config &                                                                                                 
 [ $(which "$ICONS".sh) ] && ${ICONS}.sh &                                                                                                   
-[ -d ".X.d" ] && find ".X.d" -type f -print | while read F; do . "$F"; done                                                                 
+[ -d ".X.d" ] && find ".X.d" -type f -print && find ".X.d" -type l -print | while read F; do . "$F"; done

DISCLAIMER: untested
"Software gets slower faster than hardware gets faster." Niklaus Wirth - A Plea for Lean Software (1995)

Offline maro

  • Hero Member
  • *****
  • Posts: 1228
Re: scripts put in .X.d by an extension don't get executed.
« Reply #3 on: January 13, 2011, 03:50:56 AM »
If you want to go down that path of changing '.Xsession' I'd suggest:
    [ -d ".X.d" ] && find ".X.d" -type f -o -type l | while read F ; do . "$F" ; done

This is not Solaris which IIRC used to require '-print' in 'find' expressions, and I don't see the point of running two finds if one can do it.

Offline tinypoodle

  • Hero Member
  • *****
  • Posts: 3857
Re: scripts put in .X.d by an extension don't get executed.
« Reply #4 on: January 13, 2011, 04:36:23 AM »
If you want to go down that path of changing '.Xsession' I'd suggest:
    [ -d ".X.d" ] && find ".X.d" -type f -o -type l | while read F ; do . "$F" ; done

This is not Solaris which IIRC used to require '-print' in 'find' expressions, and I don't see the point of running two finds if one can do it.

Agreed with your conclusion.
1. I did not find an '-o' option documented for busybox find, but then perhaps I was missing it somehow.
2. I had wondered myself about the necessity of '-print', but as it was already there, I didn't want to make a change which was not essential to achieve the goal.
So, if your suggestion works, it looks certainly more elegant  ;)
"Software gets slower faster than hardware gets faster." Niklaus Wirth - A Plea for Lean Software (1995)