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

Merge pull request #57 from YunoHost-Apps/testing

4.13.1
This commit is contained in:
Kayou 2022-07-22 11:09:21 +02:00 committed by GitHub
commit 5ea9dc1ede
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 239 additions and 57 deletions

59
.github/workflows/updater.sh vendored Normal file
View file

@ -0,0 +1,59 @@
#!/bin/bash
#=================================================
# PACKAGE UPDATING HELPER
#=================================================
# This script is meant to be run by GitHub Actions
# The YunoHost-Apps organisation offers a template Action to run this script periodically
# Since each app is different, maintainers can adapt its contents so as to perform
# automatic actions when a new upstream release is detected.
#=================================================
# FETCHING LATEST RELEASE AND ITS ASSETS
#=================================================
# Fetching information
current_version=$(cat manifest.json | jq -j '.version|split("~")[0]')
repo=$(cat manifest.json | jq -j '.upstream.code|split("https://github.com/")[1]')
# Some jq magic is needed, because the latest upstream release is not always the latest version (e.g. security patches for older versions)
version=$(curl --silent "https://api.github.com/repos/$repo/releases" | jq -r '.[] | select( .prerelease != true ) | .tag_name' | cut -d "-" -f2 | sort -V | tail -1)
# Setting up the environment variables
echo "Current version: $current_version"
echo "Latest release from upstream: $version"
echo "VERSION=$version" >> $GITHUB_ENV
echo "REPO=$repo" >> $GITHUB_ENV
# For the time being, let's assume the script will fail
echo "PROCEED=false" >> $GITHUB_ENV
# Proceed only if the retrieved version is greater than the current one
if ! dpkg --compare-versions "$current_version" "lt" "$version" ; then
echo "::warning ::No new version available"
exit 0
# Proceed only if a PR for this new version does not already exist
elif git ls-remote -q --exit-code --heads https://github.com/$GITHUB_REPOSITORY.git ci-auto-update-v$version ; then
echo "::warning ::A branch already exists for this update"
exit 0
fi
#=================================================
# SPECIFIC UPDATE STEPS
#=================================================
# Any action on the app's source code can be done.
# The GitHub Action workflow takes care of committing all changes after this script ends.
#=================================================
# GENERIC FINALIZATION
#=================================================
# Replace new version in manifest
echo "$(jq -s --indent 4 ".[] | .version = \"$version~ynh1\"" manifest.json)" > manifest.json
# No need to update the README, yunohost-bot takes care of it
# The Action will proceed only if the PROCEED environment variable is set to true
echo "PROCEED=true" >> $GITHUB_ENV
exit 0

49
.github/workflows/updater.yml vendored Normal file
View file

@ -0,0 +1,49 @@
# This workflow allows GitHub Actions to automagically update your app whenever a new upstream release is detected.
# You need to enable Actions in your repository settings, and fetch this Action from the YunoHost-Apps organization.
# This file should be enough by itself, but feel free to tune it to your needs.
# It calls updater.sh, which is where you should put the app-specific update steps.
name: Check for new upstream releases
on:
# Allow to manually trigger the workflow
workflow_dispatch:
# Run it every day at 6:00 UTC
schedule:
- cron: '0 6 * * *'
jobs:
updater:
runs-on: ubuntu-latest
steps:
- name: Fetch the source code
uses: actions/checkout@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Run the updater script
id: run_updater
run: |
# Setting up Git user
git config --global user.name 'yunohost-bot'
git config --global user.email 'yunohost-bot@users.noreply.github.com'
# Run the updater script
/bin/bash .github/workflows/updater.sh
- name: Commit changes
id: commit
if: ${{ env.PROCEED == 'true' }}
run: |
git commit -am "Upgrade to v$VERSION"
- name: Create Pull Request
id: cpr
if: ${{ env.PROCEED == 'true' }}
uses: peter-evans/create-pull-request@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: Update to version ${{ env.VERSION }}
committer: 'yunohost-bot <yunohost-bot@users.noreply.github.com>'
author: 'yunohost-bot <yunohost-bot@users.noreply.github.com>'
signoff: false
base: testing
branch: ci-auto-update-v${{ env.VERSION }}
delete-branch: true
title: 'Upgrade to version ${{ env.VERSION }}'
body: |
Upgrade to v${{ env.VERSION }}
draft: false

