all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Lukas Wagner <l.wagner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH manager] debian: postinst: copy notifications.cfg from /usr/share/pve-manager
Date: Thu,  9 Nov 2023 14:50:07 +0100	[thread overview]
Message-ID: <20231109135007.542667-1-l.wagner@proxmox.com> (raw)

... 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





                 reply	other threads:[~2023-11-09 13:50 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231109135007.542667-1-l.wagner@proxmox.com \
    --to=l.wagner@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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