summaryrefslogtreecommitdiffstats
path: root/client/shared/scripts/updateBootCache
blob: e866474dca6a47533dd7550e0db3752f9dcffbc6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/bash

#/**
#         updateBootCache
#@brief   acelerador arranque pxe. incorpora a la cache el initrd y el kernel.
#@param 1 
#@param ejemplo:  
#@return  
#@exception OG_ERR_FORMAT     formato incorrecto.
#@note   
#@todo: 
#@version 1.0.1 - requiere el gestor de arranque grub2dos
#@author  Antonio J. Doblas Viso. Universidad de Malaga.
#@date    2010/07/27
#*/ ##



OGBTFTP="/opt/oglive/tftpboot/ogclient"
ogMountCache || exit 1

[ -d $OGCAC/boot ] || mkdir -p $OGCAC/boot 
	
	# comparamos los del server
	SERVERVMLINUZ=`cat ${OGBTFTP}/ogvmlinuz.sum`
	SERVERINITRD=`cat  ${OGBTFTP}/oginitrd.img.sum`
	
	#comparamos los de la cache
	CACHEVMLINUZ=`cat ${OGCAC}/boot/ogvmlinuz.sum`
	CACHEINITRD=`cat  ${OGCAC}/cache/boot/oginitrd.img.sum`
	
	echo "MD5 on SERVER: $SERVERVMLINUZ $SERVERINITRD"
	echo "MD5  on CACHE: $CACHEVMLINUZ $CACHEINITRD"
	

	if [ "$CACHEVMLINUZ" != "$SERVERVMLINUZ" ]
	then		
		echo "ogvmlinuz updating"
		cp ${OGBTFTP}/ogvmlinuz ${OGCAC}/boot/ogvmlinuz
		cp ${OGBTFTP}/ogvmlinuz.sum ${OGCAC}/boot/ogvmlinuz.sum
		DOREBOOT=true
	fi
	if [ "$CACHEINITRD" != "$SERVERINITRD" ]
	then
		echo "oginitrd updating"
		cp ${OGBTFTP}/oginitrd.img ${OGCAC}/boot/oginitrd.img
		cp ${OGBTFTP}/oginitrd.img.sum ${OGCAC}/boot/oginitrd.img.sum
		DOREBOOT=true
	fi

echo $DOREBOOT
#	[ "$DOREBOOT" == "true" ] && busybox reboot -f

#TODO: Comprobar si es necesario
#cp -prv cp ${OGBTFTP}/ ${OGCAC}/boot/

#TODO
#/opt/opengnsys/lib/grub4dos/bootlace.com /dev/sda