Page 1 of 1

Script to aid in quick modifications

Posted: 23 Dec 2014, 08:55
by Dave99
Hi all

There are times when small modifications are required, like say changing from DHCP to static or changing IP address or GW or blacklisting a device.
Normally this would require opening the xzm, changing it, then remaking the module and finally remaking the ISO.

In the case where one is booting off a USB stick, could one just not make one change initially by pointing to a bash script say in /mnt/sda1/SomeDirectory/TheScript ?
Then in the script, put the changes in there.
So any changes would only require changes to the script on the USB stick.

For example:

Code: Select all

#!/bin/bash

# change IP address and GW
ifconfig eth0 192.168.1.10 netmask 255.255.255.0
route add default gw 192.168.1.1 eth0
echo "nameserver 8.8.4.4" > /etc/resolv.conf

# Run some binary
./TheBinary
My questions then are:

1) Where would one point to the script ? in /etc/rc.d/rc.local ?

2) Would this be acceptable or could there be problems in introducing some changes/customizations this way ?

Thanks in advance.
Dave.

Re: Script to aid in quick modifications

Posted: 23 Dec 2014, 09:49
by fanthom
kiosk does not support local storage so /mnt/sda1 will never exist.

the only way which comes to my mind is to download some script from your website then run it in kiosk.
something like that in rc.local:

Code: Select all

wget http://your_website/script
chmod +x script
./script
this way you can update the script on the server any time you want and force some actions on the kiosk side.
if you want to run specific commands in certain kiosk only then add MAC address (or kiosk hostname) to the script like:

Code: Select all

mac=$(check the MAC here)
wget http://your_website/script-$mac
chmod +x script-$mac
./script-$mac
the only downside is that network must be initialized ....

Would this be acceptable or could there be problems in introducing some changes/customizations this way ?
depends what you want to change but i expect troubles.
to minimize the risk your custom script should run as first so it could modify other booting scripts if necessary (sed is available in kiosk by default). i would run it early in /etc/rc.d/rc.S and then modify /etc/rc.d/rc.M, /etc/rc.d/rc.local, /etc/xdg/openbox/autostart, firefox profile, etc ...

Re: Script to aid in quick modifications

Posted: 23 Dec 2014, 10:04
by Dave99
Thank you fanthom for the quick and informative reply.

I had forgotten that local storage will not exist.
Your idea about using a web server and wget will be fine for some modifications that don't need to be executed "early" on.
i would run it early in /etc/rc.d/rc.S and then modify /etc/rc.d/rc.M, /etc/rc.d/rc.local, /etc/xdg/openbox/autostart, firefox profile, etc ...
If I run it from /etc/rc.d/rc.5, is ethernet already up and running by then?

Re: Script to aid in quick modifications

Posted: 23 Dec 2014, 15:12
by fanthom
If I run it from /etc/rc.d/rc.5, is ethernet already up and running by then?
rc.5 is not used in kiosk. you have to create your own inet check function in your custom script which stops booting till connection is made and custom tweaks are applied. once done - booting can move forward.

Re: Script to aid in quick modifications

Posted: 23 Dec 2014, 15:40
by Dave99
Got it.
Thank you fanthom.