#!/bin/sh
# $Id: gendbpasswords 2916 2009-10-16 18:21:19Z eldering $

# Script to generate database passwords. Passwords will be written to stdout,
# you can redirect stdout to etc/dbpasswords.secret

# Exit on any error:
set -e

echo "# Format: '<role>:<db_host>:<db_name>:<user>:<password>'"
for group in team jury public plugin; do
	printf "$group:localhost:domjudge:domjudge_$group:"
	head -c12 /dev/urandom | uuencode -m /dev/stdout | tail -n +2 | \
		head -c16 | tr '/+' 'Aa'
	echo
done
