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

35 lines
1.3 KiB
Text
Raw Normal View History

2014-07-23 17:45:20 +02:00
#!/bin/bash
db_user=freshrss
db_name=freshrss
db_pwd=$(sudo yunohost app setting freshrss mysqlpwd)
2014-07-23 17:45:20 +02:00
myuser=$1
2014-07-30 15:58:09 +02:00
#check wallabag
if [[ $(sudo yunohost app list -f wallabag | /bin/grep -q "installed: True") -eq 0 ]]; then
echo "Detected wallabag"
$wallabagPath=$(sudo yunohost app setting wallabag path)
$wallabagUrl=$domain$wallabagPath
$sharingWallabag="array('type' => 'wallabag','name' => 'Wallabag','url' => 'https://$wallabagUrl',),"
fi
2014-07-23 17:45:20 +02:00
#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
2014-07-30 15:58:09 +02:00
#user_email=$(ldapsearch -h localhost -b uid=$myuser,ou=users,dc=yunohost,dc=org -x objectClass=mailAccount mail | grep mail: | head -n 1| sed 's/mail: //')
2014-07-23 17:45:20 +02:00
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
2014-07-30 15:58:09 +02:00
sudo sed -i "s/sharingArrayYnh/$sharingWallabag/g" $final_path/data/$myuser\_user.php