Changeset 112

Show
Ignore:
Timestamp:
02/17/06 17:16:09 (3 years ago)
Author:
ludo
Message:

hd space check, improved revoinc (from r3058)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/client/revimage/autorestore/autorestore.c

    r90 r112  
    7171/* default NFS read/write size */ 
    7272int rsize = 8192; 
    73  
    74 unsigned char buf[80]; 
     73/* hd space checks enabled ? */ 
     74int revonospc = 0; 
     75 
     76unsigned char buf[512]; 
    7577 
    7678unsigned char command[120]; 
     
    585587    if (f == NULL) 
    586588        return NULL; 
    587     while (fgets((char *)buf, 80, f)) { 
     589    while (fgets((char *)buf, 256, f)) { 
    588590        if (strstr(buf, str)) { 
    589591            fclose(f); 
     
    662664        /* decrease the NFS packet size */ 
    663665        rsize = 1024; 
     666    } 
     667 
     668    if ((ptr = find("revonospc", "/etc/cmdline"))) { 
     669        /* do not check the HD size */ 
     670        revonospc = 1; 
    664671    } 
    665672 
     
    791798*/ 
    792799 
     800/* 
     801 * Check if the image can fit 
     802 */ 
     803void 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} 
    793825 
    794826/* 
     
    819851        char *str; 
    820852 
     853        /* check that the HD is big enough for the restore */ 
     854        checkhdspace(major, minor, sec); 
     855        /* fill the hdmap */ 
    821856        str = malloc(strlen(buf) + 16); 
    822857        strcpy(str, "/dev/"); 
  • trunk/client/revimage/autorestore/revoboot

    r90 r112  
    147147    wecho "Downloaded" 
    148148    # no menu => stop 
    149     [ ! -f menu -o -z "`cat menu`" ] && wecho "No menu available. Cannot continue." && sleep 3 && return 
     149    [ ! -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 
    150150    parse_menu 
    151151    eval CMDLINE=\$LKERN_`cat /tmp/ret` 
  • trunk/client/revimage/autorestore/revoinc

    r39 r112  
    1616grep /imgbase/Base /etc/cmdline && TYPE="BASE" 
    1717 
    18 echo -en "\354$TYPE\00Mc:$MAC" | nc -p 1001 -w 1 $SRV 1001 
     18while ! echo -en "\354$TYPE\00Mc:$MAC" | nc -p 1001 -w 1 $SRV 1001 
     19do 
     20    echo "*** Retrying" 
     21    sleep 5 
     22done 
    1923sleep 1 
  • trunk/client/revimage/autorestore/revoinv

    r39 r112  
    77# TODO: DOS drives and partitions 
    88#  
    9 ETH=`cat /etc/eth` 
    10 MAC=`cat /etc/mac` 
    119 
    12 . /etc/netinfo.sh 
    13 SRV=$Next_server 
    14 [ -n "$Option_177" ] && SRV=`echo $Option_177|cut -d : -f 1` 
     10if [ "$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` 
     17fi 
    1518 
    1619# self-explanatory... 
     
    9699F:$FREQ" 
    97100 
    98  
    99 echo -en "\252$DATA\00Mc:$MAC" | nc -p 1001 -w 1 $SRV 1001 
    100 sleep 1 
     101if [ "$1" != "stdout" ]; then 
     102    echo -en "\252$DATA\00Mc:$MAC" | nc -p 1001 -w 1 $SRV 1001 
     103    sleep 1 
     104else 
     105    echo "$DATA" 
     106fi