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

Merge pull request #32 - upgrade to 0.14.0

Testing fix #29
This commit is contained in:
Jean-Baptiste 2019-03-01 21:07:35 +01:00 committed by GitHub
commit 45142791b1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 51 additions and 23 deletions

View file

@ -5,7 +5,7 @@
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! 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!
**Shipped version:** 0.13.2 **Shipped version:** 0.14.0
# State of this package # State of this package

View file

@ -14,7 +14,7 @@
setup_nourl=0 setup_nourl=0
setup_private=1 setup_private=1
setup_public=0 setup_public=0
upgrade=1 upgrade=1 from_commit=c455d5def074eb4012e9c1d07e8e2abba38a3aa9
backup_restore=1 backup_restore=1
multi_instance=1 multi_instance=1
incorrect_path=1 incorrect_path=1
@ -36,3 +36,7 @@
;;; Options ;;; Options
Email=jean-baptiste@holcroft.fr Email=jean-baptiste@holcroft.fr
Notification=all 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.13.3/kresus-0.13.3.tar.bz2 SOURCE_URL=https://framagit.org/kresusapp/kresus/-/archive/0.14.0/kresus-0.14.0.tar.bz2
SOURCE_SUM=b1c4af2cab68dc0c02dcc625be416c1fa59105b1cbd3ec3cd93244296e047f68 SOURCE_SUM=741a996db2b121e360c0dcf72633d56d010fca22dbf230a99a8be91be3a642bc
SOURCE_SUM_PRG=sha256sum SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.bz2 SOURCE_FORMAT=tar.bz2
SOURCE_IN_SUBDIR=true SOURCE_IN_SUBDIR=true

View file

@ -41,6 +41,14 @@ url_prefix=__PATH__
; python_exec=python3 ; python_exec=python3
python_exec=__FINALPATH__/venv/bin/python python_exec=__FINALPATH__/venv/bin/python
; A salt value used in encryption algorithms (used for instance to
; encrypt/decrypt exports). It should be a random string value with
; at least 16 characters if you decide to provide it.
; Overriden by the KRESUS_SALT environment variable, if it's set.
; Example:
; salt=gj4J89fkjf4h29aDi0f{}fu4389sejk`9osk`
salt=__SALT__
[weboob] [weboob]
; The directory in which Weboob core is stored. ; The directory in which Weboob core is stored.
; Can be removed; defaults to "", indicating that weboob is already in the ; Can be removed; defaults to "", indicating that weboob is already in the

View file

@ -24,6 +24,7 @@ ynh_abort_if_errors
domain=$YNH_APP_ARG_DOMAIN domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH path_url=$YNH_APP_ARG_PATH
port=$(ynh_find_port 9876) port=$(ynh_find_port 9876)
salt=$(ynh_string_random 40)
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
@ -49,6 +50,7 @@ ynh_webpath_register "$app" "$domain" "$path_url"
ynh_app_setting_set "$app" domain "$domain" ynh_app_setting_set "$app" domain "$domain"
ynh_app_setting_set "$app" path "$path_url" ynh_app_setting_set "$app" path "$path_url"
ynh_app_setting_set "$app" port "$port" ynh_app_setting_set "$app" port "$port"
ynh_app_setting_set "$app" salt "$salt"
#================================================= #=================================================
# STANDARD MODIFICATIONS # STANDARD MODIFICATIONS
@ -119,7 +121,7 @@ virtualenv --system-site-packages "${final_path}/venv"
ynh_use_nodejs ynh_use_nodejs
( (
cd "$final_path" cd "$final_path"
chown -R $app: "$final_path" chown -R "$app": "$final_path"
npm install --production --unsafe-perm npm install --production --unsafe-perm
) )
@ -132,6 +134,8 @@ cp ../conf/config.ini "$final_path/config.ini"
ynh_replace_string "__PORT__" "$port" "$final_path/config.ini" ynh_replace_string "__PORT__" "$port" "$final_path/config.ini"
ynh_replace_string "__PATH__" "$path_url" "$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 "__FINALPATH__" "$final_path" "$final_path/config.ini"
ynh_replace_string "__SALT__" "$salt" "$final_path/config.ini"
# Calculate and store the config file checksum into the app settings # Calculate and store the config file checksum into the app settings
ynh_store_file_checksum "$final_path/config.ini" ynh_store_file_checksum "$final_path/config.ini"

View file

