trunk 20080912
[gitenigma.git] / data / templates / instimg.tmp
blob1b00562cb280d7ba0758955dcc226b6f1b18b00e
1 #!/bin/sh
2 echo "image installation is starting..." $1 $2 $3 > /tmp/instimg.log
3 i=0;
4 while pidof enigma > /dev/null ; do
5 if [ $i -gt 14 ] ; then
6 echo "enigma is not terminating itself... so, killing it" >> /tmp/instimg.log
7 killall -9 enigma
8 else
9 pids=`pidof enigma`
10 echo "waiting for enigma to terminate:" $pids "..." >> /tmp/instimg.log
12 sleep 1
13 let i=i+1
14 done
15 echo "enigma has shut down... continuing with image installation..." >> /tmp/instimg.log
16 rm -rf /tmp/image
17 mkdir /tmp/image
18 # install cramfs
19 mount -t cramfs $2 /tmp/image -o loop
20 cp -a /tmp/image/. $1
21 umount /tmp/image
22 rm $2
23 rm $1/root/platform/kernel/os
24 echo "cramfs installed." >> /tmp/instimg.log
25 # install squashfs
26 mount -t squashfs $3 /tmp/image -o loop
27 cp -a /tmp/image/. $1
28 umount /tmp/image
29 rm $3
30 echo "squashfs installed." >> /tmp/instimg.log
31 # prepare var
32 rm -rf /tmp/image
33 rm -rf $1/var
34 mv $1/var_init $1/var
35 touch $1/var/.init
36 echo "var constructed." >> /tmp/instimg.log
37 rm /var/etc/.dont_restart_enigma
38 echo "restarting enigma... done." >> /tmp/instimg.log
39 exit