1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/wallabag2_ynh.git synced 2024-10-01 13:35:06 +02:00

Update to upstream version 2.2.2 (#24)

Tests worked correctly, merging.
This commit is contained in:
JimboJoe 2017-04-11 17:00:21 +02:00 committed by lapineige
parent 41a793fa9b
commit b773089381
9 changed files with 144 additions and 33 deletions

View file

@ -7,7 +7,7 @@ This is a work-in-progress Wallabag v2 package for YunoHost.
**NB: Since @jeromelebleu is no longer maintaining this package, I (@lapineige) take over this repository. But I have limited time and experience, so feel free to help !**
**Shipped version:** 2.1.4
**Shipped version:** 2.2.2
[Wallabag](https://www.wallabag.org/) is a self hostable Read-It-Later application allowing
you to not miss any content anymore. Click, save, read it when you can.
@ -24,8 +24,11 @@ this package:
## TODO
* Improve the LDAP integration, see [#1](https://github.com/YunoHost-Apps/wallabag2_ynh/issues/1)
* Write the `backup` / `restore` scripts (meanfile please make your own backup, e.g. with the export tool)
* Improve the LDAP integration, see [#1](https://github.com/YunoHost-Apps/wallabag2_ynh/issues/1). At the moment you have to apply a workaround to connect via OAuth (iOS, Chrome/Firefox plugin, etc.) by changing your user password:
* via the user interface and the recovery e-mail
* via CLI on the server: `cd /var/www/wallabag2 ; sudo -u www-data ./bin/console --env=prod fos:user:change-password`
* Write the `backup` / `restore` scripts (meanwhile please make your own backup, e.g. with the export tool)
* Refactor the application to apply for replacing wallabag v1 official application!
## Upgrade from v1

34
check_process Normal file
View file

@ -0,0 +1,34 @@
;; Complete test
auto_remove=1
; Manifest
domain="domain.tld" (DOMAIN)
path="/path" (PATH)
admin="john" (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=0
multi_instance=0
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=0
Level 5=auto
Level 6=auto
Level 7=auto
Level 8=0
Level 9=0
Level 10=0

View file

@ -5,9 +5,9 @@ location {LOCATION} {
rewrite ^ https://$server_name$request_uri? permanent;
}
try_files $uri @wallbag2;
try_files $uri @wallabag2;
location ~ ^{PATH}/app\.php(?:$|/) {
location ~ ^{PATH}/app\.php(/|$) {
include fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
fastcgi_param SCRIPT_FILENAME $request_filename;
@ -27,6 +27,6 @@ location {LOCATION} {
include conf.d/yunohost_panel.conf.inc;
}
location @wallbag2 {
rewrite ^ {PATH}/app.php$is_args$args;
location @wallabag2 {
rewrite ^ {PATH}/app.php/$is_args$args;
}

37
conf/nginx_sub_dir.conf Normal file
View file

@ -0,0 +1,37 @@
location {LOCATION}/ {
alias {DESTDIR}/web/;
if ($scheme = http) {
rewrite ^ https://$server_name$request_uri? permanent;
}
try_files $uri @wallabag2;
location ~ ^{PATH}/app\.php(/|$) {
include fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param REMOTE_USER $remote_user;
fastcgi_pass unix:/var/run/php5-fpm-{POOLNAME}.sock;
fastcgi_intercept_errors on;
}
# return 404 for all other php files not matching the front controller
# this prevents access to other php files you don't want to be accessible.
location ~ \.php$ {
return 404;
}
# Include SSOWAT user panel.
include conf.d/yunohost_panel.conf.inc;
}
location @wallabag2 {
rewrite ^ {PATH}/app.php/$is_args$args;
}
location {LOCATION} {
return 301 {LOCATION}/;
}

View file

@ -8,6 +8,7 @@ parameters:
database_path: null
database_table_prefix: null
database_socket: null
database_charset: utf8mb4
mailer_transport: smtp
mailer_host: 127.0.0.1
@ -36,9 +37,14 @@ parameters:
rabbitmq_port: 5672
rabbitmq_user: guest
rabbitmq_password: guest
rabbitmq_prefetch_count: 10
# Redis processing
redis_scheme: tcp
redis_host: localhost
redis_port: 6379
redis_path: null
redis_password: null
# sites credentials
sites_credentials: {}

View file

@ -8,7 +8,7 @@
},
"url": "https://www.wallabag.org",
"license": "MIT",
"version": "2.1.4",
"version": "2.2.2",
"maintainer": {
"name": "jerome",
"email": "jerome@yunohost.org"

View file

@ -3,16 +3,16 @@
#
# Wallabag version
VERSION="2.1.4"
VERSION="2.2.2"
# Package name for Wallabag dependencies
DEPS_PKG_NAME="wallabag-deps"
# Full Wallabag sources tarball URL
WALLABAG_SOURCE_URL="https://framabag.org/wallabag-release-${VERSION}.tar.gz"
WALLABAG_SOURCE_URL="https://static.wallabag.org/releases/wallabag-release-${VERSION}.tar.gz"
# Full Wallabag sources tarball checksum
WALLABAG_SOURCE_SHA256="eb64205a4d7c161527edd08bed22e8dd9799fe8a4130c5964c18cba3a94c9768"
WALLABAG_SOURCE_SHA256="40d98bd556116dbc28f92339f0e5b93836ece87dcb01e7aaa628ea98855a1f51"
# App package root directory should be the parent folder
PKGDIR=$(cd ../; pwd)
@ -34,7 +34,7 @@ exec_as() {
eval $@
else
# use sudo twice to be root and be allowed to use another user
sudo sudo -u "$USER" $@
sudo sudo -u "$USER" "$@"
fi
}
@ -44,7 +44,7 @@ exec_console() {
local AS_USER=$1
local WORKDIR=$2
shift 2
exec_as "$AS_USER" php "bin/console" --no-interaction --env=prod $@
exec_as "$AS_USER" php "$WORKDIR/bin/console" --no-interaction --env=prod "$@"
}
# Download and extract Wallabag sources to the given directory
@ -69,3 +69,27 @@ extract_wallabag() {
&& for p in ${PKGDIR}/patches/*.patch; do patch -p1 < $p; done) \
|| ynh_die "Unable to apply patches to Wallabag"
}
# Normalize the url path syntax
# Handle the slash at the beginning of path and its absence at ending
# Return a normalized url path
#
# example: url_path=$(ynh_normalize_url_path $url_path)
# ynh_normalize_url_path example -> /example
# ynh_normalize_url_path /example -> /example
# ynh_normalize_url_path /example/ -> /example
# ynh_normalize_url_path / -> /
#
# usage: ynh_normalize_url_path path_to_normalize
# | arg: url_path_to_normalize - URL path to normalize before using it
ynh_normalize_url_path () {
path_url=$1
test -n "$path_url" || ynh_die "ynh_normalize_url_path expect a URL path as first argument and received nothing."
if [ "${path_url:0:1}" != "/" ]; then # If the first character is not a /
path_url="/$path_url" # Add / at begin of path variable
fi
if [ "${path_url:${#path_url}-1}" == "/" ] && [ ${#path_url} -gt 1 ]; then # If the last character is a / and that not the only character.
path_url="${path_url:0:${#path_url}-1}" # Delete the last character
fi
echo $path_url
}

View file

@ -3,16 +3,16 @@
# Exit on command errors and treat unset variables as an error
set -eu
# Load common variables and helpers
source ./_common.sh
# Retrieve app id
app=$YNH_APP_INSTANCE_NAME
# Retrieve arguments
domain=$1
path=${2%/}
admin=$3
# Load common variables and helpers
source ./_common.sh
domain=$YNH_APP_ARG_DOMAIN
path=$(ynh_normalize_url_path $YNH_APP_ARG_PATH)
admin=$YNH_APP_ARG_ADMIN
# Set app specific variables
dbname=$app
@ -80,12 +80,16 @@ done
exec_console www-data "$DESTDIR" fos:user:promote --super "$admin"
# Copy and set nginx configuration
nginx_conf="/etc/nginx/conf.d/${domain}.d/${app}.conf"
sed -i "s@{LOCATION}@${path:-/}@g" $PKGDIR/conf/nginx.conf
sed -i "s@{PATH}@${path}@g" $PKGDIR/conf/nginx.conf
sed -i "s@{DESTDIR}@${DESTDIR}@g" $PKGDIR/conf/nginx.conf
sed -i "s@{POOLNAME}@${app}@g" $PKGDIR/conf/nginx.conf
sudo cp $PKGDIR/conf/nginx.conf "$nginx_conf"
if [[ "$path" == "/" ]] ; then
nginx_conf=$PKGDIR/conf/nginx_root.conf
else
nginx_conf=$PKGDIR/conf/nginx_sub_dir.conf
fi
sed -i "s@{LOCATION}@${path:-/}@g" "$nginx_conf"
sed -i "s@{PATH}@${path}@g" "$nginx_conf"
sed -i "s@{DESTDIR}@${DESTDIR}@g" "$nginx_conf"
sed -i "s@{POOLNAME}@${app}@g" "$nginx_conf"
sudo cp "$nginx_conf" "/etc/nginx/conf.d/${domain}.d/${app}.conf"
# Copy and set php-fpm configuration
phpfpm_conf="/etc/php5/fpm/pool.d/${app}.conf"

View file

@ -13,8 +13,7 @@ dbuser=$app
# Retrieve arguments
domain=$(ynh_app_setting_get "$app" domain)
path=$(ynh_app_setting_get "$app" path)
path=${path%/}
path=$(ynh_normalize_url_path $(ynh_app_setting_get "$app" path))
dbpass=$(ynh_app_setting_get "$app" mysqlpwd)
deskey=$(ynh_app_setting_get "$app" deskey)
@ -50,12 +49,16 @@ exec_console www-data "$DESTDIR" doctrine:migrations:migrate
exec_console www-data "$DESTDIR" cache:clear
# Copy and set nginx configuration
nginx_conf="/etc/nginx/conf.d/${domain}.d/${app}.conf"
sed -i "s@{LOCATION}@${path:-/}@g" ../conf/nginx.conf
sed -i "s@{PATH}@${path}@g" ../conf/nginx.conf
sed -i "s@{DESTDIR}@${DESTDIR}@g" ../conf/nginx.conf
sed -i "s@{POOLNAME}@${app}@g" ../conf/nginx.conf
sudo cp ../conf/nginx.conf "$nginx_conf"
if [[ "$path" == "/" ]] ; then
nginx_conf=$PKGDIR/conf/nginx_root.conf
else
nginx_conf=$PKGDIR/conf/nginx_sub_dir.conf
fi
sed -i "s@{LOCATION}@${path:-/}@g" "$nginx_conf"
sed -i "s@{PATH}@${path}@g" "$nginx_conf"
sed -i "s@{DESTDIR}@${DESTDIR}@g" "$nginx_conf"
sed -i "s@{POOLNAME}@${app}@g" "$nginx_conf"
sudo cp "$nginx_conf" "/etc/nginx/conf.d/${domain}.d/${app}.conf"
# Copy and set php-fpm configuration
phpfpm_conf="/etc/php5/fpm/pool.d/${app}.conf"