diff -ur convertfs-orig/contrib/convertfs convertfs/contrib/convertfs --- convertfs-orig/contrib/convertfs 2002-03-18 09:15:15.000000000 -0700 +++ convertfs/contrib/convertfs 2003-08-23 22:57:29.000000000 -0600 @@ -119,13 +119,23 @@ } error() { + echo "Trying to clean up" 1>&2 umount $loopdev 2>/dev/null losetup -d $loopdev 2>/dev/null umount $dev 2>/dev/null - rm -rf $tmp + rmdir $fs1root + rmdir $fs2root + rmdir $tmp exit 1 } +for I in devclone devremap prepindex; do + if [ -z "$(which "$I")" ]; then + echo "Your it is not complete" 1>&2 + exit 1 + fi +done + # device to convert dev=$1 # filesystem to convert from @@ -192,7 +202,7 @@ echo "== Creating clone of \`$from_fs_type' filesystem that's on \`$dev'. ==" umount $dev 2>/dev/null mount -t $from_fs_type $dev $fs1root || error -./devclone $dev $fsimage || error +devclone $dev $fsimage || error echo "===== Creating destination \`$to_fs_type' filesystem. =====" umount $loopdev 2>/dev/null @@ -207,6 +217,7 @@ [ "x$file" != "x$fsindex_name" ] && [ "x$file" != "xlost+found" ] && [ "x$file" != "x$fssuper_name" ]; then + # FIXME: this needs work if $file's size is > free space mv -f $fs1root/$file $fs2root/ || error fi done @@ -216,17 +227,17 @@ losetup -d $loopdev 2>/dev/null echo "=== Preparing info for block relocation ===" -./prepindex $fsimage $fsindex $fssuper || error +prepindex $fsimage $fsindex $fssuper || error umount $dev || error dd if=$fssuper of=$dev || exit sync echo "============ Relocating blocks ============" -./devremap $dev || exit +devremap $dev || exit echo "=== Filesystem conversion accomplished! ===" rm -rf $tmp echo "NOTE: If you want to boot the new filesystem on \`$dev' you" echo " should edit \`/etc/fstab' and add something like this." -echo " $dev / $to_fs_type defaults 1 1" +echo " $dev /mountpoint $to_fs_type defaults 1 1" Only in convertfs/contrib: convertfs~