summaryrefslogtreecommitdiff
path: root/community/dspam/dspam.install
blob: 0cdd547727256fe19dadfbc433a2a968059d91b6 (plain)
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
post_install() {
  echo -n "adding dspam system group... "
  groupadd -g 115 dspam && echo "done."
  echo -n "adding dspam system user... "
  useradd -c "DSPAM Daemon" -u 115 -d /var/lib/dspam -g dspam -s /bin/false dspam \
    && echo "done."
  passwd -l dspam &>/dev/null
  chown root:dspam usr/bin/dspam{,c}
  chown -R root:dspam etc/dspam
  chmod g+rs usr/bin/dspam{,c}
  systemd-tmpfiles --create dspam.conf

cat << EOF
>>> To populate the DSPAM database, you need to follow several steps.
>>> First create a database. Login to the mysql command prompt.
    $ mysql -u root -p
    mysql> CREATE database dspam;
>>> Next, you need to create a dspam user. At the same MySQL prompt:
    mysql> GRANT ALL PRIVILEGES ON dspam.* TO dspam@'localhost' IDENTIFIED BY 'passwd';
>>> Replacing passwd with your chosen password.
>>> If you want a space optimized db do:
    $ mysql -u dspam dspam -p < /var/lib/dspam/mysql/mysql_objects-space.sql
>>> If you want a speed optimized db do:
    $ mysql -u dspam dspam -p < /var/lib/dspam/mysql/mysql_objects-speed.sql
>>> Enter the password you set in the previous step, and the database should be populated.

>>> Remember to edit /etc/dspam/dspam.conf accordenly
>>> If you want to use the postgresql, sqlite3 or Berekely DB4 backends,
>>> read the documentation
>>>
EOF
}

post_upgrade() {
  chown root:dspam usr/bin/dspam{,c}
  chown -R root:dspam etc/dspam
  chmod g+s usr/bin/dspamc
  systemd-tmpfiles --create dspam.conf
}

post_remove() {
  echo -n -e "\nremoving dspam system user and group..."
  userdel dspam && echo "done."
}