Sophie

Sophie

distrib > Mandriva > 10.0 > i586 > media > updates > by-pkgid > 5db5b94fc31c810a6866b8dd191bebc4 > scriptlet

mailman-2.1.4-2.3.100mdk.i586.rpm

PREIN

/bin/sh
if [ $1 = "2" ]; then
	if [ ! -L /usr/lib/mailman/Mailman/mm_cfg.py ]; then
		mv /usr/lib/mailman/Mailman/mm_cfg.py /etc/mailman.tmp
	fi
	if [ ! -L /var/lib/mailman/logs ]; then
		mv /var/lib/mailman/logs /var/log/mailman
	fi
fi

PREUN

/bin/sh
/usr/share/rpm-helper/del-service mailman $1 mailman 

if [ $1 = 0 ]; then
  # since we compile pyc files during %post, we need to remove them here on uninstall
  find /usr/lib/mailman/Mailman -name *.pyc -exec rm -f {} \;
  find /usr/lib/mailman/pythonlib -name *.pyc -exec rm -f {} \;
  rm -f /usr/lib/mailman/{bin,cron}/paths.pyc
fi

POSTIN

/bin/sh
/usr/share/rpm-helper/add-service mailman $1 mailman 

# we have to do the compilation post install otherwise buildroot is always
# embedded in the binaries
echo "Post-install compilation..."
/usr/bin/python -c 'from compileall import *; compile_dir("/usr/lib/mailman/Mailman")' >/dev/null

cd /usr/lib/mailman

if [ $1 = 1 ]; then
  # installation

  # generic tasks

  # mailman basic configuration
  cat >>Mailman/mm_cfg.py <<EOF
DEFAULT_EMAIL_HOST = '`hostname`'
DEFAULT_URL_HOST = '`hostname`'
add_virtualhost(DEFAULT_URL_HOST, DEFAULT_EMAIL_HOST)
EOF

  # locale setup
  lang=`echo $LANGUAGE | awk -F: '{print $2}'`
  if [ "$lang" != "en" ] && [ -n "$lang" ]; then
    cat >>Mailman/mm_cfg.py <<EOF
DEFAULT_SERVER_LANGUAGE = '$lang'
EOF
  fi

  # add cron task
  crontab -u mail /usr/lib/mailman/cron/crontab.in

  # restart web server
  /sbin/service httpd graceful

  # check mta
  mta="`readlink /etc/alternatives/mta 2>/dev/null | cut -d . -f 2`"

  # mta specific tasks
  if [ "$mta" == "postfix" ]; then
    cat >>Mailman/mm_cfg.py <<EOF
MTA = 'Postfix'
EOF
    postconf -e \
    	'owner_request_special = no' \
    	'recipient_delimiter = +' \
    	'alias_maps = '`/usr/sbin/postconf -h alias_maps`', hash:/var/lib/mailman/data/aliases'

  fi

  # check kernel secure
  if [ `uname -r | grep -c secure` != 0 ]; then
     echo ''
     echo '*****'
     cd /usr/lib/mailman/bin
     echo 'Running kernel-secure, executing'
     echo '/usr/lib/mailman/bin/check_perms_grsecurity.py'
     echo 'for proper mailman functionality'
     echo '*****'
     ./check_perms -f > /dev/null
     ./check_perms_grsecurity.py -f
  fi

  # (sb) msec wipes out log file perms, add to perm.local
  if [ ! -e /etc/security/msec/perm.local ] || [ `grep -cs mailman /etc/security/msec/perm.local` -lt 4 ]; then
     cat >>/etc/security/msec/perm.local <<EOF
/var/log/mailman/error			root.mail	0664	force
/var/log/mailman/qrunner		mail.mail       0664	force
/var/log/mailman/smtp			mail.mail       0664	force
/var/log/mailman/update.log             root.mail       0644	force
EOF
  fi
  echo ''
  echo '*****'

  echo '* You must now "cd /usr/lib/mailman/; ./bin/mmsitepass" as root to set the'
  echo '* site password to be used for administrating all Mailman data as necessary.'
  echo '*****'
  echo ''
  echo '*****'
  echo '* You must also "cd /usr/lib/mailman/; su -c "./bin/newlist mailman" mail" as root to'
  echo '* setup the base mailman maillist - answer the questions appropriately.'
  echo '*****'
  echo ''
  echo '*****'
  echo '* You should then issue the command "service mailman start" as root to start the server.'
  echo '*****'
  echo ''
else
  # upgrade
  bin/update > /var/log/mailman/update.log
  echo ''
  echo '* If you are migrating older mailman lists, under postfix, make sure the aliases reside under /var/lib/mailman/data, owned by mail.mail'
  echo '*****'
  echo ''
  if [ -f /etc/mailman.tmp ]; then
  mv -f /etc/mailman.tmp /etc/mailman
  fi
fi

POSTUN

/bin/sh
if [ $1 = 0 ]; then
  # generic tasks

  # remove cron task
  crontab -u mail -r

  # restart web server
  /sbin/service httpd graceful

  # check mta
  mta="`readlink /etc/alternatives/mta 2>/dev/null | cut -d . -f 2`"

  # mta specific tasks
  if [ "$mta" == "postfix" ]; then
    postconf -e 'alias_maps = '`/usr/sbin/postconf -h alias_maps | sed -e 's|, hash:/var/lib/mailman/data/aliases||'`
  fi
fi