2012-07-24 01:57:38 +08:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
usage() {
|
|
|
|
echo "Usage: $0 [OPTION]"
|
|
|
|
echo
|
|
|
|
echo "Configuration:"
|
|
|
|
echo " --help display this help and exit"
|
|
|
|
echo " --with-pgport=NUM access PostgreSQL server on TCP port NUM"
|
|
|
|
}
|
|
|
|
|
|
|
|
PGPORT=5432
|
|
|
|
|
|
|
|
while test -n "$1"; do
|
|
|
|
case "$1" in
|
|
|
|
--help|-h)
|
|
|
|
usage
|
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
--with-pgport=*)
|
|
|
|
PGPORT=`echo "$1" | cut -d= -f2`
|
|
|
|
;;
|
|
|
|
*)
|
2014-10-08 16:12:52 +08:00
|
|
|
echo "Unused option '$1'" >&2
|
|
|
|
;;
|
2012-07-24 01:57:38 +08:00
|
|
|
esac
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
|
|
|
|
echo "PGPORT: $PGPORT"
|
|
|
|
|
|
|
|
# TODO: allow specifying configuration settings !
|
|
|
|
for f in config/environments/*.example; do
|
|
|
|
o=`dirname "$f"`/`basename "$f" .example`
|
|
|
|
echo "Writing $o"
|
|
|
|
sed "s/\( *module.exports.db_port[ \t]*= *'\?\)[^';]*\('\?;\)/\1$PGPORT\2/" < "$f" > "$o"
|
|
|
|
done
|