sed script of alternc.install now have a fixed name + squirrelmail-install script is using the template system to handle /etc/squirrelmail/alternc-changepass.conf.

This commit is contained in:
Benjamin Sonntag 2012-10-16 13:50:44 +00:00
parent de4ff858c2
commit 373157ebc8
7 changed files with 35 additions and 12 deletions

4
.gitattributes vendored
View File

@ -548,8 +548,8 @@ selenium/20120826-alternc-panel-testsuite.html -text
selenium/README -text selenium/README -text
selenium/alternc.domain-local-mail-tld.html -text selenium/alternc.domain-local-mail-tld.html -text
squirrelmail/Makefile -text squirrelmail/Makefile -text
squirrelmail/alternc-changepass/change.php -text squirrelmail/alternc_changepass/change.php -text
squirrelmail/alternc-changepass/setup.php -text squirrelmail/alternc_changepass/setup.php -text
squirrelmail/class/m_squirrelmail.php -text squirrelmail/class/m_squirrelmail.php -text
squirrelmail/squirrelmail-install -text squirrelmail/squirrelmail-install -text
squirrelmail/templates/apache2/squirrelmail.conf -text squirrelmail/templates/apache2/squirrelmail.conf -text

View File

@ -178,7 +178,7 @@ PUBLIC_IP_BEGIN=$(echo $PUBLIC_IP|cut -c 1)
# XXX: I assume this is secure if /tmp is sticky (+t) # XXX: I assume this is secure if /tmp is sticky (+t)
# we should have a better way to deal with templating, of course. # we should have a better way to deal with templating, of course.
SED_SCRIPT=`mktemp` SED_SCRIPT="/tmp/alternc.install.sedscript"
cat > $SED_SCRIPT <<EOF cat > $SED_SCRIPT <<EOF
s\\%%hosting%%\\$HOSTING\\; s\\%%hosting%%\\$HOSTING\\;
s\\%%fqdn%%\\$FQDN\\; s\\%%fqdn%%\\$FQDN\\;

View File

@ -30,4 +30,4 @@ install:
# Desktop files # Desktop files
install -o 1999 -g 1999 -m 644 class/m_squirrelmail.php $(DESTDIR)/var/alternc/bureau/class/ install -o 1999 -g 1999 -m 644 class/m_squirrelmail.php $(DESTDIR)/var/alternc/bureau/class/
# Squirrelmail Change Password Plugin # Squirrelmail Change Password Plugin
install -m 644 alternc-changepass/setup.php alternc-changepass/change.php $(DESTDIR)/usr/share/squirrelmail/plugins/alternc-changepass/ install -m 644 alternc_changepass/setup.php alternc_changepass/change.php $(DESTDIR)/usr/share/squirrelmail/plugins/alternc_changepass/

View File

@ -27,10 +27,32 @@ then
echo "Installing Squirrelmail Templates ..." echo "Installing Squirrelmail Templates ..."
cp -f /etc/alternc/templates/squirrelmail/avelsieve-config.php /etc/alternc/templates/squirrelmail/apache.conf /etc/squirrelmail/ cp -f /etc/alternc/templates/squirrelmail/avelsieve-config.php /etc/alternc/templates/squirrelmail/apache.conf /etc/squirrelmail/
cp -f /etc/alternc/templates/javascript-common/javascript-common.conf /etc/javascript-common/ cp -f /etc/alternc/templates/javascript-common/javascript-common.conf /etc/javascript-common/
if [ -e /etc/alternc/templates/squirrelmail/alternc-changepass.conf ]; then
CONFIG_FILES="$CONFIG_FILES squirrelmail/alternc-changepass.conf"
fi
LOGIN="2000_squirrelmail"
PASSWORD="`perl -e 'print map{("a".."z","A".."Z",0..9)[int(rand(62))]}(1..10)'`"
# Add new variables to the sed script ...
SED_SCRIPT="/tmp/alternc.install.sedscript"
cat >> $SED_SCRIPT <<EOF
s\\%%squirrelmail-login%%\\$LOGIN\\;
s\\%%squirrelmail-password%%\\$PASSWORD\\;
EOF
echo " Done" echo " Done"
. /usr/lib/alternc/functions.sh . /usr/lib/alternc/functions.sh
echo "giving write access to squirrelmail to the email password ..."
# cf alternc.install for more explanations on this horror :
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`
# now database host user and password are mysql root account values ;)
mysql_query "GRANT UPDATE (password) ON ${database}.address TO '$LOGIN'@'%' IDENTIFIED BY PASSWORD('$PASSWORD');"
mysql_query "GRANT SELECT ON ${database}.address TO '$LOGIN'@'%';"
mysql_query "GRANT SELECT ON ${database}.domaines TO '$LOGIN'@'%';"
echo " Done"
echo "Setting squirrelmail domaintype" echo "Setting squirrelmail domaintype"
mysql_query "INSERT IGNORE INTO domaines_type (name ,description ,target ,entry ,compatibility ,enable ,only_dns ,need_dns ,advanced )VALUES ('squirrelmail','Squirrelmail Webmail access', 'NONE', '%SUB% IN A @@PUBLIC_IP@@', 'txt', 'ALL', '0', '0', '0');" mysql_query "INSERT IGNORE INTO domaines_type (name ,description ,target ,entry ,compatibility ,enable ,only_dns ,need_dns ,advanced )VALUES ('squirrelmail','Squirrelmail Webmail access', 'NONE', '%SUB% IN A @@PUBLIC_IP@@', 'txt', 'ALL', '0', '0', '0');"
echo " Done" echo " Done"

View File

@ -1,9 +1,10 @@
<?php <?php
// This is the configuration file of AlternC-changepass plugin for Squirrelmail // This is the configuration file of AlternC-changepass plugin for Squirrelmail
define("ALTERNC_CHANGEPASS_LOC","/var/alternc"); // It is overwritten by alternc.install (precisely in squirrelmail-install subscript)
define("ALTERNC_CHANGEPASS_MYSQL_HOST","localhost");
define("ALTERNC_CHANGEPASS_MYSQL_USER","2000_squirrelmail"); define("ALTERNC_CHANGEPASS_LOC","%%ALTERNC_LOC%%");
define("ALTERNC_CHANGEPASS_MYSQL_PASSWORD","een3ooCi"); define("ALTERNC_CHANGEPASS_MYSQL_HOST","%%dbhost%%");
define("ALTERNC_CHANGEPASS_MYSQL_DB","alternc"); define("ALTERNC_CHANGEPASS_MYSQL_USER","%%squirrelmail-login%%"); // 2000_squirrelmail
define("ALTERNC_CHANGEPASS_MYSQL_PASSWORD","%%squirrelmail-pass%%"); // een3ooCi
define("ALTERNC_CHANGEPASS_MYSQL_DB","%%dbname%%");
?>