if [ -z "$2" ] || [ ! -d "$1" ] || [ ! -f "$1/$2" ]; then
return 1
- fi
-
- CWD="`pwd`"
- cd $1
-
- if ! echo $2 | grep -q -e "^\.\/"; then
- # add ./ in front of the file name
- file="./$1"
- elif ! echo $2 | grep -q -e "^\."; then
- # add . in front of the file name
- file=".$1"
else
file="$1"
+ folder="$2"
fi
+ CWD="`pwd`"
+ cd $folder
+
if [ ! -f CHECKSUMS.md5 ]; then
gen_md5_checksums .
else
# remove the old entry and add a new one
- sed -i "/ $(regexp_slash $file)$/d" CHECKSUMS.md5
+ sed -i "/ \.*\/*$(regexp_slash $file)$/d" CHECKSUMS.md5
md5sum $file >> CHECKSUMS.md5
fi