Changeset 112
- Timestamp:
- 02/17/06 17:16:09 (3 years ago)
- Files:
-
- trunk/client/revimage/autorestore/autorestore.c (modified) (5 diffs)
- trunk/client/revimage/autorestore/revoboot (modified) (1 diff)
- trunk/client/revimage/autorestore/revoinc (modified) (1 diff)
- trunk/client/revimage/autorestore/revoinv (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/client/revimage/autorestore/autorestore.c
r90 r112 71 71 /* default NFS read/write size */ 72 72 int rsize = 8192; 73 74 unsigned char buf[80]; 73 /* hd space checks enabled ? */ 74 int revonospc = 0; 75 76 unsigned char buf[512]; 75 77 76 78 unsigned char command[120]; … … 585 587 if (f == NULL) 586 588 return NULL; 587 while (fgets((char *)buf, 80, f)) {589 while (fgets((char *)buf, 256, f)) { 588 590 if (strstr(buf, str)) { 589 591 fclose(f); … … 662 664 /* decrease the NFS packet size */ 663 665 rsize = 1024; 666 } 667 668 if ((ptr = find("revonospc", "/etc/cmdline"))) { 669 /* do not check the HD size */ 670 revonospc = 1; 664 671 } 665 672 … … 791 798 */ 792 799 800 /* 801 * Check if the image can fit 802 */ 803 void checkhdspace(__u32 major, __u32 minor, __u32 sect) 804 { 805 FILE *f; 806 char fn[64], command[256]; 807 __u32 orig = 0; 808 809 if (revonospc) return; 810 811 sprintf(fn, "/revosave/size%02x%02x.txt", major, minor); 812 f = fopen(fn, "r"); 813 if (f == NULL) return; 814 fscanf(f, "%u", &orig); 815 if (orig > sect) { 816 /* problem : the disk seems to be too small */ 817 system("/bin/revosendlog 8"); 818 sprintf(command, 819 "/revobin/image_error \"Your hard disk seems to be to small to restore this image (%u vs %u KB).\n\nIf you want to restore anyway, you can disable the disk space checks in the client's options panel.\"", sect, orig); 820 system(command); 821 while (1) sleep(1); 822 } 823 fclose(f); 824 } 793 825 794 826 /* … … 819 851 char *str; 820 852 853 /* check that the HD is big enough for the restore */ 854 checkhdspace(major, minor, sec); 855 /* fill the hdmap */ 821 856 str = malloc(strlen(buf) + 16); 822 857 strcpy(str, "/dev/"); trunk/client/revimage/autorestore/revoboot
r90 r112 147 147 wecho "Downloaded" 148 148 # no menu => stop 149 [ ! -f menu -o -z "`cat menu`" ] && wecho "No menu available. Cannot continue. " && sleep 3 && return149 [ ! -f menu -o -z "`cat menu`" ] && wecho "No menu available. Cannot continue. Did you add the client using the LRS administration interface ?" && sleep 3 && return 150 150 parse_menu 151 151 eval CMDLINE=\$LKERN_`cat /tmp/ret` trunk/client/revimage/autorestore/revoinc
r39 r112 16 16 grep /imgbase/Base /etc/cmdline && TYPE="BASE" 17 17 18 echo -en "\354$TYPE\00Mc:$MAC" | nc -p 1001 -w 1 $SRV 1001 18 while ! echo -en "\354$TYPE\00Mc:$MAC" | nc -p 1001 -w 1 $SRV 1001 19 do 20 echo "*** Retrying" 21 sleep 5 22 done 19 23 sleep 1 trunk/client/revimage/autorestore/revoinv
r39 r112 7 7 # TODO: DOS drives and partitions 8 8 # 9 ETH=`cat /etc/eth`10 MAC=`cat /etc/mac`11 9 12 . /etc/netinfo.sh 13 SRV=$Next_server 14 [ -n "$Option_177" ] && SRV=`echo $Option_177|cut -d : -f 1` 10 if [ "$1" != "stdout" ]; then 11 ETH=`cat /etc/eth` 12 MAC=`cat /etc/mac` 13 14 . /etc/netinfo.sh 15 SRV=$Next_server 16 [ -n "$Option_177" ] && SRV=`echo $Option_177|cut -d : -f 1` 17 fi 15 18 16 19 # self-explanatory... … … 96 99 F:$FREQ" 97 100 98 99 echo -en "\252$DATA\00Mc:$MAC" | nc -p 1001 -w 1 $SRV 1001 100 sleep 1 101 if [ "$1" != "stdout" ]; then 102 echo -en "\252$DATA\00Mc:$MAC" | nc -p 1001 -w 1 $SRV 1001 103 sleep 1 104 else 105 echo "$DATA" 106 fi
