diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..cbb3a13
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,4 @@
+*.rpm
+*.log
+*spec-20*
+*.tar.gz
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..36675e1
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,19 @@
+NAME := smeserver-postgresql
+SPECFILE = $(firstword $(wildcard *.spec))
+
+define find-makefile-common
+for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done
+endef
+
+MAKEFILE_COMMON := $(shell $(find-makefile-common))
+
+ifeq ($(MAKEFILE_COMMON),)
+# attept a checkout
+define checkout-makefile-common
+test -f CVS/Root && { cvs -Q -d $$(cat CVS/Root) checkout common && echo "common/Makefile.common" ; } || { echo "ERROR: I can't figure out how to checkout the 'common' module." ; exit -1 ; } >&2
+endef
+
+MAKEFILE_COMMON := $(shell $(checkout-makefile-common))
+endif
+
+include $(MAKEFILE_COMMON)
diff --git a/README.md b/README.md
index a1bff92..1106601 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,16 @@
-# smeserver-postgresql
+# smeserver-postgresql
-SMEServer Koozali developed git repo for smeserver-postgresql smecontribs
\ No newline at end of file
+SMEServer Koozali developed git repo for smeserver-postgresql smecontribs
+
+## Wiki
+
https://wiki.koozali.org/Postgresql
+
https://wiki.koozali.org/Software_Collections:PostgreSQL
+
+## Bugzilla
+Show list of outstanding bugs: [here](https://bugs.koozali.org/buglist.cgi?component=smeserver-postgresql&product=SME%20Contribs&query_format=advanced&limit=0&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&bug_status=CONFIRMED)
+
+## Description
+
+
*This description has been generated by an LLM AI system and cannot be relied on to be fully correct.*
+*Once it has been checked, then this comment will be deleted*
+
diff --git a/additional/COPYING b/additional/COPYING
new file mode 100644
index 0000000..eeb586b
--- /dev/null
+++ b/additional/COPYING
@@ -0,0 +1,340 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+
+ Copyright (C) 19yy
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) 19yy name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ , 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
diff --git a/contriborbase b/contriborbase
new file mode 100644
index 0000000..9b7fd51
--- /dev/null
+++ b/contriborbase
@@ -0,0 +1 @@
+contribs10
diff --git a/createlinks b/createlinks
new file mode 100755
index 0000000..f4d4a4d
--- /dev/null
+++ b/createlinks
@@ -0,0 +1,76 @@
+#!/usr/bin/perl -w
+
+use esmith::Build::CreateLinks qw(:all);
+
+#--------------------------------------------------
+# pre-backup actions
+#--------------------------------------------------
+my $event = "pre-backup";
+
+event_link("pgsql-delete-dumped-tables", $event, "10");
+event_link("pgsql-dump-tables", $event, "20");
+
+#--------------------------------------------------
+# post-backup actions
+#--------------------------------------------------
+$event = "post-backup";
+
+# Probably don't really need to do this
+event_link("pgsql-delete-dumped-tables", $event, "10");
+
+# When we do a restore, we want to start from a completely clean slate
+$event = "pre-restore";
+
+safe_symlink("stop", "root/etc/e-smith/events/$event/services2adjust/postgresql-13");
+# Needs to be after shutdown of pgsqld
+event_link("pgsql-delete-db-files", $event, "99");
+
+# Now we set up pgsql.init script for restore after reboot
+templates2events("/etc/e-smith/pgsql/init/00_restore_backup", $event);
+
+#--------------------------------------------------
+# actions for bootstrap-console-save event
+#--------------------------------------------------
+$event = "bootstrap-console-save";
+
+templates2events("/etc/e-smith/pgsql/init/00_restore_backup", $event);
+# data dir must be empty for initdb
+#templates2events("/var/lib/pgsql/13/data/postgresql.conf", $event);
+#templates2events("/var/lib/pgsql/13/data/pg_hba.conf", $event);
+templates2events("/var/lib/pgsql/.pg_pwd", $event);
+templates2events("/var/lib/pgsql/set.password", $event);
+#templates2events("/etc/e-smith/pgsql/init/10postgresql_upgrade", "$event");
+
+# Move all database dumps to pgsql/init
+#event_link("postgresql-load-tables", $event, "40");
+
+#--------------------------------------------------
+# actions for timezone-update event
+#--------------------------------------------------
+$event = "timezone-update";
+
+safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/postgresql-13");
+
+#--------------------------------------------------
+# actions for smeserver-postgresql-update event
+#--------------------------------------------------
+$event = "smeserver-postgresql-update";
+
+templates2events("/etc/e-smith/pgsql/init/00_restore_backup", $event);
+# data dir must be empty for initdb
+#templates2events("/var/lib/pgsql/13/data/postgresql.conf", $event);
+#templates2events("/var/lib/pgsql/13/data/pg_hba.conf", $event);
+templates2events("/var/lib/pgsql/.pg_pwd", $event);
+templates2events("/var/lib/pgsql/set.password", $event);
+#templates2events("/etc/e-smith/pgsql/init/10postgresql_upgrade", $event);
+
+# Move all database dumps to pgsql/init
+#event_link("postgresql-load-tables", $event, "40");
+
+# systemd-specific action mandatory for this package-update event
+event_link('systemd-default', "$event", '88');
+event_link('systemd-reload', "$event", '89');
+
+safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/postgresql-13");
+safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/pgsql.init");
+
diff --git a/root/etc/e-smith/db/configuration/defaults/pgsql.init/status b/root/etc/e-smith/db/configuration/defaults/pgsql.init/status
new file mode 100644
index 0000000..86981e6
--- /dev/null
+++ b/root/etc/e-smith/db/configuration/defaults/pgsql.init/status
@@ -0,0 +1 @@
+enabled
diff --git a/root/etc/e-smith/db/configuration/defaults/pgsql.init/type b/root/etc/e-smith/db/configuration/defaults/pgsql.init/type
new file mode 100644
index 0000000..24e1098
--- /dev/null
+++ b/root/etc/e-smith/db/configuration/defaults/pgsql.init/type
@@ -0,0 +1 @@
+service
diff --git a/root/etc/e-smith/db/configuration/defaults/postgresql-13/LocalNetworkingOnly b/root/etc/e-smith/db/configuration/defaults/postgresql-13/LocalNetworkingOnly
new file mode 100644
index 0000000..7cfab5b
--- /dev/null
+++ b/root/etc/e-smith/db/configuration/defaults/postgresql-13/LocalNetworkingOnly
@@ -0,0 +1 @@
+yes
diff --git a/root/etc/e-smith/db/configuration/defaults/postgresql-13/status b/root/etc/e-smith/db/configuration/defaults/postgresql-13/status
new file mode 100644
index 0000000..86981e6
--- /dev/null
+++ b/root/etc/e-smith/db/configuration/defaults/postgresql-13/status
@@ -0,0 +1 @@
+enabled
diff --git a/root/etc/e-smith/db/configuration/defaults/postgresql-13/type b/root/etc/e-smith/db/configuration/defaults/postgresql-13/type
new file mode 100644
index 0000000..24e1098
--- /dev/null
+++ b/root/etc/e-smith/db/configuration/defaults/postgresql-13/type
@@ -0,0 +1 @@
+service
diff --git a/root/etc/e-smith/events/actions/pgsql-delete-db-files b/root/etc/e-smith/events/actions/pgsql-delete-db-files
new file mode 100644
index 0000000..1753f11
--- /dev/null
+++ b/root/etc/e-smith/events/actions/pgsql-delete-db-files
@@ -0,0 +1,5 @@
+#! /bin/sh
+
+cd /var/lib/pgsql/13 && \
+ find . -type f | xargs rm -f && \
+ rm -rf data/*
diff --git a/root/etc/e-smith/events/actions/pgsql-delete-dumped-tables b/root/etc/e-smith/events/actions/pgsql-delete-dumped-tables
new file mode 100644
index 0000000..4fa72a2
--- /dev/null
+++ b/root/etc/e-smith/events/actions/pgsql-delete-dumped-tables
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+exec /bin/rm -f /home/e-smith/db/pgsql/pgsql.dump
diff --git a/root/etc/e-smith/events/actions/pgsql-dump-tables b/root/etc/e-smith/events/actions/pgsql-dump-tables
new file mode 100644
index 0000000..12ea844
--- /dev/null
+++ b/root/etc/e-smith/events/actions/pgsql-dump-tables
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+status=$(/sbin/e-smith/config getprop postgresql status)
+if [ "$status" = "disabled" ]
+then
+ echo "postgresql is disabled - no tables dumped" >&2
+ exit 0
+fi
+pgdumpall="/usr/pgsql-13/bin/pg_dumpall"
+#avoid error could not change directory to
+cd /tmp
+umask 027
+exec >/home/e-smith/db/pgsql/pgsql.dump
+chgrp postgres /home/e-smith/db/pgsql/pgsql.dump
+exec chpst -u postgres $pgdumpall
diff --git a/root/etc/e-smith/pgsql/init/.gitignore b/root/etc/e-smith/pgsql/init/.gitignore
new file mode 100644
index 0000000..e69de29
diff --git a/root/etc/e-smith/templates.metadata/etc/e-smith/pgsql/init/00_restore_backup b/root/etc/e-smith/templates.metadata/etc/e-smith/pgsql/init/00_restore_backup
new file mode 100644
index 0000000..15f5dc4
--- /dev/null
+++ b/root/etc/e-smith/templates.metadata/etc/e-smith/pgsql/init/00_restore_backup
@@ -0,0 +1,3 @@
+UID="root"
+GID="postgres"
+PERMS=04550
diff --git a/root/etc/e-smith/templates.metadata/var/lib/pgsql/.pg_pwd b/root/etc/e-smith/templates.metadata/var/lib/pgsql/.pg_pwd
new file mode 100644
index 0000000..90c56cd
--- /dev/null
+++ b/root/etc/e-smith/templates.metadata/var/lib/pgsql/.pg_pwd
@@ -0,0 +1,3 @@
+PERMS=0600
+UID="postgres"
+GID="postgres"
diff --git a/root/etc/e-smith/templates.metadata/var/lib/pgsql/13/data/pg_hba.conf b/root/etc/e-smith/templates.metadata/var/lib/pgsql/13/data/pg_hba.conf
new file mode 100644
index 0000000..90c56cd
--- /dev/null
+++ b/root/etc/e-smith/templates.metadata/var/lib/pgsql/13/data/pg_hba.conf
@@ -0,0 +1,3 @@
+PERMS=0600
+UID="postgres"
+GID="postgres"
diff --git a/root/etc/e-smith/templates.metadata/var/lib/pgsql/13/data/postgresql.conf b/root/etc/e-smith/templates.metadata/var/lib/pgsql/13/data/postgresql.conf
new file mode 100644
index 0000000..90c56cd
--- /dev/null
+++ b/root/etc/e-smith/templates.metadata/var/lib/pgsql/13/data/postgresql.conf
@@ -0,0 +1,3 @@
+PERMS=0600
+UID="postgres"
+GID="postgres"
diff --git a/root/etc/e-smith/templates.metadata/var/lib/pgsql/set.password b/root/etc/e-smith/templates.metadata/var/lib/pgsql/set.password
new file mode 100644
index 0000000..90c56cd
--- /dev/null
+++ b/root/etc/e-smith/templates.metadata/var/lib/pgsql/set.password
@@ -0,0 +1,3 @@
+PERMS=0600
+UID="postgres"
+GID="postgres"
diff --git a/root/etc/e-smith/templates/etc/e-smith/pgsql/init/00_restore_backup b/root/etc/e-smith/templates/etc/e-smith/pgsql/init/00_restore_backup
new file mode 100644
index 0000000..71d50c7
--- /dev/null
+++ b/root/etc/e-smith/templates/etc/e-smith/pgsql/init/00_restore_backup
@@ -0,0 +1,13 @@
+#! /usr/bin/perl -T
+use warnings;
+use strict;
+
+$ENV\{PATH\} = "/usr/pgsql-13/bin/:/usr/bin";
+delete $ENV\{BASH_ENV\};
+
+if (-e "/home/e-smith/db/pgsql/pgsql.dump")
+\{
+ open(STDIN, "/home/e-smith/db/pgsql/pgsql.dump");
+ exec(qw(chpst -u postgres /usr/pgsql-13/bin/psql -q -f - template1));
+\}
+exit 0;
diff --git a/root/etc/e-smith/templates/etc/systemd/system-preset/49-koozali.preset/06config b/root/etc/e-smith/templates/etc/systemd/system-preset/49-koozali.preset/06config
new file mode 100644
index 0000000..4819a6d
--- /dev/null
+++ b/root/etc/e-smith/templates/etc/systemd/system-preset/49-koozali.preset/06config
@@ -0,0 +1 @@
+{ push( @list, 'pgsql.init'); $OUT = ""; }
diff --git a/root/etc/e-smith/templates/var/lib/pgsql/.pg_pwd/10All b/root/etc/e-smith/templates/var/lib/pgsql/.pg_pwd/10All
new file mode 100644
index 0000000..aa3a05c
--- /dev/null
+++ b/root/etc/e-smith/templates/var/lib/pgsql/.pg_pwd/10All
@@ -0,0 +1,8 @@
+{
+ use esmith::util;
+
+ my $pw = esmith::util::LdapPassword();
+
+# postgresql
+ $OUT .= "$pw;\n";
+}
diff --git a/root/etc/e-smith/templates/var/lib/pgsql/.pg_pwd/template-begin b/root/etc/e-smith/templates/var/lib/pgsql/.pg_pwd/template-begin
new file mode 100644
index 0000000..e69de29
diff --git a/root/etc/e-smith/templates/var/lib/pgsql/13/data/pg_hba.conf/10Local b/root/etc/e-smith/templates/var/lib/pgsql/13/data/pg_hba.conf/10Local
new file mode 100644
index 0000000..7dbf7cd
--- /dev/null
+++ b/root/etc/e-smith/templates/var/lib/pgsql/13/data/pg_hba.conf/10Local
@@ -0,0 +1,80 @@
+# PostgreSQL Client Authentication Configuration File
+# ===================================================
+#
+# Refer to the "Client Authentication" section in the PostgreSQL
+# documentation for a complete description of this file. A short
+# synopsis follows.
+#
+# This file controls: which hosts are allowed to connect, how clients
+# are authenticated, which PostgreSQL user names they can use, which
+# databases they can access. Records take one of these forms:
+#
+# local DATABASE USER METHOD [OPTIONS]
+# host DATABASE USER ADDRESS METHOD [OPTIONS]
+# hostssl DATABASE USER ADDRESS METHOD [OPTIONS]
+# hostnossl DATABASE USER ADDRESS METHOD [OPTIONS]
+#
+# (The uppercase items must be replaced by actual values.)
+#
+# The first field is the connection type: "local" is a Unix-domain
+# socket, "host" is either a plain or SSL-encrypted TCP/IP socket,
+# "hostssl" is an SSL-encrypted TCP/IP socket, and "hostnossl" is a
+# plain TCP/IP socket.
+#
+# DATABASE can be "all", "sameuser", "samerole", "replication", a
+# database name, or a comma-separated list thereof. The "all"
+# keyword does not match "replication". Access to replication
+# must be enabled in a separate record (see example below).
+#
+# USER can be "all", a user name, a group name prefixed with "+", or a
+# comma-separated list thereof. In both the DATABASE and USER fields
+# you can also write a file name prefixed with "@" to include names
+# from a separate file.
+#
+# ADDRESS specifies the set of hosts the record matches. It can be a
+# host name, or it is made up of an IP address and a CIDR mask that is
+# an integer (between 0 and 32 (IPv4) or 128 (IPv6) inclusive) that
+# specifies the number of significant bits in the mask. A host name
+# that starts with a dot (.) matches a suffix of the actual host name.
+# Alternatively, you can write an IP address and netmask in separate
+# columns to specify the set of hosts. Instead of a CIDR-address, you
+# can write "samehost" to match any of the server's own IP addresses,
+# or "samenet" to match any address in any subnet that the server is
+# directly connected to.
+#
+# METHOD can be "trust", "reject", "md5", "password", "gss", "sspi",
+# "krb5", "ident", "peer", "pam", "ldap", "radius" or "cert". Note that
+# "password" sends passwords in clear text; "md5" is preferred since
+# it sends encrypted passwords.
+#
+# OPTIONS are a set of options for the authentication in the format
+# NAME=VALUE. The available options depend on the different
+# authentication methods -- refer to the "Client Authentication"
+# section in the documentation for a list of which options are
+# available for which authentication methods.
+#
+# Database and user names containing spaces, commas, quotes and other
+# special characters must be quoted. Quoting one of the keywords
+# "all", "sameuser", "samerole" or "replication" makes the name lose
+# its special character, and just match a database or username with
+# that name.
+#
+# This file is read on server startup and when the postmaster receives
+# a SIGHUP signal. If you edit the file on a running system, you have
+# to SIGHUP the postmaster for the changes to take effect. You can
+# use "pg_ctl reload" to do that.
+
+# Put your actual configuration here
+# ----------------------------------
+#
+# If you want to allow non-local connections, you need to add more
+# "host" records. In that case you will also need to make PostgreSQL
+# listen on a non-local interface via the listen_addresses
+# configuration parameter, or via the -i or -h command line switches.
+
+
+
+# TYPE DATABASE USER ADDRESS METHOD
+
+# "local" is for Unix domain socket connections only
+local all postgres ident
diff --git a/root/etc/e-smith/templates/var/lib/pgsql/13/data/pg_hba.conf/25LocalAll b/root/etc/e-smith/templates/var/lib/pgsql/13/data/pg_hba.conf/25LocalAll
new file mode 100644
index 0000000..7b0fe55
--- /dev/null
+++ b/root/etc/e-smith/templates/var/lib/pgsql/13/data/pg_hba.conf/25LocalAll
@@ -0,0 +1 @@
+local all all md5
diff --git a/root/etc/e-smith/templates/var/lib/pgsql/13/data/pg_hba.conf/30Host b/root/etc/e-smith/templates/var/lib/pgsql/13/data/pg_hba.conf/30Host
new file mode 100644
index 0000000..6c3e948
--- /dev/null
+++ b/root/etc/e-smith/templates/var/lib/pgsql/13/data/pg_hba.conf/30Host
@@ -0,0 +1,7 @@
+# IPv4 local connections:
+host all all 127.0.0.1/32 md5
+
+# IPv6 local connections:
+#host all all ::1/128 md5
+
+host all all 0.0.0.0 255.255.255.255 reject
diff --git a/root/etc/e-smith/templates/var/lib/pgsql/13/data/pg_hba.conf/template-begin b/root/etc/e-smith/templates/var/lib/pgsql/13/data/pg_hba.conf/template-begin
new file mode 100644
index 0000000..2c39f1c
--- /dev/null
+++ b/root/etc/e-smith/templates/var/lib/pgsql/13/data/pg_hba.conf/template-begin
@@ -0,0 +1,4 @@
+#------------------------------------------------------------
+# !!DO NOT MODIFY THIS FILE!!
+# Manual changes will be lost when this file is regenerated.
+#------------------------------------------------------------
diff --git a/root/etc/e-smith/templates/var/lib/pgsql/13/data/postgresql.conf/10All_102ori b/root/etc/e-smith/templates/var/lib/pgsql/13/data/postgresql.conf/10All_102ori
new file mode 100644
index 0000000..b37199d
--- /dev/null
+++ b/root/etc/e-smith/templates/var/lib/pgsql/13/data/postgresql.conf/10All_102ori
@@ -0,0 +1,750 @@
+# -----------------------------
+# PostgreSQL configuration file
+# -----------------------------
+#
+# This file consists of lines of the form:
+#
+# name = value
+#
+# (The "=" is optional.) Whitespace may be used. Comments are introduced with
+# "#" anywhere on a line. The complete list of parameter names and allowed
+# values can be found in the PostgreSQL documentation.
+#
+# The commented-out settings shown in this file represent the default values.
+# Re-commenting a setting is NOT sufficient to revert it to the default value;
+# you need to reload the server.
+#
+# This file is read on server startup and when the server receives a SIGHUP
+# signal. If you edit the file on a running system, you have to SIGHUP the
+# server for the changes to take effect, run "pg_ctl reload", or execute
+# "SELECT pg_reload_conf()". Some parameters, which are marked below,
+# require a server shutdown and restart to take effect.
+#
+# Any parameter can also be given as a command-line option to the server, e.g.,
+# "postgres -c log_connections=on". Some parameters can be changed at run time
+# with the "SET" SQL command.
+#
+# Memory units: kB = kilobytes Time units: ms = milliseconds
+# MB = megabytes s = seconds
+# GB = gigabytes min = minutes
+# TB = terabytes h = hours
+# d = days
+
+
+#------------------------------------------------------------------------------
+# FILE LOCATIONS
+#------------------------------------------------------------------------------
+
+# The default values of these variables are driven from the -D command-line
+# option or PGDATA environment variable, represented here as ConfigDir.
+
+#data_directory = 'ConfigDir' # use data in another directory
+ # (change requires restart)
+#hba_file = 'ConfigDir/pg_hba.conf' # host-based authentication file
+ # (change requires restart)
+#ident_file = 'ConfigDir/pg_ident.conf' # ident configuration file
+ # (change requires restart)
+
+# If external_pid_file is not explicitly set, no extra PID file is written.
+#external_pid_file = '' # write an extra PID file
+ # (change requires restart)
+
+
+#------------------------------------------------------------------------------
+# CONNECTIONS AND AUTHENTICATION
+#------------------------------------------------------------------------------
+
+# - Connection Settings -
+
+#listen_addresses = 'localhost' # what IP address(es) to listen on;
+ # comma-separated list of addresses;
+ # defaults to 'localhost'; use '*' for all
+ # (change requires restart)
+#port = 5432 # (change requires restart)
+max_connections = 100 # (change requires restart)
+#superuser_reserved_connections = 3 # (change requires restart)
+#unix_socket_directories = '/var/run/postgresql, /tmp' # comma-separated list of directories
+ # (change requires restart)
+#unix_socket_group = '' # (change requires restart)
+#unix_socket_permissions = 0777 # begin with 0 to use octal notation
+ # (change requires restart)
+#bonjour = off # advertise server via Bonjour
+ # (change requires restart)
+#bonjour_name = '' # defaults to the computer name
+ # (change requires restart)
+
+# - TCP settings -
+# see "man 7 tcp" for details
+
+#tcp_keepalives_idle = 0 # TCP_KEEPIDLE, in seconds;
+ # 0 selects the system default
+#tcp_keepalives_interval = 0 # TCP_KEEPINTVL, in seconds;
+ # 0 selects the system default
+#tcp_keepalives_count = 0 # TCP_KEEPCNT;
+ # 0 selects the system default
+#tcp_user_timeout = 0 # TCP_USER_TIMEOUT, in milliseconds;
+ # 0 selects the system default
+
+# - Authentication -
+
+#authentication_timeout = 1min # 1s-600s
+#password_encryption = md5 # md5 or scram-sha-256
+#db_user_namespace = off
+
+# GSSAPI using Kerberos
+#krb_server_keyfile = ''
+#krb_caseins_users = off
+
+# - SSL -
+
+#ssl = off
+#ssl_ca_file = ''
+#ssl_cert_file = 'server.crt'
+#ssl_crl_file = ''
+#ssl_key_file = 'server.key'
+#ssl_ciphers = 'HIGH:MEDIUM:+3DES:!aNULL' # allowed SSL ciphers
+#ssl_prefer_server_ciphers = on
+#ssl_ecdh_curve = 'prime256v1'
+#ssl_min_protocol_version = 'TLSv1'
+#ssl_max_protocol_version = ''
+#ssl_dh_params_file = ''
+#ssl_passphrase_command = ''
+#ssl_passphrase_command_supports_reload = off
+
+
+#------------------------------------------------------------------------------
+# RESOURCE USAGE (except WAL)
+#------------------------------------------------------------------------------
+
+# - Memory -
+
+shared_buffers = 128MB # min 128kB
+ # (change requires restart)
+#huge_pages = try # on, off, or try
+ # (change requires restart)
+#temp_buffers = 8MB # min 800kB
+#max_prepared_transactions = 0 # zero disables the feature
+ # (change requires restart)
+# Caution: it is not advisable to set max_prepared_transactions nonzero unless
+# you actively intend to use prepared transactions.
+#work_mem = 4MB # min 64kB
+#maintenance_work_mem = 64MB # min 1MB
+#autovacuum_work_mem = -1 # min 1MB, or -1 to use maintenance_work_mem
+#max_stack_depth = 2MB # min 100kB
+#shared_memory_type = mmap # the default is the first option
+ # supported by the operating system:
+ # mmap
+ # sysv
+ # windows
+ # (change requires restart)
+dynamic_shared_memory_type = posix # the default is the first option
+ # supported by the operating system:
+ # posix
+ # sysv
+ # windows
+ # mmap
+ # (change requires restart)
+
+# - Disk -
+
+#temp_file_limit = -1 # limits per-process temp file space
+ # in kB, or -1 for no limit
+
+# - Kernel Resources -
+
+#max_files_per_process = 1000 # min 25
+ # (change requires restart)
+
+# - Cost-Based Vacuum Delay -
+
+#vacuum_cost_delay = 0 # 0-100 milliseconds (0 disables)
+#vacuum_cost_page_hit = 1 # 0-10000 credits
+#vacuum_cost_page_miss = 10 # 0-10000 credits
+#vacuum_cost_page_dirty = 20 # 0-10000 credits
+#vacuum_cost_limit = 200 # 1-10000 credits
+
+# - Background Writer -
+
+#bgwriter_delay = 200ms # 10-10000ms between rounds
+#bgwriter_lru_maxpages = 100 # max buffers written/round, 0 disables
+#bgwriter_lru_multiplier = 2.0 # 0-10.0 multiplier on buffers scanned/round
+#bgwriter_flush_after = 512kB # measured in pages, 0 disables
+
+# - Asynchronous Behavior -
+
+#effective_io_concurrency = 1 # 1-1000; 0 disables prefetching
+#max_worker_processes = 8 # (change requires restart)
+#max_parallel_maintenance_workers = 2 # taken from max_parallel_workers
+#max_parallel_workers_per_gather = 2 # taken from max_parallel_workers
+#parallel_leader_participation = on
+#max_parallel_workers = 8 # maximum number of max_worker_processes that
+ # can be used in parallel operations
+#old_snapshot_threshold = -1 # 1min-60d; -1 disables; 0 is immediate
+ # (change requires restart)
+#backend_flush_after = 0 # measured in pages, 0 disables
+
+
+#------------------------------------------------------------------------------
+# WRITE-AHEAD LOG
+#------------------------------------------------------------------------------
+
+# - Settings -
+
+#wal_level = replica # minimal, replica, or logical
+ # (change requires restart)
+#fsync = on # flush data to disk for crash safety
+ # (turning this off can cause
+ # unrecoverable data corruption)
+#synchronous_commit = on # synchronization level;
+ # off, local, remote_write, remote_apply, or on
+#wal_sync_method = fsync # the default is the first option
+ # supported by the operating system:
+ # open_datasync
+ # fdatasync (default on Linux)
+ # fsync
+ # fsync_writethrough
+ # open_sync
+#full_page_writes = on # recover from partial page writes
+#wal_compression = off # enable compression of full-page writes
+#wal_log_hints = off # also do full page writes of non-critical updates
+ # (change requires restart)
+#wal_init_zero = on # zero-fill new WAL files
+#wal_recycle = on # recycle WAL files
+#wal_buffers = -1 # min 32kB, -1 sets based on shared_buffers
+ # (change requires restart)
+#wal_writer_delay = 200ms # 1-10000 milliseconds
+#wal_writer_flush_after = 1MB # measured in pages, 0 disables
+
+#commit_delay = 0 # range 0-100000, in microseconds
+#commit_siblings = 5 # range 1-1000
+
+# - Checkpoints -
+
+#checkpoint_timeout = 5min # range 30s-1d
+max_wal_size = 1GB
+min_wal_size = 80MB
+#checkpoint_completion_target = 0.5 # checkpoint target duration, 0.0 - 1.0
+#checkpoint_flush_after = 256kB # measured in pages, 0 disables
+#checkpoint_warning = 30s # 0 disables
+
+# - Archiving -
+
+#archive_mode = off # enables archiving; off, on, or always
+ # (change requires restart)
+#archive_command = '' # command to use to archive a logfile segment
+ # placeholders: %p = path of file to archive
+ # %f = file name only
+ # e.g. 'test ! -f /mnt/server/archivedir/%f && cp %p /mnt/server/archivedir/%f'
+#archive_timeout = 0 # force a logfile segment switch after this
+ # number of seconds; 0 disables
+
+# - Archive Recovery -
+
+# These are only used in recovery mode.
+
+#restore_command = '' # command to use to restore an archived logfile segment
+ # placeholders: %p = path of file to restore
+ # %f = file name only
+ # e.g. 'cp /mnt/server/archivedir/%f %p'
+ # (change requires restart)
+#archive_cleanup_command = '' # command to execute at every restartpoint
+#recovery_end_command = '' # command to execute at completion of recovery
+
+# - Recovery Target -
+
+# Set these only when performing a targeted recovery.
+
+#recovery_target = '' # 'immediate' to end recovery as soon as a
+ # consistent state is reached
+ # (change requires restart)
+#recovery_target_name = '' # the named restore point to which recovery will proceed
+ # (change requires restart)
+#recovery_target_time = '' # the time stamp up to which recovery will proceed
+ # (change requires restart)
+#recovery_target_xid = '' # the transaction ID up to which recovery will proceed
+ # (change requires restart)
+#recovery_target_lsn = '' # the WAL LSN up to which recovery will proceed
+ # (change requires restart)
+#recovery_target_inclusive = on # Specifies whether to stop:
+ # just after the specified recovery target (on)
+ # just before the recovery target (off)
+ # (change requires restart)
+#recovery_target_timeline = 'latest' # 'current', 'latest', or timeline ID
+ # (change requires restart)
+#recovery_target_action = 'pause' # 'pause', 'promote', 'shutdown'
+ # (change requires restart)
+
+
+#------------------------------------------------------------------------------
+# REPLICATION
+#------------------------------------------------------------------------------
+
+# - Sending Servers -
+
+# Set these on the master and on any standby that will send replication data.
+
+#max_wal_senders = 10 # max number of walsender processes
+ # (change requires restart)
+#wal_keep_segments = 0 # in logfile segments; 0 disables
+#wal_sender_timeout = 60s # in milliseconds; 0 disables
+
+#max_replication_slots = 10 # max number of replication slots
+ # (change requires restart)
+#track_commit_timestamp = off # collect timestamp of transaction commit
+ # (change requires restart)
+
+# - Master Server -
+
+# These settings are ignored on a standby server.
+
+#synchronous_standby_names = '' # standby servers that provide sync rep
+ # method to choose sync standbys, number of sync standbys,
+ # and comma-separated list of application_name
+ # from standby(s); '*' = all
+#vacuum_defer_cleanup_age = 0 # number of xacts by which cleanup is delayed
+
+# - Standby Servers -
+
+# These settings are ignored on a master server.
+
+#primary_conninfo = '' # connection string to sending server
+ # (change requires restart)
+#primary_slot_name = '' # replication slot on sending server
+ # (change requires restart)
+#promote_trigger_file = '' # file name whose presence ends recovery
+#hot_standby = on # "off" disallows queries during recovery
+ # (change requires restart)
+#max_standby_archive_delay = 30s # max delay before canceling queries
+ # when reading WAL from archive;
+ # -1 allows indefinite delay
+#max_standby_streaming_delay = 30s # max delay before canceling queries
+ # when reading streaming WAL;
+ # -1 allows indefinite delay
+#wal_receiver_status_interval = 10s # send replies at least this often
+ # 0 disables
+#hot_standby_feedback = off # send info from standby to prevent
+ # query conflicts
+#wal_receiver_timeout = 60s # time that receiver waits for
+ # communication from master
+ # in milliseconds; 0 disables
+#wal_retrieve_retry_interval = 5s # time to wait before retrying to
+ # retrieve WAL after a failed attempt
+#recovery_min_apply_delay = 0 # minimum delay for applying changes during recovery
+
+# - Subscribers -
+
+# These settings are ignored on a publisher.
+
+#max_logical_replication_workers = 4 # taken from max_worker_processes
+ # (change requires restart)
+#max_sync_workers_per_subscription = 2 # taken from max_logical_replication_workers
+
+
+#------------------------------------------------------------------------------
+# QUERY TUNING
+#------------------------------------------------------------------------------
+
+# - Planner Method Configuration -
+
+#enable_bitmapscan = on
+#enable_hashagg = on
+#enable_hashjoin = on
+#enable_indexscan = on
+#enable_indexonlyscan = on
+#enable_material = on
+#enable_mergejoin = on
+#enable_nestloop = on
+#enable_parallel_append = on
+#enable_seqscan = on
+#enable_sort = on
+#enable_tidscan = on
+#enable_partitionwise_join = off
+#enable_partitionwise_aggregate = off
+#enable_parallel_hash = on
+#enable_partition_pruning = on
+
+# - Planner Cost Constants -
+
+#seq_page_cost = 1.0 # measured on an arbitrary scale
+#random_page_cost = 4.0 # same scale as above
+#cpu_tuple_cost = 0.01 # same scale as above
+#cpu_index_tuple_cost = 0.005 # same scale as above
+#cpu_operator_cost = 0.0025 # same scale as above
+#parallel_tuple_cost = 0.1 # same scale as above
+#parallel_setup_cost = 1000.0 # same scale as above
+
+#jit_above_cost = 100000 # perform JIT compilation if available
+ # and query more expensive than this;
+ # -1 disables
+#jit_inline_above_cost = 500000 # inline small functions if query is
+ # more expensive than this; -1 disables
+#jit_optimize_above_cost = 500000 # use expensive JIT optimizations if
+ # query is more expensive than this;
+ # -1 disables
+
+#min_parallel_table_scan_size = 8MB
+#min_parallel_index_scan_size = 512kB
+#effective_cache_size = 4GB
+
+# - Genetic Query Optimizer -
+
+#geqo = on
+#geqo_threshold = 12
+#geqo_effort = 5 # range 1-10
+#geqo_pool_size = 0 # selects default based on effort
+#geqo_generations = 0 # selects default based on effort
+#geqo_selection_bias = 2.0 # range 1.5-2.0
+#geqo_seed = 0.0 # range 0.0-1.0
+
+# - Other Planner Options -
+
+#default_statistics_target = 100 # range 1-10000
+#constraint_exclusion = partition # on, off, or partition
+#cursor_tuple_fraction = 0.1 # range 0.0-1.0
+#from_collapse_limit = 8
+#join_collapse_limit = 8 # 1 disables collapsing of explicit
+ # JOIN clauses
+#force_parallel_mode = off
+#jit = on # allow JIT compilation
+#plan_cache_mode = auto # auto, force_generic_plan or
+ # force_custom_plan
+
+
+#------------------------------------------------------------------------------
+# REPORTING AND LOGGING
+#------------------------------------------------------------------------------
+
+# - Where to Log -
+
+log_destination = 'stderr' # Valid values are combinations of
+ # stderr, csvlog, syslog, and eventlog,
+ # depending on platform. csvlog
+ # requires logging_collector to be on.
+
+# This is used when logging to stderr:
+logging_collector = on # Enable capturing of stderr and csvlog
+ # into log files. Required to be on for
+ # csvlogs.
+ # (change requires restart)
+
+# These are only used if logging_collector is on:
+log_directory = 'log' # directory where log files are written,
+ # can be absolute or relative to PGDATA
+log_filename = 'postgresql-%a.log' # log file name pattern,
+ # can include strftime() escapes
+#log_file_mode = 0600 # creation mode for log files,
+ # begin with 0 to use octal notation
+log_truncate_on_rotation = on # If on, an existing log file with the
+ # same name as the new log file will be
+ # truncated rather than appended to.
+ # But such truncation only occurs on
+ # time-driven rotation, not on restarts
+ # or size-driven rotation. Default is
+ # off, meaning append to existing files
+ # in all cases.
+log_rotation_age = 1d # Automatic rotation of logfiles will
+ # happen after that time. 0 disables.
+log_rotation_size = 0 # Automatic rotation of logfiles will
+ # happen after that much log output.
+ # 0 disables.
+
+# These are relevant when logging to syslog:
+#syslog_facility = 'LOCAL0'
+#syslog_ident = 'postgres'
+#syslog_sequence_numbers = on
+#syslog_split_messages = on
+
+# This is only relevant when logging to eventlog (win32):
+# (change requires restart)
+#event_source = 'PostgreSQL'
+
+# - When to Log -
+
+#log_min_messages = warning # values in order of decreasing detail:
+ # debug5
+ # debug4
+ # debug3
+ # debug2
+ # debug1
+ # info
+ # notice
+ # warning
+ # error
+ # log
+ # fatal
+ # panic
+
+#log_min_error_statement = error # values in order of decreasing detail:
+ # debug5
+ # debug4
+ # debug3
+ # debug2
+ # debug1
+ # info
+ # notice
+ # warning
+ # error
+ # log
+ # fatal
+ # panic (effectively off)
+
+#log_min_duration_statement = -1 # -1 is disabled, 0 logs all statements
+ # and their durations, > 0 logs only
+ # statements running at least this number
+ # of milliseconds
+
+#log_transaction_sample_rate = 0.0 # Fraction of transactions whose statements
+ # are logged regardless of their duration. 1.0 logs all
+ # statements from all transactions, 0.0 never logs.
+
+# - What to Log -
+
+#debug_print_parse = off
+#debug_print_rewritten = off
+#debug_print_plan = off
+#debug_pretty_print = on
+#log_checkpoints = off
+#log_connections = off
+#log_disconnections = off
+#log_duration = off
+#log_error_verbosity = default # terse, default, or verbose messages
+#log_hostname = off
+log_line_prefix = '%m [%p] ' # special values:
+ # %a = application name
+ # %u = user name
+ # %d = database name
+ # %r = remote host and port
+ # %h = remote host
+ # %p = process ID
+ # %t = timestamp without milliseconds
+ # %m = timestamp with milliseconds
+ # %n = timestamp with milliseconds (as a Unix epoch)
+ # %i = command tag
+ # %e = SQL state
+ # %c = session ID
+ # %l = session line number
+ # %s = session start timestamp
+ # %v = virtual transaction ID
+ # %x = transaction ID (0 if none)
+ # %q = stop here in non-session
+ # processes
+ # %% = '%'
+ # e.g. '<%u%%%d> '
+#log_lock_waits = off # log lock waits >= deadlock_timeout
+#log_statement = 'none' # none, ddl, mod, all
+#log_replication_commands = off
+#log_temp_files = -1 # log temporary files equal or larger
+ # than the specified size in kilobytes;
+ # -1 disables, 0 logs all temp files
+log_timezone = 'Indian/Reunion'
+
+#------------------------------------------------------------------------------
+# PROCESS TITLE
+#------------------------------------------------------------------------------
+
+#cluster_name = '' # added to process titles if nonempty
+ # (change requires restart)
+#update_process_title = on
+
+
+#------------------------------------------------------------------------------
+# STATISTICS
+#------------------------------------------------------------------------------
+
+# - Query and Index Statistics Collector -
+
+#track_activities = on
+#track_counts = on
+#track_io_timing = off
+#track_functions = none # none, pl, all
+#track_activity_query_size = 1024 # (change requires restart)
+#stats_temp_directory = 'pg_stat_tmp'
+
+
+# - Monitoring -
+
+#log_parser_stats = off
+#log_planner_stats = off
+#log_executor_stats = off
+#log_statement_stats = off
+
+
+#------------------------------------------------------------------------------
+# AUTOVACUUM
+#------------------------------------------------------------------------------
+
+#autovacuum = on # Enable autovacuum subprocess? 'on'
+ # requires track_counts to also be on.
+#log_autovacuum_min_duration = -1 # -1 disables, 0 logs all actions and
+ # their durations, > 0 logs only
+ # actions running at least this number
+ # of milliseconds.
+#autovacuum_max_workers = 3 # max number of autovacuum subprocesses
+ # (change requires restart)
+#autovacuum_naptime = 1min # time between autovacuum runs
+#autovacuum_vacuum_threshold = 50 # min number of row updates before
+ # vacuum
+#autovacuum_analyze_threshold = 50 # min number of row updates before
+ # analyze
+#autovacuum_vacuum_scale_factor = 0.2 # fraction of table size before vacuum
+#autovacuum_analyze_scale_factor = 0.1 # fraction of table size before analyze
+#autovacuum_freeze_max_age = 200000000 # maximum XID age before forced vacuum
+ # (change requires restart)
+#autovacuum_multixact_freeze_max_age = 400000000 # maximum multixact age
+ # before forced vacuum
+ # (change requires restart)
+#autovacuum_vacuum_cost_delay = 2ms # default vacuum cost delay for
+ # autovacuum, in milliseconds;
+ # -1 means use vacuum_cost_delay
+#autovacuum_vacuum_cost_limit = -1 # default vacuum cost limit for
+ # autovacuum, -1 means use
+ # vacuum_cost_limit
+
+
+#------------------------------------------------------------------------------
+# CLIENT CONNECTION DEFAULTS
+#------------------------------------------------------------------------------
+
+# - Statement Behavior -
+
+#client_min_messages = notice # values in order of decreasing detail:
+ # debug5
+ # debug4
+ # debug3
+ # debug2
+ # debug1
+ # log
+ # notice
+ # warning
+ # error
+#search_path = '"$user", public' # schema names
+#row_security = on
+#default_tablespace = '' # a tablespace name, '' uses the default
+#temp_tablespaces = '' # a list of tablespace names, '' uses
+ # only default tablespace
+#default_table_access_method = 'heap'
+#check_function_bodies = on
+#default_transaction_isolation = 'read committed'
+#default_transaction_read_only = off
+#default_transaction_deferrable = off
+#session_replication_role = 'origin'
+#statement_timeout = 0 # in milliseconds, 0 is disabled
+#lock_timeout = 0 # in milliseconds, 0 is disabled
+#idle_in_transaction_session_timeout = 0 # in milliseconds, 0 is disabled
+#vacuum_freeze_min_age = 50000000
+#vacuum_freeze_table_age = 150000000
+#vacuum_multixact_freeze_min_age = 5000000
+#vacuum_multixact_freeze_table_age = 150000000
+#vacuum_cleanup_index_scale_factor = 0.1 # fraction of total number of tuples
+ # before index cleanup, 0 always performs
+ # index cleanup
+#bytea_output = 'hex' # hex, escape
+#xmlbinary = 'base64'
+#xmloption = 'content'
+#gin_fuzzy_search_limit = 0
+#gin_pending_list_limit = 4MB
+
+# - Locale and Formatting -
+
+datestyle = 'iso, dmy'
+#intervalstyle = 'postgres'
+timezone = 'Indian/Reunion'
+#timezone_abbreviations = 'Default' # Select the set of available time zone
+ # abbreviations. Currently, there are
+ # Default
+ # Australia (historical usage)
+ # India
+ # You can create your own file in
+ # share/timezonesets/.
+#extra_float_digits = 1 # min -15, max 3; any value >0 actually
+ # selects precise output mode
+#client_encoding = sql_ascii # actually, defaults to database
+ # encoding
+
+# These settings are initialized by initdb, but they can be changed.
+lc_messages = 'fr_FR.UTF-8' # locale for system error message
+ # strings
+lc_monetary = 'fr_FR.UTF-8' # locale for monetary formatting
+lc_numeric = 'fr_FR.UTF-8' # locale for number formatting
+lc_time = 'fr_FR.UTF-8' # locale for time formatting
+
+# default configuration for text search
+default_text_search_config = 'pg_catalog.french'
+
+# - Shared Library Preloading -
+
+#shared_preload_libraries = '' # (change requires restart)
+#local_preload_libraries = ''
+#session_preload_libraries = ''
+#jit_provider = 'llvmjit' # JIT library to use
+
+# - Other Defaults -
+
+#dynamic_library_path = '$libdir'
+
+
+#------------------------------------------------------------------------------
+# LOCK MANAGEMENT
+#------------------------------------------------------------------------------
+
+#deadlock_timeout = 1s
+#max_locks_per_transaction = 64 # min 10
+ # (change requires restart)
+#max_pred_locks_per_transaction = 64 # min 10
+ # (change requires restart)
+#max_pred_locks_per_relation = -2 # negative values mean
+ # (max_pred_locks_per_transaction
+ # / -max_pred_locks_per_relation) - 1
+#max_pred_locks_per_page = 2 # min 0
+
+
+#------------------------------------------------------------------------------
+# VERSION AND PLATFORM COMPATIBILITY
+#------------------------------------------------------------------------------
+
+# - Previous PostgreSQL Versions -
+
+#array_nulls = on
+#backslash_quote = safe_encoding # on, off, or safe_encoding
+#escape_string_warning = on
+#lo_compat_privileges = off
+#operator_precedence_warning = off
+#quote_all_identifiers = off
+#standard_conforming_strings = on
+#synchronize_seqscans = on
+
+# - Other Platforms and Clients -
+
+#transform_null_equals = off
+
+
+#------------------------------------------------------------------------------
+# ERROR HANDLING
+#------------------------------------------------------------------------------
+
+#exit_on_error = off # terminate session on any error?
+#restart_after_crash = on # reinitialize after backend crash?
+#data_sync_retry = off # retry or panic on failure to fsync
+ # data?
+ # (change requires restart)
+
+
+#------------------------------------------------------------------------------
+# CONFIG FILE INCLUDES
+#------------------------------------------------------------------------------
+
+# These options allow settings to be loaded from files other than the
+# default postgresql.conf. Note that these are directives, not variable
+# assignments, so they can usefully be given more than once.
+
+#include_dir = '...' # include files ending in '.conf' from
+ # a directory, e.g., 'conf.d'
+#include_if_exists = '...' # include file only if it exists
+#include = '...' # include file
+
+
+#------------------------------------------------------------------------------
+# CUSTOMIZED OPTIONS
+#------------------------------------------------------------------------------
+
+# Add settings for extensions here
diff --git a/root/etc/e-smith/templates/var/lib/pgsql/13/data/postgresql.conf/20ConnxParms b/root/etc/e-smith/templates/var/lib/pgsql/13/data/postgresql.conf/20ConnxParms
new file mode 100644
index 0000000..371a7ab
--- /dev/null
+++ b/root/etc/e-smith/templates/var/lib/pgsql/13/data/postgresql.conf/20ConnxParms
@@ -0,0 +1,24 @@
+# <<<<<<<<<<<<<<<<<<<<<<<<< >>>>>>>>>>>>>>>>>>>>>>>>>
+# # what IP address(es) to listen on;
+{
+ my $local = $postgresql{LocalNetworkingOnly} || 'yes';
+ my $access = $postgresql{access} || 'localhost';
+ $OUT = "listen_addresses = ";
+ $OUT .= ($local eq 'yes') ? "localhost\n" :
+ ($access eq 'public') ? "*\n" :
+ ($access eq 'private') ? "127.0.0.1,$LocalIP\n" : "127.0.0.1\n";
+
+ $OUT .= <<"END";
+port = 5432
+max_connections = 100 # (change requires restart)
+superuser_reserved_connections = 2 # (change requires restart)
+END
+
+ $OUT .= "##ssl = on # (change requires restart)";
+ $OUT .= "##ssl_cert_file = '$SystemName.$DomainName.crt' # (change requires restart)\n";
+ $OUT .= "##ssl_key_file = '$SystemName.$DomainName.key' # (change requires restart)\n";
+}
+
+password_encryption = on
+
+shared_buffers = 128MB # min 128kB
diff --git a/root/etc/e-smith/templates/var/lib/pgsql/13/data/postgresql.conf/21WalParm b/root/etc/e-smith/templates/var/lib/pgsql/13/data/postgresql.conf/21WalParm
new file mode 100644
index 0000000..2b41f47
--- /dev/null
+++ b/root/etc/e-smith/templates/var/lib/pgsql/13/data/postgresql.conf/21WalParm
@@ -0,0 +1,7 @@
+wal_level = hot_standby
+max_wal_senders = 5
+min_wal_size = '32MB'
+max_wal_size = '32MB'
+##wal_keep_segments = 24
+hot_standby = on
+wal_log_hints = on
diff --git a/root/etc/e-smith/templates/var/lib/pgsql/13/data/postgresql.conf/22Locales b/root/etc/e-smith/templates/var/lib/pgsql/13/data/postgresql.conf/22Locales
new file mode 100644
index 0000000..ec7aae6
--- /dev/null
+++ b/root/etc/e-smith/templates/var/lib/pgsql/13/data/postgresql.conf/22Locales
@@ -0,0 +1,13 @@
+{
+
+$OUT =<" 1>&2
+ exit 1
+fi
+# We should only do something if $1 is 'start'.
+if [ $1 != "start" ] && [ $1 != "restart" ]; then
+ exit 0
+fi
+
+psql='/usr/pgsql-13/bin/psql'
+createdb='/usr/pgsql-13/bin/createdb'
+
+M="Waiting for postgresql to startup: ."
+for i in $(seq 1 30)
+do
+ if chpst -u postgres $psql -f - template1 < /dev/null 2>/dev/null
+ then
+ if [ "$M" = "." ]
+ then
+ echo
+ fi
+ exit_value=0
+ HOME=/root
+ export HOME
+ for link in $(find /etc/e-smith/pgsql/init -type f -o -type l | sort)
+ do
+ F=$(basename $link | sed s/S[0-9][0-9]//)
+ case $F in
+ *.sql)
+ D=$(echo $F | sed 's/\.sql$//')
+ action "Creating database $D in postgresql" chpst -u postgres $createdb -T template0 $D
+ action "Loading $F into postgresql" chpst -u postgres $psql $D < $link && /bin/rm $link
+ ;;
+ *)
+ action "Loading $F into postgresql" chpst -u postgres $link && /bin/rm $link
+ ;;
+ esac
+ # Record any failure for the final return value.
+ if [ $? -ne 0 ]; then
+ exit_value=1
+ fi
+ done
+ exit $exit_value
+ fi
+ echo -n $M
+ M=.
+ sleep 2
+done
+echo "Timed out waiting for postgresql to startup" >&2
+exit 1
diff --git a/root/sbin/e-smith/systemd/postgresql-initialize b/root/sbin/e-smith/systemd/postgresql-initialize
new file mode 100644
index 0000000..eb0b94e
--- /dev/null
+++ b/root/sbin/e-smith/systemd/postgresql-initialize
@@ -0,0 +1,13 @@
+#! /bin/sh
+
+PG_VERSION='13'
+
+exec 2>&1
+if !( /usr/pgsql-${PG_VERSION}/bin/postgresql-${PG_VERSION}-check-db-dir /var/lib/pgsql/${PG_VERSION}/data > /dev/null )
+then
+ PGSETUP_INITDB_OPTIONS="--pwfile='/var/lib/pgsql/.pg_pwd'" \
+ /usr/pgsql-${PG_VERSION}/bin/postgresql-${PG_VERSION}-setup initdb
+ /sbin/e-smith/expand-template /etc/e-smith/pgsql/init/00_restore_backup
+#else
+# ?? /bin/pgsql -U postgres < /var/lib/pgsql/set.password
+fi
diff --git a/root/usr/lib/systemd/system/pgsql.init.service b/root/usr/lib/systemd/system/pgsql.init.service
new file mode 100644
index 0000000..b339749
--- /dev/null
+++ b/root/usr/lib/systemd/system/pgsql.init.service
@@ -0,0 +1,20 @@
+[Unit]
+SourcePath=/etc/rc.d/init.d/pgsql.init
+Description=Koozali SME Server pgsql DB injector for postgresql-13
+After=postgresql-13.service
+Requires=postgresql-13.service
+
+[Service]
+Type=oneshot
+Restart=no
+TimeoutSec=10min
+IgnoreSIGPIPE=no
+KillMode=process
+GuessMainPID=no
+RemainAfterExit=yes
+ExecStart=/etc/rc.d/init.d/pgsql.init start
+ExecStop=/etc/rc.d/init.d/pgsql.init stop
+
+[Install]
+WantedBy=sme-server.target
+
diff --git a/root/usr/lib/systemd/system/postgresql-13.service.d/51koozali.conf b/root/usr/lib/systemd/system/postgresql-13.service.d/51koozali.conf
new file mode 100644
index 0000000..3ef8f84
--- /dev/null
+++ b/root/usr/lib/systemd/system/postgresql-13.service.d/51koozali.conf
@@ -0,0 +1,46 @@
+[Unit]
+Description=PostgreSQL 13 database server
+Documentation=https://www.postgresql.org/docs/13/static/
+After=syslog.target
+After=network.target
+
+[Service]
+Type=simple
+
+User=root
+Group=postgres
+
+# Location of database directory
+Environment=PGDATA=/var/lib/pgsql/13/data/
+
+# This is normally controlled by the global default set by systemd
+# StandardOutput=syslog
+
+# Disable OOM kill on the postmaster
+OOMScoreAdjust=-1000
+Environment=PG_OOM_ADJUST_FILE=/proc/self/oom_score_adj
+Environment=PG_OOM_ADJUST_VALUE=0
+
+
+#reset
+ExecStartPre=
+#ours : we need root user as + and ! are not yet supported
+ExecStartPre=-/sbin/e-smith/service-status postgresql-13
+ExecStartPre=/sbin/e-smith/systemd/postgresql-initialize
+ExecStartPre=/usr/pgsql-13/bin/postgresql-13-check-db-dir ${PGDATA}
+ExecStartPre=-/sbin/e-smith/expand-template /var/lib/pgsql/13/data/postgresql.conf
+ExecStartPre=-/sbin/e-smith/expand-template /var/lib/pgsql/13/data/pg_hba.conf
+
+#reset
+ExecStart=
+#ours
+ExecStart=/bin/su -s /bin/bash postgres -c "/usr/pgsql-13/bin/postmaster -D ${PGDATA}"
+ExecReload=/bin/su -s /bin/bash postgres -c "/bin/kill -HUP $MAINPID"
+KillMode=mixed
+KillSignal=SIGINT
+
+# Do not set any timeout value, so that systemd will not kill postmaster
+TimeoutSec=0
+
+[Install]
+WantedBy=sme-server.target
diff --git a/root/var/.gitignore b/root/var/.gitignore
new file mode 100644
index 0000000..e69de29
diff --git a/smeserver-postgresql.spec b/smeserver-postgresql.spec
new file mode 100644
index 0000000..0ffc4ed
--- /dev/null
+++ b/smeserver-postgresql.spec
@@ -0,0 +1,179 @@
+Summary: e-smith specific postgresql configuration and templates.
+%define name smeserver-postgresql
+Name: %{name}
+%define version 0.2.0
+%define pg_ver 13
+%define release 5
+Version: %{version}
+Release: %{release}%{?dist}
+License: GPL
+Group: Networking/Daemons
+Source: %{name}-%{version}.tar.xz
+
+BuildRoot: /var/tmp/%{name}-%{version}-%{release}-buildroot
+BuildArch: noarch
+BuildRequires: e-smith-devtools >= 2.6.0-10
+Requires: e-smith-base >= 5.8.1
+Requires: e-smith-lib >= 2.6.0-14
+Requires: postgresql%{pg_ver}
+Requires: postgresql%{pg_ver}-server
+Requires: postgresql%{pg_ver}-libs
+Requires: postgresql%{pg_ver}-contrib
+AutoReqProv: no
+
+%description
+This package adds necessary startup and configuration items for
+postgresql.
+
+%prep
+%setup
+
+%build
+mkdir -p root/etc/e-smith/pgsql/init
+perl createlinks
+
+mkdir -p root/var/log/postgresql
+mkdir -p root/home/e-smith/db/pgsql
+mkdir -p root/etc/e-smith/pgsql/init
+#ln -s root/var/lib/pgsql/%{pg_ver} root/var/lib/pgsql/cur
+
+%install
+rm -rf $RPM_BUILD_ROOT
+(cd root ; find . -depth -print | cpio -dump $RPM_BUILD_ROOT)
+/sbin/e-smith/genfilelist $RPM_BUILD_ROOT \
+ --file /sbin/e-smith/systemd/postgresql-initialize 'attr(0554,root,root)' \
+ --dir '/var/log/postgresql' 'attr(2750,postgres,postgres)' \
+ --dir '/home/e-smith/db/pgsql' 'attr(0750,root,root)' \
+ > %{name}-%{version}-filelist
+echo "%doc COPYING" >> %{name}-%{version}-filelist
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files -f %{name}-%{version}-filelist
+%defattr(-,root,root)
+
+%changelog
+* Sat Sep 07 2024 cvs2git.sh aka Brian Read 0.2.0-5.sme
+- Roll up patches and move to git repo [SME: 12338]
+
+* Sat Sep 07 2024 BogusDateBot
+- Eliminated rpmbuild "bogus date" warnings due to inconsistent weekday,
+ by assuming the date is correct and changing the weekday.
+
+* Mon Dec 26 2022 Jean-Philippe Pialasse 0.2.0-4.sme
+- fix failing pgsql.init service preventing restore [SME: 12290]
+
+* Mon Dec 12 2022 Jean-Philippe Pialasse 0.2.0-3.sme
+- fix pre-backup event fails error 256 [SME: 12264]
+
+* Fri Dec 02 2022 Jean-Philippe Pialasse 0.2.0-2.sme
+- fix preset OUT missing
+
+* Wed Nov 17 2021 Michel Begue 0.2.0-1
+- First import to Sme 10 (postgresql13)
+
+* Tue Sep 11 2007 Charlie Brady 0.0.1-24
+- Add support for localhost/private/public access settings to
+ determine which network interfaces to bind to.
+
+* Thu May 24 2007 Charlie Brady 0.0.1-23
+- Determine correct format for network access specs in postgresql.conf
+ at template expansion time (postgresql 7 and 8 need different
+ directives).
+
+* Sun Apr 29 2007 Shad L. Lords
+- Clean up spec so package can be built by koji/plague
+
+* Tue Feb 06 2007 Charlie Brady 0.0.1-22
+- Escape braces in full restore template.
+
+* Thu Dec 07 2006 Shad L. Lords
+- Update to new release naming. No functional changes.
+- Make Packager generic
+
+* Fri Dec 01 2006 Charlie Brady 0.0.1-21
+- Tighten permissions of dump file so that it is never world
+ readable.
+- Fix restore scriptlet so that it exits silently if there is no
+ dump to restore from.
+- Fix taint problem with restore script.
+- Fix services2adjust symlink names so that postgresl is stopped
+ prior to restore, and restarted during timezone change.
+
+* Wed Oct 18 2006 Charlie Brady 0.0.1-20
+- Expand template for 00_restore_backup pgsql.init script during
+ pre-restore event, so that the dump is restored following next
+ reboot.
+
+* Tue Oct 17 2006 Charlie Brady 0.0.1-19
+- Fix permissions problem with restore from backup.
+
+* Mon Sep 25 2006 Charlie Brady 0.0.1-18
+- Ensure that pre-backup event does not fail if postgresql is disabled.
+- Apply sigterm patch - included in -17 source, but not applied in build.
+
+* Thu Sep 21 2006 Charlie Brady 0.0.1-17
+- Add control/t script so that SIGINT is used to terminate postgresql
+ (so that existing connections cannot keep the server up indefinitely).
+
+* Thu Sep 14 2006 Charlie Brady 0.0.1-16
+- Fix run script so that conf templates are not run until after
+ initdb.
+
+* Thu Sep 7 2006 Charlie Brady 0.0.1-15
+- Fix permissions of run files (typo).
+
+* Tue Aug 29 2006 Charlie Brady 0.0.1-14
+- Fix comparison operator in tcpip template fragment.
+
+* Tue Aug 29 2006 Charlie Brady 0.0.1-13
+- Fix ownership of config files (typo).
+
+* Tue Aug 29 2006 Charlie Brady 0.0.1-12
+- Run all pgsql.init scripts is user 'postgres'.
+
+* Thu Aug 24 2006 Charlie Brady 0.0.1-11
+- Require passwords for local socket and loopback socket connections
+ except for 'postgres' user connecting via Unix domain socket.
+
+* Mon Aug 21 2006 Charlie Brady 0.0.1-10
+- Add option to accept connections on tcpip socket.
+
+* Fri Aug 04 2006 Charlie Brady 0.0.1-09
+- Fix permissions on log/run file, and fix name of pgsql/init
+ directory.
+
+* Wed Jun 28 2006 Charlie Brady
+- [0.0.1-08]
+- Deal more correctly with pgsql.init startup race condition.
+
+* Wed Jun 28 2006 Charlie Brady
+- [0.0.1-07]
+- Add full database restore feature.
+
+* Wed Jun 28 2006 Charlie Brady
+- [0.0.1-06]
+- Move config templates to the correct place.
+- Fix delete-db action to remove empty subdirectories of
+ /var/lib/pgsql/data.
+
+* Wed Jun 28 2006 Charlie Brady
+- [0.0.1-05]
+- Use chpst rather than setuidgid in run script.
+
+* Wed Jun 28 2006 Charlie Brady
+- [0.0.1-04]
+- Add minimal templated configuration files.
+
+* Wed Jun 28 2006 Charlie Brady
+- [0.0.1-03]
+- Fix broken pqsql.init.
+
+* Wed Jun 28 2006 Charlie Brady
+- [0.0.1-02]
+- Add missing /etc/e-smith/pgsql/init directory
+
+* Wed May 24 2006 Charlie Brady
+- [0.0.1-01]
+- initial release