]>
Commit | Line | Data |
---|---|---|
f60e6b29 | 1 | diff -ur convertfs-orig/contrib/convertfs convertfs/contrib/convertfs |
2 | --- convertfs-orig/contrib/convertfs 2002-03-18 09:15:15.000000000 -0700 | |
3 | +++ convertfs/contrib/convertfs 2003-08-23 22:57:29.000000000 -0600 | |
4 | @@ -119,13 +119,23 @@ | |
5 | } | |
6 | ||
7 | error() { | |
8 | + echo "Trying to clean up" 1>&2 | |
9 | umount $loopdev 2>/dev/null | |
10 | losetup -d $loopdev 2>/dev/null | |
11 | umount $dev 2>/dev/null | |
12 | - rm -rf $tmp | |
13 | + rmdir $fs1root | |
14 | + rmdir $fs2root | |
15 | + rmdir $tmp | |
16 | exit 1 | |
17 | } | |
18 | ||
19 | +for I in devclone devremap prepindex; do | |
20 | + if [ -z "$(which "$I")" ]; then | |
21 | + echo "Your it is not complete" 1>&2 | |
22 | + exit 1 | |
23 | + fi | |
24 | +done | |
25 | + | |
26 | # device to convert | |
27 | dev=$1 | |
28 | # filesystem to convert from | |
29 | @@ -192,7 +202,7 @@ | |
30 | echo "== Creating clone of \`$from_fs_type' filesystem that's on \`$dev'. ==" | |
31 | umount $dev 2>/dev/null | |
32 | mount -t $from_fs_type $dev $fs1root || error | |
33 | -./devclone $dev $fsimage || error | |
34 | +devclone $dev $fsimage || error | |
35 | ||
36 | echo "===== Creating destination \`$to_fs_type' filesystem. =====" | |
37 | umount $loopdev 2>/dev/null | |
38 | @@ -207,6 +217,7 @@ | |
39 | [ "x$file" != "x$fsindex_name" ] && | |
40 | [ "x$file" != "xlost+found" ] && | |
41 | [ "x$file" != "x$fssuper_name" ]; then | |
42 | + # FIXME: this needs work if $file's size is > free space | |
43 | mv -f $fs1root/$file $fs2root/ || error | |
44 | fi | |
45 | done | |
46 | @@ -216,17 +227,17 @@ | |
47 | losetup -d $loopdev 2>/dev/null | |
48 | ||
49 | echo "=== Preparing info for block relocation ===" | |
50 | -./prepindex $fsimage $fsindex $fssuper || error | |
51 | +prepindex $fsimage $fsindex $fssuper || error | |
52 | umount $dev || error | |
53 | dd if=$fssuper of=$dev || exit | |
54 | sync | |
55 | ||
56 | echo "============ Relocating blocks ============" | |
57 | -./devremap $dev || exit | |
58 | +devremap $dev || exit | |
59 | ||
60 | echo "=== Filesystem conversion accomplished! ===" | |
61 | rm -rf $tmp | |
62 | echo "NOTE: If you want to boot the new filesystem on \`$dev' you" | |
63 | echo " should edit \`/etc/fstab' and add something like this." | |
64 | -echo " $dev / $to_fs_type defaults 1 1" | |
65 | +echo " $dev /mountpoint $to_fs_type defaults 1 1" | |
66 | ||
67 | Only in convertfs/contrib: convertfs~ |