View file

@ -5,7 +5,7 @@ It shall NOT be edited by hand.
# Weblate for YunoHost # Weblate for YunoHost
[![Integration level](https://dash.yunohost.org/integration/weblate.svg)](https://dash.yunohost.org/appci/app/weblate) ![](https://ci-apps.yunohost.org/ci/badges/weblate.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/weblate.maintain.svg) [![Integration level](https://dash.yunohost.org/integration/weblate.svg)](https://dash.yunohost.org/appci/app/weblate) ![Working status](https://ci-apps.yunohost.org/ci/badges/weblate.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/weblate.maintain.svg)
[![Install Weblate with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=weblate) [![Install Weblate with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=weblate)
*[Lire ce readme en français.](./README_fr.md)* *[Lire ce readme en français.](./README_fr.md)*
@ -17,13 +17,13 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
Weblate is a libre web-based translation tool with tight version control integration. It provides two user interfaces, propagation of translations across components, quality checks and automatic linking to source files. Weblate is a libre web-based translation tool with tight version control integration. It provides two user interfaces, propagation of translations across components, quality checks and automatic linking to source files.
**Shipped version:** 4.12~ynh1 **Shipped version:** 4.13.1~ynh1
**Demo:** https://hosted.weblate.org/ **Demo:** https://hosted.weblate.org/
## Screenshots ## Screenshots
![](./doc/screenshots/BigScreenshot.png) ![Screenshot of Weblate](./doc/screenshots/BigScreenshot.png)
## Disclaimers / important information ## Disclaimers / important information
@ -47,22 +47,23 @@ It doesn't work yet, but while [it looks doable](https://docs.weblate.org/en/lat
## Documentation and resources ## Documentation and resources
* Official app website: https://weblate.org * Official app website: <https://weblate.org>
* Official user documentation: https://docs.weblate.org/ * Official user documentation: <https://docs.weblate.org/>
* Official admin documentation: https://docs.weblate.org/ * Official admin documentation: <https://docs.weblate.org/>
* Upstream app code repository: https://github.com/WeblateOrg/weblate * Upstream app code repository: <https://github.com/WeblateOrg/weblate>
* YunoHost documentation for this app: https://yunohost.org/app_weblate * YunoHost documentation for this app: <https://yunohost.org/app_weblate>
* Report a bug: https://github.com/YunoHost-Apps/weblate_ynh/issues * Report a bug: <https://github.com/YunoHost-Apps/weblate_ynh/issues>
## Developer info ## Developer info
Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/weblate_ynh/tree/testing). Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/weblate_ynh/tree/testing).
To try the testing branch, please proceed like that. To try the testing branch, please proceed like that.
```
``` bash
sudo yunohost app install https://github.com/YunoHost-Apps/weblate_ynh/tree/testing --debug sudo yunohost app install https://github.com/YunoHost-Apps/weblate_ynh/tree/testing --debug
or or
sudo yunohost app upgrade weblate -u https://github.com/YunoHost-Apps/weblate_ynh/tree/testing --debug sudo yunohost app upgrade weblate -u https://github.com/YunoHost-Apps/weblate_ynh/tree/testing --debug
``` ```
**More info regarding app packaging:** https://yunohost.org/packaging_apps **More info regarding app packaging:** <https://yunohost.org/packaging_apps>

View file

@ -1,10 +1,14 @@
<!--
N.B.: This README was automatically generated by https://github.com/YunoHost/apps/tree/master/tools/README-generator
It shall NOT be edited by hand.
-->
# Weblate pour YunoHost # Weblate pour YunoHost
[![Niveau d'intégration](https://dash.yunohost.org/integration/weblate.svg)](https://dash.yunohost.org/appci/app/weblate) ![](https://ci-apps.yunohost.org/ci/badges/weblate.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/weblate.maintain.svg) [![Niveau d'intégration](https://dash.yunohost.org/integration/weblate.svg)](https://dash.yunohost.org/appci/app/weblate) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/weblate.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/weblate.maintain.svg)
[![Installer Weblate avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=weblate) [![Installer Weblate avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=weblate)
*[Read this readme in english.](./README.md)* *[Read this readme in english.](./README.md)*
*[Lire ce readme en français.](./README_fr.md)*
> *Ce package vous permet d'installer Weblate rapidement et simplement sur un serveur YunoHost. > *Ce package vous permet d'installer Weblate rapidement et simplement sur un serveur YunoHost.
Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.* Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.*
@ -13,13 +17,13 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour
Weblate est un outil de traduction libre avec une intégration étroite du contrôle de version. Il fournit deux interfaces utilisateur, la propagation des traductions entre les composants, les contrôles de qualité et la liaison automatique aux fichiers source. Weblate est un outil de traduction libre avec une intégration étroite du contrôle de version. Il fournit deux interfaces utilisateur, la propagation des traductions entre les composants, les contrôles de qualité et la liaison automatique aux fichiers source.
**Version incluse :** 4.12~ynh1 **Version incluse :** 4.13.1~ynh1
**Démo :** https://hosted.weblate.org/ **Démo :** https://hosted.weblate.org/
## Captures d'écran ## Captures d'écran
![](./doc/screenshots/BigScreenshot.png) ![Capture d'écran de Weblate](./doc/screenshots/BigScreenshot.png)
## Avertissements / informations importantes ## Avertissements / informations importantes
@ -42,22 +46,23 @@ Vous pouvez éditer le fichier `$final_path/local_settings.py` pour activer ou d
Cela ne fonctionne pas encore, mais bien que [cela semble faisable](https://docs.weblate.org/en/latest/admin/auth.html?highlight=LDAP#ldap-authentication), je ne suis pas sûr que ce soit le cas une bonne idée de connecter ce genre d'outils à votre LDAP. Cela ne fonctionne pas encore, mais bien que [cela semble faisable](https://docs.weblate.org/en/latest/admin/auth.html?highlight=LDAP#ldap-authentication), je ne suis pas sûr que ce soit le cas une bonne idée de connecter ce genre d'outils à votre LDAP.
## Documentations et ressources ## Documentations et ressources
* Site officiel de l'app : https://weblate.org * Site officiel de l'app : <https://weblate.org>
* Documentation officielle utilisateur : https://docs.weblate.org/ * Documentation officielle utilisateur : <https://docs.weblate.org/>
* Documentation officielle de l'admin : https://docs.weblate.org/ * Documentation officielle de l'admin : <https://docs.weblate.org/>
* Dépôt de code officiel de l'app : https://github.com/WeblateOrg/weblate * Dépôt de code officiel de l'app : <https://github.com/WeblateOrg/weblate>
* Documentation YunoHost pour cette app : https://yunohost.org/app_weblate * Documentation YunoHost pour cette app : <https://yunohost.org/app_weblate>
* Signaler un bug : https://github.com/YunoHost-Apps/weblate_ynh/issues * Signaler un bug : <https://github.com/YunoHost-Apps/weblate_ynh/issues>
## Informations pour les développeurs ## Informations pour les développeurs
Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/weblate_ynh/tree/testing). Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/weblate_ynh/tree/testing).
Pour essayer la branche testing, procédez comme suit. Pour essayer la branche testing, procédez comme suit.
```
``` bash
sudo yunohost app install https://github.com/YunoHost-Apps/weblate_ynh/tree/testing --debug sudo yunohost app install https://github.com/YunoHost-Apps/weblate_ynh/tree/testing --debug
ou ou
sudo yunohost app upgrade weblate -u https://github.com/YunoHost-Apps/weblate_ynh/tree/testing --debug sudo yunohost app upgrade weblate -u https://github.com/YunoHost-Apps/weblate_ynh/tree/testing --debug
``` ```
**Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps **Plus d'infos sur le packaging d'applications :** <https://yunohost.org/packaging_apps>

View file

@ -2,9 +2,9 @@
; Manifest ; Manifest
domain="domain.tld" domain="domain.tld"
path="/path" path="/path"
admin="john"
password="randompass"
is_public=1 is_public=1
admin="john"
password="1Strong-Password"
github_account="myaccount" github_account="myaccount"
github_token="myoauthtoken" github_token="myoauthtoken"
; Checks ; Checks

7
conf/libxxhash.src Normal file
View file

@ -0,0 +1,7 @@
SOURCE_URL=https://github.com/Cyan4973/xxHash/archive/refs/tags/v0.8.1.tar.gz
SOURCE_SUM=3bb6b7d6f30c591dd65aaaff1c8b7a5b94d81687998ca9400082c739a690436c
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=
SOURCE_EXTRACT=true

View file

@ -6,7 +6,7 @@
"en": "Translation platform using Git and Python", "en": "Translation platform using Git and Python",
"fr": "Plateforme de traduction utilisant Git et Python" "fr": "Plateforme de traduction utilisant Git et Python"
}, },
"version": "4.12~ynh1", "version": "4.13.1~ynh1",
"url": "https://weblate.org", "url": "https://weblate.org",
"upstream": { "upstream": {
"license": "AGPL-3.0", "license": "AGPL-3.0",

View file

@ -17,9 +17,6 @@ borgbackup_dependencies="libacl1-dev libacl1 libssl-dev liblz4-dev libzstd-dev l
pkg_dependencies="$weblate_dependencies $borgbackup_dependencies" pkg_dependencies="$weblate_dependencies $borgbackup_dependencies"
# Weblate's version for PIP and settings file
weblate_version="4.12"
debian_maj_version=$(sed 's/\..*//' /etc/debian_version) debian_maj_version=$(sed 's/\..*//' /etc/debian_version)
if [ "$debian_maj_version" -eq 9 ] ; then if [ "$debian_maj_version" -eq 9 ] ; then
@ -30,6 +27,10 @@ elif [ "$debian_maj_version" -eq 11 ] ; then
weblate_pypath="python3.9" weblate_pypath="python3.9"
fi fi
#=================================================
# PERSONAL HELPERS
#=================================================
#================================================= #=================================================
# EXPERIMENTAL HELPERS # EXPERIMENTAL HELPERS
#================================================= #=================================================
@ -141,5 +142,5 @@ ynh_redis_remove_db() {
} }
#================================================= #=================================================
# EXPERIMENTAL HELPERS # FUTURE OFFICIAL HELPERS
#================================================= #=================================================

View file

@ -25,8 +25,8 @@ 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
admin=$YNH_APP_ARG_ADMIN
is_public=$YNH_APP_ARG_IS_PUBLIC is_public=$YNH_APP_ARG_IS_PUBLIC
admin=$YNH_APP_ARG_ADMIN
password=$YNH_APP_ARG_PASSWORD password=$YNH_APP_ARG_PASSWORD
github_account=$YNH_APP_ARG_GITHUB_ACCOUNT github_account=$YNH_APP_ARG_GITHUB_ACCOUNT
github_token=$YNH_APP_ARG_GITHUB_TOKEN github_token=$YNH_APP_ARG_GITHUB_TOKEN
@ -83,7 +83,6 @@ ynh_script_progression --message="Creating a PostgreSQL database..." --weight=2
db_name=$(ynh_sanitize_dbid --db_name=$app) db_name=$(ynh_sanitize_dbid --db_name=$app)
db_user=$db_name db_user=$db_name
ynh_app_setting_set --app=$app --key=db_name --value=$db_name ynh_app_setting_set --app=$app --key=db_name --value=$db_name
ynh_psql_test_if_first_run ynh_psql_test_if_first_run
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name ynh_psql_setup_db --db_user=$db_user --db_name=$db_name
ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS pg_trgm;" --database=$db_name ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS pg_trgm;" --database=$db_name
@ -113,6 +112,19 @@ ynh_add_nginx_config
#================================================= #=================================================
# SPECIFIC SETUP # SPECIFIC SETUP
#=================================================
# INSTALL XXHASH
#=================================================
ynh_script_progression --message="Installing xxHash..."
tempdir="$(mktemp -d)"
ynh_setup_source --dest_dir=$tempdir --source_id="libxxhash"
pushd $tempdir
make
make install
popd
ynh_secure_remove --file="$tempdir"
#================================================= #=================================================
# CONFIGURE HUB # CONFIGURE HUB
#================================================= #=================================================
@ -140,12 +152,12 @@ chown -R $app: "$final_path"
set -o nounset set -o nounset
cd "${final_path}" cd "${final_path}"
sudo --user=$app $final_path/venv/bin/pip install --upgrade pip setuptools wheel pkgconfig sudo --user=$app $final_path/venv/bin/pip install --upgrade pip setuptools wheel pkgconfig xxhash
# Read the "Note" section in https://docs.weblate.org/en/weblate-4.11/admin/install/venv-debian.html#python-modules # Read the "Note" section in https://docs.weblate.org/en/weblate-4.11/admin/install/venv-debian.html#python-modules
sudo --user=$app $final_path/venv/bin/pip install --force-reinstall --no-binary :all: cffi sudo --user=$app $final_path/venv/bin/pip install --force-reinstall --no-binary :all: cffi
# Still needed with latest version of weblate? # Still needed with latest version of weblate?
sudo --user=$app BORG_OPENSSL_PREFIX=/usr/lib/x86_64-linux-gnu/ $final_path/venv/bin/pip install Weblate=="$weblate_version" sudo --user=$app BORG_OPENSSL_PREFIX=/usr/lib/x86_64-linux-gnu/ $final_path/venv/bin/pip install Weblate=="$(ynh_app_upstream_version)"
sudo --user=$app $final_path/venv/bin/pip install psycopg2-binary ruamel.yaml aeidon phply sudo --user=$app $final_path/venv/bin/pip install psycopg2-binary ruamel.yaml aeidon phply
#pip install pytz python-bidi PyYaML Babel pyuca pylibravatar py3dns psycopg2-binary phply django-redis hiredis aeidon ruamel.yaml #pip install pytz python-bidi PyYaML Babel pyuca pylibravatar py3dns psycopg2-binary phply django-redis hiredis aeidon ruamel.yaml
# specific to YunoHost package: # specific to YunoHost package:
@ -245,6 +257,8 @@ ynh_script_progression --message="Configuring permissions..." --weight=1
# Make app public if necessary # Make app public if necessary
if [ $is_public -eq 1 ] if [ $is_public -eq 1 ]
then then
# Everyone can access the app.
# The "main" permission is automatically created before the install script.
ynh_permission_update --permission="main" --add="visitors" ynh_permission_update --permission="main" --add="visitors"
fi fi

View file

@ -90,6 +90,19 @@ ynh_script_progression --message="Removing dependencies..." --weight=10
# Remove metapackage and its dependencies # Remove metapackage and its dependencies
ynh_exec_warn_less ynh_remove_app_dependencies ynh_exec_warn_less ynh_remove_app_dependencies
#=================================================
# REMOVE XXHASH
#=================================================
ynh_script_progression --message="Removing xxHash..."
tempdir="$(mktemp -d)"
ynh_setup_source --dest_dir=$tempdir --source_id="libxxhash"
pushd $tempdir
make
make uninstall
popd
ynh_secure_remove --file="$tempdir"
#================================================= #=================================================
# SPECIFIC REMOVE # SPECIFIC REMOVE
#================================================= #=================================================

View file

@ -23,7 +23,7 @@ ynh_abort_if_errors
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Loading settings..." --weight=1 ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
@ -43,13 +43,6 @@ test ! -d $final_path \
#================================================= #=================================================
# STANDARD RESTORATION STEPS # STANDARD RESTORATION STEPS
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the NGINX web server configuration..."
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#================================================= #=================================================
# RECREATE THE DEDICATED USER # RECREATE THE DEDICATED USER
#================================================= #=================================================
@ -85,7 +78,14 @@ ynh_script_progression --message="Reinstalling dependencies..." --weight=40
ynh_exec_warn_less ynh_install_app_dependencies "$pkg_dependencies" ynh_exec_warn_less ynh_install_app_dependencies "$pkg_dependencies"
#================================================= #=================================================
# RESTORE THE PostgreSQL DATABASE # RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the NGINX web server configuration..."
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# RESTORE THE POSTGRESQL DATABASE
#================================================= #=================================================
ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=5 ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=5
@ -95,6 +95,19 @@ ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS pg_trgm;" --database=$db_name ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS pg_trgm;" --database=$db_name
ynh_psql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql ynh_psql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
#=================================================
# INSTALL XXHASH
#=================================================
ynh_script_progression --message="Installing xxHash..."
tempdir="$(mktemp -d)"
ynh_setup_source --dest_dir=$tempdir --source_id="libxxhash"
pushd $tempdir
make
make install
popd
ynh_secure_remove --file="$tempdir"
#================================================= #=================================================
# RESTORE VARIOUS FILES # RESTORE VARIOUS FILES
#================================================= #=================================================

View file

@ -23,13 +23,20 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name db_user=$db_name
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
admin_mail=$(ynh_user_get_info "$admin" mail)
github_account=$(ynh_app_setting_get --app=$app --key=github_account) github_account=$(ynh_app_setting_get --app=$app --key=github_account)
github_token=$(ynh_app_setting_get --app=$app --key=github_token) github_token=$(ynh_app_setting_get --app=$app --key=github_token)
key=$(ynh_string_random 50)
redis_db=$(ynh_app_setting_get --app=$app --key=redis_db) redis_db=$(ynh_app_setting_get --app=$app --key=redis_db)
admin_mail=$(ynh_user_get_info --username="$admin" --key=mail)
key=$(ynh_string_random --length=50)
#=================================================
# CHECK VERSION
#=================================================
ynh_script_progression --message="Checking version..."
upgrade_type=$(ynh_check_app_version_changed)
#================================================= #=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#================================================= #=================================================
@ -89,6 +96,13 @@ ynh_script_progression --message="Making sure dedicated system user exists..." -
# Create a dedicated user (if not existing) # Create a dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir="$final_path" --use_shell ynh_system_user_create --username=$app --home_dir="$final_path" --use_shell
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
ynh_script_progression --message="Upgrading dependencies..." --weight=5
ynh_exec_warn_less ynh_install_app_dependencies "$pkg_dependencies"
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
#================================================= #=================================================
@ -97,15 +111,21 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." -
# Create a dedicated NGINX config # Create a dedicated NGINX config
ynh_add_nginx_config ynh_add_nginx_config
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
ynh_script_progression --message="Upgrading dependencies..." --weight=5
ynh_exec_warn_less ynh_install_app_dependencies "$pkg_dependencies"
#================================================= #=================================================
# SPECIFIC UPGRADE # SPECIFIC UPGRADE
#=================================================
# INSTALL XXHASH
#=================================================
ynh_script_progression --message="Installing xxHash..."
tempdir="$(mktemp -d)"
ynh_setup_source --dest_dir=$tempdir --source_id="libxxhash"
pushd $tempdir
make
make install
popd
ynh_secure_remove --file="$tempdir"
#================================================= #=================================================
# CONFIGURE HUB # CONFIGURE HUB
#================================================= #=================================================
@ -158,7 +178,7 @@ upgrade() {
set -o nounset set -o nounset
cd "${final_path}" cd "${final_path}"
sudo --user=$app $final_path/venv/bin/pip install --upgrade pip setuptools wheel pkgconfig sudo --user=$app $final_path/venv/bin/pip install --upgrade pip setuptools wheel pkgconfig xxhash
# Read the "Note" section in https://docs.weblate.org/en/weblate-4.11/admin/install/venv-debian.html#python-modules # Read the "Note" section in https://docs.weblate.org/en/weblate-4.11/admin/install/venv-debian.html#python-modules
sudo --user=$app $final_path/venv/bin/pip install --force-reinstall --no-binary :all: cffi sudo --user=$app $final_path/venv/bin/pip install --force-reinstall --no-binary :all: cffi
@ -210,7 +230,7 @@ upgrade() {
# Check the configuration # Check the configuration
# This may fail in some cases with errors, etc., but the app works and the user can fix issues later. # This may fail in some cases with errors, etc., but the app works and the user can fix issues later.
if [ "$new_version" == "$weblate_version" ]; then if [ "$new_version" == "$(ynh_app_upstream_version)" ]; then
sudo --user=$app $final_path/venv/bin/weblate check --deploy || true sudo --user=$app $final_path/venv/bin/weblate check --deploy || true
fi fi
) )
@ -238,7 +258,7 @@ then
upgrade "4.1.1" "../conf/settings.4.1.1.py" upgrade "4.1.1" "../conf/settings.4.1.1.py"
fi fi
upgrade $weblate_version "../conf/settings.py" upgrade $(ynh_app_upstream_version) "../conf/settings.py"
# Set right permissions for curl installation # Set right permissions for curl installation
mkdir -p "$final_path/avatar-cache" mkdir -p "$final_path/avatar-cache"