1
1
mirror of https://schlomp.space/tastytea/hashboot synced 2024-11-16 14:37:06 +01:00

minor updates

This commit is contained in:
xor 2015-10-04 20:07:12 +02:00
parent 7a86d01c0f
commit d0eefebb2a

@ -66,7 +66,7 @@ fi
#Look for config file and set ${MBR_DEVICE}.
if [ -f ${CONFIG_FILE} ]
then
MBR_DEVICE=$(grep ^MBR_DEVICE ${CONFIG_FILE} | awk '{print $3}')
source ${CONFIG_FILE}
[ $? != 0 ] && die 9 "Error reading config file"
#If not found, create one and ask for ${MBR_DEVICE}
else
@ -84,12 +84,12 @@ else
fi
# Find out where the first partition starts and set ${MBR_SIZE} in KiB
sectorsize=$(LC_ALL=C fdisk -l ${MBR_DEVICE} | grep '^Units' | awk '{print $8}')
sectorsize=$(LC_ALL=C fdisk -l ${MBR_DEVICE} | grep '^Units' )
if [ "${sectorsize}" == "=" ] # Older versions of util-linux
then
sectorsize=$(LC_ALL=C fdisk -l ${MBR_DEVICE} | grep '^Units' | awk '{print $9}')
sectorsize=$(LC_ALL=C fdisk -l ${MBR_DEVICE} | grep '^Units' )
fi
startsector=$(LC_ALL=C fdisk -l ${MBR_DEVICE} | grep -A1 'Device' | tail -n1 | awk '{print $3}')
startsector=$(LC_ALL=C fdisk -l ${MBR_DEVICE} | grep -A1 'Device' | tail -n1 )
MBR_SIZE=$(expr ${sectorsize} \* ${startsector} / 1024)
@ -155,7 +155,7 @@ then
fi
elif [ "${1}" == "check" ]
then
HASHER=$(head -n1 ${DIGEST_FILE} | awk '{print $5}')
HASHER=$(head -n1 ${DIGEST_FILE} )
dd if=${MBR_DEVICE} of=${MBR_TMP} bs=${MBR_SIZE}K count=1 status=noxfer || die 8
if ! $(grep ${MBR_TMP} ${DIGEST_FILE} | ${HASHER} --check --warn --quiet --strict > ${LOG_FILE})