mirror of
https://github.com/YunoHost-Apps/framagames_ynh.git
synced 2024-09-03 18:36:28 +02:00
Manifest v2 + update to latest upstream.
This commit is contained in:
parent
386cd443d4
commit
847105a65e
12 changed files with 190 additions and 78 deletions
|
@ -18,7 +18,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
|
||||||
|
|
||||||
Set of games Framagames from Framasoft.
|
Set of games Framagames from Framasoft.
|
||||||
|
|
||||||
**Shipped version:** 1.0~ynh4
|
**Shipped version:** 2022.12.28~ynh1
|
||||||
## Documentation and resources
|
## Documentation and resources
|
||||||
|
|
||||||
* Official app website: <https://framagit.org/framasoft/framagames>
|
* Official app website: <https://framagit.org/framasoft/framagames>
|
||||||
|
|
|
@ -18,7 +18,7 @@ Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po
|
||||||
|
|
||||||
Set of games Framagames from Framasoft.
|
Set of games Framagames from Framasoft.
|
||||||
|
|
||||||
**Version incluse :** 1.0~ynh4
|
**Version incluse :** 2022.12.28~ynh1
|
||||||
## Documentations et ressources
|
## Documentations et ressources
|
||||||
|
|
||||||
* Site officiel de l’app : <https://framagit.org/framasoft/framagames>
|
* Site officiel de l’app : <https://framagit.org/framasoft/framagames>
|
||||||
|
|
|
@ -1,26 +1,11 @@
|
||||||
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
|
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
|
||||||
location __PATH__/ {
|
location __PATH__/ {
|
||||||
|
|
||||||
# Path to source
|
# Path to source
|
||||||
alias __INSTALL_DIR__/;
|
alias __INSTALL_DIR__/public/;
|
||||||
|
|
||||||
index index.php index.html;
|
index index.html;
|
||||||
|
|
||||||
# Common parameter to increase upload size limit in conjunction with dedicated php-fpm file
|
# Include SSOWAT user panel.
|
||||||
client_max_body_size 10G;
|
include conf.d/yunohost_panel.conf.inc;
|
||||||
|
|
||||||
try_files $uri $uri/ index.php;
|
|
||||||
location ~ [^/]\.php(/|$) {
|
|
||||||
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
|
|
||||||
fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock;
|
|
||||||
|
|
||||||
fastcgi_index index.php;
|
|
||||||
include fastcgi_params;
|
|
||||||
fastcgi_param REMOTE_USER $remote_user;
|
|
||||||
fastcgi_param PATH_INFO $fastcgi_path_info;
|
|
||||||
fastcgi_param SCRIPT_FILENAME $request_filename;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Include SSOWAT user panel.
|
|
||||||
include conf.d/yunohost_panel.conf.inc;
|
|
||||||
}
|
}
|
|
@ -5,14 +5,14 @@ name = "Framagames"
|
||||||
description.en = "Set of games Framagames from Framasoft"
|
description.en = "Set of games Framagames from Framasoft"
|
||||||
description.fr = "Ensemble de jeux Framagames venant de Framasoft"
|
description.fr = "Ensemble de jeux Framagames venant de Framasoft"
|
||||||
|
|
||||||
version = "1.0~ynh4"
|
version = "2022.12.28~ynh1"
|
||||||
|
|
||||||
maintainers = []
|
maintainers = []
|
||||||
|
|
||||||
[upstream]
|
[upstream]
|
||||||
license = "AGPL-3.0-only"
|
license = "AGPL-3.0-only"
|
||||||
website = "https://framagit.org/framasoft/framagames"
|
|
||||||
code = "https://framagit.org/framasoft/framagames"
|
code = "https://framagit.org/framasoft/framagames"
|
||||||
|
website = "https://framagames.org/en/"
|
||||||
|
|
||||||
[integration]
|
[integration]
|
||||||
yunohost = ">= 11.2"
|
yunohost = ">= 11.2"
|
||||||
|
@ -32,16 +32,26 @@ ram.runtime = "50M"
|
||||||
type = "path"
|
type = "path"
|
||||||
default = "/framagames"
|
default = "/framagames"
|
||||||
|
|
||||||
|
[install.language]
|
||||||
|
ask.en = "Choose the application language"
|
||||||
|
ask.fr = "Choisissez la langue de l'application"
|
||||||
|
type = "select"
|
||||||
|
choices = ["fr", "en"]
|
||||||
|
default = "en"
|
||||||
|
|
||||||
[install.init_main_permission]
|
[install.init_main_permission]
|
||||||
|
help.en = "If enabled, Framagames will be accessible by people who doesn’t have an account. This can be changed later via the webadmin."
|
||||||
|
help.fr = "Si cette case est cochée, Framagames sera accessible aux personnes n’ayant pas de compte. Vous pourrez changer ceci plus tard via la webadmin."
|
||||||
type = "group"
|
type = "group"
|
||||||
default = "visitors"
|
default = "visitors"
|
||||||
|
|
||||||
[resources]
|
[resources]
|
||||||
|
|
||||||
[resources.sources.main]
|
[resources.sources]
|
||||||
|
|
||||||
url = "https://framagit.org/framasoft/framagames/-/archive/6808f75cd18f4a1bb0345ce65d055e2dfef8c0b7/framagames-6808f75cd18f4a1bb0345ce65d055e2dfef8c0b7.tar.gz"
|
[resources.sources.main]
|
||||||
sha256 = "6c2bf60663dad46ac6660ddb3634d1c05dcf38cea1f2687b8ee26743deb8a10e"
|
url = "https://framagit.org/framasoft/framagames/-/archive/5510754d92e9649aa1808ffb1d3255d5da1ebf47/framagames-5510754d92e9649aa1808ffb1d3255d5da1ebf47.tar.gz"
|
||||||
|
sha256 = "d1b772cbda377ee2fdecf468eb251fb0d05b865d1b39703790a86943a1731973"
|
||||||
|
|
||||||
[resources.system_user]
|
[resources.system_user]
|
||||||
|
|
||||||
|
@ -49,6 +59,3 @@ ram.runtime = "50M"
|
||||||
|
|
||||||
[resources.permissions]
|
[resources.permissions]
|
||||||
main.url = "/"
|
main.url = "/"
|
||||||
|
|
||||||
[resources.apt]
|
|
||||||
packages = "php8.2-fpm"
|
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
# COMMON VARIABLES
|
# COMMON VARIABLES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
nodejs_version=18
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# PERSONAL HELPERS
|
# PERSONAL HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -27,12 +27,6 @@ ynh_backup --src_path="$install_dir"
|
||||||
|
|
||||||
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# BACKUP THE PHP-FPM CONFIGURATION
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -21,3 +21,4 @@ ynh_change_url_nginx_config
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Change of URL completed for $app"
|
ynh_script_progression --message="Change of URL completed for $app"
|
||||||
|
|
||||||
|
|
|
@ -9,24 +9,65 @@
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# INSTALL DEPENDENCIES
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Installing dependencies..."
|
||||||
|
|
||||||
|
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Setting up source files..."
|
ynh_script_progression --message="Setting up source files..."
|
||||||
|
|
||||||
# Download, check integrity, uncompress and patch the source from app.src
|
# Download, check integrity, uncompress and patch the source from app.src
|
||||||
ynh_setup_source --dest_dir="$install_dir"
|
ynh_setup_source --dest_dir="$install_dir/build"
|
||||||
|
|
||||||
|
chmod 750 "$install_dir"
|
||||||
chmod -R o-rwx "$install_dir"
|
chmod -R o-rwx "$install_dir"
|
||||||
chown -R $app:www-data "$install_dir"
|
chown -R $app:www-data "$install_dir"
|
||||||
|
|
||||||
#=================================================
|
ynh_script_progression --message="Building...." --weight=5
|
||||||
# PHP-FPM CONFIGURATION
|
|
||||||
#=================================================
|
ynh_use_nodejs
|
||||||
ynh_script_progression --message="Configuring PHP-FPM..."
|
|
||||||
|
stripped_path=$(echo $path_url | sed -e 's/\///')
|
||||||
|
|
||||||
|
pushd "$install_dir/build"
|
||||||
|
ynh_replace_string --match_string="framanav: true" --replace_string="framanav: false" --target_file="src/data/main.yml"
|
||||||
|
ynh_replace_string --match_string="defaultLang: fr" --replace_string="defaultLang: $language" --target_file="src/data/main.yml"
|
||||||
|
|
||||||
|
ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH NODE_OPTIONS="--openssl-legacy-provider" $ynh_npm run commons
|
||||||
|
if [ $path_url == "/" ]; then
|
||||||
|
ynh_replace_string --match_string="canonical: https://framagames.org" --replace_string="canonical: https://$domain" --target_file="src/data/main.yml"
|
||||||
|
ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH NODE_ENV=production NODE_OPTIONS="--openssl-legacy-provider" $ynh_npm run prod
|
||||||
|
else
|
||||||
|
ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH NODE_ENV=production CI_JOB_NAME=pages CI_PAGES_URL="https://$domain$path_url" NODE_OPTIONS="--openssl-legacy-provider" $ynh_npm run prod
|
||||||
|
fi
|
||||||
|
|
||||||
|
ynh_secure_remove --file="$install_dir/build/public"
|
||||||
|
mv dist/ public/
|
||||||
|
|
||||||
|
if [ $path_url == "/" ]; then
|
||||||
|
cp ./public/$language/index.html ./public/index.html
|
||||||
|
mv -f games/* public/
|
||||||
|
else
|
||||||
|
cp ./public/$stripped_path/$language/index.html ./public/$stripped_path/index.html
|
||||||
|
mv -f games/* public/$stripped_path
|
||||||
|
fi
|
||||||
|
cd public && for f in $(find -type l);do cp --remove-destination $(readlink -f $f) $f;done;
|
||||||
|
|
||||||
|
popd
|
||||||
|
|
||||||
|
if [ $path_url == "/" ]; then
|
||||||
|
mv "$install_dir/build/public" "$install_dir/public"
|
||||||
|
else
|
||||||
|
mv "$install_dir/build/public/$stripped_path" "$install_dir/public"
|
||||||
|
fi
|
||||||
|
|
||||||
|
ynh_secure_remove --file="$install_dir/build"
|
||||||
|
|
||||||
# Create a dedicated PHP-FPM config
|
|
||||||
ynh_add_fpm_config
|
|
||||||
|
|
||||||
# Create a dedicated NGINX config
|
# Create a dedicated NGINX config
|
||||||
ynh_add_nginx_config
|
ynh_add_nginx_config
|
||||||
|
|
|
@ -17,9 +17,6 @@ ynh_script_progression --message="Removing NGINX web server configuration..."
|
||||||
# Remove the dedicated NGINX config
|
# Remove the dedicated NGINX config
|
||||||
ynh_remove_nginx_config
|
ynh_remove_nginx_config
|
||||||
|
|
||||||
# Remove the dedicated PHP-FPM config
|
|
||||||
ynh_remove_fpm_config
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -11,36 +11,39 @@ source ../settings/scripts/_common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE APP MAIN DIR
|
# STANDARD RESTORATION STEPS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring the app main directory..."
|
# RESTORE THE NGINX CONFIGURATION
|
||||||
|
|
||||||
ynh_restore_file --origin_path="$install_dir"
|
|
||||||
|
|
||||||
chmod -R o-rwx "$install_dir"
|
|
||||||
chown -R $app:www-data "$install_dir"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE PHP-FPM CONFIGURATION
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Restoring the PHP-FPM configuration..."
|
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
|
||||||
|
|
||||||
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"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RESTORE THE APP MAIN DIR
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Restoring $app main directory..." --weight=2
|
||||||
|
|
||||||
|
ynh_restore_file --origin_path="$install_dir"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RESTORE USER RIGHTS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Restore permissions on app files
|
||||||
|
chown -R $app:www-data $install_dir
|
||||||
|
chmod o-rwx $install_dir
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX AND PHP-FPM
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..."
|
ynh_script_progression --message="Reloading NGINX web server..." --weight=3
|
||||||
|
|
||||||
ynh_systemd_action --service_name=php$phpversion-fpm --action=reload
|
|
||||||
ynh_systemd_action --service_name=nginx --action=reload
|
ynh_systemd_action --service_name=nginx --action=reload
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Restoration completed for $app"
|
ynh_script_progression --message="Restoration completed for $app" --last
|
||||||
|
|
102
scripts/upgrade
102
scripts/upgrade
|
@ -15,36 +15,112 @@ source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
upgrade_type=$(ynh_check_app_version_changed)
|
upgrade_type=$(ynh_check_app_version_changed)
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# ENSURE DOWNWARD COMPATIBILITY
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
|
||||||
|
|
||||||
|
# If language doesn't exist, create it
|
||||||
|
if [ -z "${language:-}" ]; then
|
||||||
|
language="en"
|
||||||
|
ynh_app_setting_set --app=$app --key=language --value=$language
|
||||||
|
fi
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# INSTALL DEPENDENCIES
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Installing dependencies..."
|
||||||
|
|
||||||
|
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||||
then
|
then
|
||||||
ynh_script_progression --message="Upgrading source files..."
|
|
||||||
|
|
||||||
ynh_secure_remove --file="$install_dir"
|
if $(ynh_compare_current_package_version --comparison lt --version "2022.12.28~ynh1")
|
||||||
|
then
|
||||||
|
ynh_script_progression --message="Removing old files..." --weight=2
|
||||||
|
ynh_secure_remove --file="$install_dir"
|
||||||
|
|
||||||
|
mkdir -p $install_dir
|
||||||
|
# Set permissions on app files
|
||||||
|
chown $app:www-data $install_dir
|
||||||
|
chmod o-rwx $install_dir
|
||||||
|
fi
|
||||||
|
ynh_script_progression --message="Setting up source files..."
|
||||||
|
|
||||||
# Download, check integrity, uncompress and patch the source from app.src
|
# Download, check integrity, uncompress and patch the source from app.src
|
||||||
ynh_setup_source --dest_dir="$install_dir"
|
ynh_setup_source --dest_dir="$install_dir/build"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
chmod -R o-rwx "$install_dir"
|
|
||||||
chown -R $app:www-data "$install_dir"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# PHP-FPM CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Upgrading PHP-FPM configuration..."
|
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=2
|
||||||
|
|
||||||
# Create a dedicated PHP-FPM config
|
|
||||||
ynh_add_fpm_config
|
|
||||||
|
|
||||||
# Create a dedicated NGINX config
|
# Create a dedicated NGINX config
|
||||||
ynh_add_nginx_config
|
ynh_add_nginx_config
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SECURE FILES AND DIRECTORIES
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Set permissions on app files
|
||||||
|
chown -R $app:www-data $install_dir
|
||||||
|
chmod o-rwx $install_dir
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# BUILD
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||||
|
then
|
||||||
|
ynh_script_progression --message="Building...." --weight=5
|
||||||
|
|
||||||
|
ynh_use_nodejs
|
||||||
|
|
||||||
|
stripped_path=$(echo $path_url | sed -e 's/\///')
|
||||||
|
|
||||||
|
pushd "$install_dir/build"
|
||||||
|
ynh_replace_string --match_string="framanav: true" --replace_string="framanav: false" --target_file="src/data/main.yml"
|
||||||
|
ynh_replace_string --match_string="defaultLang: fr" --replace_string="defaultLang: $language" --target_file="src/data/main.yml"
|
||||||
|
|
||||||
|
ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH NODE_OPTIONS="--openssl-legacy-provider" $ynh_npm run commons
|
||||||
|
if [ $path_url == "/" ]; then
|
||||||
|
ynh_replace_string --match_string="canonical: https://framagames.org" --replace_string="canonical: https://$domain" --target_file="src/data/main.yml"
|
||||||
|
ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH NODE_ENV=production NODE_OPTIONS="--openssl-legacy-provider" $ynh_npm run prod
|
||||||
|
else
|
||||||
|
ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH NODE_ENV=production CI_JOB_NAME=pages CI_PAGES_URL="https://$domain$path_url" NODE_OPTIONS="--openssl-legacy-provider" $ynh_npm run prod
|
||||||
|
fi
|
||||||
|
|
||||||
|
ynh_secure_remove --file="$install_dir/build/public"
|
||||||
|
mv dist/ public/
|
||||||
|
|
||||||
|
if [ $path_url == "/" ]; then
|
||||||
|
cp ./public/$language/index.html ./public/index.html
|
||||||
|
mv -f games/* public/
|
||||||
|
else
|
||||||
|
cp ./public/$stripped_path/$language/index.html ./public/$stripped_path/index.html
|
||||||
|
mv -f games/* public/$stripped_path
|
||||||
|
fi
|
||||||
|
cd public && for f in $(find -type l);do cp --remove-destination $(readlink -f $f) $f;done;
|
||||||
|
|
||||||
|
popd
|
||||||
|
|
||||||
|
if [ $path_url == "/" ]; then
|
||||||
|
mv "$install_dir/build/public" "$install_dir/public"
|
||||||
|
else
|
||||||
|
mv "$install_dir/build/public/$stripped_path" "$install_dir/public"
|
||||||
|
fi
|
||||||
|
|
||||||
|
ynh_secure_remove --file="$install_dir/build"
|
||||||
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Upgrade of $app completed"
|
ynh_script_progression --message="Upgrade of $app completed" --last
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
test_format = 1.0
|
test_format = 1.0
|
||||||
|
|
||||||
[default]
|
[default]
|
||||||
|
|
||||||
|
# ------------
|
||||||
|
# Tests to run
|
||||||
|
# ------------
|
||||||
|
|
||||||
|
test_upgrade_from.fb3cdde65e8003c2386002e7dc49c02989f9198d.name = "Upgrade from 1.0~ynh4"
|
||||||
|
|
Loading…
Add table
Reference in a new issue