2014-09-11 16:48:29 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
app=$1
|
|
|
|
new_users=$2
|
2014-09-20 10:56:59 +02:00
|
|
|
app_path=/var/www/freshrss
|
2014-09-11 16:48:29 +02:00
|
|
|
|
|
|
|
|
|
|
|
if [[ "freshrss" = "$app" ]];
|
|
|
|
then
|
|
|
|
db_user=freshrss
|
|
|
|
db_name=freshrss
|
|
|
|
db_pwd=$(sudo yunohost app setting freshrss mysqlpwd)
|
|
|
|
|
|
|
|
#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
|
|
|
|
|
|
|
|
for myuser in $(echo "$new_users" | sed "s/,/ /g")
|
|
|
|
do
|
|
|
|
#copy sql
|
2014-09-20 10:56:59 +02:00
|
|
|
sudo cp $app_path/app/SQL/install_ynh.sql /tmp/$myuser-install.sql
|
2014-09-11 16:48:29 +02:00
|
|
|
|
|
|
|
#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
|
2015-02-08 18:55:48 +01:00
|
|
|
sudo mkdir $app_path/data/$myuser/
|
2015-02-08 19:23:59 +01:00
|
|
|
sudo cp $app_path/data/user.php.dist $app_path/data/users/$myuser/config.php
|
2014-09-11 16:48:29 +02:00
|
|
|
#change username
|
2015-02-08 19:23:59 +01:00
|
|
|
sudo sed -i "s/YnoUser/$myuser/g" $app_path/data/users/$myuser/config.php
|
2014-09-11 16:48:29 +02:00
|
|
|
#add wallabag sharing
|
2015-02-08 18:55:48 +01:00
|
|
|
sudo sed -i "s@sharingArrayYnh@$sharingWallabag@g" $app_path/data/$myuser/config.php
|
2015-02-08 19:23:59 +01:00
|
|
|
touch $app_path/data/users/$myuser/log.txt
|
|
|
|
chown www-data: $app_path/data/users/$myuser -R
|
2014-09-11 16:48:29 +02:00
|
|
|
done
|
|
|
|
fi
|