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
|
2015-02-09 18:08:17 +01:00
|
|
|
sharingWallabag="'sharing' => \n\tarray( \n\t\t0 => \n\t\tarray(\n\t\t\t'type' => 'wallabag',\n\t\t\t'name' => 'Wallabag',\n\t\t\t'url' => 'https://$wallabagUrl',\n\t\t),"
|
|
|
|
sharingEnable=1
|
2014-09-11 16:48:29 +02:00
|
|
|
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
|
2015-02-09 18:08:17 +01:00
|
|
|
|
2014-09-11 16:48:29 +02:00
|
|
|
#copy default conf
|
2015-02-09 18:08:17 +01:00
|
|
|
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
|
|
|
|
#add wallabag sharing
|
|
|
|
if [[ $sharingEnable -eq 1 ]]; then
|
|
|
|
sudo sed -i "s@'sharing'\ =>\ array\ (@$sharingWallabag@g" $app_path/data/users/$myuser/config.php
|
|
|
|
fi
|
|
|
|
sudo chown -R www-data: $app_path/data/users/$myuser/
|
2014-09-11 16:48:29 +02:00
|
|
|
done
|
|
|
|
fi
|