So, placing command in a script in /var/bin/init.d/3.emu_start will execute those just before the sbox binary (Ipbox's main program) is executed.
But there's a snag, to execute newcs and mgcamd well, they's have to wait until some files are generated by sbox, so executing them too early will cause an infinite loop (waiting for sbox) during startup.
The solution is to start the script in /var/bin/init.d/3.emu_start, but make the Ipbox "move on" with the execution of sbox. Simply adding an " & " after a command will make this happen (isn't linux great?).
What I did in practice:
1) make the directory /var/bin/init.d
2) put a small script in /var/bin/init.d (I called it 3.emu_start), branching to the real softcam start script. I just has one line (remember the "&" at the end):
bash /var/bin/emu_start.sh >/dev/null &
3) make the second script in /var/bin to start the softcam (I called it emu_start.sh):
# give some signal to the outside world
front_ioctl -job puts "MGCAMD-NEWCS"
# start cardserver (I like newcs 1.65)
/var/bin/newcs-1.65 -C /var/keys/newcs.xml
sleep 5
# wait for sbox process
while { ! [ -f /tmp/pmt.tmp ] ; }
do
sleep 1
done
# start mgcamd
ln -s /tmp/pmt1.tmp /tmp/pmt1_1.tmp
ln -s /tmp/pmt2.tmp /tmp/pmt2_1.tmp
/var/bin/mgcamd-1.33
sleep 1
exit 0
4) put the mgcamd-1.33 and newcs-1.65 binaries in /var/bin
5) make a directory /var/keys
6) put the config files (mg_cfg , newcs.xml , newcamd.list, etc.) in /var/keys
7) chmod 755 the necessary files and reboot
In this way, I get the softcam to start right after sbox has completed, so I get a picture even on coded channels without the "usual" 10 second delay.
Off course, you can use the same method to set up a swapfile, send some parameters to your HDD (hdparm), say "hello world", or whatever you would like your Ipbox to do.