3 # fetchmaildistrib --- Distribute central fetchmail knowledge.
5 # The central fetchmail database, /etc/fetchmail, contains all accounts that
6 # are to be fetched by the root's daemon. Often, a user desires quicker
7 # access (e.g., when testing some email path). In such cases, the destination
8 # user (marked as is USER here in the poll lines) should set up a ~/.fetchmailrc
9 # for himself. This scripts generates such lines from the central file.
13 # From stdin, select poll lines for user $1
14 function selectuser () {
15 grep ^poll | grep "is $1 here"
19 for i in `cut -d: -f1 </etc/passwd`
20 do homedir=`grep ^$i: /etc/passwd | cut -d: -f6`
21 fetchfile=`selectuser $i </etc/fetchmailrc`
22 if [ -z "$fetchfile" ]
23 then rm -f $homedir/.fetchmailrc
24 else cp /dev/null $homedir/.fetchmailrc
25 chmod go-rwx $homedir/.fetchmailrc
26 grep ^defaults /etc/fetchmailrc >>$homedir/.fetchmailrc
27 selectuser $i </etc/fetchmailrc >>$homedir/.fetchmailrc