1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/freshrss_ynh.git synced 2024-09-03 18:36:33 +02:00
freshrss_ynh/hooks/post_user_create
2016-09-01 08:56:14 +02:00

21 lines
662 B
Bash
Executable file

#!/bin/bash
db_user=freshrss
db_name=freshrss
db_pwd=$(sudo yunohost app setting freshrss mysqlpwd)
app_path=/var/www/freshrss
myuser=$1
#copy sql
sudo cp $app_path/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 -r $app_path/data/users/_ $app_path/data/users/$myuser/
sudo mv $app_path/data/users/$myuser/config.default.php $app_path/data/users/$myuser/config.php
sudo chown -R www-data: $app_path/data/users/$myuser/