WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Startup Scripts  (Read 6259 times)

Offline danielibarnes

  • Hero Member
  • *****
  • Posts: 548
Startup Scripts
« on: February 24, 2009, 11:30:18 AM »
I noticed that when tc-config searches for startup scripts (find /usr/local/tce.installed/ -perm -755 -type f) it will not load startup scripts included in a .tcz because they are symbolic links instead of files. I had to include a user.tar.gz in my .tcz extension. Is this a bug or by design? Am I using the feature properly?

Offline mikshaw

  • Sr. Member
  • ****
  • Posts: 368
Re: Startup Scripts
« Reply #1 on: February 24, 2009, 12:29:13 PM »
Is it important that your scripts need to be symoblic links? A wrapper script can be used to accomplish basically the same thing as a link:

Code: [Select]
#!/bin/sh
exec /path/to/my/startup_script

Offline danielibarnes

  • Hero Member
  • *****
  • Posts: 548
Re: Startup Scripts
« Reply #2 on: February 24, 2009, 01:11:41 PM »
When loaded, a .tcz extension is loop mounted on /tmp/tcloop/BASENAME. Symbolic links which point to all of the files in the extension are created on the root filesystem (similar to cp -lr). This is a feature of Tiny Core Linux.

Offline danielibarnes

  • Hero Member
  • *****
  • Posts: 548
Re: Startup Scripts
« Reply #3 on: March 06, 2009, 01:19:51 PM »
I noticed that "tce-load" does not check for startup scripts. Can someone with the knowledge please tell me how this should work? I thought that the startup scripts feature was a sort of "autorun" for extensions. Is this not correct?

Offline mikshaw

  • Sr. Member
  • ****
  • Posts: 368
Re: Startup Scripts
« Reply #4 on: March 06, 2009, 05:19:53 PM »
Perhaps it is only used for auto-loaded extensions?  I noticed that adding a script to tclocal directory will run during boot even if that script has nothing to do with tce packages.  As a result I put my  persistent bootlocal script there.  I'm guessing it doesn't apply to tce-load, although I'm too sleepy to check it at the moment.

Offline roberts

  • Administrator
  • Hero Member
  • *****
  • Posts: 7361
  • Founder Emeritus
Re: Startup Scripts
« Reply #5 on: March 06, 2009, 10:53:26 PM »
The startup script support was for Sytem Startup, i.e., booting, but can and will be extended for dynamic extension processing (tce-load). However, they are not an autorun for extensions for the following reasons...

There is a big difference. During booting, no login has occured. No X started. No paths sets. During booting it is like an rc level script. With dynamic loading (tce-load), X is typically up and user is loggged in. Paths are set. Therefore, startup scripts are not an autorun for extensions.

« Last Edit: March 06, 2009, 11:22:26 PM by roberts »
10+ Years Contributing to Linux Open Source Projects.

Offline Jason W

  • Administrator
  • Hero Member
  • *****
  • Posts: 9730
Re: Startup Scripts
« Reply #6 on: March 07, 2009, 04:28:30 AM »
I misunderstood the startup script myself thinking they were run when an extension was loaded, and that is why bash sometimes works and sometimes doesn't since the startup script creates the /bin/bash symlink if it is not there.  It only works from a reboot and not fresh from the appbrowser. Of course, I always use test cases  in the startup scripts to see if an action like adding users or creating symlinks or copying files has taken place. 

I understand that there is a difference in the state of the system at boot compared to normal.  I didn't read clearly in Robert's post if the startup scripts will be run with tce-load or not.  If not I will change the startup scripts for my extensions like bash so they will work in all cases.


Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 10962
Re: Startup Scripts
« Reply #7 on: March 07, 2009, 04:42:57 AM »
I just checked the tce-load from 1.2rc2, it does check for a startup script. Is here some misunderstanding?
The only barriers that can stop you are the ones you create yourself.

Offline mikshaw

  • Sr. Member
  • ****
  • Posts: 368
Re: Startup Scripts
« Reply #8 on: March 07, 2009, 05:03:24 AM »
I don't see it in 1.1, so maybe it's new.
All I see is a check for deps.

Offline Jason W

  • Administrator
  • Hero Member
  • *****
  • Posts: 9730
Re: Startup Scripts
« Reply #9 on: March 07, 2009, 05:06:12 AM »
I am on Windows now, but I will look into my setup when I get home.  But I do remember a bash issue, though I could have been using an earlier TC version.  If tce-load already executes the scripts, then cool beans.  If not, I will go from there.

Offline roberts

  • Administrator
  • Hero Member
  • *****
  • Posts: 7361
  • Founder Emeritus
Re: Startup Scripts
« Reply #10 on: March 07, 2009, 06:45:26 AM »
I will add startup script processing to tce-load in next cut.
10+ Years Contributing to Linux Open Source Projects.

Offline roberts

  • Administrator
  • Hero Member
  • *****
  • Posts: 7361
  • Founder Emeritus
Re: Startup Scripts
« Reply #11 on: March 07, 2009, 03:44:29 PM »
Yes. Startup script is there already. Perhaps we need it to be sudo ?
10+ Years Contributing to Linux Open Source Projects.

Offline Jason W

  • Administrator
  • Hero Member
  • *****
  • Posts: 9730
Re: Startup Scripts
« Reply #12 on: March 07, 2009, 03:57:25 PM »
Another oversight of mine while away from home, as rc2 does execute startup scripts with the appbrowser or tce-load.  Tested bash and it works. 

Offline danielibarnes

  • Hero Member
  • *****
  • Posts: 548
Re: Startup Scripts
« Reply #13 on: March 10, 2009, 10:15:25 AM »
I see now what I misunderstood. On startup, tc-config finds all files within /usr/local/tce.installed that have 755 permissions and executes them, so I called my startup script "something.sh". tce-load checks for a file which has the same name as the extension and executes it, so that's why it didn't work for me. I just need to rename my file to remove the ".sh" suffix.

Thanks,
Daniel