summaryrefslogtreecommitdiffstats
path: root/client/shared/scripts/updateBootCache
blob: f3edae7cfe2bdc52f33c3b4b3230348b57d1f78c (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
#!/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