Script to aid in quick modifications

Here you can post about the issues related to modifications performed manually (not through the kiosk wizard). Example: swapped kernel, added 3rd party modules or files.
Please describe in detail what has been changed and hopefully other kiosk user will be able to help.
Porteus team wont resolve bugs posted in this category as we support only modifications made by the kiosk wizard.
Forum rules
Porteus Kiosk section of the forum is unmaintained now. Its kept in a 'read only' mode for archival purposes.
Please use the kiosk contact page for directing your queries: https://porteus-kiosk.org/contact.html
Dave99
Black ninja
Black ninja
Posts: 54
Joined: 19 Apr 2014, 20:15
Distribution: Porteus
Location: R.S.A.

Script to aid in quick modifications

Post#1 by Dave99 » 23 Dec 2014, 08:55

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.

User avatar
fanthom
Moderator Team
Moderator Team
Posts: 5667
Joined: 28 Dec 2010, 02:42
Distribution: Porteus Kiosk
Location: Poland
Contact:

Re: Script to aid in quick modifications

Post#2 by fanthom » 23 Dec 2014, 09:49

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 ...
Please add [Solved] to your thread title if the solution was found.

Dave99
Black ninja
Black ninja
Posts: 54
Joined: 19 Apr 2014, 20:15
Distribution: Porteus
Location: R.S.A.

Re: Script to aid in quick modifications

Post#3 by Dave99 » 23 Dec 2014, 10:04

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?

User avatar
fanthom
Moderator Team
Moderator Team
Posts: 5667
Joined: 28 Dec 2010, 02:42
Distribution: Porteus Kiosk
Location: Poland
Contact:

Re: Script to aid in quick modifications

Post#4 by fanthom » 23 Dec 2014, 15:12

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.
Please add [Solved] to your thread title if the solution was found.

Dave99
Black ninja
Black ninja
Posts: 54
Joined: 19 Apr 2014, 20:15
Distribution: Porteus
Location: R.S.A.

Re: Script to aid in quick modifications

Post#5 by Dave99 » 23 Dec 2014, 15:40

Got it.
Thank you fanthom.

Locked