We only warn on failure so that the postinst script does not fail in case pmxcfs is not running.
Signed-off-by: Lukas Wagner <[email protected]> --- debian/postinst | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/debian/postinst b/debian/postinst index 4c9a1f25..7dad2b1a 100755 --- a/debian/postinst +++ b/debian/postinst @@ -93,6 +93,32 @@ 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 + echo "Could not create default 'notifications.cfg' file" + fi + fi +} + case "$1" in triggered) # We don't print a status message here, as dpkg already said @@ -167,6 +193,8 @@ case "$1" in set_lvm_conf + create_default_notification_cfg + if test ! -e /proxmox_install_mode; then # modeled after code generated by dh_start for unit in ${UNITS}; do -- 2.39.2 _______________________________________________ pve-devel mailing list [email protected] https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
