Packaging v2 + LibreQR 2.0.1

This commit is contained in:
Miraty 2023-07-08 22:28:20 +02:00
parent 9980de8ba3
commit f356e6abd3
18 changed files with 123 additions and 249 deletions

View File

@ -5,7 +5,8 @@ It shall NOT be edited by hand.
# LibreQR for YunoHost
[![Integration level](https://dash.yunohost.org/integration/qr.svg)](https://dash.yunohost.org/appci/app/qr) ![Working status](https://ci-apps.yunohost.org/ci/badges/qr.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/qr.maintain.svg)
[![Integration level](https://dash.yunohost.org/integration/qr.svg)](https://dash.yunohost.org/appci/app/qr) ![Working status](https://ci-apps.yunohost.org/ci/badges/qr.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/qr.maintain.svg)
[![Install LibreQR with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=qr)
*[Lire ce readme en français.](./README_fr.md)*
@ -17,8 +18,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
Web interface for generating QR codes
**Shipped version:** 2.0.0~ynh2
**Shipped version:** 2.0.1~ynh1
**Demo:** https://qr.antopie.org
@ -28,7 +28,6 @@ Web interface for generating QR codes
## Documentation and resources
* Official app website: <https://code.antopie.org/miraty/libreqr>
* Upstream app code repository: <https://code.antopie.org/miraty/libreqr>
* YunoHost documentation for this app: <https://yunohost.org/app_qr>
* Report a bug: <https://code.antopie.org/miraty/qr_ynh/issues>
@ -40,9 +39,9 @@ Please send your pull request to the [testing branch](https://code.antopie.org/m
To try the testing branch, please proceed like that.
``` bash
sudo yunohost app install https://code.antopie.org/miraty/qr_ynh/tree/testing --debug
sudo yunohost app install https://code.antopie.org/miraty/qr_ynh/src/branch/testing --debug
or
sudo yunohost app upgrade qr -u https://code.antopie.org/miraty/qr_ynh/tree/testing --debug
sudo yunohost app upgrade qr -u https://code.antopie.org/miraty/qr_ynh/src/branch/testing --debug
```
**More info regarding app packaging:** <https://yunohost.org/packaging_apps>

View File

@ -5,33 +5,32 @@ It shall NOT be edited by hand.
# LibreQR pour YunoHost
[![Niveau d'intégration](https://dash.yunohost.org/integration/qr.svg)](https://dash.yunohost.org/appci/app/qr) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/qr.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/qr.maintain.svg)
[![Niveau dintégration](https://dash.yunohost.org/integration/qr.svg)](https://dash.yunohost.org/appci/app/qr) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/qr.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/qr.maintain.svg)
[![Installer LibreQR avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=qr)
*[Read this readme in english.](./README.md)*
> *Ce package vous permet d'installer LibreQR 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.*
> *Ce package vous permet dinstaller LibreQR rapidement et simplement sur un serveur YunoHost.
Si vous navez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment linstaller et en profiter.*
## Vue d'ensemble
## Vue densemble
Interface Web pour générer des codes QR
**Version incluse :** 2.0.0~ynh2
**Version incluse :** 2.0.1~ynh1
**Démo :** https://qr.antopie.org
## Captures d'écran
## Captures décran
![Capture d'écran de LibreQR](./doc/screenshots/screenshot.png)
![Capture décran de LibreQR](./doc/screenshots/screenshot.png)
## Documentations et ressources
* Site officiel de l'app : <https://code.antopie.org/miraty/libreqr>
* Dépôt de code officiel de l'app : <https://code.antopie.org/miraty/libreqr>
* Dépôt de code officiel de lapp : <https://code.antopie.org/miraty/libreqr>
* Documentation YunoHost pour cette app : <https://yunohost.org/app_qr>
* Signaler un bug : <https://code.antopie.org/miraty/qr_ynh/issues>
* Signaler un bug : <https://code.antopi.org/miraty/qr_ynh/issues>
## Informations pour les développeurs
@ -40,9 +39,9 @@ Merci de faire vos pull request sur la [branche testing](https://code.antopie.or
Pour essayer la branche testing, procédez comme suit.
``` bash
sudo yunohost app install https://code.antopie.org/miraty/qr_ynh/tree/testing --debug
sudo yunohost app install https://code.antopie.org/miraty/qr_ynh/src/branch/testing --debug
ou
sudo yunohost app upgrade qr -u https://code.antopie.org/miraty/qr_ynh/tree/testing --debug
sudo yunohost app upgrade qr -u https://code.antopie.org/miraty/qr_ynh/src/branch/testing --debug
```
**Plus d'infos sur le packaging d'applications :** <https://yunohost.org/packaging_apps>
**Plus dinfos sur le packaging dapplications :** <https://yunohost.org/packaging_apps>

View File

@ -1,18 +0,0 @@
;; Default test serie
; Checks
pkg_linter=1
setup_sub_dir=1
setup_root=1
setup_private=1
setup_public=1
upgrade=1
upgrade=1 from_commit=3b225b6a98f91493bdf3ae593a59cbdd3616106f
upgrade=1 from_commit=53600a0a5838d26d0d6989be4c461007a58b4bf0
backup_restore=1
multi_instance=1
change_url=1
;;; Upgrade options
; commit=3b225b6a98f91493bdf3ae593a59cbdd3616106f
name=1.3.0~ynh1
; commit=53600a0a5838d26d0d6989be4c461007a58b4bf0
name=2.0.0~ynh1

View File

@ -1,7 +0,0 @@
SOURCE_URL=https://libreqr.antopie.org/releases/libreqr-2.0.0.tar.gz
SOURCE_SUM=3c30b6371fde58b89f1c93f58cc6bb234c6e0f5d025f6427eb879b46156adbcb0ef468cbe9bf96f6d934b373f53f34c14d261e1c968c595195b596df32e7606c
SOURCE_SUM_PRG=sha512sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=
SOURCE_EXTRACT=true

2
conf/extra_php-fpm.conf Executable file
View File

@ -0,0 +1,2 @@
chroot = __INSTALL_DIR__
chdir = /

View File

@ -1,27 +1,28 @@
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
location __PATH__/ {
# Path to source
alias __FINALPATH__/;
# Path to source
alias __INSTALL_DIR__/;
index index.php;
index index.php;
# Chrooted PHP-FPM
# Chrooted PHP-FPM
#sub_path_only location ~ ^__PATH__(?<chroot_path>/.*\.php)$ {
#root_path_only location ~ ^(?<chroot_path>/.*\.php)$ {
alias /;
fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $chroot_path;
include fastcgi_params;
}
alias /;
fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $chroot_path;
include fastcgi_params;
#sub_path_only }
#root_path_only }
# Security related headers
more_set_headers "Referrer-Policy: no-referrer";
more_set_headers "Content-Security-Policy: default-src 'none'; style-src 'self'; img-src 'self' data:; frame-ancestors 'none'; form-action 'self';";
# Security related headers
more_set_headers "Referrer-Policy: no-referrer";
more_set_headers "Content-Security-Policy: default-src 'none'; style-src 'self'; img-src 'self' data:; frame-ancestors 'none'; form-action 'self';";
# Include SSOWAT user panel.
include conf.d/yunohost_panel.conf.inc;
# Include SSOWAT user panel.
include conf.d/yunohost_panel.conf.inc;
}

View File

@ -1,23 +0,0 @@
[__NAMETOCHANGE__]
user = __USER__
group = __USER__
listen = /var/run/php/php__PHPVERSION__-fpm-__NAMETOCHANGE__.sock
listen.owner = www-data
listen.group = www-data
pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
request_terminate_timeout = 1d
chroot = __FINALPATH__
chdir = /
clear_env = yes
security.limit_extensions = .php

1
doc/DESCRIPTION.md Normal file
View File

@ -0,0 +1 @@
A PHP Web interface for generating QR codes. You can choose colors, size and redundancy rate.

1
doc/DESCRIPTION_fr.md Normal file
View File

@ -0,0 +1 @@
Une interface Web en PHP pour générer des codes QR. On peut choisir les couleurs, la taille et le taux de redondance.

53
manifest.toml Normal file
View File

@ -0,0 +1,53 @@
packaging_format = 2
id = "qr"
name = "LibreQR"
description.en = "Web interface for generating QR codes"
description.fr = "Interface Web pour générer des codes QR"
version = "2.0.1~ynh1"
maintainers = ["Miraty"]
[upstream]
license = "AGPL-3.0-or-later"
demo = "https://qr.antopie.org"
code = "https://code.antopie.org/miraty/libreqr"
[integration]
yunohost = ">= 11.1.21"
architectures = "all"
multi_instance = true
ldap = "not_relevant"
sso = "not_relevant"
disk = "5M"
ram.build = "50M"
ram.runtime = "50M"
[install]
[install.domain]
type = "domain"
[install.path]
type = "path"
default = "/"
[install.init_main_permission]
type = "group"
default = "visitors"
[resources]
[resources.system_user]
[resources.install_dir]
[resources.permissions]
main.url = "/"
[resources.apt]
packages = "php8.2-fpm"
[resources.sources]
[resources.sources.main]
url = "https://libreqr.antopie.org/releases/libreqr-2.0.1.tar.gz"
sha256 = "92a0cb8d9a9bfefd3f763a717914a0860ea31a50747bc86ecac702db2b47e12e"

View File

@ -1,14 +1,16 @@
libreqr_apply_filesystem_permissions() {
find "$final_path" -type f -exec chmod 400 "{}" +
find "$final_path" -type f -exec chown www-data:www-data "{}" +
find "$final_path" -type d -exec chmod 510 "{}" +
find "$final_path" -type d -exec chown $app:www-data "{}" +
find "$final_path" -type f -name "*.php" -exec chmod 400 "{}" +
find "$final_path" -type f -name "*.php" -exec chown $app:$app "{}" +
find "$final_path" -type f -name "*.css" -exec chmod 440 "{}" +
find "$final_path" -type f -name "*.css" -exec chown $app:www-data "{}" +
find "$final_path" -type f -name "*.less" -exec chmod 440 "{}" +
find "$final_path" -type f -name "*.less" -exec chown $app:www-data "{}" +
chmod 750 "$final_path"/css
chown $app:www-data "$final_path"/css
mktemp -p "$install_dir"/css/
rm "$install_dir"/css/*
find "$install_dir" -type f -exec chmod 400 "{}" +
find "$install_dir" -type f -exec chown www-data:www-data "{}" +
find "$install_dir" -type d -exec chmod 510 "{}" +
find "$install_dir" -type d -exec chown $app:www-data "{}" +
find "$install_dir" -type f -name "*.php" -exec chmod 400 "{}" +
find "$install_dir" -type f -name "*.php" -exec chown $app:$app "{}" +
find "$install_dir" -type f -name "*.css" -exec chmod 440 "{}" +
find "$install_dir" -type f -name "*.css" -exec chown $app:www-data "{}" +
find "$install_dir" -type f -name "*.less" -exec chmod 440 "{}" +
find "$install_dir" -type f -name "*.less" -exec chown $app:www-data "{}" +
chmod 750 "$install_dir"/css
chown $app:www-data "$install_dir"/css
}

View File

@ -1,17 +1,7 @@
#!/bin/bash
source /usr/share/yunohost/helpers
ynh_abort_if_errors
ynh_print_info --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
domain=$(ynh_app_setting_get --app=$app --key=domain)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
ynh_print_info --message="Declaring files to be backed up..."
ynh_backup --src_path="$final_path"
ynh_backup --src_path="$install_dir"
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."

View File

@ -1,52 +1,5 @@
#!/bin/bash
source /usr/share/yunohost/helpers
old_domain=$YNH_APP_OLD_DOMAIN
old_path=$YNH_APP_OLD_PATH
new_domain=$YNH_APP_NEW_DOMAIN
new_path=$YNH_APP_NEW_PATH
app=$YNH_APP_INSTANCE_NAME
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
ynh_script_progression --message="Loading installation settings..."
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..."
ynh_backup_before_upgrade
ynh_clean_setup () {
ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
ynh_restore_upgradebackup
}
ynh_abort_if_errors
ynh_script_progression --message="Updating NGINX web server configuration..."
# Change the path if needed
change_path=0
if [ "$old_path" != "$new_path" ]
then
change_path=1
fi
if [ $change_path -eq 1 ]
then
ynh_backup_if_checksum_is_different --file="$nginx_conf_path"
domain="$old_domain"
path_url="$new_path"
ynh_add_nginx_config
fi
# Change the domain if needed
change_domain=0
if [ "$old_domain" != "$new_domain" ]
then
change_domain=1
fi
if [ $change_domain -eq 1 ]
then
ynh_delete_file_checksum --file="$nginx_conf_path"
mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
fi
ynh_script_progression --message="Reloading NGINX web server..."
ynh_systemd_action --service_name=nginx --action=reload
ynh_script_progression --message="Change of URL completed for $app" --last
ynh_change_url_nginx_config

View File

@ -2,40 +2,11 @@
source _common.sh
source /usr/share/yunohost/helpers
ynh_abort_if_errors
domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH
is_public=$YNH_APP_ARG_IS_PUBLIC
app=$YNH_APP_INSTANCE_NAME
ynh_script_progression --message="Validating installation parameters..."
final_path=/var/www/$app
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
ynh_script_progression --message="Storing installation settings..."
ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set --app=$app --key=path --value=$path_url
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
ynh_script_progression --message="Configuring system user..."
ynh_system_user_create --username=$app --home_dir="$final_path"
ynh_script_progression --message="Setting up source files..."
ynh_setup_source --dest_dir="$final_path"
ynh_setup_source --dest_dir="$install_dir"
libreqr_apply_filesystem_permissions
ynh_script_progression --message="Configuring NGINX web server..."
ynh_add_nginx_config
ynh_script_progression --message="Configuring PHP-FPM..."
ynh_add_fpm_config
ynh_script_progression --message="Configuring permissions..."
if [ $is_public -eq 1 ]
then
ynh_permission_update --permission="main" --add="visitors"
fi
ynh_script_progression --message="Installation of $app completed" --last
ynh_add_fpm_config --usage="medium" --footprint="medium"

View File

@ -1,22 +1,8 @@
#!/bin/bash
source /usr/share/yunohost/helpers
ynh_script_progression --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
ynh_script_progression --message="Removing app main directory..."
ynh_secure_remove --file="$final_path"
ynh_script_progression --message="Removing NGINX web server configuration..."
ynh_remove_nginx_config
ynh_script_progression --message="Removing PHP-FPM configuration..."
ynh_remove_fpm_config
ynh_script_progression --message="Removing the dedicated system user..."
ynh_system_user_delete --username=$app
ynh_script_progression --message="Removal of $app completed" --last

View File

@ -2,20 +2,8 @@
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
ynh_abort_if_errors
ynh_script_progression --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
ynh_script_progression --message="Recreating the dedicated system user..."
ynh_system_user_create --username=$app --home_dir="$final_path"
ynh_script_progression --message="Restoring the app main directory..."
ynh_restore_file --origin_path="$final_path"
ynh_restore_file --origin_path="$install_dir"
libreqr_apply_filesystem_permissions
ynh_script_progression --message="Restoring the PHP-FPM configuration..."
@ -25,5 +13,3 @@ ynh_systemd_action --service_name=php$phpversion-fpm --action=reload
ynh_script_progression --message="Restoring the NGINX configuration..."
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_systemd_action --service_name=nginx --action=reload
ynh_script_progression --message="Restoration completed for $app" --last

View File

@ -2,42 +2,11 @@
source _common.sh
source /usr/share/yunohost/helpers
ynh_script_progression --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
upgrade_type=$(ynh_check_app_version_changed)
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..."
ynh_backup_before_upgrade
ynh_clean_setup () {
ynh_restore_upgradebackup
}
ynh_abort_if_errors
ynh_script_progression --message="Ensuring downward compatibility..."
if ynh_legacy_permissions_exists; then
ynh_legacy_permissions_delete_all
ynh_app_setting_delete --app=$app --key=is_public
fi
ynh_script_progression --message="Making sure dedicated system user exists..."
ynh_system_user_create --username=$app --home_dir="$final_path"
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_script_progression --message="Upgrading source files..."
ynh_secure_remove --file="$final_path"
ynh_setup_source --dest_dir="$final_path"
fi
ynh_setup_source --dest_dir="$install_dir"
libreqr_apply_filesystem_permissions
ynh_script_progression --message="Upgrading NGINX web server configuration..."
ynh_add_nginx_config
ynh_script_progression --message="Upgrading PHP-FPM configuration..."
ynh_add_fpm_config
ynh_script_progression --message="Upgrade of $app completed" --last
ynh_add_fpm_config --usage="medium" --footprint="low"

9
tests.toml Normal file
View File

@ -0,0 +1,9 @@
test_format = 1.0
[default]
#exclude = ["install.root", "install.subpath", "install.private", "install.multi", "backup_restore", "change_url"]
test_upgrade_from.3b225b6a.name = "1.3.0~ynh1"
test_upgrade_from.53600a0a.name = "2.0.0~ynh1"
test_upgrade_from.3b4562b7.name = "2.0.0~ynh2"