|
|
|
@ -42,40 +42,6 @@ if [[ "$admin_wordpress" = "" || "$is_public" = "" || "$language" = "" ]]; then |
|
|
|
exit 1 |
|
|
|
fi |
|
|
|
|
|
|
|
# Generate random password |
|
|
|
db_pwd=$(sudo yunohost app setting wordpress mysqlpwd) |
|
|
|
|
|
|
|
# Use 'wordpress' as database name and user |
|
|
|
db_user=wordpress |
|
|
|
|
|
|
|
### Execute potential SQL statements here |
|
|
|
|
|
|
|
# Copy files to the right place |
|
|
|
final_path=/var/www/wordpress |
|
|
|
sudo mkdir -p $final_path |
|
|
|
sudo cp -a ../sources/* $final_path |
|
|
|
sudo cp ../conf/wp-config.php $final_path/wp-config.php |
|
|
|
|
|
|
|
# Change variables in Wordpress configuration |
|
|
|
sudo sed -i "s/yunouser/$db_user/g" $final_path/wp-config.php |
|
|
|
sudo sed -i "s/yunopass/$db_pwd/g" $final_path/wp-config.php |
|
|
|
sudo sed -i "s/yunobase/$db_user/g" $final_path/wp-config.php |
|
|
|
for i in 1 2 3 4 5 6 7 8 |
|
|
|
do |
|
|
|
j=$(dd if=/dev/urandom bs=1 count=200 2> /dev/null | tr -c -d '[A-Za-z0-9]' | sed -n 's/\(.\{40\}\).*/\1/p') |
|
|
|
if [ "$j" = "" ]; |
|
|
|
then |
|
|
|
# For obscure reasons, the loop is too fast at execution |
|
|
|
sleep 1 |
|
|
|
j=$(dd if=/dev/urandom bs=1 count=200 2> /dev/null | tr -c -d '[A-Za-z0-9]' | sed -n 's/\(.\{40\}\).*/\1/p') |
|
|
|
fi |
|
|
|
sudo sed -i "s/KEY$i/$j/g" $final_path/wp-config.php |
|
|
|
done |
|
|
|
sudo sed -i "s/I18NTOCHANGE/$language/g" $final_path/wp-config.php |
|
|
|
sudo sed -i "s@URLWORDPRESS@$domain$path@g" ../conf/*.sql |
|
|
|
|
|
|
|
# Set permissions to roundcube directory |
|
|
|
sudo chown -R www-data: $final_path |
|
|
|
|
|
|
|
# Modify Nginx configuration file and copy it to Nginx conf directory |
|
|
|
sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf* |
|
|
|
|