2014-07-23 17:45:20 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
db_user=freshrss
|
|
|
|
db_name=freshrss
|
2014-07-23 18:22:57 +02:00
|
|
|
db_pwd=$(sudo yunohost app setting freshrss mysqlpwd)
|
2014-07-23 17:45:20 +02:00
|
|
|
|
|
|
|
myuser=$1
|
|
|
|
|
|
|
|
#copy sql
|
|
|
|
sudo cp /var/www/freshrss/app/SQL/install_ynh.sql /tmp/$myuser-install.sql
|
|
|
|
#change username in sql
|
|
|
|
sudo sed -i "s/YnoUser/$myuser/g" /tmp/$myuser-install.sql
|
|
|
|
#create tables
|
|
|
|
mysql -u $db_user -p$db_pwd $db_user < /tmp/$myuser-install.sql
|
|
|
|
#remove temp sql
|
|
|
|
sudo rm /tmp/$myuser-install.sql
|
|
|
|
#copy default conf
|
|
|
|
sudo cp /var/www/freshrss/data/user.php.dist /var/www/freshrss/data/$myuser\_user.php
|
|
|
|
#change email
|
|
|
|
user_email=$(ldapsearch -h localhost -b uid=$myuser,ou=users,dc=yunohost,dc=org -x objectClass=mailAccount mail | grep mail: | grep $myuser| sed 's/mail: //')
|
|
|
|
sudo sed -i "s/ynoUserEmail/$user_email/g" /var/www/freshrss//data/$myuser\_user.php
|
|
|
|
#change username
|
|
|
|
sudo sed -i "s/YnoUser/$myuser/g" /var/www/freshrss/data/$myuser\_user.php
|
|
|
|
|