#!/bin/sh set -e PATH=/sbin:/usr/sbin:/bin:/usr/bin:$PATH [ -x /usr/sbin/postalias ] || exit 0 [ -f /etc/postfix/main.cf ] || exit 0 gecos="/var/lib/postfix-cn/aliases_gecos" grep -q "hash:$gecos" /etc/postfix/main.cf || exit 0 [ -d /var/lib/postfix-cn/ ] || exit 0 # Load CARNET Tools . /usr/share/carnet-tools/functions.sh awk -F: ' $3 >= 100 && $1 != "nobody" && $5 \ { split($5, g, ","); if (g[1]=="") {next}; gsub(/ /, ".", g[1]); print tolower(g[1]) ": " $1; }' < /etc/passwd > $gecos.dpkg-tmp.$$ if ! cmp -s $gecos.dpkg-tmp.$$ $gecos > /dev/null; then cp_mv $gecos.dpkg-tmp.$$ $gecos postalias hash:$gecos else rm -f $gecos.dpkg-tmp.$$ fi