From: Stefan Bund Date: Fri, 20 Aug 2010 21:28:04 +0000 (+0200) Subject: Some fixes for karmic X-Git-Url: http://g0dil.de/git?p=mapsector.git;a=commitdiff_plain;h=7e1bb1c5a10dc6654b8f5c7ea42980e733ee9fe2 Some fixes for karmic --- diff --git a/lib/10_scan_mountpoint.sh b/lib/10_scan_mountpoint.sh index 4f7751e..3025761 100644 --- a/lib/10_scan_mountpoint.sh +++ b/lib/10_scan_mountpoint.sh @@ -17,7 +17,7 @@ do_mountpoint() case "$dev" in *:*) ;; *) - if [ "$devnums" == "`deviceid $dev`" ]; then + if [ "$devnums" = "`deviceid $dev`" ]; then echo "mountpoint $dir" break fi diff --git a/lib/50_map_partition.sh b/lib/50_map_partition.sh index ec5fc2b..76cae0f 100644 --- a/lib/50_map_partition.sh +++ b/lib/50_map_partition.sh @@ -1,6 +1,6 @@ detect_partition() { - [ -z "`fdisk -l $device 2>&1 >/dev/null`" ] + file -bks $device | grep -qF partition } describe_partition() diff --git a/lib/50_scan_extfs.sh b/lib/50_scan_extfs.sh index 45408ce..16ad869 100644 --- a/lib/50_scan_extfs.sh +++ b/lib/50_scan_extfs.sh @@ -16,9 +16,9 @@ do_extfs() local fstype local inode - echo "$device: ext2-4 filesystem detected" 1>&2 + echo "# $device: ext2-4 filesystem detected" 1>&2 - fstype="`file -s $device | sed -e 's/.*\(ext[0-9]\).*/\1/'`" + fstype="`file -bkrs $device | sed -ne 's/.*\(ext[0-9]\).*/\1/' -eT -ep`" echo "fstype $fstype" # Step 6: Get filesystem blocksize and convert sector number to filesystem block number @@ -48,7 +48,7 @@ do_extfs() # Step 8: Find inode, to which the block belongs - inode="`echo "icheck $fsblock" | debugfs $device 2>/dev/null | awk 'FNR>1{print $2}'`" #`" + inode="`echo "icheck $fsblock" | debugfs $device 2>/dev/null | awk '/^[0-9]+[ \t]+[0-9]+$/{print $2}'`" #`" if [ -z "$inode" ]; then echo "blocktype meta?" @@ -63,7 +63,7 @@ do_extfs() namefound="$(\ echo "ncheck $inode" \ | debugfs $device 2>/dev/null \ - | sed -e '1d' -e 's/^[0-9]*[ ]*//' -e 's/^\/\//\//' \ + | sed -n -e 's/^[0-9]\+[ \t]\+//' -eT -e 's/^\/\//\//' -ep \ | while read name; do \ if [ -z "$firstname" ]; then \ echo "blocktype data" 1>&3; \