From a4ba21d174f931287f889fed8555898e26b424eb Mon Sep 17 00:00:00 2001 From: William Petit Date: Thu, 2 Sep 2021 14:41:04 +0200 Subject: [PATCH] Create staging dist branch --- conf/pg_backup.conf | 2 +- debian/compat | 1 + debian/control | 14 ++++++++++++++ debian/postgres-backup.dirs | 1 + debian/postgres-backup.links | 2 ++ debian/postgres-backup.postinst | 4 ++++ debian/postgres-backup.service | 10 ++++++++++ debian/postgres-backup.timer | 9 +++++++++ debian/rules | 24 ++++++++++++++++++++++++ debian/source/format | 1 + 10 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 debian/compat create mode 100644 debian/control create mode 100644 debian/postgres-backup.dirs create mode 100644 debian/postgres-backup.links create mode 100644 debian/postgres-backup.postinst create mode 100644 debian/postgres-backup.service create mode 100644 debian/postgres-backup.timer create mode 100644 debian/rules create mode 100644 debian/source/format diff --git a/conf/pg_backup.conf b/conf/pg_backup.conf index 2f9dd66..64a9044 100644 --- a/conf/pg_backup.conf +++ b/conf/pg_backup.conf @@ -7,7 +7,7 @@ BACKUP_USER=postgres # Optional hostname to adhere to pg_hba policies. Will default to "localhost" if none specified. -HOSTNAME=/var/run/postgresql +HOSTNAME= # Optional username to connect to database as. Will default to "postgres" if none specified. USERNAME= diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..ec63514 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +9 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..29b1a2f --- /dev/null +++ b/debian/control @@ -0,0 +1,14 @@ +Source: postgres-backup +Section: unknown +Priority: optional +Maintainer: Cadoles +Build-Depends: debhelper (>= 8.0.0), dh-systemd (>= 1.5) +Standards-Version: 3.9.4 +Homepage: http://forge.cadoles.com/Cadoles/postgres-backup +Vcs-Git: http://forge.cadoles.com/Cadoles/postgres-backup.git +Vcs-Browser: http://forge.cadoles.com/Cadoles/postgres-backup + +Package: postgres-backup +Architecture: amd64 +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: PostgreSQL backup scripts diff --git a/debian/postgres-backup.dirs b/debian/postgres-backup.dirs new file mode 100644 index 0000000..c896bd1 --- /dev/null +++ b/debian/postgres-backup.dirs @@ -0,0 +1 @@ +/var/backups/database/postgresql \ No newline at end of file diff --git a/debian/postgres-backup.links b/debian/postgres-backup.links new file mode 100644 index 0000000..6bd6498 --- /dev/null +++ b/debian/postgres-backup.links @@ -0,0 +1,2 @@ +/usr/share/postgres-backup/pg_backup.sh /usr/bin/pg_backup.sh +/usr/share/postgres-backup/pg_backup_rotated.sh /usr/bin/pg_backup_rotated.sh \ No newline at end of file diff --git a/debian/postgres-backup.postinst b/debian/postgres-backup.postinst new file mode 100644 index 0000000..a05b58d --- /dev/null +++ b/debian/postgres-backup.postinst @@ -0,0 +1,4 @@ +#!/bin/bash + +mkdir -p /var/backups/database/postgresql +chown -R postgres:postgres /var/backups/database/postgresql \ No newline at end of file diff --git a/debian/postgres-backup.service b/debian/postgres-backup.service new file mode 100644 index 0000000..a3547b1 --- /dev/null +++ b/debian/postgres-backup.service @@ -0,0 +1,10 @@ +[Unit] +Description=Run PostgreSQL backup + +[Service] +Type=oneshot +ExecStart=/usr/bin/pg_backup_rotated.sh -c /etc/postgres-backup/pg_backup.conf +User=postgres + +[Install] +WantedBy=default.target \ No newline at end of file diff --git a/debian/postgres-backup.timer b/debian/postgres-backup.timer new file mode 100644 index 0000000..237a6e9 --- /dev/null +++ b/debian/postgres-backup.timer @@ -0,0 +1,9 @@ +[Unit] +Description=Timer for periodic execution of postgres-backup service. + +[Timer] +OnCalendar=daily +Persistent=true + +[Install] +WantedBy=timers.target \ No newline at end of file diff --git a/debian/rules b/debian/rules new file mode 100644 index 0000000..5af568d --- /dev/null +++ b/debian/rules @@ -0,0 +1,24 @@ +#!/usr/bin/make -f +# -*- makefile -*- + +# Uncomment this to turn on verbose mode. +export DH_VERBOSE=1 + +%: + dh $@ --with systemd + +override_dh_auto_install: + mkdir -p debian/postgres-backup/usr/share/postgres-backup + mkdir -p debian/postgres-backup/etc/postgres-backup + mkdir -p debian/postgres-backup/usr/bin + + cp script/pg_backup.sh debian/postgres-backup/usr/share/postgres-backup/pg_backup.sh + cp script/pg_backup_rotated.sh debian/postgres-backup/usr/share/postgres-backup/pg_backup_rotated.sh + cp conf/pg_backup.conf debian/postgres-backup/etc/postgres-backup/pg_backup.conf + + chmod +x debian/postgres-backup/usr/share/postgres-backup/pg_backup_rotated.sh + chmod +x debian/postgres-backup/usr/share/postgres-backup/pg_backup.sh + + install -D -m 644 debian/postgres-backup.timer debian/postgres-backup/lib/systemd/system/postgres-backup.timer + + install -d debian/postgres-backup \ No newline at end of file diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000..9f67427 --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (native) \ No newline at end of file