Tiny Core Base > Micro Core

Script issue in tc-config


Hello, I maded a little script to execute a second script file wich name is stored into a variable, like next:

if [ -f "$xFile" ]; then command $xFile ; fi;

This script really is some complex because depends by other variables.  The script runs fine in ash command shell, but it did not run into tc-config file.  Why?

Into tc-config file I runned fine other executed scripts, like alsa startup.  But this code only recognizes variable values and checking for files.  Into tc-config it did not launch the $xFile script.  /dev/sda1 hard disk is mounted successfully in tc-config file before calling the script.

Thank you.  :-)

tc-config is part of the initrd.   If you need to make changes to tc-config, you will need to remaster your initrd.  You cannot edit the file and add to .filetool.sh.

Why not just run your script in bootlocal.sh?

I know.  My current core remaster is 341mb in size.  :-)

Hi AlejandroPadrino

--- Quote from: AlejandroPadrino on June 29, 2023, 07:03:05 AM --- ... The script runs fine in ash command shell, but it did not run into tc-config file.  Why? ...
--- End quote ---
It did not run, or you did not see the result you expected?
Those are 2 different issues that could show the same symptoms.

You need to add some debugging code to find out what's happening.
Change your tc-config to this:

--- Code: ---xFile=/mnt/sda1/myfolder/myscript.sh
if [ -f "$xFile" ]; then echo "xFile=$xFile" > /tmp/xFile.log ; fi;
if [ -f "$xFile" ]; then command $xFile ; fi;
--- End code ---

Then add this to myscript.sh:

--- Code: ---echo "myscript.sh started" >> /tmp/xFile.log
echo "Environmental variables:" >> /tmp/xFile.log
env >> /tmp/xFile.log
--- End code ---

Check that the log file exists.
Check that the variables you need are listed in the log file.
Check the PATH variable in the log file. Make sure:
    1. It includes paths you assume to be defined are included.
    2. Make sure the order of the paths matches what you expect.

Solved ... and sorry.

I don't expect that myscript.sh file was copy to NTFS partition /mnt/sda1/myfolder with root user and group.  changed to tc:staff runs fine.

Thank you.  :-)


[0] Message Index

Go to full version