@ -35,9 +35,9 @@ final_path=$(ynh_app_setting_get "$app" final_path)
# CHECK IF THE APP CAN BE RESTORED # CHECK IF THE APP CAN BE RESTORED
#================================================= #=================================================
ynh_webpath_available $domain $path_url \ ynh_webpath_available "$domain" "$path_url" \
|| ynh_die "Path not available: ${domain}${path_url}" || ynh_die "Path not available: ${domain}${path_url}"
test ! -d $final_path \ test ! -d "$final_path" \
|| ynh_die "There is already a directory: $final_path " || ynh_die "There is already a directory: $final_path "
#================================================= #=================================================
@ -66,7 +66,7 @@ ynh_system_user_create "$app"
#================================================= #=================================================
# Restore permissions on app files # Restore permissions on app files
chown -R $app: $final_path chown -R "$app": "$final_path"
chmod 600 "$final_path/config.ini" chmod 600 "$final_path/config.ini"
#================================================= #=================================================
@ -90,13 +90,13 @@ ynh_install_nodejs 8
#================================================= #=================================================
ynh_restore_file "/etc/systemd/system/$app.service" ynh_restore_file "/etc/systemd/system/$app.service"
systemctl enable $app.service systemctl enable "$app".service
#================================================= #=================================================
# START HASTEBIN # START HASTEBIN
#================================================= #=================================================
systemctl start $app systemctl start "$app"
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION

View file

@ -18,26 +18,32 @@ ynh_abort_if_errors
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get $app domain) domain=$(ynh_app_setting_get "$app" domain)
path_url=$(ynh_app_setting_get $app path) path_url=$(ynh_app_setting_get "$app" path)
final_path=$(ynh_app_setting_get $app final_path) final_path=$(ynh_app_setting_get "$app" final_path)
port=$(ynh_app_setting_get $app port) port=$(ynh_app_setting_get "$app" port)
salt=$(ynh_app_setting_get "$app" salt)
#================================================= #=================================================
# ENSURE DOWNWARD COMPATIBILITY # ENSURE DOWNWARD COMPATIBILITY
#================================================= #=================================================
# If final_path doesn't exist, create it # If final_path doesn't exist, create it
if [ -z $final_path ]; then if [ -z "$final_path" ]; then
final_path=/var/www/$app final_path=/var/www/$app
ynh_app_setting_set $app final_path $final_path ynh_app_setting_set "$app" final_path "$final_path"
fi fi
if [ -z "/home/ynh$app" ]; then if [ -d "/home/ynh$app" ]; then
mv "/home/ynh$app/data" "$final_path/data" mv "/home/ynh$app/data" "$final_path/data"
ynh_secure_remove "/home/ynh$app" ynh_secure_remove "/home/ynh$app"
fi fi
if [ -z "$salt" ]; then
salt=$(ynh_string_random 40)
ynh_app_setting_set "$app" salt "$salt"
fi
#================================================= #=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#================================================= #=================================================
@ -57,7 +63,7 @@ ynh_abort_if_errors
#================================================= #=================================================
# Normalize the URL path syntax # Normalize the URL path syntax
path_url=$(ynh_normalize_url_path $path_url) path_url=$(ynh_normalize_url_path "$path_url")
#================================================= #=================================================
# STANDARD UPGRADE STEPS # STANDARD UPGRADE STEPS
@ -126,7 +132,7 @@ virtualenv --system-site-packages "${final_path}/venv"
ynh_use_nodejs ynh_use_nodejs
( (
cd "$final_path" cd "$final_path"
chown -R $app: "$final_path" chown -R "$app": "$final_path"
npm install --production --unsafe-perm npm install --production --unsafe-perm
) )
@ -141,6 +147,7 @@ cp ../conf/config.ini "$final_path/config.ini"
ynh_replace_string "__PORT__" "$port" "$final_path/config.ini" ynh_replace_string "__PORT__" "$port" "$final_path/config.ini"
ynh_replace_string "__PATH__" "$path_url" "$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 "__FINALPATH__" "$final_path" "$final_path/config.ini"
ynh_replace_string "__SALT__" "$salt" "$final_path/config.ini"
# Calculate and store the config file checksum into the app settings # Calculate and store the config file checksum into the app settings
ynh_store_file_checksum "$final_path/config.ini" ynh_store_file_checksum "$final_path/config.ini"
@ -171,7 +178,12 @@ chmod -R 750 "$final_path/data/"
# Set permissions to config files # Set permissions to config files
chown "$app" "$final_path/config.ini" chown "$app" "$final_path/config.ini"
chmod 600 "$final_path/config.ini" "$final_path/data/weboob-data/backends" chmod 600 "$final_path/config.ini"
if [ -f "$final_path/data/weboob-data/backends" ]
then
chmod 600 "$final_path/data/weboob-data/backends"
fi
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX