File: functions

package info (click to toggle)
postfix 2.7.1-1%2Bsqueeze1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 19,012 kB
  • ctags: 13,339
  • sloc: ansic: 93,261; makefile: 12,027; sh: 4,995; perl: 2,518; python: 182; awk: 124
file content (26 lines) | stat: -rw-r--r-- 671 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
DISTRO=$(lsb_release -is 2>/dev/null || echo Debian)
addmap()
{   
    name=$1
    if [ "x$2" != "x" ]; then
	mkmap=${2:=}
    fi
    FILE=/etc/postfix/dynamicmaps.cf
    if ! grep -q "^${name}[[:space:]]" ${FILE}; then
	 echo "Adding ${name} map entry to ${FILE}"
	 echo "${name}	/usr/lib/postfix/dict_${name}.so		dict_${name}_open	${mkmap}" >> ${FILE}
    fi
    return 0
}
delmap()
{   
    name=$1
    FILE=/etc/postfix/dynamicmaps.cf
    if grep -q "^${name}[[:space:]]" ${FILE}; then
	 echo "Removing ${name} map entry from ${FILE}"
	 sed "/^${name}[[:space:]]/d" ${FILE} > ${FILE}.$$ && \
	     cp ${FILE}.$$ ${FILE} && \
	     rm ${FILE}.$$
    fi
    return 0
}