1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/kresus_ynh.git synced 2024-09-03 19:36:10 +02:00

Upgrade to 0.15.2

Upgrade to 0.15.2
This commit is contained in:
Jean-Baptiste 2019-12-08 22:48:25 +01:00 committed by GitHub
commit 0efe5b4186
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 85 additions and 226 deletions

View file

@ -3,11 +3,44 @@
[![Integration level](https://dash.yunohost.org/integration/kresus.svg)](https://dash.yunohost.org/appci/app/kresus)
[![Install Kresus with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=kresus)
Kresus is an open-source libre self-hosted personal finance manager. It allows you to safely track your banking history, check your overall balance and know exactly on what you are spending money with the use of tags!
> *This package allows you to install Kresus quickly and simply on a YunoHost server.
If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to know how to install and enjoy it.*
**Shipped version:** 0.14.0
## Overview
# State of this package
Kresus is an open-source libre self-hosted personal finance manager. It allows you to safely track your banking history, check your overall balance and know exactly how you are spending money using categories!
**Shipped version:** 0.15.2
## Screenshots
![](https://kresus.org/images/pages/view-all-accounts.png)
## Demo
* [Official demo](https://kresus.org/en/demo.html) ⚠️ Don't set up a connection to your bank accounts, or everybody would be able to look at your private bank information!
## Configuration
## Documentation
* Official documentation: https://kresus.org/en/doc.html
## YunoHost specific features
### Supported architectures
* x86-64b - [![Build Status](https://ci-apps.yunohost.org/ci/logs/kresus%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/kresus/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/kresus%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/kresus/)
* Jessie x86-64b - [![Build Status](https://ci-stretch.nohost.me/ci/logs/kresus%20%28Apps%29.svg)](https://ci-stretch.nohost.me/ci/apps/kresus/)
## Limitations
* By default, all users have access to the accounts. Need to manually select authorised user through YunoHost Administration Panel.
# Additional information
## Roadmap
* works fine:

View file

@ -14,29 +14,16 @@
setup_nourl=0
setup_private=1
setup_public=0
upgrade=1 from_commit=c455d5def074eb4012e9c1d07e8e2abba38a3aa9
upgrade=1
backup_restore=1
multi_instance=1
incorrect_path=1
port_already_use=0
change_url=0
;;; Levels
Level 1=auto
Level 2=auto
Level 3=auto
# Level 4: kresus doesn't support any user
Level 4=1
# Level 5:
# If the level 5 (Package linter) is forced to 1. Please add justifications here.
Level 5=auto
Level 6=auto
Level 7=auto
Level 8=0
Level 9=0
Level 10=0
;;; Options
Email=jean-baptiste@holcroft.fr
Notification=all
;;; Upgrade options
; commit=c455d5def074eb4012e9c1d07e8e2abba38a3aa9
name=Upgrade from 0.13
manifest_arg=domain=DOMAIN&path=/

View file

@ -1,5 +1,5 @@
SOURCE_URL=https://framagit.org/kresusapp/kresus/-/archive/0.14.0/kresus-0.14.0.tar.bz2
SOURCE_SUM=741a996db2b121e360c0dcf72633d56d010fca22dbf230a99a8be91be3a642bc
SOURCE_URL=https://framagit.org/kresusapp/kresus/-/archive/0.15.2/kresus-0.15.2.tar.bz2
SOURCE_SUM=420ed94313e3343f47d84095bd9adade166cc1e5d83f211d39cb2dd254bb63a6
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.bz2
SOURCE_IN_SUBDIR=true

View file

@ -76,7 +76,7 @@ sources_list=
;
; Can be removed; defaults to "", which means no emails will be sent.
; Overridden by the KRESUS_EMAIL_TRANSPORT environment variable, if it's set.
transport=
transport=sendmail
; The path to the sendmail executable to use.
; Can be removed; defaults to "", which means defaults to "sendmail"
@ -90,18 +90,18 @@ sendmail_bin=
; needed to prevent email alerts from landing in the spam folder.
; Can be removed; defaults to "", which means no email will be sent.
; Overridden by the KRESUS_EMAIL_FROM environment variable, if it's set.
from=
from=__APP__@__DOMAIN__
; The network address (ipv4, ipv6 or FQDN) of the SMTP server.
; Can be removed; defaults to "", which means no email will be sent.
; Overridden by the KRESUS_EMAIL_HOST environment variable, if it's set.
host=
host=127.0.0.1
; The port to which the SMTP server listens. Default values tend to be
; 25 (server to server), or 587 (clients to server), or 465 (nonstandard).
; Can be removed; defaults to "", which means no email will be sent.
; Overridden by the KRESUS_EMAIL_PORT environment variable, if it's set.
port=
port=465
; The username used during authentication to the SMTP server.
; Can be removed; defaults to "", which means an anonymous connection.

View file

@ -8,7 +8,7 @@ location __PATH__/ {
}
location ~ __PATH__/\.(css|js|png|jpe?g|svg|eot|woff2?)$ {
add_header Cache-Control 'max-age=2592000, must-revalidate, public';
more_set_headers Cache-Control 'max-age=2592000, must-revalidate, public';
gzip_types text/plain text/css application/javascript text/javascript;
gzip on;
try_files $uri $uri/index.html @kresus;

View file

@ -6,7 +6,7 @@ After=syslog.target network.target
Type=simple
User=__APP__
Group=__APP__
ExecStartPre=__NODEJS__
#ExecStartPre=__NODEJS__
WorkingDirectory=__FINALPATH__
Environment="PATH=__ENV_PATH__"
Environment=NODE_ENV=production
@ -20,7 +20,13 @@ ProtectHome=true
ProtectSystem=strict
ProtectControlGroups=yes
ProtectKernelModules=yes
ReadWritePaths=__FINALPATH__/config.ini __FINALPATH__/data/
# to allow this systemd service to use sendmail.
# references:
# https://bugs.archlinux.org/task/57721
# https://linux.m2osw.com/snapwebsites-postfixpostdrop18189-warning-mailqueueenter-create-file-maildrop25937318189-permission
# Future wait for this ticket to be resolved: https://github.com/YunoHost/issues/issues/947
SupplementaryGroups=postdrop
ReadWritePaths=__FINALPATH__/config.ini __FINALPATH__/data/ /var/spool/postfix/maildrop/
StandardOutput=syslog
StandardError=syslog

View file

@ -13,9 +13,9 @@
"email": "jean-baptiste@holcroft.fr"
},
"requirements": {
"yunohost": ">= 2.7.14"
"yunohost": ">= 3.6.0"
},
"version": "0.13.3~ynh2",
"version": "0.15.2~ynh2",
"multi_instance": true,
"services": [
"nginx"

View file

@ -1,169 +1,6 @@
#!/bin/bash
# INFOS
# n (Node version management) utilise la variable PATH pour stocker le path de la version de node à utiliser.
# C'est ainsi qu'il change de version
# ynh_install_nodejs installe la version de nodejs demandée en argument, avec n
# ynh_use_nodejs active une version de nodejs dans le script courant
# 3 variables sont mises à disposition, et 2 sont stockées dans la config de l'app
# - nodejs_path: Le chemin absolu de cette version de node
# Utilisé pour des appels directs à node.
# - nodejs_version: Simplement le numéro de version de nodejs pour cette application
# - nodejs_use_version: Un alias pour charger une version de node dans le shell courant.
# Utilisé pour démarrer un service ou un script qui utilise node ou npm
# Dans ce cas, c'est $PATH qui contient le chemin de la version de node. Il doit être propagé sur les autres shell si nécessaire.
n_install_dir="/opt/node_n"
node_version_path="/opt/node_n/n/versions/node"
# N_PREFIX est le dossier de n, il doit être chargé dans les variables d'environnement pour n.
export N_PREFIX="$n_install_dir"
ynh_install_n () {
echo "Installation of N - Node.js version management" >&2
# Build an app.src for n
mkdir -p "../conf"
echo "SOURCE_URL=https://github.com/tj/n/archive/v2.1.7.tar.gz
SOURCE_SUM=2ba3c9d4dd3c7e38885b37e02337906a1ee91febe6d5c9159d89a9050f2eea8f" > "../conf/n.src"
# Download and extract n
ynh_setup_source "$n_install_dir/git" n
# Install n
(cd "$n_install_dir/git"
PREFIX=$N_PREFIX make install 2>&1)
}
ynh_use_nodejs () {
nodejs_version=$(ynh_app_setting_get $app nodejs_version)
load_n_path="[[ :$PATH: == *\":$n_install_dir/bin:\"* ]] || PATH=\"$n_install_dir/bin:$PATH\"; N_PREFIX="$n_install_dir""
nodejs_use_version="$n_install_dir/bin/n -q $nodejs_version"
# "Load" a version of node
eval $load_n_path; $nodejs_use_version
# Get the absolute path of this version of node
nodejs_path="$(n bin $nodejs_version)"
# Make an alias for node use
ynh_node_exec="eval $load_n_path; n use $nodejs_version"
}
ynh_install_nodejs () {
# Use n, https://github.com/tj/n to manage the nodejs versions
nodejs_version="$1"
local n_install_script="https://git.io/n-install"
# Create $n_install_dir
mkdir -p "$n_install_dir"
# Load n path in PATH
CLEAR_PATH="$n_install_dir/bin:$PATH"
# Remove /usr/local/bin in PATH in case of node has already setup.
PATH=$(echo $CLEAR_PATH | sed 's@/usr/local/bin:@@')
# Move an existing node binary, to avoid to block n.
test -x /usr/bin/node && mv /usr/bin/node /usr/bin/node_n
test -x /usr/bin/npm && mv /usr/bin/npm /usr/bin/npm_n
# If n is not previously setup, install it
if ! test n --version > /dev/null 2>&1
then
ynh_install_n
fi
# Modify the default N_PREFIX in n script
ynh_replace_string "^N_PREFIX=\${N_PREFIX-.*}$" "N_PREFIX=\${N_PREFIX-$N_PREFIX}" "$n_install_dir/bin/n"
# Restore /usr/local/bin in PATH
PATH=$CLEAR_PATH
# And replace the old node binary.
test -x /usr/bin/node_n && mv /usr/bin/node_n /usr/bin/node
test -x /usr/bin/npm_n && mv /usr/bin/npm_n /usr/bin/npm
# Install the requested version of nodejs
n $nodejs_version
# Find the last "real" version for this major version of node.
real_nodejs_version=$(find $node_version_path/$nodejs_version* -maxdepth 0 | sort --version-sort | tail --lines=1)
real_nodejs_version=$(basename $real_nodejs_version)
# Create a symbolic link for this major version. If the file doesn't already exist
if [ ! -e "$node_version_path/$nodejs_version" ]
then
ln --symbolic --force --no-target-directory $node_version_path/$real_nodejs_version $node_version_path/$nodejs_version
fi
# Store the ID of this app and the version of node requested for it
echo "$YNH_APP_ID:$nodejs_version" | tee --append "$n_install_dir/ynh_app_version"
# Store nodejs_version into the config of this app
ynh_app_setting_set $app nodejs_version $nodejs_version
# Build the update script and set the cronjob
ynh_cron_upgrade_node
ynh_use_nodejs
}
ynh_remove_nodejs () {
ynh_use_nodejs
# Remove the line for this app
sed --in-place "/$YNH_APP_ID:$nodejs_version/d" "$n_install_dir/ynh_app_version"
# If none another app uses this version of nodejs, remove it.
if ! grep --quiet "$nodejs_version" "$n_install_dir/ynh_app_version"
then
n rm $nodejs_version
fi
# If none another app uses n, remove n
if [ ! -s "$n_install_dir/ynh_app_version" ]
then
ynh_secure_remove "$n_install_dir"
ynh_secure_remove "/usr/local/n"
sed --in-place "/N_PREFIX/d" /root/.bashrc
fi
}
ynh_cron_upgrade_node () {
# Build the update script
cat > "$n_install_dir/node_update.sh" << EOF
#!/bin/bash
version_path="$node_version_path"
n_install_dir="$n_install_dir"
# Log the date
date
# List all real installed version of node
all_real_version="\$(find \$version_path/* -maxdepth 0 -type d | sed "s@\$version_path/@@g")"
# Keep only the major version number of each line
all_real_version=\$(echo "\$all_real_version" | sed 's/\..*\$//')
# Remove double entries
all_real_version=\$(echo "\$all_real_version" | sort --unique)
# Read each major version
while read version
do
echo "Update of the version \$version"
sudo \$n_install_dir/bin/n \$version
# Find the last "real" version for this major version of node.
real_nodejs_version=\$(find \$version_path/\$version* -maxdepth 0 | sort --version-sort | tail --lines=1)
real_nodejs_version=\$(basename \$real_nodejs_version)
# Update the symbolic link for this version
sudo ln --symbolic --force --no-target-directory \$version_path/\$real_nodejs_version \$version_path/\$version
done <<< "\$(echo "\$all_real_version")"
EOF
chmod +x "$n_install_dir/node_update.sh"
# Build the cronjob
cat > "/etc/cron.daily/node_update" << EOF
#!/bin/bash
$n_install_dir/node_update.sh >> $n_install_dir/node_update.log
EOF
chmod +x "/etc/cron.daily/node_update"
}
pkg_dependencies="dh-autoreconf python3-pip python3-dev python3-lxml python3-pillow virtualenv"
# Send an email to inform the administrator
#

View file

@ -6,12 +6,7 @@
# IMPORT GENERIC HELPERS
#=================================================
if [ ! -e _common.sh ]; then
# Get the _common.sh file if it's not in the current directory
cp ../settings/scripts/_common.sh ./_common.sh
chmod a+rx _common.sh
fi
source _common.sh
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================

View file

@ -23,8 +23,6 @@ ynh_abort_if_errors
# Retrieve arguments
domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH
port=$(ynh_find_port 9876)
salt=$(ynh_string_random 40)
app=$YNH_APP_INSTANCE_NAME
@ -49,6 +47,14 @@ ynh_webpath_register "$app" "$domain" "$path_url"
ynh_app_setting_set "$app" domain "$domain"
ynh_app_setting_set "$app" path "$path_url"
#=================================================
# DEFAULT SETTINGS
#=================================================
port=$(ynh_find_port 9876)
salt=$(ynh_string_random 40)
ynh_app_setting_set "$app" port "$port"
ynh_app_setting_set "$app" salt "$salt"
@ -58,8 +64,7 @@ ynh_app_setting_set "$app" salt "$salt"
# INSTALL DEPENDENCIES
#=================================================
ynh_install_app_dependencies dh-autoreconf \
python-pip python-dev python-lxml python-imaging python-virtualenv
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
@ -98,20 +103,20 @@ ynh_system_user_create "$app"
#=================================================
# install nodejs
ynh_install_nodejs 8
ynh_install_nodejs 10
#=================================================
# Install weboob with pip
#=================================================
virtualenv --system-site-packages "${final_path}/venv"
virtualenv --python=python3 --system-site-packages "${final_path}/venv"
(
set +o nounset
source "${final_path}/venv/bin/activate"
set -o nounset
pip install --upgrade pip
pip install weboob html2text simplejson BeautifulSoup PyExecJS
pip install weboob html2text simplejson BeautifulSoup4 PyExecJS
)
#=================================================
@ -135,6 +140,8 @@ ynh_replace_string "__PORT__" "$port" "$final_path/config.ini"
ynh_replace_string "__PATH__" "$path_url" "$final_path/config.ini"
ynh_replace_string "__FINALPATH__" "$final_path" "$final_path/config.ini"
ynh_replace_string "__SALT__" "$salt" "$final_path/config.ini"
ynh_replace_string "__APP__" "$app" "$final_path/config.ini"
ynh_replace_string "__DOMAIN__" "$domain" "$final_path/config.ini"
# Calculate and store the config file checksum into the app settings
@ -144,7 +151,7 @@ ynh_store_file_checksum "$final_path/config.ini"
# SETUP SYSTEMD
#=================================================
ynh_replace_string "__NODEJS__" "$nodejs_use_version" ../conf/systemd.service
ynh_replace_string "__NODEJS__" "$nodejs_path" ../conf/systemd.service
ynh_replace_string "__ENV_PATH__" "$PATH" ../conf/systemd.service
ynh_replace_string "__NODEPATH__" "$(dirname "$nodejs_path")" ../conf/systemd.service

View file

@ -6,12 +6,7 @@
# IMPORT GENERIC HELPERS
#=================================================
if [ ! -e _common.sh ]; then
# Get the _common.sh file if it's not in the current directory
cp ../settings/scripts/_common.sh ./_common.sh
chmod a+rx _common.sh
fi
source _common.sh
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
@ -76,14 +71,13 @@ chmod 600 "$final_path/config.ini"
#=================================================
# Define and install dependencies
ynh_install_app_dependencies dh-autoreconf \
python-pip python-dev python-lxml python-imaging python-virtualenv
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# INSTALL NODEJS
#=================================================
ynh_install_nodejs 8
ynh_install_nodejs 10
#=================================================
# RESTORE SYSTEMD

View file

@ -71,8 +71,7 @@ path_url=$(ynh_normalize_url_path "$path_url")
# INSTALL DEPENDENCIES
#=================================================
ynh_install_app_dependencies dh-autoreconf \
python-pip python-dev python-lxml python-imaging python-virtualenv
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
@ -109,20 +108,21 @@ ynh_system_user_create "$app"
#=================================================
# install nodejs
ynh_install_nodejs 8
ynh_install_nodejs 10
#=================================================
# Install weboob with pip
#=================================================
virtualenv --system-site-packages "${final_path}/venv"
ynh_secure_remove "${final_path}/venv"
virtualenv --python=python3 --system-site-packages "${final_path}/venv"
(
set +o nounset
source "${final_path}/venv/bin/activate"
set -o nounset
pip install --upgrade pip
pip install weboob html2text simplejson BeautifulSoup PyExecJS
pip install weboob html2text simplejson BeautifulSoup4 PyExecJS
)
#=================================================
@ -156,7 +156,7 @@ ynh_store_file_checksum "$final_path/config.ini"
# SETUP SYSTEMD
#=================================================
ynh_replace_string "__NODEJS__" "$nodejs_use_version" ../conf/systemd.service
ynh_replace_string "__NODEJS__" "$nodejs_path" ../conf/systemd.service
ynh_replace_string "__ENV_PATH__" "$PATH" ../conf/systemd.service
ynh_replace_string "__NODEPATH__" "$(dirname "$nodejs_path")" ../conf/systemd.service