Changeset 8
- Timestamp:
- 05/21/08 17:18:08 (6 months ago)
- Files:
-
- branches/liberamente/src/kobold.py (modified) (5 diffs)
- branches/liberamente/src/livecd-iso-to-disk (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/liberamente/src/kobold.py
r6 r8 37 37 return 38 38 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)) 41 41 if exit_status == 256 and option.erase: 42 42 # Error 1: Not a valid filesystem (vfat or ext[23]). … … 45 45 print 'Caught error 1' 46 46 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)) 49 49 elif exit_status == 512: 50 50 # Error 2: Partition needs a filesystem label. … … 55 55 elif device.GetProperty('volume.fstype')[:3] == 'ext': 56 56 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)) 59 59 elif exit_status == 768: 60 60 # Error 3: Partition isn't marked bootable. … … 62 62 print 'Caught error 3' 63 63 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)) 66 66 elif exit_status == 1024: 67 67 # Error 4: MBR appears to be blank 68 68 # Rerun l-i-t-d with --reset-mbr option 69 69 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)) 72 72 elif exit_status == 1280 and option.erase: 73 73 # Error 5: Generic error. … … 82 82 os.system('/sbin/sfdisk %s << EOF\n,,6,*\n;\nEOF' % device_name) 83 83 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')) 86 86 elif exit_status == 0: 87 87 # If everything is ok play some wonderful music branches/liberamente/src/livecd-iso-to-disk
r7 r8 188 188 done 189 189 190 ISO=$ 1190 ISO=$(readlink -f "$1") 191 191 USBDEV=$2 192 192 193 if [ -z "$ISO" -o ! - e"$ISO" ]; then193 if [ -z "$ISO" -o ! -f "$ISO" ]; then 194 194 usage 195 195 fi … … 217 217 [ -n $resetmbr ] && resetMBR $USBDEV 218 218 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 219 if [ -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 222 224 fi 223 225 224 226 # FIXME: would be better if we had better mountpoints 225 227 CDMNT=$(mktemp -d /media/cdtmp.XXXXXX) 226 mount -o loop $ISO $CDMNT || exitclean228 mount -o loop,ro $ISO $CDMNT || exitclean 227 229 CD_IS_MNT=1 228 230 USBMNT=$(mktemp -d /media/usbdev.XXXXXX) … … 231 233 232 234 trap exitclean SIGINT SIGTERM 235 236 # let's try to make sure there's enough room on the stick 237 if [ -d $CDMNT/LiveOS ]; then 238 check=$CDMNT/LiveOS 239 else 240 check=$CDMNT 241 fi 242 if [ -d $USBMNT/LiveOS ]; then 243 tbd=$(du -s -B 1M $USBMNT/LiveOS | awk {'print $1;'}) 244 else 245 tbd=0 246 fi 247 livesize=$(du -s -B 1M $check | awk {'print $1;'}) 248 free=$(df -B1M $USBDEV |tail -n 1 |awk {'print $4;'}) 249 250 if [ $(($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 256 fi 233 257 234 258 if [ -d $USBMNT/LiveOS ]; then … … 252 276 cp $CDMNT/ext3fs.img $USBMNT/LiveOS/ext3fs.img || exitclean 253 277 fi 254 if [ -f $CDMNT/ osmin.img ]; then255 cp $CDMNT/ osmin.img $USBMNT/LiveOS/osmin.img || exitclean278 if [ -f $CDMNT/LiveOS/osmin.img ]; then 279 cp $CDMNT/LiveOS/osmin.img $USBMNT/LiveOS/osmin.img || exitclean 256 280 fi 257 281