new feature and versions bump

pull/1/head
xor 2015-10-04 22:37:44 +02:00
parent 3f375ef746
commit 1edc0e2f11
1 changed files with 13 additions and 19 deletions

View File

@ -11,7 +11,7 @@
# meet some day, and you think this stuff is worth it, you can give us a hug. # # meet some day, and you think this stuff is worth it, you can give us a hug. #
################################################################################### ###################################################################################
VERSION="0.7.5" VERSION="0.7.6"
PATH="/bin:/usr/bin:/sbin:/usr/sbin:${PATH}" PATH="/bin:/usr/bin:/sbin:/usr/sbin:${PATH}"
DIGEST_FILE="/var/lib/hashboot.digest" DIGEST_FILE="/var/lib/hashboot.digest"
@ -120,7 +120,7 @@ then
#If we found no hasher: exit #If we found no hasher: exit
[ -z "${HASHER}" ] && die 5 "No hash calculator found" [ -z "${HASHER}" ] && die 5 "No hash calculator found"
#Exists ${DIGEST_FILE}, if true run du magic, else write ${DIGEST_FILE} #Exists ${DIGEST_FILE}, if true run do magic, else write ${DIGEST_FILE}
if [ -f ${DIGEST_FILE} ] if [ -f ${DIGEST_FILE} ]
then then
@ -132,28 +132,22 @@ then
then then
die 0 die 0
else else
#Compare actual hashes of MBR against saved hashes. for file in $(diff ${DIGEST_FILE} ${DIGEST_FILE_TMP} | grep '<' | cut -d'*' -f2 | sed 's/\ /\\ /g' );
if [ "$(grep ${MBR_TMP} ${DIGEST_FILE})" != "$(grep ${MBR_TMP} ${DIGEST_FILE_TMP})" ] do
then #lösche_aus_tar
[ -t "0" ] && echo "mbr was faulty." tar --delete -z -f -v $BACKUP_FILE $file
#future write separatly from files done
fi for file in $(diff ${DIGEST_FILE} ${DIGEST_FILE_TMP} | grep '>' | cut -d'*' -f2 | sed 's/\ /\\ /g' );
#Compare actual hashes of /boot against saved hashes. tar -r -z -f -v $BACKUP_FILE $file
if [ "$(grep -v ${MBR_TMP} ${DIGEST_FILE})" != "$(grep -v ${MBR_TMP} ${DIGEST_FILE_TMP})" ] done
then
[ -t "0" ] && echo "any file was faulty." #mv -v ${DIGEST_FILE_TMP} ${DIGEST_FILE} || die 7
#future: write per file and separatly from mbr
fi
mv ${DIGEST_FILE_TMP} ${DIGEST_FILE} || die 7
echo "List of hashes written to ${DIGEST_FILE}"
fi fi
else else
write_hashes $DIGEST_FILE write_hashes $DIGEST_FILE
fi fi
#readconfig
source ${CONFIG_FILE}
#Backup of good files #Backup of good files
tar -czpPf ${BACKUP_FILE} ${MBR_TMP} /boot ${DIGEST_FILE} tar -czpPf ${BACKUP_FILE} /boot ${DIGEST_FILE}
if [ $? == 0 ] if [ $? == 0 ]
then then
echo "Backup written to ${BACKUP_FILE}" echo "Backup written to ${BACKUP_FILE}"