smeserver-postgresql/createlinks

77 lines
2.9 KiB
Perl
Executable File

#!/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");