1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/photoview_ynh.git synced 2024-09-03 20:05:55 +02:00

Merge branch 'testing' into purge

This commit is contained in:
Salamandar 2024-02-28 17:12:53 +01:00 committed by GitHub
commit 2d1dcd19a6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
23 changed files with 315 additions and 190 deletions

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

@ -0,0 +1,103 @@
#!/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' | sort -V | tail -1)
assets="https://github.com/$repo/archive/refs/tags/$version.tar.gz"
# Later down the script, we assume the version has only digits and dots
# Sometimes the release name starts with a "v", so let's filter it out.
# You may need more tweaks here if the upstream repository has different naming conventions.
if [[ ${version:0:1} == "v" || ${version:0:1} == "V" ]]; then
version=${version:1}
fi
# Setting up the environment variables
echo "Current version: $current_version"
echo "Latest release from upstream: $version"
echo "VERSION=$version" >> $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
#=================================================
# UPDATE SOURCE FILES
#=================================================
# Let's download source tarball
asset_url=$assets
echo "Handling asset at $asset_url"
src="app"
# Create the temporary directory
tempdir="$(mktemp -d)"
# Download sources and calculate checksum
filename=${asset_url##*/}
curl --silent -4 -L $asset_url -o "$tempdir/$filename"
checksum=$(sha256sum "$tempdir/$filename" | head -c 64)
# Delete temporary directory
rm -rf $tempdir
# Get extension
if [[ $filename == *.tar.gz ]]; then
extension=tar.gz
else
extension=${filename##*.}
fi
# Rewrite source file
cat <<EOT > conf/$src.src
SOURCE_URL=$asset_url
SOURCE_SUM=$checksum
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=$extension
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=
EOT
echo "... conf/$src.src updated"
#=================================================
# 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@v3
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@v4
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

@ -1,7 +1,13 @@
<!--
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.
-->
# Photoview for YunoHost # Photoview for YunoHost
[![Integration level](https://dash.yunohost.org/integration/photoview.svg)](https://dash.yunohost.org/appci/app/photoview) ![](https://ci-apps.yunohost.org/ci/badges/photoview.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/photoview.maintain.svg) [![Integration level](https://dash.yunohost.org/integration/photoview.svg)](https://dash.yunohost.org/appci/app/photoview) ![Working status](https://ci-apps.yunohost.org/ci/badges/photoview.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/photoview.maintain.svg)
[![Install photoview with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=photoview)
[![Install Photoview with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=photoview)
*[Lire ce readme en français.](./README_fr.md)* *[Lire ce readme en français.](./README_fr.md)*
@ -9,52 +15,36 @@
If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.* If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.*
## Overview ## Overview
Photoview is a simple and user-friendly photo gallery that's made for photographers and aims to provide an easy and fast way to navigate directories, with thousands of high resolution photos. Photoview is a simple and user-friendly photo gallery that's made for photographers and aims to provide an easy and fast way to navigate directories, with thousands of high resolution photos.
**Shipped version:** 2.3.9
**Shipped version:** 2.3.12~ynh1
**Demo:** https://photos.qpqp.dk/
## Screenshots ## Screenshots
![](https://github.com/photoview/photoview/raw/master/screenshots/timeline.png) ![Screenshot of Photoview](./doc/screenshots/screenshot1.png)
## Demo ## Documentation and resources
* [Official demo](https://photos.qpqp.dk/) Username: **demo** Password: **demo** * Official app website: <https://photoview.github.io/>
* Official admin documentation: <https://photoview.github.io/docs/>
## Configuration * Upstream app code repository: <https://github.com/photoview/photoview>
* YunoHost Store: <https://apps.yunohost.org/app/photoview>
You can access an admin panel from the web interface. * Report a bug: <https://github.com/YunoHost-Apps/photoview_ynh/issues>
## Documentation
* Official documentation: https://photoview.github.io/docs/
#### Multi-user support
Are LDAP and HTTP auth supported? **No**
Can the app be used by multiple users? **Yes**
#### Supported architectures
* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/photoview.svg)](https://ci-apps.yunohost.org/ci/apps/photoview/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/photoview.svg)](https://ci-apps-arm.yunohost.org/ci/apps/photoview/)
## Links
* Report a bug: https://github.com/YunoHost-Apps/photoview_ynh/issues
* App website: https://photoview.github.io/
* Upstream app repository: https://github.com/photoview/photoview
* YunoHost website: https://yunohost.org/
---
## Developer info ## Developer info
Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/photoview_ynh/tree/testing). Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/photoview_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/photoview_ynh/tree/testing --debug sudo yunohost app install https://github.com/YunoHost-Apps/photoview_ynh/tree/testing --debug
or or
sudo yunohost app upgrade photoview -u https://github.com/YunoHost-Apps/photoview_ynh/tree/testing --debug sudo yunohost app upgrade photoview -u https://github.com/YunoHost-Apps/photoview_ynh/tree/testing --debug
``` ```
**More info regarding app packaging:** <https://yunohost.org/packaging_apps>

View file

@ -1,60 +1,50 @@
<!--
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.
-->
# Photoview pour YunoHost # Photoview pour YunoHost
[![Niveau d'intégration](https://dash.yunohost.org/integration/photoview.svg)](https://dash.yunohost.org/appci/app/photoview) ![](https://ci-apps.yunohost.org/ci/badges/photoview.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/photoview.maintain.svg) [![Niveau dintégration](https://dash.yunohost.org/integration/photoview.svg)](https://dash.yunohost.org/appci/app/photoview) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/photoview.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/photoview.maintain.svg)
[![Installer photoview avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=photoview)
[![Installer Photoview avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=photoview)
*[Read this readme in english.](./README.md)* *[Read this readme in english.](./README.md)*
> *Ce package vous permet d'installer Photoview rapidement et simplement sur un serveur YunoHost. > *Ce package vous permet dinstaller Photoview rapidement et simplement sur un serveur YunoHost.
Si vous n'avez pas YunoHost, consultez [le guide](https://yunohost.org/#/install) pour apprendre comment l'installer.* Si vous navez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment linstaller et en profiter.*
## Vue d'ensemble ## Vue densemble
Photoview est une galerie photos simple et facile à utiliser, conçue pour les photographes et qui vise à fournir un moyen simple et rapide pour naviguer dans les dossiers contenant des milliers de photos haute résolution.
**Version incluse :** 2.3.9 Galerie photos simple et facile à utiliser, faite pour les photographes.
## Captures d'écran
![](https://github.com/photoview/photoview/raw/master/screenshots/timeline.png) **Version incluse :** 2.3.12~ynh1
## Démo **Démo :** https://photos.qpqp.dk/
* [Démo officielle](https://photos.qpqp.dk/) Nom d'utilisateur: **demo** Mot de pase: **demo** ## Captures décran
## Configuration ![Capture décran de Photoview](./doc/screenshots/screenshot1.png)
Vous pouvez accéder à un panneau admin depuis l'interface web. ## Documentations et ressources
## Documentation * Site officiel de lapp : <https://photoview.github.io/>
* Documentation officielle de ladmin : <https://photoview.github.io/docs/>
* Documentation officielle : https://photoview.github.io/docs/ * Dépôt de code officiel de lapp : <https://github.com/photoview/photoview>
* YunoHost Store: <https://apps.yunohost.org/app/photoview>
#### Support multi-utilisateur * Signaler un bug : <https://github.com/YunoHost-Apps/photoview_ynh/issues>
* L'authentification LDAP et HTTP est-elle prise en charge ? **Non**
* L'application peut-elle être utilisée par plusieurs utilisateurs ? **Oui**
#### Architectures supportées
* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/photoview.svg)](https://ci-apps.yunohost.org/ci/apps/photoview/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/photoview.svg)](https://ci-apps-arm.yunohost.org/ci/apps/photoview/)
## Liens
* Signaler un bug : https://github.com/YunoHost-Apps/photoview_ynh/issues
* Site de l'application : https://photoview.github.io/
* Dépôt de l'application principale : https://github.com/photoview/photoview
* Site web YunoHost : https://yunohost.org/
---
## 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/photoview_ynh/tree/testing). Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/photoview_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/photoview_ynh/tree/testing --debug sudo yunohost app install https://github.com/YunoHost-Apps/photoview_ynh/tree/testing --debug
ou ou
sudo yunohost app upgrade photoview -u https://github.com/YunoHost-Apps/photoview_ynh/tree/testing --debug sudo yunohost app upgrade photoview -u https://github.com/YunoHost-Apps/photoview_ynh/tree/testing --debug
``` ```
**Plus dinfos sur le packaging dapplications :** <https://yunohost.org/packaging_apps>

View file

@ -1,7 +1,6 @@
SOURCE_URL=https://github.com/photoview/photoview/archive/refs/tags/v2.3.9.tar.gz SOURCE_URL=https://github.com/photoview/photoview/archive/refs/tags/v2.3.12.tar.gz
SOURCE_SUM=f5daaab41061f86c94b029914131f363d0774b29ace5db942c4ef6511914708e SOURCE_SUM=f9de00fb2d854217655a71264c06f8451b06b67170d3a5bbd9160fc94f1dda0f
SOURCE_SUM_PRG=sha256sum SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=v2.3.9.tar.gz SOURCE_FILENAME=
SOURCE_EXTRACT=true

View file

@ -1,7 +1,7 @@
SOURCE_URL=https://github.com/strukturag/libheif/releases/download/v1.11.0/libheif-1.11.0.tar.gz SOURCE_URL=https://github.com/strukturag/libheif/releases/download/v1.12.0/libheif-1.12.0.tar.gz
SOURCE_SUM=c550938f56ff6dac83702251a143f87cb3a6c71a50d8723955290832d9960913 SOURCE_SUM=e1ac2abb354fdc8ccdca71363ebad7503ad731c84022cf460837f0839e171718
SOURCE_SUM_PRG=sha256sum SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=libheif-1.11.0.tar.gz SOURCE_FILENAME=libheif-1.12.0.tar.gz
SOURCE_EXTRACT=true SOURCE_EXTRACT=true

0
doc/.gitkeep Normal file
View file

1
doc/DESCRIPTION.md Normal file
View file

@ -0,0 +1 @@
Photoview is a simple and user-friendly photo gallery that's made for photographers and aims to provide an easy and fast way to navigate directories, with thousands of high resolution photos.

1
doc/DESCRIPTION_fr.md Normal file
View file

@ -0,0 +1 @@
Galerie photos simple et facile à utiliser, faite pour les photographes.

0
doc/DISCLAIMER.md Normal file
View file

0
doc/DISCLAIMER_fr.md Normal file
View file

0
doc/screenshots/.gitkeep Normal file
View file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 MiB

View file

@ -6,15 +6,22 @@
"en": "Simple and user-friendly photo gallery that's made for photographers ", "en": "Simple and user-friendly photo gallery that's made for photographers ",
"fr": "Galerie photos simple et facile à utiliser, faite pour les photographes" "fr": "Galerie photos simple et facile à utiliser, faite pour les photographes"
}, },
"version": "2.3.9~ynh2", "version": "2.3.12~ynh1",
"url": "https://photoview.github.io/", "url": "https://photoview.github.io/",
"upstream": {
"license": "AGPL-3.0-only",
"website": "https://photoview.github.io/",
"demo": "https://photos.qpqp.dk/",
"admindoc": "https://photoview.github.io/docs/",
"code": "https://github.com/photoview/photoview"
},
"license": "AGPL-3.0-only", "license": "AGPL-3.0-only",
"maintainer": { "maintainer": {
"name": "Jules Bertholet", "name": "Jules Bertholet",
"email": "jules.bertholet@gmail.com" "email": "jules.bertholet@gmail.com"
}, },
"requirements": { "requirements": {
"yunohost": ">= 4.1.7" "yunohost": ">= 4.3.0"
}, },
"multi_instance": true, "multi_instance": true,
"services": [ "services": [
@ -22,11 +29,15 @@
"mysql" "mysql"
], ],
"arguments": { "arguments": {
"install" : [ "install": [
{ {
"name": "domain", "name": "domain",
"type": "domain", "type": "domain"
"example": "example.com" },
{
"name": "is_public",
"type": "boolean",
"default": true
}, },
{ {
"name": "mapbox_token", "name": "mapbox_token",
@ -41,11 +52,6 @@
"en": "Required for mapping features. You can get one for free at https://www.mapbox.com/", "en": "Required for mapping features. You can get one for free at https://www.mapbox.com/",
"fr": "Nécessaire pour les fonctionnalités cartographiques. Vous pouvez en obtenir une gratuitement à https://www.mapbox.com/" "fr": "Nécessaire pour les fonctionnalités cartographiques. Vous pouvez en obtenir une gratuitement à https://www.mapbox.com/"
} }
},
{
"name": "is_public",
"type": "boolean",
"default": true
} }
] ]
} }

View file

@ -29,6 +29,9 @@ function setup_sources {
} }
function build_libheif { function build_libheif {
export GOPATH="$final_path/build/go"
export GOCACHE="$final_path/build/.cache"
pushd "$final_path/libheif" || ynh_die pushd "$final_path/libheif" || ynh_die
chown -R $app:$app "$final_path/libheif" chown -R $app:$app "$final_path/libheif"
mkdir -p "$final_path/local" mkdir -p "$final_path/local"
@ -49,6 +52,9 @@ function set_go_vars {
ynh_install_go --go_version=1.16 ynh_install_go --go_version=1.16
ynh_use_go ynh_use_go
export GOPATH="$final_path/build/go"
export GOCACHE="$final_path/build/.cache"
go_shims_path=$goenv_install_dir/shims go_shims_path=$goenv_install_dir/shims
go_path_full="$go_shims_path":"$(sudo -u $app bash -c 'echo $PATH')" go_path_full="$go_shims_path":"$(sudo -u $app bash -c 'echo $PATH')"
heif_lib_path="$final_path/local/lib":"$(sudo -u $app bash -c 'echo $LIBRARY_PATH')" heif_lib_path="$final_path/local/lib":"$(sudo -u $app bash -c 'echo $LIBRARY_PATH')"

View file

@ -14,7 +14,7 @@ source /usr/share/yunohost/helpers
# MANAGE SCRIPT FAILURE # MANAGE SCRIPT FAILURE
#================================================= #=================================================
ynh_clean_setup() { ynh_clean_setup () {
true true
} }
# Exit if an error occurs during the execution of the script # Exit if an error occurs during the execution of the script
@ -28,9 +28,9 @@ ynh_print_info --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
final_path=$(ynh_app_setting_get --app=$app --key=final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
data_path=$(ynh_app_setting_get --app=$app --key=data_path)
domain=$(ynh_app_setting_get --app=$app --key=domain) domain=$(ynh_app_setting_get --app=$app --key=domain)
db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_name=$(ynh_app_setting_get --app=$app --key=db_name)
data_path=$(ynh_app_setting_get --app=$app --key=data_path)
#================================================= #=================================================
# DECLARE DATA AND CONF FILES TO BACKUP # DECLARE DATA AND CONF FILES TO BACKUP
@ -69,18 +69,12 @@ ynh_backup --src_path="/etc/logrotate.d/$app"
ynh_backup --src_path="/etc/systemd/system/$app.service" ynh_backup --src_path="/etc/systemd/system/$app.service"
#=================================================
# BACKUP VARIOUS FILES
#=================================================
ynh_backup --src_path="/var/log/$app"
#================================================= #=================================================
# BACKUP THE MYSQL DATABASE # BACKUP THE MYSQL DATABASE
#================================================= #=================================================
ynh_print_info --message="Backing up the MySQL database..." ynh_print_info --message="Backing up the MySQL database..."
ynh_mysql_dump_db --database="$db_name" >db.sql ynh_mysql_dump_db --database="$db_name" > db.sql
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT

View file

@ -40,13 +40,14 @@ data_path=$(ynh_app_setting_get --app=$app --key=data_path)
mapbox_token=$(ynh_app_setting_get --app=$app --key=mapbox_token) mapbox_token=$(ynh_app_setting_get --app=$app --key=mapbox_token)
#================================================= #=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP # BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
#================================================= #=================================================
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=35 ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=35
# Backup the current version of the app # Backup the current version of the app
ynh_backup_before_upgrade ynh_backup_before_upgrade
ynh_clean_setup() { ynh_clean_setup () {
ynh_clean_check_starting
# Remove the new domain config file, the remove script won't do it as it doesn't know yet its location. # Remove the new domain config file, the remove script won't do it as it doesn't know yet its location.
ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
@ -61,7 +62,8 @@ ynh_abort_if_errors
#================================================= #=================================================
change_domain=0 change_domain=0
if [ "$old_domain" != "$new_domain" ]; then if [ "$old_domain" != "$new_domain" ]
then
change_domain=1 change_domain=1
fi fi
@ -84,7 +86,8 @@ ynh_script_progression --message="Updating NGINX web server configuration..." --
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
# Change the domain for NGINX # Change the domain for NGINX
if [ $change_domain -eq 1 ]; then if [ $change_domain -eq 1 ]
then
# Delete file checksum for the old conf file location # Delete file checksum for the old conf file location
ynh_delete_file_checksum --file="$nginx_conf_path" ynh_delete_file_checksum --file="$nginx_conf_path"
mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
@ -107,6 +110,7 @@ ynh_add_config --template=".env" --destination="$final_path/output/.env"
#================================================= #=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_script_progression --message="Starting a systemd service..." --weight=1
# Start a systemd service
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
#================================================= #=================================================

View file

@ -13,8 +13,8 @@ source /usr/share/yunohost/helpers
# MANAGE SCRIPT FAILURE # MANAGE SCRIPT FAILURE
#================================================= #=================================================
ynh_clean_setup() { ynh_clean_setup () {
true ynh_clean_check_starting
} }
# Exit if an error occurs during the execution of the script # Exit if an error occurs during the execution of the script
ynh_abort_if_errors ynh_abort_if_errors
@ -39,7 +39,6 @@ final_path=/opt/yunohost/$app
test ! -e "$final_path" || ynh_die --message="This path already contains a folder" test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
data_path=/home/yunohost.app/$app data_path=/home/yunohost.app/$app
test ! -e "$data_path" || ynh_die --message="This path already contains a folder"
# Register (book) web path # Register (book) web path
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
@ -56,7 +55,7 @@ ynh_app_setting_set --app=$app --key=mapbox_token --value=$mapbox_token
#================================================= #=================================================
# STANDARD MODIFICATIONS # STANDARD MODIFICATIONS
#================================================= #=================================================
# FIND PORTS # FIND A PORT
#================================================= #=================================================
ynh_script_progression --message="Finding an available port..." --weight=1 ynh_script_progression --message="Finding an available port..." --weight=1
@ -136,11 +135,12 @@ build_ui
ynh_script_progression --message="Configuring a systemd service..." --weight=1 ynh_script_progression --message="Configuring a systemd service..." --weight=1
# Create a dedicated systemd config # Create a dedicated systemd config
ynh_add_systemd_config --service=$app ynh_add_systemd_config
#================================================= #=================================================
# ADD A CONFIGURATION # ADD A CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Adding a configuration file..."
ynh_add_config --template=".env" --destination="$final_path/output/.env" ynh_add_config --template=".env" --destination="$final_path/output/.env"
@ -177,7 +177,8 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$ap
ynh_script_progression --message="Configuring permissions..." --weight=1 ynh_script_progression --message="Configuring permissions..." --weight=1
# Make app public if necessary # Make app public if necessary
if [ $is_public -eq 1 ]; then if [ $is_public -eq 1 ]
then
# Everyone can access the app. # Everyone can access the app.
# The "main" permission is automatically created before the install script. # The "main" permission is automatically created before the install script.
ynh_permission_update --permission="main" --add="visitors" ynh_permission_update --permission="main" --add="visitors"

View file

@ -44,6 +44,14 @@ ynh_script_progression --message="Stopping and removing the systemd service..."
# Remove the dedicated systemd config # Remove the dedicated systemd config
ynh_remove_systemd_config ynh_remove_systemd_config
#=================================================
# REMOVE LOGROTATE CONFIGURATION
#=================================================
ynh_script_progression --message="Removing logrotate configuration..." --weight=1
# Remove the app-specific logrotate config
ynh_remove_logrotate
#================================================= #=================================================
# REMOVE THE MYSQL DATABASE # REMOVE THE MYSQL DATABASE
#================================================= #=================================================
@ -52,14 +60,6 @@ ynh_script_progression --message="Removing the MySQL database..." --weight=1
# Remove a database if it exists, along with the associated user # Remove a database if it exists, along with the associated user
ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_script_progression --message="Removing dependencies..." --weight=5
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
#================================================= #=================================================
# REMOVE APP MAIN DIR # REMOVE APP MAIN DIR
#================================================= #=================================================
@ -88,12 +88,14 @@ ynh_script_progression --message="Removing NGINX web server configuration..." --
ynh_remove_nginx_config ynh_remove_nginx_config
#================================================= #=================================================
# REMOVE LOGROTATE CONFIGURATION # REMOVE DEPENDENCIES
#================================================= #=================================================
ynh_script_progression --message="Removing logrotate configuration..." --weight=1 ynh_script_progression --message="Removing dependencies..." --weight=5
# Remove the app-specific logrotate config # Remove metapackage and its dependencies
ynh_remove_logrotate ynh_remove_go
ynh_remove_nodejs
ynh_remove_app_dependencies
#================================================= #=================================================
# SPECIFIC REMOVE # SPECIFIC REMOVE
@ -104,20 +106,6 @@ ynh_remove_logrotate
# Remove the log files # Remove the log files
ynh_secure_remove --file="/var/log/$app" ynh_secure_remove --file="/var/log/$app"
#=================================================
# REMOVE GO
#=================================================
ynh_script_progression --message="Removing Go..." --weight=1
ynh_remove_go
#=================================================
# REMOVE NODE
#=================================================
ynh_script_progression --message="Removing Node.js..." --weight=1
ynh_remove_nodejs
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
#================================================= #=================================================

View file

@ -15,7 +15,7 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
ynh_clean_setup() { ynh_clean_setup() {
true ynh_clean_check_starting
} }
# Exit if an error occurs during the execution of the script # Exit if an error occurs during the execution of the script
ynh_abort_if_errors ynh_abort_if_errors
@ -42,36 +42,26 @@ mapbox_token=$(ynh_app_setting_get --app=$app --key=mapbox_token)
#================================================= #=================================================
ynh_script_progression --message="Validating restoration parameters..." --weight=1 ynh_script_progression --message="Validating restoration parameters..." --weight=1
ynh_webpath_available --domain=$domain --path_url=$path_url || test ! -d $final_path \
ynh_die --message="Path not available: ${domain}${path_url}" || ynh_die --message="There is already a directory: $final_path "
test ! -d $final_path ||
ynh_die --message="There is already a directory: $final_path "
#================================================= #=================================================
# STANDARD RESTORATION STEPS # STANDARD RESTORATION STEPS
#================================================= #=================================================
# RESTORE THE NGINX CONFIGURATION # 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" ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#================================================= #=================================================
# RECREATE THE DEDICATED USER # RECREATE THE DEDICATED USER
#================================================= #=================================================
ynh_script_progression --message="Recreating the dedicated system user..." --weight=1 ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
# Create the dedicated user (if not existing) # Create the dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir="$final_path" ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# REINSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Reinstalling dependencies..." --weight=30
# Define and install dependencies
install_dependencies
#================================================= #=================================================
# RESTORE THE APP MAIN DIR # RESTORE THE APP MAIN DIR
#================================================= #=================================================
@ -84,7 +74,6 @@ set_permissions
#================================================= #=================================================
# RESTORE THE APP DATA DIR # RESTORE THE APP DATA DIR
#================================================= #=================================================
ynh_script_progression --message="Restoring the app data directory..." --weight=1 ynh_script_progression --message="Restoring the app data directory..." --weight=1
ynh_restore_file --origin_path="$data_path" --not_mandatory ynh_restore_file --origin_path="$data_path" --not_mandatory
@ -93,6 +82,16 @@ set_permissions
#================================================= #=================================================
# SPECIFIC RESTORATION # SPECIFIC RESTORATION
#=================================================
# REINSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Reinstalling dependencies..." --weight=30
# Define and install dependencies
install_dependencies
set_go_vars
set_node_vars
#================================================= #=================================================
# RESTORE THE MYSQL DATABASE # RESTORE THE MYSQL DATABASE
#================================================= #=================================================
@ -100,21 +99,7 @@ ynh_script_progression --message="Restoring the MySQL database..." --weight=1
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name <./db.sql ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
#=================================================
# RESTORE GO
#=================================================
ynh_script_progression --message="Restoring Go..." --weight=1
set_go_vars
#=================================================
# RESTORE NODE.JS
#=================================================
ynh_script_progression --message="Restoring Node.js..." --weight=1
set_node_vars
#================================================= #=================================================
# RESTORE SYSTEMD # RESTORE SYSTEMD
@ -124,6 +109,15 @@ ynh_script_progression --message="Restoring the systemd configuration..." --weig
ynh_restore_file --origin_path="/etc/systemd/system/$app.service" ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
systemctl enable $app.service --quiet systemctl enable $app.service --quiet
#=================================================
# RESTORE THE LOGROTATE CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the logrotate configuration..."
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
set_permissions
#================================================= #=================================================
# INTEGRATE SERVICE IN YUNOHOST # INTEGRATE SERVICE IN YUNOHOST
#================================================= #=================================================
@ -138,20 +132,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
#=================================================
# RESTORE VARIOUS FILES
#=================================================
ynh_restore_file --origin_path="/var/log/$app"
#=================================================
# RESTORE THE LOGROTATE CONFIGURATION
#=================================================
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
set_permissions
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
#================================================= #=================================================

View file

@ -29,6 +29,7 @@ mapbox_token=$(ynh_app_setting_get --app=$app --key=mapbox_token)
#================================================= #=================================================
# CHECK VERSION # CHECK VERSION
#================================================= #=================================================
ynh_script_progression --message="Checking version..."
upgrade_type=$(ynh_check_app_version_changed) upgrade_type=$(ynh_check_app_version_changed)
@ -39,7 +40,8 @@ ynh_script_progression --message="Backing up the app before upgrading (may take
# Backup the current version of the app # Backup the current version of the app
ynh_backup_before_upgrade ynh_backup_before_upgrade
ynh_clean_setup() { ynh_clean_setup () {
ynh_clean_check_starting
# Restore it if the upgrade fails # Restore it if the upgrade fails
ynh_restore_upgradebackup ynh_restore_upgradebackup
} }
@ -55,6 +57,18 @@ ynh_script_progression --message="Stopping a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log" ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log"
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..."
# Cleaning legacy permissions
if ynh_legacy_permissions_exists; then
ynh_legacy_permissions_delete_all
ynh_app_setting_delete --app=$app --key=is_public
fi
#================================================= #=================================================
# CREATE DEDICATED USER # CREATE DEDICATED USER
#================================================= #=================================================
@ -63,13 +77,6 @@ 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" ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
ynh_script_progression --message="Upgrading dependencies..." --weight=1
install_dependencies
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
@ -88,9 +95,18 @@ 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=1
install_dependencies
#================================================= #=================================================
# SPECIFIC UPGRADE # SPECIFIC UPGRADE
#================================================= #=================================================
# BUILD APP
#=================================================
if [ "$upgrade_type" == "UPGRADE_APP" ]; then if [ "$upgrade_type" == "UPGRADE_APP" ]; then
#================================================= #=================================================
@ -121,11 +137,12 @@ fi
ynh_script_progression --message="Upgrading systemd configuration..." --weight=1 ynh_script_progression --message="Upgrading systemd configuration..." --weight=1
# Create a dedicated systemd config # Create a dedicated systemd config
ynh_add_systemd_config --service=$app ynh_add_systemd_config
#================================================= #=================================================
# UPDATE A CONFIG FILE # UPDATE A CONFIG FILE
#================================================= #=================================================
ynh_script_progression --message="Updating a configuration file..."
ynh_add_config --template=".env" --destination="$final_path/output/.env" ynh_add_config --template=".env" --destination="$final_path/output/.env"

View file

@ -1,2 +0,0 @@
*~
*.sw[op]

View file

@ -1,2 +0,0 @@
*~
*.sw[op]