1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/retroarch_ynh.git synced 2024-09-03 20:16:12 +02:00

Merge pull request #1 from YunoHost-Apps/testing

Initial
This commit is contained in:
Krakinou 2021-05-09 19:11:39 +02:00 committed by GitHub
commit b26a1f5ea0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 306 additions and 209 deletions

View file

@ -1,5 +1,3 @@
##ON GOING DEVELOPMENT - DO NOT USE
# RetroArch Web Player for YunoHost
[![Integration level](https://dash.yunohost.org/integration/retroarch.svg)](https://dash.yunohost.org/appci/app/retroarch)
@ -11,33 +9,37 @@
If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to know how to install and enjoy it.*
## Overview
Quick description of this app.
RetroArch is a frontend for emulators, game engines and media players.
It enables you to run classic games on a wide range of computers and consoles through its slick graphical interface. Settings are also unified so configuration is done once and for all.
The RetroArch Web Player is RetroArch compiled through [Emscripten](http://kripken.github.io/emscripten-site/).
**Shipped version:** 1.9.1
## Screenshots
![](Link to an screenshot for this app)
![](https://github.com/libretro/RetroArch/blob/master/docs/ozone-main-menu.jpg)
## Demo
* [Official demo](https://web.libretro.com/)
## Configuration
How to configure this app: by an admin panel, a plain file with SSH, or any other way.
## Documentation
* Official documentation: Link to the official documentation of this app
* YunoHost documentation: If specific documentation is needed, feel free to contribute.
* [Official Website](https://www.retroarch.com/)
* [Official web player documentation](https://github.com/libretro/RetroArch/tree/master/pkg/emscripten) (not much to see here...)
* [Official documentation](https://docs.libretro.com/)
## YunoHost specific features
#### Multi-users support
### Use Shared ROMs library
Although you can upload a ROM at runtime, retroarch may have access to the ROMs you already have on your server:
* Games are located in `/opt/yunohost/retroarch/assets/cores`. A symbolic link is created to this folder in `/home/yunohost.multimedia/share/Games`, so that you can place your games from here
* cores have to be indexed to work : script `/opt/yunohost/retroarch/indexer.sh` run every 5 minutes to index all games in `opt/yunohost/retroarch/assets/cores`
Are LDAP and HTTP auth supported?
Can the app be used by multiple users?
#### Supported architectures
@ -46,20 +48,15 @@ Can the app be used by multiple users?
## Limitations
* Any known limitations.
## Additional information
* Other information you would add about this application
**More information on the documentation page:**
https://yunohost.org/packaging_apps
* cannot save game, in fact, cannot write at all... so configuration is lost each time you start again
* no user management
* some core are listed but not implemented : they do not work, the issue is from the upstream app.
## Links
* Report a bug: https://github.com/YunoHost-Apps/retroarch_ynh/issues
* App website: Link to the official website of this app
* Upstream app repository: Link to the official repository of the upstream app
* App website: [Official Website](https://www.retroarch.com/)
* Upstream app repository: https://github.com/libretro/RetroArch/tree/master/pkg/emscripten
* YunoHost website: https://yunohost.org/

View file

@ -1,64 +1,62 @@
# App exemple pour YunoHost
# RetroArch Web Player pour YunoHost
[![Niveau d'intégration](https://dash.yunohost.org/integration/REPLACEBYYOURAPP.svg)](https://dash.yunohost.org/appci/app/REPLACEBYYOURAPP)
[![Installer REPLACEBYYOURAPP avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=REPLACEBYYOURAPP)
[![Niveau d'intégration](https://dash.yunohost.org/integration/retroarch.svg)](https://dash.yunohost.org/appci/app/retroarch)
[![Installer retroarch avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=retroarch)
*[Read this readme in english.](./README.md)*
> *Ce package vous permet d'installer REPLACEBYYOURAPP rapidement et simplement sur un serveur Yunohost.
> *Ce package vous permet d'installer retroarch 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.*
## Vue d'ensemble
Description rapide de cette application.
RetroArch est un frontend pour des émulateurs, des moteurs de jeux et des lecteurs média.
Il vous permet de rejouer à des classiques du jeu vidéo sur une large gamme d'ordinateur et de console grace à son interface graphique légère. Les réglages sont unifiés afin de n'avoir a effectuer les réglages qu'une seule fois.
**Version incluse:** 1.0
Le Web Player Retroarch utilise RetroArch compilé grace à [Emscripten](http://kripken.github.io/emscripten-site/).
**Version incluse:** 1.9.1
## Captures d'écran
![](Lien vers une capture d'écran pour cette application)
![](https://github.com/libretro/RetroArch/blob/master/docs/ozone-main-menu.jpg)
## Démo
* [Démo officielle](Lien vers un site de démonstration pour cette application)
* [Démo officielle](https://web.libretro.com/)
## Configuration
Comment configurer cette application: via le panneau d'administration, un fichier brut en SSH ou tout autre moyen.
## Documentation
* Documentation officielle: Lien vers la documentation officielle de cette application
* Documentation YunoHost: Si une documentation spécifique est nécessaire, n'hésitez pas à contribuer.
* [Website officiel](https://www.retroarch.com/)
* [Documentation officielle du web player](https://github.com/libretro/RetroArch/tree/master/pkg/emscripten) (c'est très très léger...)
* [Documentation officielle](https://docs.libretro.com/)
## Caractéristiques spécifiques YunoHost
#### Support multi-utilisateurs
#### Bibliothèque partagée
L'authentification LDAP et HTTP est-elle prise en charge?
L'application peut-elle être utilisée par plusieurs utilisateurs?
Même si vous pouvez uploader une ROM depuis l'application, RetroArch peut accéder à celle déjà sur votre serveur:
* Les jeux sont situés dans `/opt/yunohost/retroarch/assets/cores`. Un lien symbolique est créé vers `/home/yunohost.multimedia/share/Games` de façon à ce que vous puissiez les y mettre facilement.
* Les cores doivent être indexés pour fonctionner : le script `/opt/yunohost/retroarch/indexer.sh` tourne toutes les 5 minutes pour indexer tous les jeux dans `opt/yunohost/retroarch/assets/cores`
#### Architectures supportées
* x86-64b - [![Build Status](https://ci-apps.yunohost.org/ci/logs/REPLACEBYYOURAPP%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/REPLACEBYYOURAPP/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/REPLACEBYYOURAPP%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/REPLACEBYYOURAPP/)
* Jessie x86-64b - [![Build Status](https://ci-stretch.nohost.me/ci/logs/REPLACEBYYOURAPP%20%28Apps%29.svg)](https://ci-stretch.nohost.me/ci/apps/REPLACEBYYOURAPP/)
* x86-64b - [![Build Status](https://ci-apps.yunohost.org/ci/logs/retroarch%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/retroarch/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/retroarch%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/retroarch/)
* Jessie x86-64b - [![Build Status](https://ci-stretch.nohost.me/ci/logs/retroarch%20%28Apps%29.svg)](https://ci-stretch.nohost.me/ci/apps/retroarch/)
## Limitations
* Limitations connues.
## Informations additionnelles
* Autres informations à ajouter sur cette application
**Plus d'informations sur la page de documentation:**
https://yunohost.org/packaging_apps
* On ne peut pas sauvegarder. En fait, on ne peut pas écrire dans les fichiers du tout, donc la configuration est perdue à chaque fois...
* Pas de gestion d'utilisateurs
* certains cores sont listés mais ne sont pas implémentés : ils ne fonctionnent donc pas, le problème vient de l'application elle même.
## Liens
* Signaler un bug: https://github.com/YunoHost-Apps/REPLACEBYYOURAPP_ynh/issues
* Site de l'application: Lien vers le site officiel de cette application
* Dépôt de l'application principale: Lien vers le dépôt officiel de l'application principale
* Signaler un bug: https://github.com/YunoHost-Apps/retroarch_ynh/issues
* Site de l'application: [Official Website](https://www.retroarch.com/)
* Dépôt de l'application principale: https://github.com/libretro/RetroArch/tree/master/pkg/emscripten
* Site web YunoHost: https://yunohost.org/
---
@ -67,11 +65,11 @@ Informations pour les développeurs
----------------
**Seulement si vous voulez utiliser une branche de test pour le codage, au lieu de fusionner directement dans la banche principale.**
Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/REPLACEBYYOURAPP_ynh/tree/testing).
Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/retroarch_ynh/tree/testing).
Pour essayer la branche testing, procédez comme suit.
```
sudo yunohost app install https://github.com/YunoHost-Apps/REPLACEBYYOURAPP_ynh/tree/testing --debug
sudo yunohost app install https://github.com/YunoHost-Apps/retroarch_ynh/tree/testing --debug
ou
sudo yunohost app upgrade REPLACEBYYOURAPP -u https://github.com/YunoHost-Apps/REPLACEBYYOURAPP_ynh/tree/testing --debug
sudo yunohost app upgrade retroarch -u https://github.com/YunoHost-Apps/retroarch_ynh/tree/testing --debug
```

View file

@ -19,7 +19,7 @@
backup_restore=1
multi_instance=0
port_already_use=0 #No port required
change_url=1
change_url=0 #not yet done
;;; Levels
# If the level 5 (Package linter) is forced to 1. Please add justifications here.
Level 5=auto

2
conf/README.GAME Normal file
View file

@ -0,0 +1,2 @@
You may put ROMs to be used by retroarch in this folder.
After a 5 minute delay, they should be available in retroarch itself in the "download/Game" directory.

29
conf/indexer.sh Normal file
View file

@ -0,0 +1,29 @@
#!/bin/bash
#This script is run by the cron job in /etc/cron.d/retroarch
#It will index all cores in the opt/yunohost/retroarch/assets/cores folder so that they are available in
# retroarch itself.
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source /usr/share/yunohost/helpers
source _common.sh
#=================================================
# GET APP SETTINGS
#=================================================
app=__APP__
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#=================================================
# Update the index
#=================================================
ynh_use_nodejs
cd $final_path/assets/frontend/bundle/
../../../indexer > .index-xhr
cd $final_path/assets/cores
../../indexer > .index-xhr

2
conf/retroarch.cron Normal file
View file

@ -0,0 +1,2 @@
#This script will update the core index every 5 minutes so that they are available in retroarch
*/5 * * * * root __FINAL_PATH__/indexer.sh > /dev/null 2>&1

View file

@ -8,7 +8,7 @@
},
"version": "1.9.1~ynh1",
"url": "http://www.retroarch.com/",
"license": "free",
"license": "GPL-3.0-or-later",
"maintainer": {
"name": "Krakinou",
"email": "misterl56@hotmail.com"
@ -25,19 +25,15 @@
{
"name": "domain",
"type": "domain",
"ask": {
"en": "Choose a domain name for RetroArch (RetroArch requires its own domain)",
"fr": "Choisissez un nom de domaine pour RetroArch (RetroArch nécessite son propre domaine)"
"help": {
"en": "RetroArch requires its own subdomain",
"fr": "RetroArch nécessite son propre sous-domaine"
},
"example": "retroarch.example.com"
},
{
"name": "is_public",
"type": "boolean",
"ask": {
"en": "Is it a public application?",
"fr": "Est-ce une application publique ?"
},
"default": true,
"help":{
"en":"Yes will allow everyone to access the app without login to yunohost instance first",

View file

@ -15,4 +15,4 @@
---
*If you have access to [App Continuous Integration for packagers](https://yunohost.org/#/packaging_apps_ci) you can provide a link to the package_check results like below, replacing '-NUM-' in this link by the PR number and USERNAME by your username on the ci-apps-dev. Or you provide a screenshot or a pastebin of the results*
[![Build Status](https://ci-apps-dev.yunohost.org/jenkins/job/REPLACEBYYOURAPP_ynh%20PR-NUM-%20(USERNAME)/badge/icon)](https://ci-apps-dev.yunohost.org/jenkins/job/REPLACEBYYOURAPP_ynh%20PR-NUM-%20(USERNAME)/)
[![Build Status](https://ci-apps-dev.yunohost.org/jenkins/job/retroarch_ynh%20PR-NUM-%20(USERNAME)/badge/icon)](https://ci-apps-dev.yunohost.org/jenkins/job/retroarch_ynh%20PR-NUM-%20(USERNAME)/)

View file

@ -18,3 +18,82 @@ pkg_dependencies="p7zip"
#=================================================
# FUTURE OFFICIAL HELPERS
#=================================================
# Install or update the main directory yunohost.multimedia
#
# usage: ynh_multimedia_build_main_dir
ynh_multimedia_build_main_dir () {
local ynh_media_release="v1.2"
local checksum="806a827ba1902d6911095602a9221181"
# Download yunohost.multimedia scripts
wget -nv https://github.com/Yunohost-Apps/yunohost.multimedia/archive/${ynh_media_release}.tar.gz 2>&1
# Check the control sum
echo "${checksum} ${ynh_media_release}.tar.gz" | md5sum -c --status \
|| ynh_die "Corrupt source"
# Check if the package acl is installed. Or install it.
ynh_package_is_installed 'acl' \
|| ynh_package_install acl
# Extract
mkdir yunohost.multimedia-master
tar -xf ${ynh_media_release}.tar.gz -C yunohost.multimedia-master --strip-components 1
./yunohost.multimedia-master/script/ynh_media_build.sh
}
# Add a directory in yunohost.multimedia
# This "directory" will be a symbolic link to a existing directory.
#
# usage: ynh_multimedia_addfolder "Source directory" "Destination directory"
#
# | arg: -s, --source_dir= - Source directory - The real directory which contains your medias.
# | arg: -d, --dest_dir= - Destination directory - The name and the place of the symbolic link, relative to "/home/yunohost.multimedia"
ynh_multimedia_addfolder () {
# Declare an array to define the options of this helper.
declare -Ar args_array=( [s]=source_dir= [d]=dest_dir= )
local source_dir
local dest_dir
# Manage arguments with getopts
ynh_handle_getopts_args "$@"
./yunohost.multimedia-master/script/ynh_media_addfolder.sh --source="$source_dir" --dest="$dest_dir"
}
# Move a directory in yunohost.multimedia, and replace by a symbolic link
#
# usage: ynh_multimedia_movefolder "Source directory" "Destination directory"
#
# | arg: -s, --source_dir= - Source directory - The real directory which contains your medias.
# It will be moved to "Destination directory"
# A symbolic link will replace it.
# | arg: -d, --dest_dir= - Destination directory - The new name and place of the directory, relative to "/home/yunohost.multimedia"
ynh_multimedia_movefolder () {
# Declare an array to define the options of this helper.
declare -Ar args_array=( [s]=source_dir= [d]=dest_dir= )
local source_dir
local dest_dir
# Manage arguments with getopts
ynh_handle_getopts_args "$@"
./yunohost.multimedia-master/script/ynh_media_addfolder.sh --inv --source="$source_dir" --dest="$dest_dir"
}
# Allow an user to have an write authorisation in multimedia directories
#
# usage: ynh_multimedia_addaccess user_name
#
# | arg: -u, --user_name= - The name of the user which gain this access.
ynh_multimedia_addaccess () {
# Declare an array to define the options of this helper.
declare -Ar args_array=( [u]=user_name=)
local user_name
# Manage arguments with getopts
ynh_handle_getopts_args "$@"
groupadd -f multimedia
usermod -a -G multimedia $user_name
}

View file

@ -6,7 +6,7 @@
# IMPORT GENERIC HELPERS
#=================================================
#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
@ -24,36 +24,42 @@ ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --time --weight=1
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)
#=================================================
# DECLARE DATA AND CONF FILES TO BACKUP
#=================================================
ynh_print_info --message="Declaring files to be backed up..."
#=================================================
# BACKUP THE APP MAIN DIR
#=================================================
ynh_script_progression --message="Backing up the main app directory..." --time --weight=1
ynh_backup --src_path="$final_path"
#=================================================
# BACKUP THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Backing up nginx web server configuration..." --time --weight=1
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# BACKUP A CRON FILE
# SPECIFIC BACKUP
#=================================================
# BACKUP VARIOUS FILES
#=================================================
#ynh_backup --src_path="/etc/cron.d/$app"
ynh_backup --src_path="/etc/cron.d/$app"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." --time --last
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."

View file

@ -25,11 +25,8 @@ ynh_abort_if_errors
#=================================================
domain=$YNH_APP_ARG_DOMAIN
#path_url=$YNH_APP_ARG_PATH
path_url="/"
#admin=$YNH_APP_ARG_ADMIN
is_public=$YNH_APP_ARG_IS_PUBLIC
#language=$YNH_APP_ARG_LANGUAGE
app=$YNH_APP_INSTANCE_NAME
#=================================================
@ -50,7 +47,6 @@ ynh_script_progression --message="Storing installation settings..." --weight=1
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=is_public --value=$is_public
#=================================================
# INSTALL DEPENDENCIES
@ -61,7 +57,6 @@ ynh_install_nodejs --nodejs_version=10
ynh_use_nodejs
ynh_npm install -g coffeescript
ynh_install_app_dependencies $pkg_dependencies
#=================================================
@ -76,17 +71,37 @@ ynh_setup_source --dest_dir="$final_path" --source_id=$app
#7z archive not handled by ynh and no way to strip component, have to move it manually
7zr x $final_path/retroarch.7z -o$final_path
mv $final_path/retroarch/* $final_path/
rm $final_path/retroarch.7z
rm -r $final_path/retroarch
ynh_secure_remove --file="$final_path/retroarch.7z"
ynh_secure_remove --file="$final_path/retroarch"
#create additionnal folders & file #https://github.com/libretro/RetroArch/tree/master/pkg/emscripten
mkdir -p $final_path/assets/frontend/bundle
mkdir -p $final_path/assets/cores
touch $final_path/analytics.js #https://github.com/libretro/RetroArch/issues/4539#issuecomment-473345195
#Get the indexer as exe so that folder w/ ROMs can be indexed
chmod +x $final_path/indexer
#=================================================
#SETTING MULTIMEDIA DIRECTORY
#=================================================
ynh_script_progression --message="Setting up Multimedia directory..." --weight=9
ynh_multimedia_build_main_dir
mkdir -p $final_path/assets/cores/Game
ynh_multimedia_addfolder --source_dir="$final_path/assets/cores/Game" --dest_dir="/share/Game"
ynh_add_config --template="../conf/README.GAME" --destination="$final_path/assets/cores/Game/README"
chmod 666 $final_path/assets/cores/Game/README
# SETUP CRON FILE FOR INDEXER
#setup indexer bash script
ynh_add_config --template="../conf/indexer.sh" --destination="$final_path/indexer.sh"
chown root: $final_path/indexer.sh
chmod 744 $final_path/indexer.sh
#setup cron file
cron_path="/etc/cron.d/$app"
ynh_add_config --template="../conf/retroarch.cron" --destination="$cron_path"
chown root: "$cron_path"
chmod 644 "$cron_path"
#=================================================
# NGINX CONFIGURATION
#=================================================
@ -111,18 +126,6 @@ ynh_add_nginx_config
# Set permissions to app files
chown -R root: $final_path
#=================================================
# SETUP INDEX
#=================================================
#indexer use the current directory to run #https://github.com/libretro/RetroArch/tree/master/pkg/emscripten
#Indexer will list the available ROM and cores for Retroarch
ynh_script_progression --message="Setup Indexer for content..." --weight=3
cd $final_path/assets/frontend/bundle/
../../../indexer > .index-xhr
cd $final_path/assets/cores
../../indexer > .index-xhr
#=================================================
# SETUP SSOWAT
#=================================================
@ -134,6 +137,19 @@ then
ynh_permission_update --permission "main" --add visitors
fi
#=================================================
# SETUP INDEX
#=================================================
#indexer use the current directory to run #https://github.com/libretro/RetroArch/tree/master/pkg/emscripten,
# so we have to cd in it to use it correctly => last step of the install so to not mess with other commands relative path
#Indexer will list the available ROM and cores for Retroarch
ynh_script_progression --message="Setup Indexer for content..." --weight=3
cd $final_path/assets/frontend/bundle/
../../../indexer > .index-xhr
cd $final_path/assets/cores
../../indexer > .index-xhr
#=================================================
# RELOAD NGINX
#=================================================
@ -142,7 +158,6 @@ ynh_script_progression --message="Reloading nginx web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================

View file

@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --time --weight=1
ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME
@ -22,7 +22,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_script_progression --message="Removing dependencies..." --time --weight=1
ynh_script_progression --message="Removing dependencies..." --weight=7
# Remove metapackage and its dependencies
#ynh_remove_app_dependencies
@ -31,12 +31,18 @@ ynh_script_progression --message="Removing dependencies..." --time --weight=1
ynh_use_nodejs
ynh_npm uninstall -g coffeescript
ynh_remove_nodejs
ynh_remove_app_dependencies
#=================================================
# REMOVE CRONJOB
#=================================================
ynh_secure_remove --file="/etc/cron.d/$app"
#=================================================
# REMOVE APP MAIN DIR
#=================================================
ynh_script_progression --message="Removing app main directory..." --time --weight=1
ynh_script_progression --message="Removing app main directory..." --weight=1
# Remove the app directory securely
ynh_secure_remove --file="$final_path"
@ -44,7 +50,7 @@ ynh_secure_remove --file="$final_path"
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Removing nginx web server configuration..." --time --weight=1
ynh_script_progression --message="Removing nginx web server configuration..." --weight=1
# Remove the dedicated nginx config
ynh_remove_nginx_config
@ -62,4 +68,4 @@ fi
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Removal of $app completed" --time --last
ynh_script_progression --message="Removal of $app completed" --last

View file

@ -25,19 +25,18 @@ ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading settings..." --time --weight=1
ynh_script_progression --message="Loading settings..." --weight=1
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)
is_public=$(ynh_app_setting_get --app=$app --key=is_public)
#=================================================
# CHECK IF THE APP CAN BE RESTORED
#=================================================
ynh_script_progression --message="Validating restoration parameters..." --time --weight=1
ynh_script_progression --message="Validating restoration parameters..." --weight=1
ynh_webpath_available --domain=$domain --path_url=$path_url \
|| ynh_die --message="Path not available: ${domain}${path_url}"
@ -60,21 +59,15 @@ if [ !$(grep wasm /etc/nginx/mime.types) ]; then
ynh_replace_string --match_string=" application/octet-stream bin exe dll;" --replace_string=" application/wasm wasm;\n\n application/octet-stream bin exe dll;" --target_file="/etc/nginx/mime.types"
ynh_store_file_checksum --file="/etc/nginx/mime.types"
fi
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
ynh_script_progression --message="Restoring the app main directory..." --time --weight=1
ynh_script_progression --message="Restoring the app main directory..." --weight=1
ynh_restore_file --origin_path="$final_path"
#=================================================
# RECREATE THE DEDICATED USER
#=================================================
ynh_script_progression --message="Recreating the dedicated system user..." --time --weight=1
# Create the dedicated user (if not existing)
ynh_system_user_create --username=$app
#=================================================
# RESTORE USER RIGHTS
#=================================================
@ -87,38 +80,41 @@ chown -R root: $final_path
#=================================================
# REINSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Reinstalling dependencies..." --time --weight=1
ynh_script_progression --message="Reinstalling dependencies..." --weight=5
# Define and install dependencies
#Dependencies are not really required as this is just to unzip the 7z file
#ynh_install_app_dependencies $pkg_dependencies
ynh_install_app_dependencies $pkg_dependencies
#However, npm IS required to run the coffeescript
#ynh_install_nodejs --nodejs_version=14
#ynh_use_nodejs
#ynh_npm install -g coffeescript
npm install -g coffeescript
ynh_install_nodejs --nodejs_version=10
ynh_use_nodejs
ynh_npm install -g coffeescript
#=================================================
#SETTING MULTIMEDIA DIRECTORY
#=================================================
ynh_script_progression --message="Setting up Multimedia directory..." --weight=5
ynh_multimedia_build_main_dir
mkdir -p $final_path/assets/cores/Game
ynh_multimedia_addfolder --source_dir="$final_path/assets/cores/Game" --dest_dir="/share/Game"
ynh_add_config --template="../conf/README.GAME" --destination="$final_path/assets/cores/Game/README"
chmod 666 $final_path/assets/cores/Game/README
#=================================================
# RESTORE THE CRON FILE
#=================================================
#ynh_restore_file --origin_path="/etc/cron.d/$app"
ynh_restore_file --origin_path="/etc/cron.d/$app"
# Make app public if necessary
if [ $is_public -eq 1 ]
then
# unprotected_uris allows SSO credentials to be passed anyway.
#ynh_app_setting_set $app unprotected_uris "/"
ynh_permission_update --permission "main" --add visitors
fi
#=================================================
# GENERIC FINALIZATION
#=================================================
# RELOAD NGINX AND PHP-FPM
#=================================================
ynh_script_progression --message="Reloading nginx web server..." --time --weight=1
ynh_script_progression --message="Reloading nginx web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload
@ -126,4 +122,4 @@ ynh_systemd_action --service_name=nginx --action=reload
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Restoration completed for $app" --time --last
ynh_script_progression --message="Restoration completed for $app" --last

View file

@ -12,13 +12,12 @@ source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --time --weight=1
ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path)
is_public=$(ynh_app_setting_get --app=$app --key=is_public)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#=================================================
@ -33,128 +32,100 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
### UPGRADE_APP should be used to upgrade the core app only if there's an upgrade to do.
upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --time --weight=1
# Fix is_public as a boolean value
if [ "$is_public" = "Yes" ]; then
ynh_app_setting_set --app=$app --key=is_public --value=1
is_public=1
elif [ "$is_public" = "No" ]; then
ynh_app_setting_set --app=$app --key=is_public --value=0
is_public=0
fi
# If final_path doesn't exist, create it
if [ -z "$final_path" ]; then
final_path=/var/www/$app
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
fi
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --time --weight=1
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=10
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
# restore it if the upgrade fails
# Restore it if the upgrade fails
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# CHECK THE PATH
#=================================================
# Normalize the URL path syntax
# N.B. : this is for app installations before YunoHost 2.7
# where this value might be something like /foo/ or foo/
# instead of /foo ....
# If nobody installed your app before 2.7, then you may
# safely remove this line
path_url=$(ynh_normalize_url_path --path_url=$path_url)
# STANDARD UPGRADE STEPS
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_script_progression --message="Upgrading source files..." --time --weight=1
ynh_script_progression --message="Upgrading source files..." --weight=5
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path" --source_id=$app
7zr e $final_path/retroarch.7z -o$final_path
rm $final_path/retroarch.7z
#7z archive not handled by ynh and no way to strip component, have to move it manually
7zr x $final_path/retroarch.7z -o$final_path
#mv not working as target directory is not empty
cp -R $final_path/retroarch/* $final_path/
ynh_secure_remove --file="$final_path/retroarch.7z"
ynh_secure_remove --file="$final_path/retroarch"
touch $final_path/analytics.js #https://github.com/libretro/RetroArch/issues/4539#issuecomment-473345195
#Get the indexer as exe so that folder w/ ROMs can be indexed
chmod +x $final_path/indexer
fi
# SETUP CRON FILE FOR INDEXER
#setup indexer bash script
ynh_add_config --template="../conf/indexer.sh" --destination="$final_path/indexer.sh"
chown root: $final_path/indexer.sh
chmod 744 $final_path/indexer.sh
#setup cron file
cron_path="/etc/cron.d/$app"
ynh_add_config --template="../conf/retroarch.cron" --destination="$cron_path"
chown root: "$cron_path"
chmod 644 "$cron_path"
#=================================================
#SETTING MULTIMEDIA DIRECTORY
#=================================================
ynh_script_progression --message="Setting up Multimedia directory..." --weight=4
ynh_multimedia_build_main_dir
mkdir -p $final_path/assets/cores/Game
ynh_multimedia_addfolder --source_dir="$final_path/assets/cores/Game" --dest_dir="/share/Game"
ynh_add_config --template="../conf/README.GAME" --destination="$final_path/assets/cores/Game/README"
chmod 666 $final_path/assets/cores/Game/README
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Upgrading nginx web server configuration..." --time --weight=1
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1
# Create a dedicated nginx config
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
ynh_script_progression --message="Upgrading dependencies..." --time --weight=1
ynh_script_progression --message="Upgrading dependencies..." --weight=20
# Define and install dependencies
#Dependencies are not really required as this is just to unzip the 7z file
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Making sure dedicated system user exists..." --time --weight=1
# Create a dedicated user (if not existing)
ynh_system_user_create --username=$app
#However, npm IS required to run the coffeescript
ynh_install_nodejs --nodejs_version=10
ynh_use_nodejs
ynh_npm install -g coffeescript
#=================================================
# SPECIFIC UPGRADE
#=================================================
# ...
#=================================================
#=================================================
# STORE THE CONFIG FILE CHECKSUM
#=================================================
### Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script.
### And create a backup of this file if the checksum is different. So the file will be backed up if the admin had modified it.
#ynh_backup_if_checksum_is_different --file="$final_path/CONFIG_FILE"
# Recalculate and store the checksum of the file for the next upgrade.
#ynh_store_file_checksum --file="$final_path/CONFIG_FILE"
#=================================================
# SECURE FILES AND DIRECTORIES
#=================================================
# Set permissions on app files
#=================================================
#
chown -R root: $final_path
#=================================================
# SETUP SSOWAT
#=================================================
ynh_script_progression --message="Upgrading SSOwat configuration..." --time --weight=1
# Make app public if necessary
if [ $is_public -eq 1 ]
then
# unprotected_uris allows SSO credentials to be passed anyway
ynh_app_setting_set --app=$app --key=unprotected_uris --value="/"
fi
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading nginx web server..." --time --weight=1
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload
@ -162,4 +133,4 @@ ynh_systemd_action --service_name=nginx --action=reload
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Upgrade of $app completed" --time --last
ynh_script_progression --message="Upgrade of $app completed" --last