mirror of https://schlomp.space/tastytea/hashboot
more safety. check if files exists..
parent
4920769d5b
commit
ed2415cc34
24
hashboot
24
hashboot
|
@ -132,30 +132,25 @@ then
|
|||
then
|
||||
die 0
|
||||
else
|
||||
for file in $(diff ${DIGEST_FILE} ${DIGEST_FILE_TMP} | grep '<' | cut -d'*' -f2 | sed 's/\ /\\ /g' );
|
||||
for file in $(diff ${DIGEST_FILE} ${DIGEST_FILE_TMP} | grep -v '^#' | grep '<' | cut -d'*' -f2 | sed 's/\ /\\ /g' );
|
||||
do
|
||||
#lösche_aus_tar
|
||||
echo tar --delete -z -v -f $BACKUP_FILE $file
|
||||
tar --delete -v -f $BACKUP_FILE $file
|
||||
done
|
||||
for file in $(diff ${DIGEST_FILE} ${DIGEST_FILE_TMP} | grep '>' | cut -d'*' -f2 | sed 's/\ /\\ /g' );
|
||||
for file in $(diff ${DIGEST_FILE} ${DIGEST_FILE_TMP} | grep -v '^#' | grep '>' | cut -d'*' -f2 | sed 's/\ /\\ /g' );
|
||||
do
|
||||
echo tar -r -z -v -f $BACKUP_FILE $file
|
||||
tar -r -v -f $BACKUP_FILE $file
|
||||
done
|
||||
|
||||
#mv -v ${DIGEST_FILE_TMP} ${DIGEST_FILE} || die 7
|
||||
fi
|
||||
else
|
||||
write_hashes $DIGEST_FILE
|
||||
fi
|
||||
#Backup of good files
|
||||
tar -czpPf ${BACKUP_FILE} /boot ${DIGEST_FILE}
|
||||
if [ $? == 0 ]
|
||||
then
|
||||
tar -cpPf ${BACKUP_FILE} ${MBR_TMP} /boot ${DIGEST_FILE} || die 7 "Error writing ${BACKUP_FILE}"
|
||||
echo "Backup written to ${BACKUP_FILE}"
|
||||
else
|
||||
die 7 "Error writing ${BACKUP_FILE}"
|
||||
fi
|
||||
|
||||
elif [ "${1}" == "check" ]
|
||||
then
|
||||
[ -f ${DIGEST_FILE} ]
|
||||
then
|
||||
HASHER=$(head -n1 ${DIGEST_FILE} | awk '{print $5}')
|
||||
|
||||
|
@ -171,6 +166,9 @@ then
|
|||
COUNTER=$((COUNTER + 2))
|
||||
die $COUNTER
|
||||
fi
|
||||
else
|
||||
#error no digest file
|
||||
fi
|
||||
elif [ "${1}" == "recover" ]
|
||||
then
|
||||
echo "Restoring files from backup... (type yes or no for each file)"
|
||||
|
|
Loading…
Reference in New Issue