Changeset 3139


Ignore:
Timestamp:
04/16/12 16:21:10 (13 months ago)
Author:
squidly
Message:

Dev in progress

Location:
alternc/trunk
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • alternc/trunk/debian/alternc.config

    r2974 r3139  
    2727MYSQL_USER=sysusr 
    2828MYSQL_PASS="`perl -e 'print map{("a".."z","A".."Z",0..9)[int(rand(62))]}(1..10)' `" 
     29MYSQL_MAIL_USER=alternc_mail_user 
     30MYSQL_MAIL_PASS="`perl -e 'print map{("a".."z","A".."Z",0..9)[int(rand(62))]}(1..10)' `" 
    2931MYSQL_CLIENT=localhost 
    3032FQDN="`cat /etc/mailname 2>/dev/null || hostname -f`" 
     
    5456fi 
    5557 
     58if [ -r /etc/alternc/my_mail.cnf ]; then 
     59    # make mysql configuration available as shell variables 
     60    # to convert from .cnf to shell syntax, we: 
     61    # * match only lines with "equal" in them (/=/) 
     62    # * remove whitespace around the = and add a left quote operator ' (;s) 
     63    # * add a right quote operator at the end of line (;s) 
     64    # * convert mysql variables into our MYSQL_ naming convention (;s) 
     65    # * print the result (;p) 
     66    eval `sed -n -e "/=/{s/ *= *\"\?/='/;s/\"\?\$/'/;s/host/MYSQL_HOST/;s/user/MYSQL_MAIL_USER/;s/password/MYSQL_MAIL_PASS/;s/database/MYSQL_DATABASE/;p}" /etc/alternc/my_mail.cnf` 
     67fi 
    5668 
    5769# mettre les valeurs de local.sh comme "default" pour debconf 
     
    158170fi 
    159171 
     172if [ -z "$RET" ] 
     173    then 
     174db_set alternc/mysql/alternc_mail_user "$MYSQL_MAIL_USER" 
     175fi 
     176 
     177if [ -z "$RET" ] 
     178    then 
     179db_set alternc/mysql/alternc_mail_password "$MYSQL_MAIL_PASS" 
     180fi 
    160181db_input medium alternc/desktopname || true 
    161182db_input medium alternc/hostingname || true 
     
    171192db_input low alternc/mysql/user || true 
    172193db_input low alternc/mysql/password || true 
     194db_input low alternc/mysql/alternc_mail_password || true 
     195db_input low alternc/mysql/alternc_mail_user || true 
    173196db_input low alternc/mysql/client || true 
    174197db_input low alternc/sql/backup_type || true 
  • alternc/trunk/debian/alternc.postinst

    r3138 r3139  
    232232                else 
    233233                        echo "running an older version of sudo" 
    234                         echo "copy content of /usr/share/doc/aegir-provision/examples/example.sudoers into /etc/sudoers for aegir to run properly" 
     234                        #FIXME 
     235                        echo "copy content of /usr/share/doc/examples/example.sudoers into /etc/sudoers.d for to run properly" 
    235236          fi 
    236237 
  • alternc/trunk/debian/changelog

    r3138 r3139  
    22 
    33  * Templating of dovecot and postfix 
    4         adding a view for dovecot usage (dovecot_view) 
    5         adding of user vmail dedicated to the mail system 
     4    adding a view for dovecot usage (dovecot_view) 
     5    adding of user vmail dedicated to the mail system 
    66  * Bugfixes 
    77 
     
    3131alternc (1.0.2) stable; urgency=high 
    3232  * Bugfix : dependency on gamin OR fam : gamin is better for courier-imap 
    33         and fam makes sasl imap auth fail 
     33    and fam makes sasl imap auth fail 
    3434  * Bugfix : adding french messages for domain new error messages 
    3535  * Bugfix : Fixing domaines types templates issues (incompatibility with pre 1.0 alternc) 
  • alternc/trunk/etc/alternc/templates/postfix/myalias.cf

    r3137 r3139  
    33# 
    44 
    5 user = %%dbuser%% 
    6 password = %%dbpwd%% 
     5user = %%db_mail_user%% 
     6password = %%db_mail_pwd%% 
    77hosts =%%dbhost%% 
    88dbname = %%dbname%% 
  • alternc/trunk/etc/alternc/templates/postfix/mydomain.cf

    r2990 r3139  
    33# 
    44 
    5 user = %%dbuser%% 
    6 password = %%dbpwd%% 
     5user = %%db_mail_user%% 
     6password = %%db_mail_pwd%% 
    77hosts =%%dbhost%% 
    88dbname = %%dbname%% 
  • alternc/trunk/etc/alternc/templates/postfix/mygid.cf

    r2990 r3139  
    33# 
    44 
    5 user = %%dbuser%% 
    6 password = %%dbpwd%% 
     5user = %%db_mail_user%% 
     6password = %%db_mail_pwd%% 
    77hosts =%%dbhost%% 
    88dbname = %%dbname%% 
  • alternc/trunk/etc/alternc/templates/postfix/myrelay.cf

    r2559 r3139  
    33# 
    44 
    5 user = %%dbuser%% 
    6 password = %%dbpwd%% 
     5user = %%db_mail_user%% 
     6password = %%db_mail_pwd%% 
    77hosts =%%dbhost%% 
    88dbname = %%dbname%% 
  • alternc/trunk/etc/alternc/templates/postfix/myvirtual.cf

    r3137 r3139  
    33# 
    44 
    5 user = %%dbuser%% 
    6 password = %%dbpwd%% 
     5user = %%db_mail_user%% 
     6password = %%db_mail_pwd%% 
    77hosts =%%dbhost%% 
    88dbname = %%dbname%% 
  • alternc/trunk/install/alternc.install

    r2997 r3139  
    111111fi 
    112112 
     113if [ -r /etc/alternc/my_mail.cnf ]; then 
     114    # make mysql configuration available as shell variables 
     115    # to convert from .cnf to shell syntax, we: 
     116    # * match only lines with "equal" in them (/=/) 
     117    # * remove whitespace around the = and add a left quote operator ' (;s) 
     118    # * add a right quote operator at the end of line (;s) 
     119    # * convert mysql variables into our MYSQL_ naming convention (;s) 
     120    # * print the result (;p) 
     121    eval `sed -n -e "/=/{s/ *= *\"\?/='/;s/\"\?\$/'/;s/host/MYSQL_HOST/;s/user/MYSQL_USER/;s/password/MYSQL_PASS/;s/database/MYSQL_DATABASE/;p}" /etc/alternc/my.cnf` 
     122    chown root:alterncpanel /etc/alternc/my_mail.cnf 
     123    chmod 640 /etc/alternc/my_mail.cnf 
     124fi 
     125 
    113126WARNING="WARNING: Do not edit this file, edit the one in /etc/alternc/templates and launch alternc.install again." 
    114127 
     
    149162s\\%%dbuser%%\\$MYSQL_USER\\; 
    150163s\\%%dbpwd%%\\$MYSQL_PASS\\; 
     164s\\%%db_mail_user%%\\$MYSQL_MAIL_USER\\; 
     165s\\%%db_mail_pwd%%\\$MYSQL_MAIL_PASS\\; 
    151166s\\%%ALTERNC_LOC%%\\$ALTERNC_LOC\\; 
    152167s\\%%warning_message%%\\$WARNING\\; 
  • alternc/trunk/install/mysql.sh

    r2913 r3139  
    3535# * password 
    3636# * database 
     37# * mail_user 
     38# * mail_password 
    3739# * MYSQL_CLIENT 
    3840#  
     
    4850 
    4951MYSQL_CONFIG="/etc/alternc/my.cnf" 
     52MYSQL_MAIL_CONFIG="/etc/alternc/my_mail.cnf" 
    5053 
    5154. /etc/alternc/local.sh 
     
    5356# this means (a) creating the user and (b) creating the database 
    5457grant="GRANT ALL ON *.* TO '$user'@'${MYSQL_CLIENT}' IDENTIFIED BY '$password' WITH GRANT OPTION; 
    55 CREATE DATABASE IF NOT EXISTS $database;" 
     58CREATE DATABASE IF NOT EXISTS $database;GRANT ALL ON '$database'.dovecot_view TO '$mail_user'@'${MYSQL_CLIENT}' IDENTIFIED BY '$mail_password'; " 
    5659 
    5760echo -n "Trying debian.cnf: " 
     
    111114fi 
    112115 
     116if [ -f $MYSQL_MAIL_CONFIG ]; then 
     117    echo "Updating mysql configuration in $MYSQL_MAIL_CONFIG" 
     118else 
     119    echo "Creating mysql configuration in $MYSQL_MAIL_CONFIG" 
     120    cat > $MYSQL_MAIL_CONFIG <<EOF 
     121# AlternC - Web Hosting System - MySQL mail user Configuration  
     122# Automatically generated by AlternC configuration, do not edit 
     123# This file will be modified on package configuration 
     124# (e.g. upgrade or dpkg-reconfigure alternc) 
     125[mysql] 
     126database= 
     127 
     128[client] 
     129EOF 
     130    chown root:www-data $MYSQL_MAIL_CONFIG 
     131    chmod 640 $MYSQL_MAIL_CONFIG 
     132fi 
    113133# create a sed script to create/update the file 
    114134set_value() { 
    115135    var=$1 
    116136    RET=$2 
    117     grep -Eq "^ *$var=" $MYSQL_CONFIG || echo "$var=" >> $MYSQL_CONFIG 
     137    file=$3 
     138    grep -Eq "^ *$var=" $file || echo "$var=" >> $file 
    118139    SED_SCRIPT="$SED_SCRIPT;s\\^ *$var=.*\\$var=\"$RET\"\\" 
    119140} 
     
    124145    host="localhost" 
    125146fi 
    126 set_value host $host 
    127 set_value database $database 
    128 set_value user $user 
    129 set_value password $password 
     147#filling the config file for the sysusr 
     148set_value host $host $MYSQL_CONFIG 
     149set_value database $database $MYSQL_CONFIG 
     150set_value user $user $MYSQL_CONFIG 
     151set_value password $password $MYSQL_CONFIG 
     152 
     153 
     154#filling the config file for the mailuser 
     155set_value host $host $MYSQL_MAIL_CONFIG 
     156set_value database $database $MYSQL_MAIL_CONFIG 
     157set_value user $mail_user $MYSQL_MAIL_CONFIG 
     158set_value password $mail_password $MYSQL_MAIL_CONFIG 
     159 
    130160 
    131161# take extra precautions here with the mysql password: 
     
    141171# Now we should be able to use the mysql configuration 
    142172mysql="/usr/bin/mysql --defaults-file=$MYSQL_CONFIG" 
     173mysql_mail="/usr/bin/mysql --defaults-file=$MYSQL_MAIL_CONFIG" 
    143174 
    144175echo "Checking for MySQL connectivity" 
    145 $mysql -e "SHOW TABLES" >/dev/null && echo "MYSQL.SH OK!" || echo "MYSQL.SH FAILED!" 
     176$mysql -e "SHOW TABLES" >/dev/null && echo "MYSQL.SH OK!" || echo "MYSQL.SH FAILED: database user setup failed" 
     177$mysql_mail -e "SHOW TABLES" >/dev/null && echo "MYSQL.SH OK!" || echo "MYSQL.SH FAILED: database mail user setup failed" 
    146178 
    147179# Final mysql setup: db schema 
Note: See TracChangeset for help on using the changeset viewer.