From ce3375d4616dbce7414cc19b31177730ae28f16a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Mon, 31 Oct 2016 12:18:57 +0100 Subject: [PATCH 01/67] upgrade to 1.6 sources --- scripts/_common.sh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index f935adc..c4bd692 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -2,14 +2,14 @@ # Common variables # -# FreshRss version -VERSION="1.5.0" +# FreshRSS version +VERSION="1.6.0" -# Roundcube complete tarball checksum -FRESHRSS_SOURCE_SHA256="72c3dcb3e58f4cf7d7e6a06ffec0cad8540ee5aeee9024e785b56e8d55656746" +# FreshRSS complete tarball checksum +FRESHRSS_SOURCE_SHA256="358f2789a9459cd91cc3348c8e3f4c18cbd1c64d8635f6719cca8e9ddde46e7a" -# Remote URL to fetch Roundcube source tarball -FRESHRSS_SOURCE_URL="https://github.com/FreshRSS/FreshRSS/archive/1.5.0.tar.gz" +# Remote URL to fetch FreshRSS source tarball +FRESHRSS_SOURCE_URL="https://github.com/FreshRSS/FreshRSS/archive/1.6.0.tar.gz" PKGDIR=$(cd ../; pwd) @@ -17,15 +17,15 @@ FINAL_PATH="/var/www/freshrss" # # Common helpers # -# Download and extract FreshRss sources to the given directory +# Download and extract FreshRSS sources to the given directory # usage: extract_freshrss DESTDIR extract_freshrss() { local DESTDIR=$1 - # retrieve and extract FreshRss tarball + # retrieve and extract FreshRSS tarball rc_tarball="${DESTDIR}/freshrss.tar.gz" wget -q -O "$rc_tarball" "$FRESHRSS_SOURCE_URL" \ - || ynh_die "Unable to download FreshRss tarball" + || ynh_die "Unable to download FreshRSS tarball" echo "$FRESHRSS_SOURCE_SHA256 $rc_tarball" | sha256sum -c >/dev/null \ || ynh_die "Invalid checksum of downloaded tarball" tar xf "$rc_tarball" -C "$DESTDIR" --strip-components 1 \ From 5e9255fb6dac845e8a3e435110aa7ab229d3539d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Wed, 2 Nov 2016 22:05:30 +0100 Subject: [PATCH 02/67] upgrade to 1.6.1 --- scripts/_common.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index c4bd692..2257a98 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -3,13 +3,13 @@ # # FreshRSS version -VERSION="1.6.0" +VERSION="1.6.1" # FreshRSS complete tarball checksum -FRESHRSS_SOURCE_SHA256="358f2789a9459cd91cc3348c8e3f4c18cbd1c64d8635f6719cca8e9ddde46e7a" +FRESHRSS_SOURCE_SHA256="829473ca628963edf4a213431b03a91f0c652ffef00b3f7f7684b598af4037e0" # Remote URL to fetch FreshRSS source tarball -FRESHRSS_SOURCE_URL="https://github.com/FreshRSS/FreshRSS/archive/1.6.0.tar.gz" +FRESHRSS_SOURCE_URL="https://github.com/FreshRSS/FreshRSS/archive/1.6.1.tar.gz" PKGDIR=$(cd ../; pwd) From fe00d16fc1ca37d3ff5e83a86ba64fe4fe3f50fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Sun, 22 Jan 2017 12:13:06 +0100 Subject: [PATCH 03/67] wip --- hooks/post_app_addaccess | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hooks/post_app_addaccess b/hooks/post_app_addaccess index 001259b..65b8ab2 100755 --- a/hooks/post_app_addaccess +++ b/hooks/post_app_addaccess @@ -29,7 +29,9 @@ then for myuser in $(echo "$new_users" | sed "s/,/ /g") do #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 + $app_path/cli/create-user.php --user --email + #change username in sql sudo sed -i "s/YnoUser/$myuser/g" /tmp/$myuser-install.sql From b3c0755e9d30834c9e69a9c3d4ec99d2ed80dcf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Sun, 22 Jan 2017 12:18:09 +0100 Subject: [PATCH 04/67] upgrade to 1.6.2 --- README.md | 1 + scripts/_common.sh | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index a1d7c5b..d957c04 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,7 @@ * [YunoHost website](https://yunohost.org) Changelog: +* Update to FreshRSS 1.6.2 * Update to FreshRSS 1.5 * Refactoring of yunohost scripts * Update to FreshRSS 1.4 diff --git a/scripts/_common.sh b/scripts/_common.sh index 2257a98..6a155f1 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -3,13 +3,13 @@ # # FreshRSS version -VERSION="1.6.1" +VERSION="1.6.2" # FreshRSS complete tarball checksum -FRESHRSS_SOURCE_SHA256="829473ca628963edf4a213431b03a91f0c652ffef00b3f7f7684b598af4037e0" +FRESHRSS_SOURCE_SHA256="3773313680fb81b21bf2bdcd7da53037b2f2b4282ad8202654995ac199819a48" # Remote URL to fetch FreshRSS source tarball -FRESHRSS_SOURCE_URL="https://github.com/FreshRSS/FreshRSS/archive/1.6.1.tar.gz" +FRESHRSS_SOURCE_URL="https://github.com/FreshRSS/FreshRSS/archive/1.6.2.tar.gz" PKGDIR=$(cd ../; pwd) From 7dd3a00bb5375809c4dd5edb28a3da67a4ec7d00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Sun, 22 Jan 2017 12:24:39 +0100 Subject: [PATCH 05/67] rollback --- hooks/post_app_addaccess | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hooks/post_app_addaccess b/hooks/post_app_addaccess index 65b8ab2..958b6ba 100755 --- a/hooks/post_app_addaccess +++ b/hooks/post_app_addaccess @@ -29,8 +29,8 @@ then for myuser in $(echo "$new_users" | sed "s/,/ /g") do #copy sql - # sudo cp $app_path/app/SQL/install_ynh.sql /tmp/$myuser-install.sql - $app_path/cli/create-user.php --user --email + sudo cp $app_path/app/SQL/install_ynh.sql /tmp/$myuser-install.sql + # $app_path/cli/create-user.php --user --email #change username in sql From becec8d2a8bb39ebed0cb334c03dcd27190667e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Sun, 22 Jan 2017 14:50:51 +0100 Subject: [PATCH 06/67] wip --- scripts/install | 43 ++++++++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/scripts/install b/scripts/install index a6832b2..b210bfa 100755 --- a/scripts/install +++ b/scripts/install @@ -32,9 +32,9 @@ if [[ ! $? -eq 0 ]]; then fi # Generate random DES key & password -deskey=$(dd if=/dev/urandom bs=1 count=200 2> /dev/null | tr -c -d 'A-Za-z0-9' | sed -n 's/\(.\{24\}\).*/\1/p') -db_pwd=$(dd if=/dev/urandom bs=1 count=200 2> /dev/null | tr -c -d 'A-Za-z0-9' | sed -n 's/\(.\{24\}\).*/\1/p') -app_salt=$(dd if=/dev/urandom bs=1 count=200 2> /dev/null | tr -c -d 'A-Za-z0-9' | sed -n 's/\(.\{40\}\).*/\1/p') +deskey=$(ynh_string_random) +db_pwd=$(ynh_string_random) +app_salt=$(ynh_string_random) # Use 'freshrss' as database name and user db_user=freshrss db_name=freshrss @@ -45,20 +45,23 @@ sudo yunohost app setting freshrss mysqlpwd -v $db_pwd # Copy files to the right place TMPDIR=$(ynh_mkdir_tmp) extract_freshrss "$TMPDIR" -sudo cp -a ../conf/config.php $TMPDIR/data -sudo cp ../sources/install_ynh.sql $TMPDIR/app/SQL/install_ynh.sql +cd $TMPDIR +./cli/do-install.php --default_user $admin_user --auth_type http --environment production --base_url $domain/$path --title FreshRSS --api_enabled --db-type mysql --db-host localhost:3306 --db-user $db_user --db-password $db_pwd --db-base $db_name + +# sudo cp -a ../conf/config.php $TMPDIR/data +# sudo cp ../sources/install_ynh.sql $TMPDIR/app/SQL/install_ynh.sql # Change variables in freshrss configuration -sudo sed -i "s/yunouser/$db_user/g" $TMPDIR/data/config.php -sudo sed -i "s/yunopass/$db_pwd/g" $TMPDIR/data/config.php -sudo sed -i "s/yunobase/$db_user/g" $TMPDIR/data/config.php -sudo sed -i "s/yunosalt/$app_salt/g" $TMPDIR/data/config.php -sudo sed -i "s@yunopath@$path@g" $TMPDIR/data/config.php -if [[ $admin_user != '' ]]; then - sudo sed -i "s/yunoadminuser/$admin_user/g" $TMPDIR/data/config.php -else - sudo sed -i '/yunoadminuser/d' $TMPDIR/data/config.php -fi +# sudo sed -i "s/yunouser/$db_user/g" $TMPDIR/data/config.php +# sudo sed -i "s/yunopass/$db_pwd/g" $TMPDIR/data/config.php +# sudo sed -i "s/yunobase/$db_user/g" $TMPDIR/data/config.php +# sudo sed -i "s/yunosalt/$app_salt/g" $TMPDIR/data/config.php +# sudo sed -i "s@yunopath@$path@g" $TMPDIR/data/config.php +# if [[ $admin_user != '' ]]; then +# sudo sed -i "s/yunoadminuser/$admin_user/g" $TMPDIR/data/config.php +# else +# sudo sed -i '/yunoadminuser/d' $TMPDIR/data/config.php +# fi # Add users @@ -81,13 +84,15 @@ fi freshrss_users=$(ldapsearch -h localhost -b ou=users,dc=yunohost,dc=org -x objectClass=mailAccount uid | grep uid: | sed 's/uid: //' | xargs) for myuser in $freshrss_users do + user_token=$(ynh_string_random) + ./cli/create-user.php --user $myuser --language en --token $user_token --no-default-feeds #copy sql - sudo cp ../sources/install_ynh.sql /tmp/$myuser-install.sql + # sudo cp ../sources/install_ynh.sql /tmp/$myuser-install.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 - ynh_mysql_connect_as "$db_user" "$db_pwd" "$db_name" \ - < "/tmp/$myuser-install.sql" + # ynh_mysql_connect_as "$db_user" "$db_pwd" "$db_name" \ + # < "/tmp/$myuser-install.sql" #remove temp sql sudo rm /tmp/$myuser-install.sql From 311e5dea7fb537690fbf7e1ef9405286bc11af99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Sun, 22 Jan 2017 15:03:06 +0100 Subject: [PATCH 07/67] wip --- scripts/install | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/install b/scripts/install index b210bfa..71c59a3 100755 --- a/scripts/install +++ b/scripts/install @@ -46,7 +46,7 @@ sudo yunohost app setting freshrss mysqlpwd -v $db_pwd TMPDIR=$(ynh_mkdir_tmp) extract_freshrss "$TMPDIR" cd $TMPDIR -./cli/do-install.php --default_user $admin_user --auth_type http --environment production --base_url $domain/$path --title FreshRSS --api_enabled --db-type mysql --db-host localhost:3306 --db-user $db_user --db-password $db_pwd --db-base $db_name +./cli/do-install.php --default_user $admin_user --auth_type http_auth --environment production --base_url $domain/$path --title FreshRSS --api_enabled --db-type mysql --db-host localhost:3306 --db-user $db_user --db-password $db_pwd --db-base $db_name # sudo cp -a ../conf/config.php $TMPDIR/data # sudo cp ../sources/install_ynh.sql $TMPDIR/app/SQL/install_ynh.sql @@ -95,9 +95,9 @@ do # < "/tmp/$myuser-install.sql" #remove temp sql - sudo rm /tmp/$myuser-install.sql + # sudo rm /tmp/$myuser-install.sql #copy default conf - sudo cp -r $TMPDIR/data/users/_/ $TMPDIR/data/users/$myuser + # sudo cp -r $TMPDIR/data/users/_/ $TMPDIR/data/users/$myuser sudo mv $TMPDIR/data/users/$myuser/config.default.php $TMPDIR/data/users/$myuser/config.php if [[ $sharingEnable -eq 1 ]]; then From 5ebdc5a476c7bf26b4ccd308a1c4f8cc1281e594 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Sun, 22 Jan 2017 15:04:52 +0100 Subject: [PATCH 08/67] wip --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 71c59a3..5eca1d9 100755 --- a/scripts/install +++ b/scripts/install @@ -46,7 +46,7 @@ sudo yunohost app setting freshrss mysqlpwd -v $db_pwd TMPDIR=$(ynh_mkdir_tmp) extract_freshrss "$TMPDIR" cd $TMPDIR -./cli/do-install.php --default_user $admin_user --auth_type http_auth --environment production --base_url $domain/$path --title FreshRSS --api_enabled --db-type mysql --db-host localhost:3306 --db-user $db_user --db-password $db_pwd --db-base $db_name +./cli/do-install.php --default_user $admin_user --auth_type http_auth --environment production --base_url $domain/$path --title FreshRSS --api_enabled --db-type mysql --db-host localhost --db-user $db_user --db-password $db_pwd --db-base $db_name # sudo cp -a ../conf/config.php $TMPDIR/data # sudo cp ../sources/install_ynh.sql $TMPDIR/app/SQL/install_ynh.sql From 3c1a798a9f055c5445c65f5edf29e2d4064856d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Sun, 22 Jan 2017 15:10:04 +0100 Subject: [PATCH 09/67] wip --- scripts/install | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/install b/scripts/install index 5eca1d9..96c5769 100755 --- a/scripts/install +++ b/scripts/install @@ -98,11 +98,11 @@ do # sudo rm /tmp/$myuser-install.sql #copy default conf # sudo cp -r $TMPDIR/data/users/_/ $TMPDIR/data/users/$myuser - sudo mv $TMPDIR/data/users/$myuser/config.default.php $TMPDIR/data/users/$myuser/config.php + # sudo mv $TMPDIR/data/users/$myuser/config.default.php $TMPDIR/data/users/$myuser/config.php - if [[ $sharingEnable -eq 1 ]]; then - sudo sed -i "s@'sharing'\ =>\ array\ (@$sharingWallabag@g" $TMPDIR/data/users/$myuser/config.php - fi + # if [[ $sharingEnable -eq 1 ]]; then + # sudo sed -i "s@'sharing'\ =>\ array\ (@$sharingWallabag@g" $TMPDIR/data/users/$myuser/config.php + # fi done # Delete install directive sudo rm $TMPDIR/data/do-install.txt From 6f7548434f658e4a96e4f1a18d499b7b6bd9d164 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Sun, 12 Feb 2017 10:20:51 +0100 Subject: [PATCH 10/67] do-install.txt already removed by cli --- scripts/install | 2 -- 1 file changed, 2 deletions(-) diff --git a/scripts/install b/scripts/install index 96c5769..edeafbd 100755 --- a/scripts/install +++ b/scripts/install @@ -104,8 +104,6 @@ do # sudo sed -i "s@'sharing'\ =>\ array\ (@$sharingWallabag@g" $TMPDIR/data/users/$myuser/config.php # fi done -# Delete install directive -sudo rm $TMPDIR/data/do-install.txt # Move temp dir to final dir sudo mv $TMPDIR $FINAL_PATH # Modify Nginx configuration file and copy it to Nginx conf directory From 26b85642e080d68eb3fbd60cbb7d28e7ea99abd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Sun, 12 Feb 2017 10:59:44 +0100 Subject: [PATCH 11/67] use helper --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index edeafbd..0de629c 100755 --- a/scripts/install +++ b/scripts/install @@ -17,7 +17,7 @@ admin_user=$3 # Check user parameter if not empty if [[ $admin_user != '' ]]; then - sudo yunohost user list --json | grep -qi "\"username\": \"$admin_user\"" + ynh_user_exists $admin_user if [[ ! $? -eq 0 ]]; then echo "Wrong user" exit 1 From a339fe250b486a53b710b94a0952efbe3afba7a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Sun, 12 Feb 2017 11:07:35 +0100 Subject: [PATCH 12/67] use helper --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 0de629c..941a133 100755 --- a/scripts/install +++ b/scripts/install @@ -22,7 +22,7 @@ if [[ $admin_user != '' ]]; then echo "Wrong user" exit 1 fi - sudo yunohost app setting freshrss admin_user -v $admin_user + ynh_app_setting_set freshrss admin_user $admin_user fi # Check domain/path availability From 6d25cdf7343f397cf9dc1299c8aa41eef7d78768 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Sun, 12 Feb 2017 11:08:08 +0100 Subject: [PATCH 13/67] add error message --- scripts/install | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/install b/scripts/install index 941a133..e5962ae 100755 --- a/scripts/install +++ b/scripts/install @@ -28,6 +28,7 @@ fi # Check domain/path availability sudo yunohost app checkurl $domain$path -a freshrss if [[ ! $? -eq 0 ]]; then + echo "Wrong url" exit 1 fi From 264ccea9e7e93ad8226821879ae203dace53ea27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Sun, 12 Feb 2017 11:20:17 +0100 Subject: [PATCH 14/67] use helper to store mysql passwd --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index e5962ae..dc2813e 100755 --- a/scripts/install +++ b/scripts/install @@ -41,7 +41,7 @@ db_user=freshrss db_name=freshrss # Initialize database and store mysql password for upgrade ynh_mysql_create_db "$db_name" "$db_user" "$db_pwd" -sudo yunohost app setting freshrss mysqlpwd -v $db_pwd +ynh_app_setting_set "$app" mysqlpwd "$dbpass" # Copy files to the right place TMPDIR=$(ynh_mkdir_tmp) From b47adf0d0b35986d6d4e30410748123c7187a7d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Sun, 12 Feb 2017 11:29:59 +0100 Subject: [PATCH 15/67] correct variable name --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index dc2813e..8a8b2b8 100755 --- a/scripts/install +++ b/scripts/install @@ -41,7 +41,7 @@ db_user=freshrss db_name=freshrss # Initialize database and store mysql password for upgrade ynh_mysql_create_db "$db_name" "$db_user" "$db_pwd" -ynh_app_setting_set "$app" mysqlpwd "$dbpass" +ynh_app_setting_set "freshrss" mysqlpwd "$db_pwd" # Copy files to the right place TMPDIR=$(ynh_mkdir_tmp) From 6240b37feac3b4a60ef017746e4404df80293f23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Sun, 12 Feb 2017 11:34:30 +0100 Subject: [PATCH 16/67] don't move to tmp dir --- scripts/install | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/install b/scripts/install index 8a8b2b8..68b27b9 100755 --- a/scripts/install +++ b/scripts/install @@ -46,8 +46,8 @@ ynh_app_setting_set "freshrss" mysqlpwd "$db_pwd" # Copy files to the right place TMPDIR=$(ynh_mkdir_tmp) extract_freshrss "$TMPDIR" -cd $TMPDIR -./cli/do-install.php --default_user $admin_user --auth_type http_auth --environment production --base_url $domain/$path --title FreshRSS --api_enabled --db-type mysql --db-host localhost --db-user $db_user --db-password $db_pwd --db-base $db_name + +$TMPDIR/cli/do-install.php --default_user $admin_user --auth_type http_auth --environment production --base_url $domain/$path --title FreshRSS --api_enabled --db-type mysql --db-host localhost --db-user $db_user --db-password $db_pwd --db-base $db_name # sudo cp -a ../conf/config.php $TMPDIR/data # sudo cp ../sources/install_ynh.sql $TMPDIR/app/SQL/install_ynh.sql @@ -86,7 +86,7 @@ freshrss_users=$(ldapsearch -h localhost -b ou=users,dc=yunohost,dc=org -x objec for myuser in $freshrss_users do user_token=$(ynh_string_random) - ./cli/create-user.php --user $myuser --language en --token $user_token --no-default-feeds + $TMPDIR/cli/create-user.php --user $myuser --language en --token $user_token --no-default-feeds #copy sql # sudo cp ../sources/install_ynh.sql /tmp/$myuser-install.sql #change username in sql From 4736ccd411f567dda6a4e7603b7fe22307b6fa98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Mon, 13 Feb 2017 22:20:55 +0100 Subject: [PATCH 17/67] cleaner code + cron + apt --- conf/freshrss-deps.control | 13 +++++++ conf/freshrss.cron | 1 + scripts/install | 76 ++++++++++---------------------------- 3 files changed, 34 insertions(+), 56 deletions(-) create mode 100644 conf/freshrss-deps.control create mode 100644 conf/freshrss.cron diff --git a/conf/freshrss-deps.control b/conf/freshrss-deps.control new file mode 100644 index 0000000..2511cd5 --- /dev/null +++ b/conf/freshrss-deps.control @@ -0,0 +1,13 @@ +Section: misc +Priority: optional +Homepage: https://github.com/FreshRSS/FreshRSS +Standards-Version: 3.9.2 + +Package: freshrss-deps +Version: 1.6.2 +Depends: php5-cli, php5-gmp +Architecture: all +Description: meta package for freshrss dependencies + FreshRSS is a self-hosted RSS feed aggregator such as Leed or Kriss Feed. + . + This meta-package is only responsible of installing its dependencies. diff --git a/conf/freshrss.cron b/conf/freshrss.cron new file mode 100644 index 0000000..683e7ac --- /dev/null +++ b/conf/freshrss.cron @@ -0,0 +1 @@ +*/10 * * * * www-data /usr/bin/php #DESTDIR#/app/actualize_script.php >/tmp/FreshRSS.log 2>&1 diff --git a/scripts/install b/scripts/install index 68b27b9..4db37a2 100755 --- a/scripts/install +++ b/scripts/install @@ -7,6 +7,10 @@ set -eu domain=$1 path=$2 admin_user=$3 +# Setup variables +$app=$APPNAME +db_user=$app +db_name=$app # Load common variables and helpers . ./_common.sh @@ -17,31 +21,25 @@ admin_user=$3 # Check user parameter if not empty if [[ $admin_user != '' ]]; then - ynh_user_exists $admin_user - if [[ ! $? -eq 0 ]]; then - echo "Wrong user" - exit 1 - fi + ynh_user_exists $admin_user || ynh_die "Wrong user" ynh_app_setting_set freshrss admin_user $admin_user fi # Check domain/path availability -sudo yunohost app checkurl $domain$path -a freshrss -if [[ ! $? -eq 0 ]]; then - echo "Wrong url" - exit 1 -fi +sudo yunohost app checkurl $domain$path -a freshrss || ynh_die "The path ${domain}${path} is not available for app installation." + +#install php5-cli +ynh_package_install_from_equivs ../conf/${DEPS_PKG_NAME}.control \ + || ynh_die "Unable to install dependencies" # Generate random DES key & password deskey=$(ynh_string_random) db_pwd=$(ynh_string_random) app_salt=$(ynh_string_random) -# Use 'freshrss' as database name and user -db_user=freshrss -db_name=freshrss + # Initialize database and store mysql password for upgrade ynh_mysql_create_db "$db_name" "$db_user" "$db_pwd" -ynh_app_setting_set "freshrss" mysqlpwd "$db_pwd" +ynh_app_setting_set "$app" mysqlpwd "$db_pwd" # Copy files to the right place TMPDIR=$(ynh_mkdir_tmp) @@ -49,23 +47,7 @@ extract_freshrss "$TMPDIR" $TMPDIR/cli/do-install.php --default_user $admin_user --auth_type http_auth --environment production --base_url $domain/$path --title FreshRSS --api_enabled --db-type mysql --db-host localhost --db-user $db_user --db-password $db_pwd --db-base $db_name -# sudo cp -a ../conf/config.php $TMPDIR/data -# sudo cp ../sources/install_ynh.sql $TMPDIR/app/SQL/install_ynh.sql - -# Change variables in freshrss configuration -# sudo sed -i "s/yunouser/$db_user/g" $TMPDIR/data/config.php -# sudo sed -i "s/yunopass/$db_pwd/g" $TMPDIR/data/config.php -# sudo sed -i "s/yunobase/$db_user/g" $TMPDIR/data/config.php -# sudo sed -i "s/yunosalt/$app_salt/g" $TMPDIR/data/config.php -# sudo sed -i "s@yunopath@$path@g" $TMPDIR/data/config.php -# if [[ $admin_user != '' ]]; then -# sudo sed -i "s/yunoadminuser/$admin_user/g" $TMPDIR/data/config.php -# else -# sudo sed -i '/yunoadminuser/d' $TMPDIR/data/config.php -# fi - # Add users - #check wallabag sharingEnable=0 if sudo yunohost app list --installed -f wallabag2 | grep -q id ; then @@ -82,28 +64,10 @@ elif sudo yunohost app list --installed -f wallabag | grep -q id ; then sharingEnable=1 fi -freshrss_users=$(ldapsearch -h localhost -b ou=users,dc=yunohost,dc=org -x objectClass=mailAccount uid | grep uid: | sed 's/uid: //' | xargs) -for myuser in $freshrss_users +for myuser in ynh_user_list do user_token=$(ynh_string_random) $TMPDIR/cli/create-user.php --user $myuser --language en --token $user_token --no-default-feeds - #copy sql - # sudo cp ../sources/install_ynh.sql /tmp/$myuser-install.sql - #change username in sql - # sudo sed -i "s/YnoUser/$myuser/g" /tmp/$myuser-install.sql - #create tables - # ynh_mysql_connect_as "$db_user" "$db_pwd" "$db_name" \ - # < "/tmp/$myuser-install.sql" - - #remove temp sql - # sudo rm /tmp/$myuser-install.sql - #copy default conf - # sudo cp -r $TMPDIR/data/users/_/ $TMPDIR/data/users/$myuser - # sudo mv $TMPDIR/data/users/$myuser/config.default.php $TMPDIR/data/users/$myuser/config.php - - # if [[ $sharingEnable -eq 1 ]]; then - # sudo sed -i "s@'sharing'\ =>\ array\ (@$sharingWallabag@g" $TMPDIR/data/users/$myuser/config.php - # fi done # Move temp dir to final dir sudo mv $TMPDIR $FINAL_PATH @@ -112,19 +76,19 @@ sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf sed -i "s@ALIASTOCHANGE@$FINAL_PATH/@g" ../conf/nginx.conf sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/freshrss.conf -#install php5-cli -sudo apt-get update -sudo apt-get install -y php5-cli php5-gmp #install update cron -echo "*/10 * * * * www-data /usr/bin/php $FINAL_PATH/app/actualize_script.php >/tmp/FreshRSS.log 2>&1" > /tmp/cronfreshrss -sudo mv /tmp/cronfreshrss /etc/cron.d/freshrss -sudo chown root /etc/cron.d/freshrss +# Add cron job +cron_path="/etc/cron.d/$app" +sed -i "s@#DESTDIR#@${FINAL_PATH}@g" ../conf/freshrss.cron +sudo cp ../conf/freshrss.cron "$cron_path" +sudo chmod 644 "$cron_path" + # Set permissions to freshrss directory sudo chown -R www-data: $FINAL_PATH/data/ sudo chown -R www-data: $FINAL_PATH/extensions/ #skip api directory -sudo yunohost app setting freshrss skipped_uris -v /api/greader.php +ynh_app_setting_set "$app" skipped_uris -v /api/greader.php # Reload Nginx and regenerate SSOwat conf sudo service nginx reload From 7fbd21fc29da61ea7bcfd9e0647beba7c664a33f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Mon, 13 Feb 2017 22:26:16 +0100 Subject: [PATCH 18/67] correct variable declaration --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 4db37a2..429abd1 100755 --- a/scripts/install +++ b/scripts/install @@ -8,7 +8,7 @@ domain=$1 path=$2 admin_user=$3 # Setup variables -$app=$APPNAME +app=$APPNAME db_user=$app db_name=$app From e35779f2aea82c3372c2f2a0c579e179d6989770 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Mon, 13 Feb 2017 22:28:50 +0100 Subject: [PATCH 19/67] APPNAME variable setup --- scripts/_common.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 6a155f1..6e1a5e5 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -1,7 +1,7 @@ # # Common variables # - +APPNAME="freshrss" # FreshRSS version VERSION="1.6.2" From 71391ecd843c132db36e612c6821c53bc548dd92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Mon, 13 Feb 2017 22:30:35 +0100 Subject: [PATCH 20/67] need to load common before using its content --- scripts/install | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/install b/scripts/install index 429abd1..8d0510e 100755 --- a/scripts/install +++ b/scripts/install @@ -3,6 +3,9 @@ # Exit on command errors and treat unset variables as an error set -eu +# Load common variables and helpers +. ./_common.sh + # Retrieve arguments domain=$1 path=$2 @@ -12,9 +15,6 @@ app=$APPNAME db_user=$app db_name=$app -# Load common variables and helpers -. ./_common.sh - # Source app helpers . /usr/share/yunohost/helpers From 82daae28fcfb9b3b68c41c38ea942c05b8800635 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Mon, 13 Feb 2017 22:32:15 +0100 Subject: [PATCH 21/67] declare DEPS_PKG_NAME --- scripts/_common.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/_common.sh b/scripts/_common.sh index 6e1a5e5..ef8f08a 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -14,6 +14,10 @@ FRESHRSS_SOURCE_URL="https://github.com/FreshRSS/FreshRSS/archive/1.6.2.tar.gz" PKGDIR=$(cd ../; pwd) FINAL_PATH="/var/www/freshrss" + +#apt dependencies +DEPS_PKG_NAME="freshrss-deps" + # # Common helpers # From 11aebfd9dd66a7784a5878d52ac5c7998365c7dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Mon, 13 Feb 2017 22:37:16 +0100 Subject: [PATCH 22/67] correct use of ynh_user_list helper --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 8d0510e..5bb10a2 100755 --- a/scripts/install +++ b/scripts/install @@ -64,7 +64,7 @@ elif sudo yunohost app list --installed -f wallabag | grep -q id ; then sharingEnable=1 fi -for myuser in ynh_user_list +for myuser in $(ynh_user_list) do user_token=$(ynh_string_random) $TMPDIR/cli/create-user.php --user $myuser --language en --token $user_token --no-default-feeds From 47b3320574db437c774ffab24c6e3f9636e53120 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Mon, 13 Feb 2017 22:40:26 +0100 Subject: [PATCH 23/67] error on ynh_app_setting_set --- scripts/install | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/scripts/install b/scripts/install index 5bb10a2..cc8ca58 100755 --- a/scripts/install +++ b/scripts/install @@ -22,7 +22,7 @@ db_name=$app # Check user parameter if not empty if [[ $admin_user != '' ]]; then ynh_user_exists $admin_user || ynh_die "Wrong user" - ynh_app_setting_set freshrss admin_user $admin_user + ynh_app_setting_set $app admin_user $admin_user fi # Check domain/path availability @@ -88,8 +88,7 @@ sudo chmod 644 "$cron_path" sudo chown -R www-data: $FINAL_PATH/data/ sudo chown -R www-data: $FINAL_PATH/extensions/ #skip api directory -ynh_app_setting_set "$app" skipped_uris -v /api/greader.php - +ynh_app_setting_set "$app" skipped_uris /api/greader.php # Reload Nginx and regenerate SSOwat conf sudo service nginx reload sudo yunohost app ssowatconf From aaa8a3a30b5e549487a25ad715c6bef1801c2f0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Mon, 13 Feb 2017 22:52:07 +0100 Subject: [PATCH 24/67] update hooks --- hooks/post_app_addaccess | 37 ++----------------------------------- hooks/post_user_create | 13 ++----------- 2 files changed, 4 insertions(+), 46 deletions(-) diff --git a/hooks/post_app_addaccess b/hooks/post_app_addaccess index 958b6ba..460cc0f 100755 --- a/hooks/post_app_addaccess +++ b/hooks/post_app_addaccess @@ -11,43 +11,10 @@ then db_name=freshrss db_pwd=$(sudo yunohost app setting freshrss mysqlpwd) - #check wallabag - if [[ $(sudo yunohost app list --installed -f wallabag2) -eq 0 ]]; then - echo "Detected wallabag V2" - wallabagPath=$(sudo yunohost app setting wallabag2 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 - 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") do - #copy sql - sudo cp $app_path/app/SQL/install_ynh.sql /tmp/$myuser-install.sql - # $app_path/cli/create-user.php --user --email - - - #change username in sql - sudo sed -i "s/YnoUser/$myuser/g" /tmp/$myuser-install.sql - #create tables - ynh_mysql_connect_as "$db_user" "$db_pwd" "$db_name" \ - < "/tmp/$myuser-install.sql" - #remove temp sql - sudo rm /tmp/$myuser-install.sql - - #copy default conf - 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 + user_token=$(ynh_string_random) + $app_path/cli/create-user.php --user $myuser --language en --token $user_token --no-default-feeds sudo chown -R www-data: $app_path/data/users/$myuser/ done fi diff --git a/hooks/post_user_create b/hooks/post_user_create index b2523f3..3241fa5 100755 --- a/hooks/post_user_create +++ b/hooks/post_user_create @@ -7,15 +7,6 @@ app_path=/var/www/freshrss myuser=$1 -#copy sql -sudo cp $app_path/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 -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 +user_token=$(ynh_string_random) +$app_path/cli/create-user.php --user $myuser --language en --token $user_token --no-default-feeds sudo chown -R www-data: $app_path/data/users/$myuser/ From fa3d251b6763f541c61f0e988ca030a417292d09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Mon, 13 Feb 2017 23:02:47 +0100 Subject: [PATCH 25/67] delete mysql parameters --- hooks/post_app_addaccess | 4 ---- hooks/post_user_create | 4 ---- 2 files changed, 8 deletions(-) diff --git a/hooks/post_app_addaccess b/hooks/post_app_addaccess index 460cc0f..a428267 100755 --- a/hooks/post_app_addaccess +++ b/hooks/post_app_addaccess @@ -7,10 +7,6 @@ app_path=/var/www/freshrss if [[ "freshrss" = "$app" ]]; then - db_user=freshrss - db_name=freshrss - db_pwd=$(sudo yunohost app setting freshrss mysqlpwd) - for myuser in $(echo "$new_users" | sed "s/,/ /g") do user_token=$(ynh_string_random) diff --git a/hooks/post_user_create b/hooks/post_user_create index 3241fa5..864e0e7 100755 --- a/hooks/post_user_create +++ b/hooks/post_user_create @@ -1,8 +1,4 @@ #!/bin/bash - -db_user=freshrss -db_name=freshrss -db_pwd=$(sudo yunohost app setting freshrss mysqlpwd) app_path=/var/www/freshrss myuser=$1 From 093d32f63ab6830086b8ed586c763939028668c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Mon, 13 Feb 2017 23:06:33 +0100 Subject: [PATCH 26/67] add helpers loading --- hooks/post_app_addaccess | 3 +++ hooks/post_user_create | 3 +++ 2 files changed, 6 insertions(+) diff --git a/hooks/post_app_addaccess b/hooks/post_app_addaccess index a428267..9dadc98 100755 --- a/hooks/post_app_addaccess +++ b/hooks/post_app_addaccess @@ -4,6 +4,9 @@ app=$1 new_users=$2 app_path=/var/www/freshrss +# Source app helpers +. /usr/share/yunohost/helpers + if [[ "freshrss" = "$app" ]]; then diff --git a/hooks/post_user_create b/hooks/post_user_create index 864e0e7..29b5f4f 100755 --- a/hooks/post_user_create +++ b/hooks/post_user_create @@ -3,6 +3,9 @@ app_path=/var/www/freshrss myuser=$1 +# Source app helpers +. /usr/share/yunohost/helpers + user_token=$(ynh_string_random) $app_path/cli/create-user.php --user $myuser --language en --token $user_token --no-default-feeds sudo chown -R www-data: $app_path/data/users/$myuser/ From a324de15d32c5dec4f5b8d98f60a755b1da333cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Mon, 13 Feb 2017 23:55:58 +0100 Subject: [PATCH 27/67] update 'remove' script --- scripts/remove | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/scripts/remove b/scripts/remove index e32e729..88a545a 100755 --- a/scripts/remove +++ b/scripts/remove @@ -1,13 +1,21 @@ #!/bin/bash +# Exit on command errors and treat unset variables as an error +set -eu + +# Source app helpers +. /usr/share/yunohost/helpers + db_user=freshrss db_name=freshrss -root_pwd=$(sudo cat /etc/yunohost/mysql) -domain=$(sudo yunohost app setting freshrss domain) +domain=$(ynh_app_setting_get freshrss domain) + +ynh_mysql_drop_db $db_name +ynh_mysql_drop_user $db_user -mysql -u root -p$root_pwd -e "DROP DATABASE $db_name ; DROP USER $db_user@localhost ;" sudo rm -rf /var/www/freshrss sudo rm -rf /etc/cron.d/freshrss sudo rm -f /etc/nginx/conf.d/$domain.d/freshrss.conf -sudo service nginx reload \ No newline at end of file +sudo service nginx reload +sudo yunohost app ssowatconf From 7d0beb1b7d2e04e48c3e841f0569a93393e196ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Tue, 14 Feb 2017 09:29:55 +0100 Subject: [PATCH 28/67] cleanup upgrade scritp --- scripts/upgrade | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 2e478f9..a516904 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -10,7 +10,7 @@ set -eu #old version cleanup if [ -f $FINAL_PATH/data/user.php.dist ]; then - sudo rm $FINAL_PATH/data/user.php.dist + sudo rm $FINAL_PATH/data/user.php.dist fi # Check destination directory @@ -26,6 +26,7 @@ extract_freshrss "$TMPDIR" sudo rm $TMPDIR/data/do-install.txt sudo cp $FINAL_PATH/data/config.php $TMPDIR/data/config.php sudo cp -r $FINAL_PATH/data/users/. $TMPDIR/data/users/ +sudo cp -r $FINAL_PATH/extensions/. $TMPDIR/extensions/ # Set permissions to freshrss directory sudo chown -R www-data: $TMPDIR/data/ @@ -37,7 +38,5 @@ sudo cp -rp "$TMPDIR" "$FINAL_PATH" #install extention for api if necessary -if ! dpkg -s php5-gmp | grep "installed" > /dev/null 2>&1; then - sudo apt-get update - sudo apt-get install -y php5-gmp -fi +ynh_package_install_from_equivs ../conf/${DEPS_PKG_NAME}.control \ + || ynh_die "Unable to install dependencies" From a6348c3fd90b60a3df26c6f184254d2e7497fa7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Tue, 14 Feb 2017 09:40:18 +0100 Subject: [PATCH 29/67] cleanup backup and restore scripts --- scripts/backup | 8 +++++--- scripts/restore | 14 +++++++------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/scripts/backup b/scripts/backup index 64f7ac8..b80ebc0 100755 --- a/scripts/backup +++ b/scripts/backup @@ -8,9 +8,11 @@ BACKUP_DIR=$1 # The parameter $2 is the id of the app instance ex: strut__2 APP=$2 +# Source app helpers +. /usr/share/yunohost/helpers + # retrieve useful param -domain=$(sudo yunohost app setting ${APP} domain) -db_pwd=$(sudo yunohost app setting ${APP} mysqlpwd) +domain=$(ynh_app_setting_get ${APP} domain) # Backup app files sudo mkdir -p "${BACKUP_DIR}/www" @@ -22,4 +24,4 @@ sudo cp -a /etc/nginx/conf.d/$domain.d/${APP}.conf "${BACKUP_DIR}/conf/${APP}.co sudo cp -a /etc/cron.d/${APP} "${BACKUP_DIR}/conf/${APP}" # Backup mysql -mysqldump -u ${APP} -p$db_pwd ${APP} | sudo dd of=${BACKUP_DIR}/${APP}.dmp +ynh_mysql_dump_db ${APP} ${BACKUP_DIR}/${APP}.dmp diff --git a/scripts/restore b/scripts/restore index 2f396f9..a477881 100644 --- a/scripts/restore +++ b/scripts/restore @@ -8,14 +8,15 @@ BACKUP_DIR=$1 # The parameter $2 is the id of the app instance ex: strut__2 APP=$2 +# Source app helpers +. /usr/share/yunohost/helpers + # retrieve useful param -domain=$(sudo yunohost app setting ${APP} domain) -db_pwd=$(sudo yunohost app setting ${APP} mysqlpwd) -path=$(sudo yunohost app setting ${APP} path) +domain=$(ynh_app_setting_get ${APP} domain) +path=$(ynh_app_setting_get ${APP} path) # Check domain/path availability -sudo yunohost app checkurl $domain$path -a ${APP} \ - || (echo "Path not available: $domain$path" && exit 1) +sudo yunohost app checkurl $domain$path -a ${APP} || ynh_die "The path ${domain}${path} is not available for app installation." # Restore sources & data final_path=/var/www/${APP} @@ -32,8 +33,7 @@ sudo cp -a "${BACKUP_DIR}/conf/${APP}.conf" /etc/nginx/conf.d/$domain.d/${APP}.c sudo cp -a "${BACKUP_DIR}/conf/${APP}" /etc/cron.d/${APP} # Restore mysql dump -sudo su -c "mysql -u ${APP} -p$db_pwd ${APP} < ${BACKUP_DIR}/${APP}.dmp" - +ynh_mysql_execute_file_as_root "${BACKUP_DIR}/${APP}.dmp" "${APP}" # Reload Nginx, and regenerate SSOwat conf sudo service nginx reload sudo yunohost app ssowatconf From 8a94115908f90421868acb3e169aaabe7f8a31a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Tue, 14 Feb 2017 09:41:13 +0100 Subject: [PATCH 30/67] permissions --- scripts/install | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/install b/scripts/install index cc8ca58..3c7e1c7 100755 --- a/scripts/install +++ b/scripts/install @@ -85,6 +85,7 @@ sudo chmod 644 "$cron_path" # Set permissions to freshrss directory +sudo chown -R root:root $FINAL_PATH sudo chown -R www-data: $FINAL_PATH/data/ sudo chown -R www-data: $FINAL_PATH/extensions/ #skip api directory From 50688365ab87c358137182df294de945b0454ef4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Tue, 14 Feb 2017 09:46:09 +0100 Subject: [PATCH 31/67] add post user delete --- hooks/post_user_delete | 5 +++++ 1 file changed, 5 insertions(+) create mode 100755 hooks/post_user_delete diff --git a/hooks/post_user_delete b/hooks/post_user_delete new file mode 100755 index 0000000..4a360de --- /dev/null +++ b/hooks/post_user_delete @@ -0,0 +1,5 @@ +#!/bin/bash +app_path=/var/www/freshrss + +myuser=$1 +$app_path/cli/delete-user.php --user $myuser From eda7b082f97316f3ceb4f49d095686c8f2438df5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Tue, 14 Feb 2017 09:50:14 +0100 Subject: [PATCH 32/67] permission on upgrade --- scripts/upgrade | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/upgrade b/scripts/upgrade index a516904..b44bfe0 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -29,6 +29,7 @@ sudo cp -r $FINAL_PATH/data/users/. $TMPDIR/data/users/ sudo cp -r $FINAL_PATH/extensions/. $TMPDIR/extensions/ # Set permissions to freshrss directory +sudo chown -R root:root $TMPDIR sudo chown -R www-data: $TMPDIR/data/ sudo chown -R www-data: $TMPDIR/extensions/ From 41f44720cf63e477cb4b5376314bdc395e5c6e4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Tue, 14 Feb 2017 10:58:25 +0100 Subject: [PATCH 33/67] linter --- scripts/_common.sh | 2 +- scripts/backup | 2 +- scripts/install | 16 ---------------- scripts/remove | 2 +- scripts/restore | 2 +- scripts/upgrade | 9 ++++----- 6 files changed, 8 insertions(+), 25 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index ef8f08a..24d6046 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -34,5 +34,5 @@ extract_freshrss() { || ynh_die "Invalid checksum of downloaded tarball" tar xf "$rc_tarball" -C "$DESTDIR" --strip-components 1 \ || ynh_die "Unable to extract FreshRss tarball" - rm "$rc_tarball" + sudo rm "$rc_tarball" } diff --git a/scripts/backup b/scripts/backup index b80ebc0..00aa3fe 100755 --- a/scripts/backup +++ b/scripts/backup @@ -1,6 +1,6 @@ #!/bin/bash -set -e +set -eu # The parameter $1 is the backup directory location dedicated to the app BACKUP_DIR=$1 diff --git a/scripts/install b/scripts/install index 3c7e1c7..a635537 100755 --- a/scripts/install +++ b/scripts/install @@ -48,22 +48,6 @@ extract_freshrss "$TMPDIR" $TMPDIR/cli/do-install.php --default_user $admin_user --auth_type http_auth --environment production --base_url $domain/$path --title FreshRSS --api_enabled --db-type mysql --db-host localhost --db-user $db_user --db-password $db_pwd --db-base $db_name # Add users -#check wallabag -sharingEnable=0 -if sudo yunohost app list --installed -f wallabag2 | grep -q id ; then - echo "Detected wallabag V2" - wallabagPath=$(sudo yunohost app setting wallabag2 path | sed 's#/*$##') - wallabagUrl=$domain$wallabagPath - 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 -elif sudo yunohost app list --installed -f wallabag | grep -q id ; 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 $(ynh_user_list) do user_token=$(ynh_string_random) diff --git a/scripts/remove b/scripts/remove index 88a545a..f2e62c4 100755 --- a/scripts/remove +++ b/scripts/remove @@ -1,7 +1,7 @@ #!/bin/bash # Exit on command errors and treat unset variables as an error -set -eu +set -u # Source app helpers . /usr/share/yunohost/helpers diff --git a/scripts/restore b/scripts/restore index a477881..be7424e 100644 --- a/scripts/restore +++ b/scripts/restore @@ -1,6 +1,6 @@ #!/bin/bash -set -e +set -eu # The parameter $1 is the backup directory location dedicated to the app BACKUP_DIR=$1 diff --git a/scripts/upgrade b/scripts/upgrade index b44bfe0..be96054 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -8,6 +8,10 @@ set -eu # Source app helpers . /usr/share/yunohost/helpers +#install extention for api if necessary +ynh_package_install_from_equivs ../conf/${DEPS_PKG_NAME}.control \ + || ynh_die "Unable to install dependencies" + #old version cleanup if [ -f $FINAL_PATH/data/user.php.dist ]; then sudo rm $FINAL_PATH/data/user.php.dist @@ -36,8 +40,3 @@ sudo chown -R www-data: $TMPDIR/extensions/ # Clean up existing files and copy new files to the right place sudo rm -rf "$FINAL_PATH" sudo cp -rp "$TMPDIR" "$FINAL_PATH" - - -#install extention for api if necessary -ynh_package_install_from_equivs ../conf/${DEPS_PKG_NAME}.control \ - || ynh_die "Unable to install dependencies" From 631e734524be3d1aaac2dd2465162045a6453b52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Tue, 14 Feb 2017 17:12:34 +0100 Subject: [PATCH 34/67] upgrade manifest --- manifest.json | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index bcf9278..064e6d3 100644 --- a/manifest.json +++ b/manifest.json @@ -1,6 +1,7 @@ { "name": "FreshRSS", "id": "freshrss", + "packaging_format": 1, "description": { "en": "FreshRSS is a selfhostable RSS reader", "fr": "FreshRSS est un agrégateur de flux RSS à auto-héberger" @@ -11,7 +12,10 @@ "name": "plopoyop", "email": "plopoyop@gmail.com" }, - "multi_instance": "false", + "requirements": { + "yunohost": ">= 2.4.0" + }, + "multi_instance": false, "services": [ "nginx", "php5-fpm", @@ -41,6 +45,7 @@ { "name": "admin", "type": "user", + "optional": true, "ask": { "en": "Choose the default user (leave empty if none)", "fr": "Choisissez l'utilisateur par defaut (laissez vide si aucun)" From 64a4c1b8e6a3a16a5fb71dc1acc422434c39ff17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Sun, 5 Mar 2017 17:17:14 +0100 Subject: [PATCH 35/67] switch to multi-instance --- manifest.json | 4 ++-- scripts/_common.sh | 5 +++++ scripts/install | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/manifest.json b/manifest.json index 064e6d3..9261bc2 100644 --- a/manifest.json +++ b/manifest.json @@ -15,7 +15,7 @@ "requirements": { "yunohost": ">= 2.4.0" }, - "multi_instance": false, + "multi_instance": true, "services": [ "nginx", "php5-fpm", @@ -45,7 +45,7 @@ { "name": "admin", "type": "user", - "optional": true, + "optional": false, "ask": { "en": "Choose the default user (leave empty if none)", "fr": "Choisissez l'utilisateur par defaut (laissez vide si aucun)" diff --git a/scripts/_common.sh b/scripts/_common.sh index 24d6046..b729181 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -36,3 +36,8 @@ extract_freshrss() { || ynh_die "Unable to extract FreshRss tarball" sudo rm "$rc_tarball" } + +install_freshrss_dependencies() { + ynh_package_install_from_equivs ../conf/${DEPS_PKG_NAME}.control \ + || ynh_die "Unable to install dependencies" +} diff --git a/scripts/install b/scripts/install index a635537..026601a 100755 --- a/scripts/install +++ b/scripts/install @@ -11,7 +11,7 @@ domain=$1 path=$2 admin_user=$3 # Setup variables -app=$APPNAME +app=$YNH_APP_INSTANCE_NAME db_user=$app db_name=$app From 3d45d9b138457c696dd781f868c0c025fbf09ddf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Sun, 5 Mar 2017 17:27:33 +0100 Subject: [PATCH 36/67] still working on multi-instance --- scripts/_common.sh | 2 -- scripts/install | 6 ++++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index b729181..f43edad 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -13,8 +13,6 @@ FRESHRSS_SOURCE_URL="https://github.com/FreshRSS/FreshRSS/archive/1.6.2.tar.gz" PKGDIR=$(cd ../; pwd) -FINAL_PATH="/var/www/freshrss" - #apt dependencies DEPS_PKG_NAME="freshrss-deps" diff --git a/scripts/install b/scripts/install index 026601a..c23c7f8 100755 --- a/scripts/install +++ b/scripts/install @@ -15,6 +15,8 @@ app=$YNH_APP_INSTANCE_NAME db_user=$app db_name=$app +FINAL_PATH="/var/www/$app" + # Source app helpers . /usr/share/yunohost/helpers @@ -26,7 +28,7 @@ if [[ $admin_user != '' ]]; then fi # Check domain/path availability -sudo yunohost app checkurl $domain$path -a freshrss || ynh_die "The path ${domain}${path} is not available for app installation." +sudo yunohost app checkurl $domain$path -a $app || ynh_die "The path ${domain}${path} is not available for app installation." #install php5-cli ynh_package_install_from_equivs ../conf/${DEPS_PKG_NAME}.control \ @@ -58,7 +60,7 @@ sudo mv $TMPDIR $FINAL_PATH # Modify Nginx configuration file and copy it to Nginx conf directory sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf sed -i "s@ALIASTOCHANGE@$FINAL_PATH/@g" ../conf/nginx.conf -sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/freshrss.conf +sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf #install update cron # Add cron job From 70b25825751d19e81d2c72486ad4c758055c3561 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Sun, 5 Mar 2017 18:01:16 +0100 Subject: [PATCH 37/67] correct bdd backup --- scripts/backup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/backup b/scripts/backup index 00aa3fe..1db5657 100755 --- a/scripts/backup +++ b/scripts/backup @@ -24,4 +24,4 @@ sudo cp -a /etc/nginx/conf.d/$domain.d/${APP}.conf "${BACKUP_DIR}/conf/${APP}.co sudo cp -a /etc/cron.d/${APP} "${BACKUP_DIR}/conf/${APP}" # Backup mysql -ynh_mysql_dump_db ${APP} ${BACKUP_DIR}/${APP}.dmp +ynh_mysql_dump_db ${APP} > ${BACKUP_DIR}/${APP}.dmp From 04f4c8613740df6e7d10a5114c8b134320c28d1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Sun, 5 Mar 2017 18:02:17 +0100 Subject: [PATCH 38/67] fix remove for multi-instance --- scripts/remove | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/scripts/remove b/scripts/remove index f2e62c4..c46cbe5 100755 --- a/scripts/remove +++ b/scripts/remove @@ -6,16 +6,18 @@ set -u # Source app helpers . /usr/share/yunohost/helpers -db_user=freshrss -db_name=freshrss -domain=$(ynh_app_setting_get freshrss domain) +app=$YNH_APP_INSTANCE_NAME +db_user=$app +db_name=$app + +domain=$(ynh_app_setting_get $app domain) ynh_mysql_drop_db $db_name ynh_mysql_drop_user $db_user -sudo rm -rf /var/www/freshrss -sudo rm -rf /etc/cron.d/freshrss -sudo rm -f /etc/nginx/conf.d/$domain.d/freshrss.conf +sudo rm -rf /var/www/$app +sudo rm -rf /etc/cron.d/$app +sudo rm -f /etc/nginx/conf.d/$domain.d/$app.conf sudo service nginx reload sudo yunohost app ssowatconf From 72b325ebb1a318d78f9c11b1035466ce151e9498 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Sun, 5 Mar 2017 20:56:16 +0100 Subject: [PATCH 39/67] move lines to comply linter --- scripts/upgrade | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index be96054..44d8c54 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -12,16 +12,16 @@ set -eu ynh_package_install_from_equivs ../conf/${DEPS_PKG_NAME}.control \ || ynh_die "Unable to install dependencies" -#old version cleanup -if [ -f $FINAL_PATH/data/user.php.dist ]; then - sudo rm $FINAL_PATH/data/user.php.dist -fi - # Check destination directory [[ ! -d $FINAL_PATH ]] && ynh_die \ "The destination directory '$FINAL_PATH' does not exist.\ The app is not correctly installed, you should remove it first." +#old version cleanup +if [ -f $FINAL_PATH/data/user.php.dist ]; then + sudo rm $FINAL_PATH/data/user.php.dist +fi + # Create tmp directory and install app inside TMPDIR=$(ynh_mkdir_tmp) extract_freshrss "$TMPDIR" From e98b150387f92b22e9b4f5c1985ae090620f8181 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Sun, 5 Mar 2017 20:57:54 +0100 Subject: [PATCH 40/67] work on backup and restore --- scripts/backup | 2 +- scripts/restore | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/backup b/scripts/backup index 1db5657..902da69 100755 --- a/scripts/backup +++ b/scripts/backup @@ -24,4 +24,4 @@ sudo cp -a /etc/nginx/conf.d/$domain.d/${APP}.conf "${BACKUP_DIR}/conf/${APP}.co sudo cp -a /etc/cron.d/${APP} "${BACKUP_DIR}/conf/${APP}" # Backup mysql -ynh_mysql_dump_db ${APP} > ${BACKUP_DIR}/${APP}.dmp +sudo ynh_mysql_dump_db ${APP} > ${BACKUP_DIR}/${APP}.dmp diff --git a/scripts/restore b/scripts/restore index be7424e..43fcd8c 100644 --- a/scripts/restore +++ b/scripts/restore @@ -7,6 +7,8 @@ BACKUP_DIR=$1 # The parameter $2 is the id of the app instance ex: strut__2 APP=$2 +dbname=$APP +dbuser=$APP # Source app helpers . /usr/share/yunohost/helpers @@ -14,6 +16,7 @@ APP=$2 # retrieve useful param domain=$(ynh_app_setting_get ${APP} domain) path=$(ynh_app_setting_get ${APP} path) +dbpass=$(ynh_app_setting_get ${APP} mysqlpwd) # Check domain/path availability sudo yunohost app checkurl $domain$path -a ${APP} || ynh_die "The path ${domain}${path} is not available for app installation." @@ -33,7 +36,9 @@ sudo cp -a "${BACKUP_DIR}/conf/${APP}.conf" /etc/nginx/conf.d/$domain.d/${APP}.c sudo cp -a "${BACKUP_DIR}/conf/${APP}" /etc/cron.d/${APP} # Restore mysql dump -ynh_mysql_execute_file_as_root "${BACKUP_DIR}/${APP}.dmp" "${APP}" +ynh_mysql_create_db "$dbname" "$dbuser" "$dbpass" +ynh_mysql_connect_as "$dbuser" "$dbpass" "$dbname" < "${BACKUP_DIR}/${APP}.dmp" + # Reload Nginx, and regenerate SSOwat conf sudo service nginx reload sudo yunohost app ssowatconf From 73be54bcb56895c86fad54120b6b135ebe9943a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Sun, 5 Mar 2017 21:58:01 +0100 Subject: [PATCH 41/67] no sudo --- scripts/backup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/backup b/scripts/backup index 902da69..1db5657 100755 --- a/scripts/backup +++ b/scripts/backup @@ -24,4 +24,4 @@ sudo cp -a /etc/nginx/conf.d/$domain.d/${APP}.conf "${BACKUP_DIR}/conf/${APP}.co sudo cp -a /etc/cron.d/${APP} "${BACKUP_DIR}/conf/${APP}" # Backup mysql -sudo ynh_mysql_dump_db ${APP} > ${BACKUP_DIR}/${APP}.dmp +ynh_mysql_dump_db ${APP} > ${BACKUP_DIR}/${APP}.dmp From 7e18bbd59f80a30a1487a3bb0f03586b94b73059 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Sun, 5 Mar 2017 23:02:33 +0100 Subject: [PATCH 42/67] remove deprecated ynh_mkdir_tmp --- scripts/install | 3 ++- scripts/upgrade | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index c23c7f8..fcd0b06 100755 --- a/scripts/install +++ b/scripts/install @@ -44,7 +44,8 @@ ynh_mysql_create_db "$db_name" "$db_user" "$db_pwd" ynh_app_setting_set "$app" mysqlpwd "$db_pwd" # Copy files to the right place -TMPDIR=$(ynh_mkdir_tmp) +TMPDIR=$(mktemp -d) +sudo chmod 655 "$TMPDIR" extract_freshrss "$TMPDIR" $TMPDIR/cli/do-install.php --default_user $admin_user --auth_type http_auth --environment production --base_url $domain/$path --title FreshRSS --api_enabled --db-type mysql --db-host localhost --db-user $db_user --db-password $db_pwd --db-base $db_name diff --git a/scripts/upgrade b/scripts/upgrade index 44d8c54..1b53c2a 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -23,7 +23,8 @@ if [ -f $FINAL_PATH/data/user.php.dist ]; then fi # Create tmp directory and install app inside -TMPDIR=$(ynh_mkdir_tmp) +TMPDIR=$(mktemp -d) +sudo chmod 655 "$TMPDIR" extract_freshrss "$TMPDIR" # Restore config From d49bbcbe2833dc4a2221bb6013f8d7e5ab640580 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Sun, 5 Mar 2017 23:08:45 +0100 Subject: [PATCH 43/67] use sudo to create tmp dir --- scripts/install | 2 +- scripts/upgrade | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index fcd0b06..b5c83a3 100755 --- a/scripts/install +++ b/scripts/install @@ -44,7 +44,7 @@ ynh_mysql_create_db "$db_name" "$db_user" "$db_pwd" ynh_app_setting_set "$app" mysqlpwd "$db_pwd" # Copy files to the right place -TMPDIR=$(mktemp -d) +TMPDIR=$(sudo mktemp -d) sudo chmod 655 "$TMPDIR" extract_freshrss "$TMPDIR" diff --git a/scripts/upgrade b/scripts/upgrade index 1b53c2a..d7769d4 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -23,7 +23,7 @@ if [ -f $FINAL_PATH/data/user.php.dist ]; then fi # Create tmp directory and install app inside -TMPDIR=$(mktemp -d) +TMPDIR=$(sudo mktemp -d) sudo chmod 655 "$TMPDIR" extract_freshrss "$TMPDIR" From 5da0672ef41121bfe49f76f479ac897901454aab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Sun, 5 Mar 2017 23:16:42 +0100 Subject: [PATCH 44/67] sudo --- scripts/_common.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index f43edad..3290ea0 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -26,7 +26,7 @@ extract_freshrss() { # retrieve and extract FreshRSS tarball rc_tarball="${DESTDIR}/freshrss.tar.gz" - wget -q -O "$rc_tarball" "$FRESHRSS_SOURCE_URL" \ + sudo wget -q -O "$rc_tarball" "$FRESHRSS_SOURCE_URL" \ || ynh_die "Unable to download FreshRSS tarball" echo "$FRESHRSS_SOURCE_SHA256 $rc_tarball" | sha256sum -c >/dev/null \ || ynh_die "Invalid checksum of downloaded tarball" From 3f293467dcfe85b4b7f8fd4eefc68eec49b9108e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Mon, 6 Mar 2017 12:02:25 +0100 Subject: [PATCH 45/67] rollback sudo --- scripts/_common.sh | 2 +- scripts/install | 4 ++-- scripts/upgrade | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 3290ea0..f43edad 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -26,7 +26,7 @@ extract_freshrss() { # retrieve and extract FreshRSS tarball rc_tarball="${DESTDIR}/freshrss.tar.gz" - sudo wget -q -O "$rc_tarball" "$FRESHRSS_SOURCE_URL" \ + wget -q -O "$rc_tarball" "$FRESHRSS_SOURCE_URL" \ || ynh_die "Unable to download FreshRSS tarball" echo "$FRESHRSS_SOURCE_SHA256 $rc_tarball" | sha256sum -c >/dev/null \ || ynh_die "Invalid checksum of downloaded tarball" diff --git a/scripts/install b/scripts/install index b5c83a3..a059698 100755 --- a/scripts/install +++ b/scripts/install @@ -44,8 +44,8 @@ ynh_mysql_create_db "$db_name" "$db_user" "$db_pwd" ynh_app_setting_set "$app" mysqlpwd "$db_pwd" # Copy files to the right place -TMPDIR=$(sudo mktemp -d) -sudo chmod 655 "$TMPDIR" +TMPDIR=$(mktemp -d) +chmod 755 "$TMPDIR" extract_freshrss "$TMPDIR" $TMPDIR/cli/do-install.php --default_user $admin_user --auth_type http_auth --environment production --base_url $domain/$path --title FreshRSS --api_enabled --db-type mysql --db-host localhost --db-user $db_user --db-password $db_pwd --db-base $db_name diff --git a/scripts/upgrade b/scripts/upgrade index d7769d4..e31fba7 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -23,8 +23,8 @@ if [ -f $FINAL_PATH/data/user.php.dist ]; then fi # Create tmp directory and install app inside -TMPDIR=$(sudo mktemp -d) -sudo chmod 655 "$TMPDIR" +TMPDIR=$(mktemp -d) +chmod 755 "$TMPDIR" extract_freshrss "$TMPDIR" # Restore config From 067f6b0957b6ce13e6ea9a5552360e8bfe3f1f46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Mon, 6 Mar 2017 13:47:59 +0100 Subject: [PATCH 46/67] multi instance yet ? --- hooks/post_app_addaccess | 4 ++-- hooks/post_user_create | 5 +++-- hooks/post_user_delete | 3 ++- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/hooks/post_app_addaccess b/hooks/post_app_addaccess index 9dadc98..7d5d247 100755 --- a/hooks/post_app_addaccess +++ b/hooks/post_app_addaccess @@ -1,8 +1,8 @@ #!/bin/bash -app=$1 +app=$YNH_APP_INSTANCE_NAME new_users=$2 -app_path=/var/www/freshrss +app_path=/var/www/$app # Source app helpers . /usr/share/yunohost/helpers diff --git a/hooks/post_user_create b/hooks/post_user_create index 29b5f4f..bc39483 100755 --- a/hooks/post_user_create +++ b/hooks/post_user_create @@ -1,5 +1,6 @@ #!/bin/bash -app_path=/var/www/freshrss +app=$YNH_APP_INSTANCE_NAME +app_path=/var/www/$app myuser=$1 @@ -7,5 +8,5 @@ myuser=$1 . /usr/share/yunohost/helpers user_token=$(ynh_string_random) -$app_path/cli/create-user.php --user $myuser --language en --token $user_token --no-default-feeds +sudo $app_path/cli/create-user.php --user $myuser --language en --token $user_token --no-default-feeds sudo chown -R www-data: $app_path/data/users/$myuser/ diff --git a/hooks/post_user_delete b/hooks/post_user_delete index 4a360de..bcccdf0 100755 --- a/hooks/post_user_delete +++ b/hooks/post_user_delete @@ -1,5 +1,6 @@ #!/bin/bash -app_path=/var/www/freshrss +app=$YNH_APP_INSTANCE_NAME +app_path=/var/www/$app myuser=$1 $app_path/cli/delete-user.php --user $myuser From edceb8ce718838aa5faac196aa520939a286a1c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Sat, 11 Mar 2017 11:02:14 +0100 Subject: [PATCH 47/67] upgrade to 1.6.3 --- scripts/_common.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index f43edad..a6d5376 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -6,10 +6,10 @@ APPNAME="freshrss" VERSION="1.6.2" # FreshRSS complete tarball checksum -FRESHRSS_SOURCE_SHA256="3773313680fb81b21bf2bdcd7da53037b2f2b4282ad8202654995ac199819a48" +FRESHRSS_SOURCE_SHA256="06bcdfbde53bd8f01b8376ee28a4f1f9630c3409d5dc12f02f74f2f7aff4a6f9" # Remote URL to fetch FreshRSS source tarball -FRESHRSS_SOURCE_URL="https://github.com/FreshRSS/FreshRSS/archive/1.6.2.tar.gz" +FRESHRSS_SOURCE_URL="https://github.com/FreshRSS/FreshRSS/archive/1.6.3.tar.gz" PKGDIR=$(cd ../; pwd) From 4e5c5e5ba7df53c380e9c3a2b6b74ec7af08f0b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Sun, 12 Mar 2017 18:38:14 +0100 Subject: [PATCH 48/67] fix upgrade --- scripts/upgrade | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index e31fba7..863389e 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -8,6 +8,9 @@ set -eu # Source app helpers . /usr/share/yunohost/helpers +$app=$YNH_APP_INSTANCE_NAME +FINAL_PATH="/var/www/$app" + #install extention for api if necessary ynh_package_install_from_equivs ../conf/${DEPS_PKG_NAME}.control \ || ynh_die "Unable to install dependencies" @@ -24,7 +27,7 @@ fi # Create tmp directory and install app inside TMPDIR=$(mktemp -d) -chmod 755 "$TMPDIR" +sudo chmod 755 "$TMPDIR" extract_freshrss "$TMPDIR" # Restore config From fa4ca075cc232e150d889e7e422888510fa44519 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Sun, 12 Mar 2017 18:48:17 +0100 Subject: [PATCH 49/67] fix upgrade #2 --- scripts/upgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index 863389e..e66bd78 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -8,7 +8,7 @@ set -eu # Source app helpers . /usr/share/yunohost/helpers -$app=$YNH_APP_INSTANCE_NAME +app=$YNH_APP_INSTANCE_NAME FINAL_PATH="/var/www/$app" #install extention for api if necessary From e3c2e0224314a9c4ae26e2d09b5b3e74e6071e0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Sun, 12 Mar 2017 19:27:31 +0100 Subject: [PATCH 50/67] backup linter --- scripts/backup | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/scripts/backup b/scripts/backup index 1db5657..0d1e948 100755 --- a/scripts/backup +++ b/scripts/backup @@ -2,26 +2,20 @@ set -eu -# The parameter $1 is the backup directory location dedicated to the app -BACKUP_DIR=$1 - -# The parameter $2 is the id of the app instance ex: strut__2 -APP=$2 - # Source app helpers . /usr/share/yunohost/helpers # retrieve useful param -domain=$(ynh_app_setting_get ${APP} domain) +app=$YNH_APP_INSTANCE_NAME +path=$(ynh_app_setting_get "$app" path) +dbpass=$(ynh_app_setting_get "$app" mysqlpwd) +domain=$(ynh_app_setting_get "$app" domain) # Backup app files -sudo mkdir -p "${BACKUP_DIR}/www" -sudo cp -a /var/www/${APP}/. "${BACKUP_DIR}/www" - +ynh_backup "$path" "www" # Backup conf files -sudo mkdir -p "${BACKUP_DIR}/conf" -sudo cp -a /etc/nginx/conf.d/$domain.d/${APP}.conf "${BACKUP_DIR}/conf/${APP}.conf" -sudo cp -a /etc/cron.d/${APP} "${BACKUP_DIR}/conf/${APP}" +ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" "conf" +ynh_backup "/etc/cron.d/$app" "conf" # Backup mysql -ynh_mysql_dump_db ${APP} > ${BACKUP_DIR}/${APP}.dmp +ynh_mysql_dump_db $app > $app.dmp From 6f11f336e0eb0a266f9a2ba8f30c461c9792897f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Sun, 12 Mar 2017 19:31:50 +0100 Subject: [PATCH 51/67] fix --- scripts/backup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/backup b/scripts/backup index 0d1e948..753576e 100755 --- a/scripts/backup +++ b/scripts/backup @@ -7,7 +7,7 @@ set -eu # retrieve useful param app=$YNH_APP_INSTANCE_NAME -path=$(ynh_app_setting_get "$app" path) +path=/var/www/$app dbpass=$(ynh_app_setting_get "$app" mysqlpwd) domain=$(ynh_app_setting_get "$app" domain) From 05d9322017e99101da9cd1d2710f7347c67217cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Sun, 12 Mar 2017 19:34:25 +0100 Subject: [PATCH 52/67] fix --- scripts/backup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/backup b/scripts/backup index 753576e..ae3102f 100755 --- a/scripts/backup +++ b/scripts/backup @@ -15,7 +15,7 @@ domain=$(ynh_app_setting_get "$app" domain) ynh_backup "$path" "www" # Backup conf files ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" "conf" -ynh_backup "/etc/cron.d/$app" "conf" +ynh_backup "/etc/cron.d/$app" "cron" # Backup mysql ynh_mysql_dump_db $app > $app.dmp From 6320d4f4c6281ca64ff5a511b926080972e22c83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Sun, 12 Mar 2017 19:46:53 +0100 Subject: [PATCH 53/67] fix backup and restore --- scripts/backup | 4 ++-- scripts/restore | 28 +++++++++++++--------------- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/scripts/backup b/scripts/backup index ae3102f..963bafc 100755 --- a/scripts/backup +++ b/scripts/backup @@ -14,8 +14,8 @@ domain=$(ynh_app_setting_get "$app" domain) # Backup app files ynh_backup "$path" "www" # Backup conf files -ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" "conf" -ynh_backup "/etc/cron.d/$app" "cron" +ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" "nginx.conf" +ynh_backup "/etc/cron.d/$app" "$app.cron" # Backup mysql ynh_mysql_dump_db $app > $app.dmp diff --git a/scripts/restore b/scripts/restore index 43fcd8c..b432409 100644 --- a/scripts/restore +++ b/scripts/restore @@ -2,29 +2,26 @@ set -eu -# The parameter $1 is the backup directory location dedicated to the app -BACKUP_DIR=$1 +app=$YNH_APP_INSTANCE_NAME +db_user=$app +db_name=$app -# The parameter $2 is the id of the app instance ex: strut__2 -APP=$2 -dbname=$APP -dbuser=$APP # Source app helpers . /usr/share/yunohost/helpers # retrieve useful param -domain=$(ynh_app_setting_get ${APP} domain) -path=$(ynh_app_setting_get ${APP} path) -dbpass=$(ynh_app_setting_get ${APP} mysqlpwd) +domain=$(ynh_app_setting_get $app domain) +path=$(ynh_app_setting_get $app path) +dbpass=$(ynh_app_setting_get $app mysqlpwd) # Check domain/path availability -sudo yunohost app checkurl $domain$path -a ${APP} || ynh_die "The path ${domain}${path} is not available for app installation." +sudo yunohost app checkurl $domain$path -a $app || ynh_die "The path ${domain}${path} is not available for app installation." # Restore sources & data -final_path=/var/www/${APP} +final_path=/var/www/$app sudo mkdir $final_path -sudo cp -a ${BACKUP_DIR}/www/. $final_path +ynh_backup "www" "$final_path" # Restore permissions sudo chown -R root:root $final_path @@ -32,12 +29,13 @@ sudo chown -R www-data: $final_path/data/ sudo chown -R www-data: $final_path/extensions/ # Restore conf files -sudo cp -a "${BACKUP_DIR}/conf/${APP}.conf" /etc/nginx/conf.d/$domain.d/${APP}.conf -sudo cp -a "${BACKUP_DIR}/conf/${APP}" /etc/cron.d/${APP} +ynh_backup "www" "$final_path" +ynh_backup "nginx.conf" /etc/nginx/conf.d/$domain.d/$app.conf +ynh_backup "$app.cron" /etc/cron.d/$app # Restore mysql dump ynh_mysql_create_db "$dbname" "$dbuser" "$dbpass" -ynh_mysql_connect_as "$dbuser" "$dbpass" "$dbname" < "${BACKUP_DIR}/${APP}.dmp" +ynh_mysql_connect_as "$dbuser" "$dbpass" "$dbname" < "$app.dmp" # Reload Nginx, and regenerate SSOwat conf sudo service nginx reload From 8bee3febda789b40c60bb2370e90c78a792566e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Sun, 12 Mar 2017 20:56:26 +0100 Subject: [PATCH 54/67] fix backup and restore --- scripts/restore | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/restore b/scripts/restore index b432409..4ca9bd8 100644 --- a/scripts/restore +++ b/scripts/restore @@ -29,9 +29,9 @@ sudo chown -R www-data: $final_path/data/ sudo chown -R www-data: $final_path/extensions/ # Restore conf files -ynh_backup "www" "$final_path" -ynh_backup "nginx.conf" /etc/nginx/conf.d/$domain.d/$app.conf -ynh_backup "$app.cron" /etc/cron.d/$app +sudo cp -a www/. $final_path +sudo cp nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf +ynh_backup $app.cron /etc/cron.d/$app # Restore mysql dump ynh_mysql_create_db "$dbname" "$dbuser" "$dbpass" From 4ec516dd63bcda1b08762c3c6807d8352b11d225 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Mon, 13 Mar 2017 13:39:53 +0100 Subject: [PATCH 55/67] fix retore www twice --- scripts/restore | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/restore b/scripts/restore index 4ca9bd8..cca0b83 100644 --- a/scripts/restore +++ b/scripts/restore @@ -29,8 +29,7 @@ sudo chown -R www-data: $final_path/data/ sudo chown -R www-data: $final_path/extensions/ # Restore conf files -sudo cp -a www/. $final_path -sudo cp nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf +ynh_backup nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf ynh_backup $app.cron /etc/cron.d/$app # Restore mysql dump From 6c42c48fa1cbe2d515540b36c802c13a34886c8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Mon, 13 Mar 2017 13:47:16 +0100 Subject: [PATCH 56/67] fix db variables --- scripts/restore | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/scripts/restore b/scripts/restore index cca0b83..4d12c5c 100644 --- a/scripts/restore +++ b/scripts/restore @@ -13,14 +13,13 @@ db_name=$app # retrieve useful param domain=$(ynh_app_setting_get $app domain) path=$(ynh_app_setting_get $app path) -dbpass=$(ynh_app_setting_get $app mysqlpwd) +db_pass=$(ynh_app_setting_get $app mysqlpwd) # Check domain/path availability sudo yunohost app checkurl $domain$path -a $app || ynh_die "The path ${domain}${path} is not available for app installation." # Restore sources & data final_path=/var/www/$app -sudo mkdir $final_path ynh_backup "www" "$final_path" # Restore permissions @@ -33,8 +32,8 @@ ynh_backup nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf ynh_backup $app.cron /etc/cron.d/$app # Restore mysql dump -ynh_mysql_create_db "$dbname" "$dbuser" "$dbpass" -ynh_mysql_connect_as "$dbuser" "$dbpass" "$dbname" < "$app.dmp" +ynh_mysql_create_db "$db_name" "$db_user" "$db_pass" +ynh_mysql_connect_as "$db_user" "$db_pass" "$db_name" < "$app.dmp" # Reload Nginx, and regenerate SSOwat conf sudo service nginx reload From cfbf00d0c82c05f995ed96f9731f30343f5c9ed4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Mon, 13 Mar 2017 20:14:53 +0100 Subject: [PATCH 57/67] linter cs --- scripts/install | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/install b/scripts/install index a059698..2dd3bab 100755 --- a/scripts/install +++ b/scripts/install @@ -7,9 +7,9 @@ set -eu . ./_common.sh # Retrieve arguments -domain=$1 -path=$2 -admin_user=$3 +domain=$YNH_APP_ARG_DOMAIN +path=$YNH_APP_ARG_PATH +admin_user=$YNH_APP_ARG_ADMIN # Setup variables app=$YNH_APP_INSTANCE_NAME db_user=$app From 882412d0f3b9bcb5c692a46de9a731c910286e86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Mon, 13 Mar 2017 20:19:27 +0100 Subject: [PATCH 58/67] forgotten sudo --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 2dd3bab..25942f5 100755 --- a/scripts/install +++ b/scripts/install @@ -45,7 +45,7 @@ ynh_app_setting_set "$app" mysqlpwd "$db_pwd" # Copy files to the right place TMPDIR=$(mktemp -d) -chmod 755 "$TMPDIR" +sudo chmod 755 "$TMPDIR" extract_freshrss "$TMPDIR" $TMPDIR/cli/do-install.php --default_user $admin_user --auth_type http_auth --environment production --base_url $domain/$path --title FreshRSS --api_enabled --db-type mysql --db-host localhost --db-user $db_user --db-password $db_pwd --db-base $db_name From 760e365700ca4b09d1cd355e5dc6f911111f4d08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Mon, 13 Mar 2017 21:46:07 +0100 Subject: [PATCH 59/67] clean manifest message --- manifest.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifest.json b/manifest.json index 9261bc2..77c10e6 100644 --- a/manifest.json +++ b/manifest.json @@ -47,8 +47,8 @@ "type": "user", "optional": false, "ask": { - "en": "Choose the default user (leave empty if none)", - "fr": "Choisissez l'utilisateur par defaut (laissez vide si aucun)" + "en": "Choose the default user", + "fr": "Choisissez l'utilisateur par defaut" }, "example": "homer" } From cbffec19ceff1234c190ba0f93bed1ea1e30658f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Mon, 13 Mar 2017 21:46:49 +0100 Subject: [PATCH 60/67] upgrade to 1.6.3 --- scripts/_common.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index a6d5376..c84e56a 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -3,7 +3,7 @@ # APPNAME="freshrss" # FreshRSS version -VERSION="1.6.2" +VERSION="1.6.3" # FreshRSS complete tarball checksum FRESHRSS_SOURCE_SHA256="06bcdfbde53bd8f01b8376ee28a4f1f9630c3409d5dc12f02f74f2f7aff4a6f9" From 703649f4d2d2c73d482e62f71a5c54a3048a2016 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Mon, 13 Mar 2017 21:47:04 +0100 Subject: [PATCH 61/67] update readme --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index d957c04..9262bfd 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,8 @@ * [YunoHost website](https://yunohost.org) Changelog: +* Update to FreshRSS 1.6.3 +* Complete package refactoring * Update to FreshRSS 1.6.2 * Update to FreshRSS 1.5 * Refactoring of yunohost scripts From 1a0f6004772d354ecc59fafcc977b5fa7536ca78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Mon, 13 Mar 2017 22:02:42 +0100 Subject: [PATCH 62/67] delete not used old config files --- conf/config.php | 23 ----------------- sources/install_ynh.sql | 57 ----------------------------------------- 2 files changed, 80 deletions(-) delete mode 100644 conf/config.php delete mode 100644 sources/install_ynh.sql diff --git a/conf/config.php b/conf/config.php deleted file mode 100644 index 7f954de..0000000 --- a/conf/config.php +++ /dev/null @@ -1,23 +0,0 @@ - 'production', - 'salt' => 'yunosalt', - 'title' => 'FreshRSS', - 'default_user' => 'yunoadminuser', - 'auth_type' => 'http_auth', - 'db' => - array ( - 'type' => 'mysql', - 'host' => 'localhost', - 'user' => 'yunouser', - 'password' => 'yunopass', - 'base' => 'yunobase', - 'prefix' => false, - ), - 'allow_anonymous' => false, - 'allow_anonymous_refresh' => false, - 'unsafe_autologin_enabled' => false, - 'api_enabled' => true, - 'extensions_enabled' => array(), -); \ No newline at end of file diff --git a/sources/install_ynh.sql b/sources/install_ynh.sql deleted file mode 100644 index 5945707..0000000 --- a/sources/install_ynh.sql +++ /dev/null @@ -1,57 +0,0 @@ -CREATE TABLE IF NOT EXISTS `YnoUser_category` ( - `id` SMALLINT NOT NULL AUTO_INCREMENT, -- v0.7 - `name` varchar(255) NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY (`name`) -- v0.7 -) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci -ENGINE = INNODB; - -CREATE TABLE IF NOT EXISTS `YnoUser_feed` ( - `id` SMALLINT NOT NULL AUTO_INCREMENT, -- v0.7 - `url` varchar(511) CHARACTER SET latin1 NOT NULL, - `category` SMALLINT DEFAULT 0, -- v0.7 - `name` varchar(255) NOT NULL, - `website` varchar(255) CHARACTER SET latin1, - `description` text, - `lastUpdate` int(11) DEFAULT 0, -- Until year 2038 - `priority` tinyint(2) NOT NULL DEFAULT 10, - `pathEntries` varchar(511) DEFAULT NULL, - `httpAuth` varchar(511) DEFAULT NULL, - `error` boolean DEFAULT 0, - `keep_history` MEDIUMINT NOT NULL DEFAULT -2, -- v0.7 - `ttl` INT NOT NULL DEFAULT -2, -- v0.7.3 - `cache_nbEntries` int DEFAULT 0, -- v0.7 - `cache_nbUnreads` int DEFAULT 0, -- v0.7 - PRIMARY KEY (`id`), - FOREIGN KEY (`category`) REFERENCES `YnoUser_category`(`id`) ON DELETE SET NULL ON UPDATE CASCADE, - UNIQUE KEY (`url`), -- v0.7 - INDEX (`name`), -- v0.7 - INDEX (`priority`), -- v0.7 - INDEX (`keep_history`) -- v0.7 -) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci -ENGINE = INNODB; - -CREATE TABLE IF NOT EXISTS `YnoUser_entry` ( - `id` bigint NOT NULL, -- v0.7 - `guid` varchar(760) CHARACTER SET latin1 NOT NULL, -- Maximum for UNIQUE is 767B - `title` varchar(255) NOT NULL, - `author` varchar(255), - `content_bin` blob, -- v0.7 - `link` varchar(1023) CHARACTER SET latin1 NOT NULL, - `date` int(11), -- Until year 2038 - `lastSeen` INT(11) DEFAULT 0, -- v1.1.1, Until year 2038 - `hash` BINARY(16), -- v1.1.1 - `is_read` boolean NOT NULL DEFAULT 0, - `is_favorite` boolean NOT NULL DEFAULT 0, - `id_feed` SMALLINT, -- v0.7 - `tags` varchar(1023), - PRIMARY KEY (`id`), - FOREIGN KEY (`id_feed`) REFERENCES `YnoUser_feed`(`id`) ON DELETE CASCADE ON UPDATE CASCADE, - UNIQUE KEY (`id_feed`,`guid`), -- v0.7 - INDEX (`is_favorite`), -- v0.7 - INDEX (`is_read`), -- v0.7 - INDEX `entry_lastSeen_index` (`lastSeen`) -- v1.1.1 -) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci -ENGINE = INNODB; - -INSERT IGNORE INTO `YnoUser_category` (id, name) VALUES(1, "Uncategorized"); From 4b7c370628475712b0abd76cb56d7b6efe04d6fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Mon, 13 Mar 2017 22:13:09 +0100 Subject: [PATCH 63/67] retrieve mysql password after ynh_die to comply linter --- check_process | 0 scripts/restore | 3 ++- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 check_process diff --git a/check_process b/check_process new file mode 100644 index 0000000..e69de29 diff --git a/scripts/restore b/scripts/restore index 4d12c5c..4e97e3b 100644 --- a/scripts/restore +++ b/scripts/restore @@ -13,11 +13,12 @@ db_name=$app # retrieve useful param domain=$(ynh_app_setting_get $app domain) path=$(ynh_app_setting_get $app path) -db_pass=$(ynh_app_setting_get $app mysqlpwd) # Check domain/path availability sudo yunohost app checkurl $domain$path -a $app || ynh_die "The path ${domain}${path} is not available for app installation." +db_pass=$(ynh_app_setting_get $app mysqlpwd) + # Restore sources & data final_path=/var/www/$app ynh_backup "www" "$final_path" From 87d9738c6d5dd0281540593c2a54a89ee9a7eb7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Mon, 13 Mar 2017 22:35:44 +0100 Subject: [PATCH 64/67] add path check --- scripts/install | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 25942f5..4cff6f0 100755 --- a/scripts/install +++ b/scripts/install @@ -8,7 +8,7 @@ set -eu # Retrieve arguments domain=$YNH_APP_ARG_DOMAIN -path=$YNH_APP_ARG_PATH +path=${YNH_APP_ARG_PATH%/} admin_user=$YNH_APP_ARG_ADMIN # Setup variables app=$YNH_APP_INSTANCE_NAME @@ -20,6 +20,14 @@ FINAL_PATH="/var/www/$app" # Source app helpers . /usr/share/yunohost/helpers +# copy past from nextcloud package +if [ "${path:0:1}" != "/" ] && [ ${#path} -gt 0 ]; then + path="/$path" +fi +if [ "${path:${#path}-1}" == "/" ] && [ ${#path} -gt 1 ]; then + path="${path:0:${#path}-1}" +fi + # Check user parameter if not empty if [[ $admin_user != '' ]]; then From 4f010f342e8836039350a1287181755f017a2226 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Mon, 13 Mar 2017 22:35:54 +0100 Subject: [PATCH 65/67] add check_process --- check_process | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/check_process b/check_process index e69de29..3c96044 100644 --- a/check_process +++ b/check_process @@ -0,0 +1,34 @@ +;; Test complet + auto_remove=1 + ; Manifest + domain="domain.tld" (DOMAIN) + path="/path" (PATH) + admin="homer" (USER) + ; Checks + pkg_linter=1 + setup_sub_dir=1 + setup_root=1 + setup_nourl=0 + setup_private=0 + setup_public=0 + upgrade=1 + backup_restore=1 + multi_instance=1 + wrong_user=1 + wrong_path=1 + incorrect_path=1 + corrupt_source=0 + fail_download_source=0 + port_already_use=0 + final_path_already_use=0 +;;; Levels + Level 1=auto + Level 2=auto + Level 3=auto + Level 4=1 + Level 5=1 + Level 6=auto + Level 7=auto + Level 8=0 + Level 9=0 + Level 10=0 From 80fd64de92181c0c2e15579a529e0d02640d2558 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Mon, 13 Mar 2017 23:08:35 +0100 Subject: [PATCH 66/67] modify path check --- scripts/install | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index 4cff6f0..c7dfc19 100755 --- a/scripts/install +++ b/scripts/install @@ -20,10 +20,11 @@ FINAL_PATH="/var/www/$app" # Source app helpers . /usr/share/yunohost/helpers -# copy past from nextcloud package -if [ "${path:0:1}" != "/" ] && [ ${#path} -gt 0 ]; then +# if path do not begin with / add a / at the begining +if [ "${path:0:1}" != "/" ]; then path="/$path" fi +# if path do not end with / add a / at the end if [ "${path:${#path}-1}" == "/" ] && [ ${#path} -gt 1 ]; then path="${path:0:${#path}-1}" fi From f4d716fbd10a45bb47473a7e681a87fe40f024e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Mon, 13 Mar 2017 23:21:31 +0100 Subject: [PATCH 67/67] update deps.control to 1.6.3 --- conf/freshrss-deps.control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/freshrss-deps.control b/conf/freshrss-deps.control index 2511cd5..fead3c8 100644 --- a/conf/freshrss-deps.control +++ b/conf/freshrss-deps.control @@ -4,7 +4,7 @@ Homepage: https://github.com/FreshRSS/FreshRSS Standards-Version: 3.9.2 Package: freshrss-deps -Version: 1.6.2 +Version: 1.6.3 Depends: php5-cli, php5-gmp Architecture: all Description: meta package for freshrss dependencies