From ff561142fceda1ec3220a30ce414967004b422d0 Mon Sep 17 00:00:00 2001 From: Sebastian Gumprich Date: Sun, 19 Feb 2017 13:54:21 +0100 Subject: [PATCH] update ttrss version, add update schema to install Remove sources from git and install tt-rss from original source. --- conf/config.php | 39 +++++++++++++-------------------------- manifest.json | 1 + scripts/_common.sh | 32 ++++++++++++++++++++++++++++++++ scripts/install | 23 +++++++++++++++-------- scripts/upgrade | 6 +++++- 5 files changed, 66 insertions(+), 35 deletions(-) create mode 100644 scripts/_common.sh diff --git a/conf/config.php b/conf/config.php index a0416fa..af10c6d 100644 --- a/conf/config.php +++ b/conf/config.php @@ -1,4 +1,4 @@ - diff --git a/manifest.json b/manifest.json index e529598..83c7c20 100644 --- a/manifest.json +++ b/manifest.json @@ -10,6 +10,7 @@ "fr": "Un lecteur de flux en PHP et Ajax" }, "url": "http://tt-rss.org", + "version": "17.1", "maintainer": { "name": "titoko", "email": "titoko@titoko.fr" diff --git a/scripts/_common.sh b/scripts/_common.sh new file mode 100644 index 0000000..0b2b1e3 --- /dev/null +++ b/scripts/_common.sh @@ -0,0 +1,32 @@ +# +# Common variables +# + +APPNAME="ttrss" + +# ttrss version +VERSION="16.8" + +# Remote URL to fetch ttrss tarball +TTRSS_BINARY_URL="https://tt-rss.org/gitlab/fox/tt-rss/repository/archive.zip?ref=${VERSION}" + +# +# Common helpers +# + +# Download and extract ttrss binary to the given directory +# usage: extract_ttrss DESTDIR +extract_ttrss() { + local DESTDIR=$1 + local TMPDIR=$(mktemp -d) + + # retrieve and extract ttrss tarball + ttrss_tarball="/tmp/ttrss.zip" + rm -f "$ttrss_tarball" + wget -q -O "$ttrss_tarball" "$TTRSS_BINARY_URL" \ + || ynh_die "Unable to download ttrss tarball" + unzip -q "$ttrss_tarball" -d "$TMPDIR" \ + || ynh_die "Unable to extract ttrss tarball" + sudo rsync -a "$TMPDIR"/tt-rss.git/* "$DESTDIR" + rm -rf "$ttrss_tarball" "$TMPDIR" +} diff --git a/scripts/install b/scripts/install index e4f8308..b0ca8a5 100644 --- a/scripts/install +++ b/scripts/install @@ -3,6 +3,10 @@ # causes the shell to exit if any subcommand or pipeline returns a non-zero status set -e +# Load common variables +source ./_common.sh + + # Retrieve arguments domain=$1 path=$2 @@ -18,22 +22,21 @@ fi 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') -# Use 'ttrss' as database name and user -db_user=$app - -# Initialize database and store mysql password for upgrade -sudo yunohost app initdb $db_user -p $db_pwd -s $(readlink -e ../source/schema/TTRSS_schema_mysql.sql) -sudo yunohost app setting $app mysqlpwd -v $db_pwd - # Copy files to the right place final_path=/var/www/$app sudo mkdir -p $final_path -sudo cp -r ../source/* $final_path +extract_ttrss $final_path sudo cp ../conf/config.php $final_path/ sudo cp ../conf/*.patch /tmp/ sudo patch -d $final_path -p0 < /tmp/update.patch sudo patch -d $final_path/plugins/auth_remote/ -p0 < /tmp/init.patch +# Use 'ttrss' as database name and user +db_user=$app + +# Initialize database and store mysql password for upgrade +sudo yunohost app initdb $db_user -p $db_pwd -s $(readlink -e $final_path/schema/ttrss_schema_mysql.sql) +sudo yunohost app setting $app mysqlpwd -v $db_pwd # Change variables in ttrss configuration sudo sed -i "s/yunouser/$db_user/g" $final_path/config.php @@ -74,4 +77,8 @@ sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf # Reload Nginx and regenerate SSOwat conf sudo service nginx reload + +# Update database schema +sudo sudo -u www-data php ${final_path}/update.php --update-schema + sudo yunohost app setting $app skipped_uris -v "/public.php,/api" diff --git a/scripts/upgrade b/scripts/upgrade index 762cba0..227271f 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -3,6 +3,9 @@ # causes the shell to exit if any subcommand or pipeline returns a non-zero status set -e +# Load common variables +source ./_common.sh + app=${!#} domain=$(sudo yunohost app setting $app domain) @@ -14,7 +17,8 @@ db_pwd=$(sudo yunohost app setting $app mysqlpwd) final_path=/var/www/$app sudo mkdir -p $final_path -sudo cp -a ../source/* $final_path +extract_ttrss $final_path + sudo cp ../conf/config.php $final_path/ sudo cp ../conf/*.patch /tmp/ sudo patch -d $final_path -p0 < /tmp/update.patch