Tiny Core Base > piCore Test Releases
piCore-7.0rc2
Rich:
Hi Greg Erskine
--- Quote ---I don't like the way $HOST was also used in get_app routine.
--- End quote ---
I noticed that too. Though I couldn't wrap my head around a lot of the syntax, it looked like the $HOST variable was
being recycled for a different purpose.
Paul_123:
--- Quote from: Rich on December 30, 2015, 11:22:06 AM ---This is from the X86 version under TC4 so I don't know if it's valid under PI. In tc-config:
It looks like if you set the hostname in /etc/hostname and back it up, it will be used if the host boot code exists.
--- End quote ---
Code on piCore is the same. You also need to look at /usr/bin/sethostname that gets called during bootsync.sh you have to specify the actual hostname on the command line. Editing /etc/hostname and adding to your backup set does nothing. You must specify "host=newname" on the command line to have any affect.
There is a fairly easy solution in adding a handshake between the command /usr/bin/sethostname running and /etc/init.d/dhcp.sh running.
Added at the end of /usr/bin/sethostname
--- Code: ---touch /tmp/sethostnameran
--- End code ---
Added to the beginning of /etc/init.d/hdcp.sh
--- Code: ---CNT=0
until [ -e "/tmp/sethostnameran" ]
do
[ $((CNT++)) -gt 100 ] && break || sleep 0.1
done
rm -fr /tmp/sethostmaneran
--- End code ---
There is probably no need for a timeout trap, since sethostname always gets called.....but just incase someone changes /opt/bootsync.sh it will timeout after 10 seconds
And yes, it looks like $HOST is just being recycled.....it is referring the the remote hostname for retrieving apps. It doesn't get used until after the local hostname is set.......so no big deal, but it's a little confusing. (I'm a little fuzzy on variable scope in shell scripts too, but I think it is a local scope too)
Rich:
Hi Paul_123
Actually I misspoke, upon taking a closer look:
--- Code: ---if [ -n "$HOST" ]; then
sethostname
else
/bin/hostname -F /etc/hostname
fi
--- End code ---
If you do not use the host boot code, the else path will be taken and set the hostname from /etc/hostname. This
happens early in the tc-config script. No need to call sethostname from bootsync.sh in this case.
Paul_123:
--- Quote from: Rich on December 30, 2015, 09:05:47 PM ---Hi Paul_123
Actually I misspoke, upon taking a closer look:
--- Code: ---if [ -n "$HOST" ]; then
sethostname
else
/bin/hostname -F /etc/hostname
fi
--- End code ---
If you do not use the host boot code, the else path will be taken and set the hostname from /etc/hostname. This
happens early in the tc-config script. No need to call sethostname from bootsync.sh in this case.
--- End quote ---
Yes, that runs early in the boot process, but the persistent data has not been restored at that point, so all you get is the name that is stored in the initrd.
Rich:
Hi Paul_123
In that case, disregard everything I said. :)
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version