Alternc  latest
Alternc logiel libre pour l'hébergement
3.4.0.sh
Go to the documentation of this file.
1 #!/bin/bash
2 
3 # this script is for 3.1.2 or 3.2.2
4 # we named it 3.4.0.sh since some of us had a 3.3.0~a.sql installed at some point in time
5 # which means the alternc_status table have this number in mind.
6 # so we need to have a bigger one
7 . /etc/alternc/local.sh
8 
9 echo "Fix OpenDKIM key generation"
10 /usr/lib/alternc/alternc_fix_opendkim.php
11 
12 echo "Fix phpmyadmin special user"
13 /usr/lib/alternc/alternc_fix_myadm_users.php
14 
15 echo "Fix of dovecot quotas"
16 /usr/lib/alternc/update_quota_mail.sh
17 
18 DIDSOMETHING=1
19 while [ "$DIDSOMETHING" -gt 0 ]
20 do
21  DIDSOMETHING=0
22  for name in $(mysql --defaults-file=/etc/alternc/my.cnf --skip-column-names -B -e "SELECT name FROM variable GROUP BY name HAVING COUNT(*)>1;")
23  do
24  mysql --defaults-file=/etc/alternc/my.cnf -e "DELETE FROM variable WHERE name='$name' LIMIT 1"
25  DIDSOMETHING=1
26  done
27 done
28 
29 # NOW we rollback the 3.3.0~a.sql crappy upgrade some of us had ...
30 for field in id strata strata_id type
31 do
32  mysql --defaults-file=/etc/alternc/my.cnf -f -e "ALTER TABLE variable DROP $field;"
33 done
34 mysql --defaults-file=/etc/alternc/my.cnf -f -e "ALTER TABLE variable DROP PRIMARY KEY;"
35 
36 mysql --defaults-file=/etc/alternc/my.cnf -f -e "ALTER TABLE variable DROP KEY name_2"
37 mysql --defaults-file=/etc/alternc/my.cnf -f -e "ALTER TABLE variable DROP KEY name"
38 mysql --defaults-file=/etc/alternc/my.cnf -f -e "ALTER TABLE variable ADD PRIMARY KEY name (name)"
39 
40 # and we fix variable if needed :
41 mysql --defaults-file=/etc/alternc/my.cnf -f -e "UPDATE variable SET value='$FQDN' WHERE value='%%FQDN%%'"
42 
43 mysql --defaults-file=/etc/alternc/my.cnf -f -e "INSERT IGNORE INTO variable SET name='mailname_bounce', value='$FQDN', comment='FQDN of the mail server, used to create vhost virtual mail_adress.';"