#!/bin/sh
set -e

printf "Updating extended parameter checksum files...\\n"
cd /opt/extparam
for f in $(find .)
do
  # Ignore dangling symlinks (if any).
  [ ! -f "$f" ] && continue
  s=${f##*/}
  s=${s%.md5}
  if [ ! -e "$s.md5" ] && [ "$s" != "." ]
  then
    printf "Creating md5sum for '%s'.\\n" "$s"
    md5sum "$s" > "$s.md5"
  fi
done
