#!/bin/sh # # mysql_install.sh # # Set the variables source ./xev_net_install_config.sh # # Do not edit below this line unless you fully understand what you are doing # # Set the variables XN_MYSQL_USER="$(php -r 'include("/usr/local/ispconfig/server/lib/mysql_clientdb.conf"); print $clientdb_user;')" XN_MYSQL_PASS="$(php -r 'include("/usr/local/ispconfig/server/lib/mysql_clientdb.conf"); print $clientdb_password;')" XN_LOGO_BASE64="data:image/png;base64,$(base64 -w 0 logo.png)" # # Crypt the remote user password using the ISPConfig PHP method XN_REMOTE_PASS_CRYPTED=$(php -r '$cleartext_password="'$XN_REMOTE_PASS'"; $salt="$6$"; $base64_alphabet="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; for ($n=0;$n<8;$n++) { $salt.=$base64_alphabet[mt_rand(0, 63)]; } $salt.="$"; echo crypt($cleartext_password, $salt);') # # Get the SQL file wget -O dbispconfig.sql "https://docs.xev.net.eu.org/doku.php?do=export_code&id=auto-install&codeblock=13" # # Execute the SQL file echo "SET @XN_HOSTNAME_FULL='$XN_HOSTNAME_FULL';\n$(cat dbispconfig.sql)" > dbispconfig.sql echo "SET @XN_SYS_COMPANY_NAME='$XN_SYS_COMPANY_NAME';\n$(cat dbispconfig.sql)" > dbispconfig.sql echo "SET @XN_SYS_COMPANY_URL='$XN_SYS_COMPANY_URL';\n$(cat dbispconfig.sql)" > dbispconfig.sql echo "SET @XN_SYS_COMPANY_TAGLINE='$XN_SYS_COMPANY_TAGLINE';\n$(cat dbispconfig.sql)" > dbispconfig.sql echo "SET @XN_REMOTE_USER='$XN_REMOTE_USER';\n$(cat dbispconfig.sql)" > dbispconfig.sql echo "SET @XN_REMOTE_PASS_CRYPTED='$XN_REMOTE_PASS_CRYPTED';\n$(cat dbispconfig.sql)" > dbispconfig.sql echo "SET @XN_LOGO_BASE64='$XN_LOGO_BASE64';\n$(cat dbispconfig.sql)" > dbispconfig.sql echo "SET @XN_SYS_SMTP_PASS='$XN_SYS_SMTP_PASS';\n$(cat dbispconfig.sql)" > dbispconfig.sql echo "SET @XN_SYS_SMTP_USER='$XN_SYS_SMTP_USER';\n$(cat dbispconfig.sql)" > dbispconfig.sql echo "SET @XN_SYS_SMTP_HOST='$XN_SYS_SMTP_HOST';\n$(cat dbispconfig.sql)" > dbispconfig.sql echo "SET @XN_SYS_SMTP_NAME='$XN_SYS_SMTP_NAME';\n$(cat dbispconfig.sql)" > dbispconfig.sql echo "SET @XN_SYS_SMTP_MAIL='$XN_SYS_SMTP_MAIL';\n$(cat dbispconfig.sql)" > dbispconfig.sql echo "SET @XN_SYS_ATOM_URL_CLIENT='$XN_SYS_ATOM_URL_CLIENT';\n$(cat dbispconfig.sql)" > dbispconfig.sql echo "SET @XN_SYS_ATOM_URL_RESELLER='$XN_SYS_ATOM_URL_RESELLER';\n$(cat dbispconfig.sql)" > dbispconfig.sql echo "SET @XN_SYS_LOGIN_TEXT='$XN_SYS_LOGIN_TEXT';\n$(cat dbispconfig.sql)" > dbispconfig.sql echo "SET @XN_SYS_LOGIN_LINK='$XN_SYS_LOGIN_LINK';\n$(cat dbispconfig.sql)" > dbispconfig.sql mysql -u $XN_MYSQL_USER -p"$XN_MYSQL_PASS" dbispconfig < dbispconfig.sql # # Clear the variables XN_MYSQL_USER="" XN_MYSQL_PASS="" XN_LOGO_BASE64="" # # Remove the SQL file rm -rfv dbispconfig.sql