From 221f9e42136e6d66a036e321c99b20c783da4b48 Mon Sep 17 00:00:00 2001 From: mbussolotto Date: Fri, 11 Aug 2023 15:24:54 +0200 Subject: [PATCH] setup postfix hostname using conf file --- susemanager/bin/mgr-setup | 23 ++++--------------- .../susemanager.changes.mbussolotto.postfix | 1 + utils/spacewalk-hostname-rename | 4 ++++ 3 files changed, 9 insertions(+), 19 deletions(-) create mode 100644 susemanager/susemanager.changes.mbussolotto.postfix diff --git a/susemanager/bin/mgr-setup b/susemanager/bin/mgr-setup index 9b555254b168..797a0dc45706 100755 --- a/susemanager/bin/mgr-setup +++ b/susemanager/bin/mgr-setup @@ -172,25 +172,10 @@ fi } setup_mail () { - -# fix hostname for postfix -REALHOSTNAME=`hostname -f` -if [ -z "$REALHOSTNAME" ]; then - for i in `ip -f inet -o addr show scope global | awk '{print $4}' | awk -F \/ '{print $1}'`; do - for j in `dig +noall +answer +time=2 +tries=1 -x $i | awk '{print $5}' | sed 's/\.$//'`; do - if [ -n "$j" ]; then - REALHOSTNAME=$j - break 2 - fi - done - done -fi -if [ -n "$REALHOSTNAME" ]; then - echo "$REALHOSTNAME" > /etc/hostname -fi -# bsc#979664 - SUSE Manager requires a working mail system -systemctl --quiet enable postfix 2>&1 -systemctl restart postfix + postconf -e myhostname=$HOSTNAME + # bsc#979664 - SUSE Manager requires a working mail system + systemctl --quiet enable postfix 2>&1 + systemctl restart postfix } setup_hostname() { diff --git a/susemanager/susemanager.changes.mbussolotto.postfix b/susemanager/susemanager.changes.mbussolotto.postfix new file mode 100644 index 000000000000..76abe2b83535 --- /dev/null +++ b/susemanager/susemanager.changes.mbussolotto.postfix @@ -0,0 +1 @@ +- setup postfix hostname using conf file diff --git a/utils/spacewalk-hostname-rename b/utils/spacewalk-hostname-rename index cde5ff6c0723..66931e5890c7 100755 --- a/utils/spacewalk-hostname-rename +++ b/utils/spacewalk-hostname-rename @@ -638,6 +638,10 @@ if [ -e $MGR_SYNC_CONF ]; then fi print_status 0 # just simulate end +echo -n "Changing postfix settings ... " | tee -a $LOG +postconf -e myhostname=$HOSTNAME +systemctl restart postfix + echo -n "Starting spacewalk services ... " | tee -a $LOG if [ "$DB_SERVICE" != "" ] then