mirror of
https://github.com/YunoHost-Apps/freshrss_ynh.git
synced 2024-09-03 18:36:33 +02:00
Prise en compte ajout de users
This commit is contained in:
parent
aed810e725
commit
5540ffe084
2 changed files with 26 additions and 0 deletions
24
hooks/post_user_create
Executable file
24
hooks/post_user_create
Executable file
|
@ -0,0 +1,24 @@
|
|||
#!/bin/bash
|
||||
|
||||
db_user=freshrss
|
||||
db_name=freshrss
|
||||
root_pwd=$(sudo cat /etc/yunohost/mysql)
|
||||
|
||||
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
|
||||
|
|
@ -56,6 +56,8 @@ do
|
|||
#change username
|
||||
sudo sed -i "s/YnoUser/$myuser/g" $final_path/data/$myuser\_user.php
|
||||
done
|
||||
#copy defaut user conf for futur users
|
||||
sudo cp ../conf/dist_user.conf $final_path/data/user.php.dist
|
||||
|
||||
# Delete install directive
|
||||
sudo rm $final_path/data/do-install.txt
|
||||
|
|
Loading…
Add table
Reference in a new issue