Assembla home | Assembla project page
 

Changeset 8

Show
Ignore:
Timestamp:
05/21/08 17:18:08 (6 months ago)
Author:
mcastellini
Message:

Small modification to make kobold run smoothly with F9 isos.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/liberamente/src/kobold.py

    r6 r8  
    3737            return 
    3838    if not option.dummy: 
    39         exit_status = os.system('./livecd-iso-to-disk --overlay-size-mb 0 ' 
    40                 '--noverify %s %s' % (args[0], device_name)) 
     39        exit_status = os.system('./livecd-iso-to-disk --noverify %s %s'  
     40                % (args[0], device_name)) 
    4141        if exit_status == 256 and option.erase: 
    4242        # Error 1: Not a valid filesystem (vfat or ext[23]). 
     
    4545            print 'Caught error 1' 
    4646            os.system('/sbin/mkdosfs -I -n usbdisk %s' % device_name) 
    47             exit_status = os.system('./livecd-iso-to-disk --overlay-size-mb 0 ' 
    48                     '--noverify %s %s' % (args[0], device_name)) 
     47            exit_status = os.system('./livecd-iso-to-disk --noverify %s %s'  
     48                    % (args[0], device_name)) 
    4949        elif exit_status == 512: 
    5050        # Error 2: Partition needs a filesystem label. 
     
    5555            elif device.GetProperty('volume.fstype')[:3] == 'ext': 
    5656                os.system('/sbin/e2label %s usbdisk' % device_name) 
    57             exit_status = os.system('./livecd-iso-to-disk --overlay-size-mb 0 ' 
    58                     '--noverify %s %s' % (args[0], device_name)) 
     57            exit_status = os.system('./livecd-iso-to-disk --noverify %s %s'  
     58                    % (args[0], device_name)) 
    5959        elif exit_status == 768: 
    6060        # Error 3: Partition isn't marked bootable. 
     
    6262            print 'Caught error 3' 
    6363            os.system('sfdisk -A%s %s' % (device_name[-1], device_name[:-1])) 
    64             exit_status = os.system('./livecd-iso-to-disk --overlay-size-mb 0 ' 
    65                     '--noverify %s %s' % (args[0], device_name)) 
     64            exit_status = os.system('./livecd-iso-to-disk --noverify %s %s'  
     65                    % (args[0], device_name)) 
    6666        elif exit_status == 1024: 
    6767        # Error 4: MBR appears to be blank 
    6868        # Rerun l-i-t-d with --reset-mbr option 
    6969            print 'Caught error 4' 
    70             exit_status = os.system('./livecd-iso-to-disk --overlay-size-mb 0
    71                     '--noverify --reset-mbr %s %s' % (args[0], device_name)) 
     70            exit_status = os.system('./livecd-iso-to-disk --noverify
     71                    '--reset-mbr %s %s' % (args[0], device_name)) 
    7272        elif exit_status == 1280 and option.erase: 
    7373        # Error 5: Generic error. 
     
    8282            os.system('/sbin/sfdisk %s << EOF\n,,6,*\n;\nEOF' % device_name) 
    8383            os.system('/sbin/mkdosfs -I -n usbdisk %s' % device_name + '1') 
    84             exit_status = os.system('./livecd-iso-to-disk --overlay-size-mb 0 ' 
    85                     '--noverify %s %s' % (args[0], device_name + '1')) 
     84            exit_status = os.system('./livecd-iso-to-disk --noverify %s %s'  
     85                    % (args[0], device_name + '1')) 
    8686        elif exit_status == 0: 
    8787        # If everything is ok play some wonderful music 
  • branches/liberamente/src/livecd-iso-to-disk

    r7 r8  
    188188done 
    189189 
    190 ISO=$1 
     190ISO=$(readlink -f "$1") 
    191191USBDEV=$2 
    192192 
    193 if [ -z "$ISO" -o ! -e "$ISO" ]; then 
     193if [ -z "$ISO" -o ! -f "$ISO" ]; then 
    194194    usage 
    195195fi 
     
    217217[ -n $resetmbr ] && resetMBR $USBDEV 
    218218 
    219 if [ -n "$overlaysizemb" -a "$USBFS" = "vfat" -a "$overlaysizemb" -gt 2047 ]; then 
    220     echo "Can't have an overlay greater than 2048MB on VFAT" 
    221     exitclean 
     219if [ -n "$overlaysizemb" -a "$USBFS" = "vfat" ]; then 
     220       if [ "$overlaysizemb" -gt 2047 ]; then 
     221               echo "Can't have an overlay greater than 2048MB on VFAT" 
     222               exitclean 
     223       fi 
    222224fi 
    223225 
    224226# FIXME: would be better if we had better mountpoints 
    225227CDMNT=$(mktemp -d /media/cdtmp.XXXXXX) 
    226 mount -o loop $ISO $CDMNT || exitclean 
     228mount -o loop,ro $ISO $CDMNT || exitclean 
    227229CD_IS_MNT=1 
    228230USBMNT=$(mktemp -d /media/usbdev.XXXXXX) 
     
    231233 
    232234trap exitclean SIGINT SIGTERM 
     235 
     236# let's try to make sure there's enough room on the stick 
     237if [ -d $CDMNT/LiveOS ]; then 
     238  check=$CDMNT/LiveOS 
     239else 
     240  check=$CDMNT 
     241fi 
     242if [ -d $USBMNT/LiveOS ]; then 
     243  tbd=$(du -s -B 1M $USBMNT/LiveOS | awk {'print $1;'}) 
     244else 
     245  tbd=0 
     246fi 
     247livesize=$(du -s -B 1M $check | awk {'print $1;'}) 
     248free=$(df  -B1M $USBDEV  |tail -n 1 |awk {'print $4;'}) 
     249 
     250if [ $(($overlaysizemb + $livesize)) -gt $(($free + $tbd)) ]; then 
     251  echo "Unable to fit live image + overlay on available space on USB stick" 
     252  echo "Size of live image: $livesize" 
     253  echo "Overlay size: $overlaysizemb" 
     254  echo "Available space: $(($free + $tbd))" 
     255  exitclean 
     256fi 
    233257 
    234258if [ -d $USBMNT/LiveOS ]; then 
     
    252276    cp $CDMNT/ext3fs.img $USBMNT/LiveOS/ext3fs.img || exitclean  
    253277fi 
    254 if [ -f $CDMNT/osmin.img ]; then 
    255     cp $CDMNT/osmin.img $USBMNT/LiveOS/osmin.img || exitclean 
     278if [ -f $CDMNT/LiveOS/osmin.img ]; then 
     279    cp $CDMNT/LiveOS/osmin.img $USBMNT/LiveOS/osmin.img || exitclean 
    256280fi 
    257281