# Do we want to send the drive to sleep when we're finished?
SLEEP_DRIVE=no
+# Do we want to try to fsck on mount? Usually you do.
+FSCK_ON_MOUNT=yes
+
lib=/usr/lib/chiark-cryptdisk
dev=`/usr/lib/chiark-cryptdisk/search-for-sata ${MODULE}`
mapname=cryptbackup
do_identify
do_dmsetup $keyid
+if [ "x${FSCK_ON_MOUNT}" = "xy" ] || [ "x${FSCK_ON_MOUNT}" = "xyes" ]; then
+ do_fsck
+fi
do_mount $ro
echo 'mounted.'
egrep . /dev/null $mnt/disk-id ||:
umount /dev/mapper/$mapname
}
+do_fsck () {
+ RV=0
+ fsck -a -T -t $fstype /dev/mapper/$mapname || RV=$?
+ case "$RV" in
+ 0) ;;
+ 1) echo "fsck preened - filesystem was modified but is ok" ;;
+ *) echo "ERROR: fsck failed with code $RV! Manual attention required."
+ exit 5 ;;
+ esac
+# CAUTION: on ext2, '-a' maps to '-p' - preen - only make safe repairs.
+# This may not be the case for other filesystems.
+}
+
do_identify () {
printf 'reading partition table... '
our_dd count=1 if=/dev/$dev of=${TMP}/dev-parttable
* search-for-sata: Add logic to detect and cope with 2.6.32-style sysfs.
* config: add SLEEP_DRIVE param
* unmount: hdparm -Y only if SLEEP_DRIVE == "y" or "yes".
+ * config: add FSCK_ON_MOUNT option
- -- Ross Younger <wry-deb@impropriety.org.uk> Sat, 19 Jun 2010 10:49:09 +0100
+ -- Ross Younger <wry-deb@impropriety.org.uk> Sun, 20 Jun 2010 09:53:40 +0100
chiark-cryptdisk (0.2) unstable; urgency=low