#/bin/sh
PASSWD_FILE="$1"
export SALT=$(cat /dev/urandom | tr -cd 'a-f0-9' | head -c 32)
export PASSWD=$(head -n 1 /opt/extparam/service_*.key | cut -d "=" -f 2 | tr -d '\n' | sha256sum | awk '{print $1}')
export PASSWD=$(echo -n $PASSWD+$SALT | tr -d '\n' | sha256sum | awk '{print $1}')
echo device:1:$SALT:$PASSWD:deviceaccount > $PASSWD_FILE
echo "" >> $PASSWD_FILE
