diff --git a/restore.lib.bash b/restore.lib.bash index b99849b..5728fb6 100755 --- a/restore.lib.bash +++ b/restore.lib.bash @@ -1,5 +1,9 @@ #!/bin/bash +pkgsum="pkgsum" +hostsum="hostsums" +hashapp="sha256sum" + # Extra functions for restore scripts function exclusions () { @@ -17,4 +21,21 @@ function mkfast_deb () { dpkg --get-selections > installed_packages_fast grep -vf installed_packages_fast installed_packages.orig > installed_packages +} + +function verify () { +find /etc -type f -exec $hashapp '{}' \; > $hostsum + +# I know this is a cheap trick, but it works + +if [ -f $pkgsum ] && [ -f $hostsum ]; then + diff -q $pkgsum $hostsum + if [ $? -eq 0 ]; then + echo "Verify passed" + else + echo "Verify failed" + fi +else + echo "Checksum files not found" +fi } \ No newline at end of file diff --git a/verify.bash b/verify.bash deleted file mode 100755 index 7e99f76..0000000 --- a/verify.bash +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash - -pkgsum="pkgsum" -hostsum="hostsums" -hashapp="sha256sum" - -# this module will check to see if /etc matches whats in the restore - -find /etc -type f -exec $hashapp '{}' \; > $hostsum - -# I know this is a cheap trick, but it works - -if [ -f $pkgsum ] && [ -f $hostsum ]; then - diff -q $pkgsum $hostsum - if [ $? -eq 0 ]; then - echo "Verify passed" - else - echo "Verify failed" - fi -else - echo "Checksum files not found" -fi \ No newline at end of file