copy_postgresql_config_files.sh [plain text]
#!/bin/sh
ServerRoot="/Applications/Server.app/Contents/ServerRoot"
ConfigDir="/Library/Server/PostgreSQL/Config"
if [ ! -e $ConfigDir ]; then
echo "Creating directory $ConfigDir..."
/bin/mkdir -p "$ConfigDir"
if [ $? != 0 ]; then
echo "Error creating directory, exiting"
exit 1;
fi
/usr/sbin/chown root:wheel "$ConfigDir"
/bin/chmod 0755 "$ConfigDir"
fi
echo "Copying PostgreSQL configuration files into /Libary/Server..."
/usr/bin/ditto $ServerRoot/Library/Preferences/org.postgresql.postgres.plist $ConfigDir
/usr/sbin/chown _postgres:_postgres $ConfigDir/org.postgresql.postgres.plist
/bin/chmod 644 $ConfigDir/org.postgresql.postgres.plist
echo "Finished."