Automatically setup hba.conf file if missing on PostgreSQL
authorJamie Cameron <jcameron@webmin.com>
Sun, 2 Dec 2007 01:39:41 +0000 (01:39 +0000)
committerJamie Cameron <jcameron@webmin.com>
Sun, 2 Dec 2007 01:39:41 +0000 (01:39 +0000)
postgresql/config-freebsd
postgresql/index.cgi

index 5f8af52..2d1ed3c 100644 (file)
@@ -1,6 +1,7 @@
 basedb=template1
 pass=
 hba_conf=/usr/local/pgsql/data/pg_hba.conf
+alt_hba_conf=/usr/local/share/postgresql/pg_hba.conf.sample
 pid_file=/usr/local/pgsql/data/postmaster.pid
 stop_cmd=/usr/local/etc/rc.d/010.pgsql.sh stop
 start_cmd=/usr/local/etc/rc.d/010.pgsql.sh start
index d92c277..af0db35 100755 (executable)
@@ -22,8 +22,14 @@ if (!-x $config{'psql'} || -d $config{'psql'}) {
        exit;
        }
 
+# Check for alternate config file, and use
+if (!$hba_conf_file && -r $config{'alt_hba_conf'}) {
+       ($hba_conf_file) = split(/\t+/, $config{'hba_conf'});
+       &copy_source_dest($config{'alt_hba_conf'}, $hba_conf_file);
+       }
+
 # Check for the config file
-if (!-r $hba_conf_file) {
+if (!$hba_conf_file) {
        &ui_print_header(undef, $text{'index_title'}, "", "intro", 1, 1, 0,
                &help_search_link("postgresql", "man", "doc", "google"));
        ($hba_conf_file) = split(/\t+/, $config{'hba_conf'});