all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH manager] debian: postinst: copy notifications.cfg from /usr/share/pve-manager
@ 2023-11-09 13:50 Lukas Wagner
  0 siblings, 0 replies; only message in thread
From: Lukas Wagner @ 2023-11-09 13:50 UTC (permalink / raw)
  To: pve-devel

... instead of using a heredoc in postinst script.

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
---
Requires
"debian: postinst: create notifications.cfg if it does not exist "[1]

from the 
"overhaul notification system, use matchers instead of filters"
patch series

[1] https://lists.proxmox.com/pipermail/pve-devel/2023-November/059824.html

 configs/Makefile          |  1 +
 configs/notifications.cfg |  7 +++++++
 debian/postinst           | 17 +----------------
 3 files changed, 9 insertions(+), 16 deletions(-)
 create mode 100644 configs/notifications.cfg

diff --git a/configs/Makefile b/configs/Makefile
index fd446b5b..575c48b9 100644
--- a/configs/Makefile
+++ b/configs/Makefile
@@ -13,6 +13,7 @@ install: country.dat vzdump.conf pve-sources.list pve-initramfs.conf pve-blackli
 	install -D -m 0644 vzdump.conf $(DESTDIR)/etc/vzdump.conf
 	install -D -m 0644 pve-initramfs.conf $(DESTDIR)/etc/initramfs-tools/conf.d/pve-initramfs.conf
 	install -D -m 0644 country.dat $(DESTDIR)/usr/share/$(PACKAGE)/country.dat
+	install -D -m 0644 notifications.cfg $(DESTDIR)/usr/share/$(PACKAGE)/notifications.cfg
 
 clean:
 	rm -f country.dat
diff --git a/configs/notifications.cfg b/configs/notifications.cfg
new file mode 100644
index 00000000..57c496c5
--- /dev/null
+++ b/configs/notifications.cfg
@@ -0,0 +1,7 @@
+sendmail: default-target
+        mailto-user root@pam
+        comment Send mails to root@pam's email address
+
+matcher: default-matcher
+        target default-target
+        comment Send all notifications to 'default-target'
diff --git a/debian/postinst b/debian/postinst
index 7dad2b1a..3f941486 100755
--- a/debian/postinst
+++ b/debian/postinst
@@ -93,27 +93,12 @@ migrate_apt_auth_conf() {
     fi
 }
 
-write_notification_cfg() {
-        # Create default config:
-        # A sendmail-target that sends to root@pam, and a
-        # matcher that sends all notifications to this target
-        cat >> /etc/pve/notifications.cfg <<EOF
-sendmail: default-target
-        mailto-user root@pam
-        comment Send mails to root@pam's email address
-
-matcher: default-matcher
-        target default-target
-        comment Send all notifications to 'default-target'
-EOF
-}
-
 create_default_notification_cfg() {
     if ! test -f /etc/pve/notifications.cfg ; then
         echo "Creating default 'notifications.cfg' file"
 
         # Only warn in case we cannot write to pmxcfs
-        if ! write_notification_cfg ; then
+        if ! cp /usr/share/pve-manager/notifications.cfg /etc/pve/notifications.cfg ; then
             echo "Could not create default 'notifications.cfg' file"
         fi
     fi
-- 
2.39.2





^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-11-09 13:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-09 13:50 [pve-devel] [PATCH manager] debian: postinst: copy notifications.cfg from /usr/share/pve-manager Lukas Wagner

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal