mirror of
https://github.com/YunoHost-Apps/freshrss_ynh.git
synced 2024-09-03 18:36:33 +02:00
[enh]refactor install finish cleaning
This commit is contained in:
parent
773a1ff7b0
commit
4b1ba962ec
3 changed files with 47 additions and 40 deletions
|
@ -4,5 +4,6 @@
|
||||||
* [YunoHost website](https://yunohost.org)
|
* [YunoHost website](https://yunohost.org)
|
||||||
|
|
||||||
Changelog:
|
Changelog:
|
||||||
|
* Refactoring of yunohost scripts
|
||||||
* Update to FreshRSS 1.4
|
* Update to FreshRSS 1.4
|
||||||
* Update to FreshRSS 1.2
|
* Update to FreshRSS 1.2
|
||||||
|
|
|
@ -7,38 +7,45 @@ app_path=/var/www/freshrss
|
||||||
|
|
||||||
if [[ "freshrss" = "$app" ]];
|
if [[ "freshrss" = "$app" ]];
|
||||||
then
|
then
|
||||||
db_user=freshrss
|
db_user=freshrss
|
||||||
db_name=freshrss
|
db_name=freshrss
|
||||||
db_pwd=$(sudo yunohost app setting freshrss mysqlpwd)
|
db_pwd=$(sudo yunohost app setting freshrss mysqlpwd)
|
||||||
|
|
||||||
#check wallabag
|
#check wallabag
|
||||||
if [[ $(sudo yunohost app list -f wallabag | /bin/grep -q "installed: True") -eq 0 ]]; then
|
if [[ $(sudo yunohost app list --installed -f wallabag2) -eq 0 ]]; then
|
||||||
echo "Detected wallabag"
|
echo "Detected wallabag V2"
|
||||||
wallabagPath=$(sudo yunohost app setting wallabag path)
|
wallabagPath=$(sudo yunohost app setting wallabag2 path)
|
||||||
wallabagUrl=$domain$wallabagPath
|
wallabagUrl=$domain$wallabagPath
|
||||||
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),"
|
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
|
sharingEnable=1
|
||||||
fi
|
elif [[ $(sudo yunohost app list --installed -f wallabag) -eq 0 ]]; then
|
||||||
|
echo "Detected wallabag"
|
||||||
|
wallabagPath=$(sudo yunohost app setting wallabag path)
|
||||||
|
wallabagUrl=$domain$wallabagPath
|
||||||
|
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
|
||||||
|
fi
|
||||||
|
|
||||||
for myuser in $(echo "$new_users" | sed "s/,/ /g")
|
for myuser in $(echo "$new_users" | sed "s/,/ /g")
|
||||||
do
|
do
|
||||||
#copy sql
|
#copy sql
|
||||||
sudo cp $app_path/app/SQL/install_ynh.sql /tmp/$myuser-install.sql
|
sudo cp $app_path/app/SQL/install_ynh.sql /tmp/$myuser-install.sql
|
||||||
|
|
||||||
#change username in sql
|
#change username in sql
|
||||||
sudo sed -i "s/YnoUser/$myuser/g" /tmp/$myuser-install.sql
|
sudo sed -i "s/YnoUser/$myuser/g" /tmp/$myuser-install.sql
|
||||||
#create tables
|
#create tables
|
||||||
mysql -u $db_user -p$db_pwd $db_user < /tmp/$myuser-install.sql
|
ynh_mysql_connect_as "$db_user" "$db_pwd" "$db_name" \
|
||||||
#remove temp sql
|
< "/tmp/$myuser-install.sql"
|
||||||
sudo rm /tmp/$myuser-install.sql
|
#remove temp sql
|
||||||
|
sudo rm /tmp/$myuser-install.sql
|
||||||
|
|
||||||
#copy default conf
|
#copy default conf
|
||||||
sudo cp -r $app_path/data/users/_ $app_path/data/users/$myuser/
|
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 mv $app_path/data/users/$myuser/config.default.php $app_path/data/users/$myuser/config.php
|
||||||
#add wallabag sharing
|
#add wallabag sharing
|
||||||
if [[ $sharingEnable -eq 1 ]]; then
|
if [[ $sharingEnable -eq 1 ]]; then
|
||||||
sudo sed -i "s@'sharing'\ =>\ array\ (@$sharingWallabag@g" $app_path/data/users/$myuser/config.php
|
sudo sed -i "s@'sharing'\ =>\ array\ (@$sharingWallabag@g" $app_path/data/users/$myuser/config.php
|
||||||
fi
|
fi
|
||||||
sudo chown -R www-data: $app_path/data/users/$myuser/
|
sudo chown -R www-data: $app_path/data/users/$myuser/
|
||||||
done
|
done
|
||||||
fi
|
fi
|
|
@ -63,7 +63,6 @@ fi
|
||||||
# Add users
|
# Add users
|
||||||
|
|
||||||
#check wallabag
|
#check wallabag
|
||||||
#if [[ $(sudo yunohost app list --installed -f wallabag2 --json | grep -q '"installed": true') -eq 0 ]]; then
|
|
||||||
if sudo yunohost app list --installed -f wallabag2 | grep -q id ; then
|
if sudo yunohost app list --installed -f wallabag2 | grep -q id ; then
|
||||||
echo "Detected wallabag V2"
|
echo "Detected wallabag V2"
|
||||||
wallabagPath=$(sudo yunohost app setting wallabag2 path | sed 's#/*$##')
|
wallabagPath=$(sudo yunohost app setting wallabag2 path | sed 's#/*$##')
|
||||||
|
@ -71,11 +70,11 @@ if sudo yunohost app list --installed -f wallabag2 | grep -q id ; then
|
||||||
sharingWallabag="'sharing' => \n\tarray( \n\t\t0 => \n\t\tarray(\n\t\t\t'type' => 'wallabagv2',\n\t\t\t'name' => 'Wallabag',\n\t\t\t'url' => 'https://$wallabagUrl',\n\t\t),"
|
sharingWallabag="'sharing' => \n\tarray( \n\t\t0 => \n\t\tarray(\n\t\t\t'type' => 'wallabagv2',\n\t\t\t'name' => 'Wallabag',\n\t\t\t'url' => 'https://$wallabagUrl',\n\t\t),"
|
||||||
sharingEnable=1
|
sharingEnable=1
|
||||||
elif sudo yunohost app list --installed -f wallabag | grep -q id ; then
|
elif sudo yunohost app list --installed -f wallabag | grep -q id ; then
|
||||||
echo "Detected wallabag"
|
echo "Detected wallabag"
|
||||||
wallabagPath=$(sudo yunohost app setting wallabag path)
|
wallabagPath=$(sudo yunohost app setting wallabag path)
|
||||||
wallabagUrl=$domain$wallabagPath
|
wallabagUrl=$domain$wallabagPath
|
||||||
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),"
|
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
|
sharingEnable=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
freshrss_users=$(ldapsearch -h localhost -b ou=users,dc=yunohost,dc=org -x objectClass=mailAccount uid | grep uid: | sed 's/uid: //' | xargs)
|
freshrss_users=$(ldapsearch -h localhost -b ou=users,dc=yunohost,dc=org -x objectClass=mailAccount uid | grep uid: | sed 's/uid: //' | xargs)
|
||||||
|
|
Loading…
Reference in a new issue