* [63c6e663] Add version variable
* [9b845b7a] Add --version/-V command line option
* [c6754307] add updateversion.sh script
+ * [cd564bd2] debianize
- -- Stefan Bund <stefan@j32.de> Fri, 06 Nov 2009 14:38:29 +0100
+ -- Stefan Bund <stefan@j32.de> Fri, 06 Nov 2009 15:04:36 +0100
mapsector (0.0.0) unstable; urgency=low
echo " RAID level 1"
}
-map_raid()
+do_raid()
{
local mddevice
local mdlevel
+ echo "# $device: RAID detected" 1>&2
+
mddevice="`mdadm -Q $device | sed -ne 's/.*\(raid[0-9] \/dev\/[^.]*\).*/\1/' -eT -ep`"
if [ -z "$mddevice" ]; then
echo "sector $sector"
device="$mddevice"
+
+ return 1
}
register_mapper "raid"
;;
esac
done < /proc/mounts
+
+ return 1
}
register_scanner "mountpoint"
echo " cryptsetup (luks and dmcrypt)"
}
-map_crypt()
+do_crypt()
{
# Step 2: Find the crypted volume defined for this partition
local cryptsector
local type
+ echo "# $device: cryptsetup detected" 1>&2
+
offset="`cryptsetup luksDump $device 2>/dev/null | awk '/^Payload offset/{print $3}'`"
if [ -z "$offset" ]; then
device="$cryptdev"
sector="$cryptsector"
+
+ return 1
}
register_mapper "crypt"
echo " LVM (linear allocation scheme)"
}
-map_lvm()
+do_lvm()
{
local pvname
local pesize
local lenum
local fsdev
local fssector
+
+ echo "# $device: LVM detected" 1>&2
# Step 3: Get pysical extent number
device="$fsdev"
sector="$fssector"
+
+ return 1
}
register_mapper "lvm"
echo " partition tables"
}
-map_partition()
+do_partition()
{
# Step 1: Find partition to which this sector belongs
local partstart
local partsector
+ echo "# $device: partition table detected" 1>&2
+
partdev="`fdisk -ul $device | awk -v sector="$sector" -F '[ *]+' '/^\// && !/Extended$/ && $2<=sector && $3>=sector {print $1,$2}'`" #`"
if [ -z "$partdev" ]; then
device="$partdev"
sector="$partsector"
+
+ return 1
}
register_mapper "partition"
echo " ext2-4"
}
-scan_extfs()
+do_extfs()
{
local fsblocksize
local fsblock
local fstype
local inode
+ echo "$device: ext2-4 filesystem detected" 1>&2
+
fstype="`file -s $device | sed -e 's/.*\(ext[0-9]\).*/\1/'`"
echo "fstype $fstype"
echo "blocktype journal?"
fi
) 3>&1
+
+ return 0
}
register_scanner "extfs"
echo " reiserfs"
}
-scan_reiserfs()
+do_reiserfs()
{
local blocksize
local block
local subsector
+
+ echo "# $device: reiserfs filesystem detected" 1>&2
echo "fstype reiserfs"
sys.stdout.write("name %s\n" % path)
EOF
+ return 0
}
register_scanner "reiserfs"
# Map device/sector through blockdevice mappings (e.g. lvm)
-run()
+map()
{
local found
- foundm=1
+ found=1
while [ -n "$found" ]; do
found=""
- for name in "$@"; do
+ for name in $mappers; do
if detect_$name; then
found=1
if do_$name; then
done
}
+scan()
+{
+ for name in $scanners; do
+ if detect_$name; then
+ if do_$name; then
+ return
+ fi
+ fi
+ done
+}
+
###########################################################################
unset LANG
echo "device $device"
echo "sector $sector"
-run $mappers
+map
if [ -z "$noscan" ]; then
- run $scanners
+ scan
fi