mirror of https://schlomp.space/tastytea/hashboot
little fixes, modified initscripts to reflect exit code changes
parent
d59eaf7ef8
commit
7f3fa8630d
3
TODO
3
TODO
|
@ -1,2 +1,3 @@
|
|||
* Deian package
|
||||
* Debian package
|
||||
* Ubuntu package
|
||||
* Read header of ${DIGEST_FILE}
|
14
hashboot.sh
14
hashboot.sh
|
@ -72,7 +72,7 @@ then
|
|||
#Write header
|
||||
echo "#hashboot ${VERSION} - Algorithm: $(basename ${HASHER})" > ${DIGEST_FILE}
|
||||
#Write hashes of all regular files to ${DIGEST_FILE}
|
||||
err=$(dd if=/dev/sda of=${MBR_TMP} bs=1M count=1 status=noxfer 2>&1) || die 8 >&2
|
||||
err=$(dd if=/dev/sda of=${MBR_TMP} bs=2M count=1 status=noxfer 2>&1) || die 8
|
||||
${HASHER} ${MBR_TMP} > ${MBR_FILE}
|
||||
find /boot -type f -exec ${HASHER} --binary {} >> ${DIGEST_FILE} +
|
||||
if [ $? == 0 ]
|
||||
|
@ -83,7 +83,7 @@ then
|
|||
die 7
|
||||
fi
|
||||
#Backup of good files
|
||||
tar -czpPf ${BACKUP_FILE} /boot ${MBR_TMP} ${MBR_FILE}
|
||||
tar -czpPf ${BACKUP_FILE} /boot ${MBR_TMP} ${MBR_FILE} ${DIGEST_FILE}
|
||||
if [ $? == 0 ]
|
||||
then
|
||||
echo "Backup written to ${BACKUP_FILE}"
|
||||
|
@ -94,26 +94,22 @@ then
|
|||
elif [ "${1}" == "check" ]
|
||||
then
|
||||
COUNTER=0
|
||||
err=$(dd if=/dev/sda of=${MBR_TMP} bs=1M count=1 status=noxfer 2>&1) || die 8 >&2
|
||||
err=$(dd if=/dev/sda of=${MBR_TMP} bs=2M count=1 status=noxfer 2>&1) || die 8
|
||||
if $(${HASHER} --check --warn --quiet --strict ${MBR_FILE} > ${LOG_FILE})
|
||||
then
|
||||
echo "MBR ok"
|
||||
|
||||
else
|
||||
echo " !! TIME TO PANIK: MBR WAS MODIFIED !!"
|
||||
COUNTER=$((COUNTER + 1))
|
||||
|
||||
fi
|
||||
if $(${HASHER} --check --warn --quiet --strict ${DIGEST_FILE} >> ${LOG_FILE})
|
||||
then
|
||||
echo "/boot io"
|
||||
echo "/boot ok"
|
||||
die 0
|
||||
|
||||
else
|
||||
echo " !! TIME TO PANIK: AT LEAST 1 FILE WAS MODIFIED !!"
|
||||
COUNTER=$((COUNTER + 2))
|
||||
die $COUNTER
|
||||
|
||||
fi
|
||||
elif [ "${1}" == "recover" ]
|
||||
then
|
||||
|
@ -124,5 +120,3 @@ else
|
|||
fi
|
||||
|
||||
die 0
|
||||
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ start()
|
|||
which hashboot.sh > /dev/null || return 1
|
||||
|
||||
hashboot.sh check
|
||||
if [ $? == 4 ]
|
||||
if [ $? -gt 0 ] && [ $? -le 3 ]
|
||||
then
|
||||
echo -n "Recover files? [y/N] "
|
||||
read -r yesno
|
||||
|
|
|
@ -19,7 +19,7 @@ case "$1" in
|
|||
log_daemon_msg "Checking integrity of files in /boot"
|
||||
|
||||
hashboot.sh check
|
||||
if [ $? == 4 ]
|
||||
if [ $? -gt 0 ] && [ $? -le 3 ]
|
||||
then
|
||||
log_end_msg 4
|
||||
|
||||
|
|
Loading…
Reference in New Issue