minor updates

pull/1/head
xor 2015-10-04 20:07:12 +02:00
parent 7a86d01c0f
commit d0eefebb2a
1 changed files with 6 additions and 6 deletions

View File

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