Projects
home:ajaissle:branches:Kolab:Development
kolab-scripts
check-postfix.sh
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File check-postfix.sh of Package kolab-scripts
#!/bin/bash PATH=/usr/bin:/bin echo -n "Checking create postfix config file in /etc/sysconfig/mail... " eval $(grep ^MAIL_CREATE_CONFIG= /etc/sysconfig/mail) if [[ "$MAIL_CREATE_CONFIG" == "no" ]]; then echo OK else echo BACKUP="/tmp/kolab-check-etc_sysconfig_mail-$(date +%s)" cp /etc/sysconfig/mail $BACKUP sed -i "s/^MAIL_CREATE_CONFIG=.*/MAIL_CREATE_CONFIG=\"no\"/" /etc/sysconfig/mail echo " Changed the setting of MAIL_CREATE_CONFIG to: no" echo " Backup stored at: $BACKUP" echo fi # The following should already be done by kolab-mta's %post macro # It should ensure that each of the settings is present exactly one time. MAINCF=/etc/postfix/main.cf echo -n "Checking postfix $MAINCF... " # Check, if the following settings exist exactly one time. If not, create them. SETTINGS="inet_interfaces local_recipient_maps mydestination transport_maps \ virtual_alias_maps smtpd_tls_auth_only smtpd_recipient_restrictions \ smtpd_sender_restrictions submission_recipient_restrictions \ submission_sender_restrictions submission_data_restrictions content_filter" for SETTING in $SETTINGS; do if [[ $(grep -c "^$SETTING = ." $MAINCF) != 1 ]]; then CHANGE_NEEDED=yes break fi done if [[ "$CHANGE_NEEDED" == "yes" ]]; then echo BACKUP="/tmp/$(tr "/" "_" <<< "$MAINCF" | sed 's/^_//')_$(date +%s)" cp $MAINCF $BACKUP echo " Backup stored at: $BACKUP" for SETTING in $SETTINGS; do if [[ $(grep -c "^$SETTING = ." $MAINCF) == 1 ]]; then echo " $SETTING: OK" else if [[ $(grep -c "^$SETTING =" $MAINCF) != 0 ]]; then sed -i "s/^$SETTING/#$SETTING/" $MAINCF fi echo "$SETTING = default" >> $MAINCF echo " Added Setting: $(grep -i "^$SETTING =" $MAINCF)" fi done else echo OK fi
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.