Fix file_changed function for non-existent files.

master
Icedream 2018-02-20 03:02:42 +01:00
parent 21f795acb7
commit 521aea6b47
Signed by: icedream
GPG Key ID: 1573F6D8EFE4D0CF
1 changed files with 10 additions and 0 deletions

View File

@ -1,6 +1,16 @@
#!/bin/sh -e
file_changed() {
if [ ! -f "$1" ]; then
if [ ! -f "$2" ]; then
return 0
else
return 1
fi
fi
if [ ! -f "$2" ]; then
return 1
fi
oldfilehash="$(sha1sum "$1" | awk '{print $1}')"
newfilehash="$(sha1sum "$2" | awk '{print $1}')"
[ "${oldfilehash}" != "${newfilehash}" ]