mirror of
https://github.com/YunoHost-Apps/retroarch_ynh.git
synced 2024-09-03 20:16:12 +02:00
Add Multimedia dir
This commit is contained in:
parent
d9740e8eb7
commit
4dcc10a89c
8 changed files with 160 additions and 34 deletions
|
@ -19,7 +19,7 @@ These programs are instantiated as dynamic libraries. We refer to these as "libr
|
||||||
* no user management
|
* no user management
|
||||||
* some core are listed but not implemented : they do not work, the issue is from the upstream app.
|
* some core are listed but not implemented : they do not work, the issue is from the upstream app.
|
||||||
* 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
|
* 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 10 minutes to index all games in `opt/yunohost/retroarch/assets/cores`
|
* 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`
|
||||||
|
|
||||||
**Shipped version:** 1.9.1
|
**Shipped version:** 1.9.1
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ Ces programmes sont instanciés comme bibliothèques dynamiques, appelées "libr
|
||||||
* Pas de gestion d'utilisateurs
|
* 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.
|
* 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.
|
||||||
* 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 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 10 minutes pour indexer tous les jeux dans `opt/yunohost/retroarch/assets/cores`
|
* 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`
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
21
conf/indexer.sh
Normal file
21
conf/indexer.sh
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# GENERIC START
|
||||||
|
#=================================================
|
||||||
|
# IMPORT GENERIC HELPERS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
source /usr/share/yunohost/helpers
|
||||||
|
source _common.sh
|
||||||
|
|
||||||
|
app=__APP__
|
||||||
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
|
|
||||||
|
|
||||||
|
ynh_use_nodejs
|
||||||
|
cd $final_path/assets/frontend/bundle/
|
||||||
|
../../../indexer > .index-xhr
|
||||||
|
cd $final_path/assets/cores
|
||||||
|
../../indexer > .index-xhr
|
||||||
|
|
1
conf/retroarch.cron
Normal file
1
conf/retroarch.cron
Normal file
|
@ -0,0 +1 @@
|
||||||
|
*/5 * * * * root __FINAL_PATH__/indexer.sh > /dev/null 2>&1
|
|
@ -18,3 +18,82 @@ pkg_dependencies="p7zip"
|
||||||
#=================================================
|
#=================================================
|
||||||
# FUTURE OFFICIAL HELPERS
|
# 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
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,6 @@ ynh_install_nodejs --nodejs_version=10
|
||||||
ynh_use_nodejs
|
ynh_use_nodejs
|
||||||
ynh_npm install -g coffeescript
|
ynh_npm install -g coffeescript
|
||||||
|
|
||||||
|
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
ynh_install_app_dependencies $pkg_dependencies
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -80,13 +79,33 @@ rm $final_path/retroarch.7z
|
||||||
rm -r $final_path/retroarch
|
rm -r $final_path/retroarch
|
||||||
|
|
||||||
#create additionnal folders & file #https://github.com/libretro/RetroArch/tree/master/pkg/emscripten
|
#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/frontend/bundle
|
||||||
mkdir -p $final_path/assets/cores
|
#mkdir -p $final_path/assets/cores
|
||||||
touch $final_path/analytics.js #https://github.com/libretro/RetroArch/issues/4539#issuecomment-473345195
|
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
|
#Get the indexer as exe so that folder w/ ROMs can be indexed
|
||||||
chmod +x $final_path/indexer
|
chmod +x $final_path/indexer
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
#SETTING MULTIMEDIA DIRECTORY
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Setting up Multimedia directory..." --weight=9
|
||||||
|
|
||||||
|
ynh_multimedia_build_main_dir
|
||||||
|
ynh_multimedia_addfolder --source_dir="$final_path/assets/cores" --dest_dir="/share/Game"
|
||||||
|
|
||||||
|
# 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
|
# NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -111,18 +130,6 @@ ynh_add_nginx_config
|
||||||
# Set permissions to app files
|
# Set permissions to app files
|
||||||
chown -R root: $final_path
|
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
|
# SETUP SSOWAT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -134,6 +141,19 @@ then
|
||||||
ynh_permission_update --permission "main" --add visitors
|
ynh_permission_update --permission "main" --add visitors
|
||||||
fi
|
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
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -142,7 +162,6 @@ ynh_script_progression --message="Reloading nginx web server..." --weight=1
|
||||||
ynh_systemd_action --service_name=nginx --action=reload
|
ynh_systemd_action --service_name=nginx --action=reload
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -67,14 +67,6 @@ ynh_script_progression --message="Restoring the app main directory..." --time --
|
||||||
|
|
||||||
ynh_restore_file --origin_path="$final_path"
|
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
|
# RESTORE USER RIGHTS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -97,7 +89,18 @@ ynh_script_progression --message="Reinstalling dependencies..." --time --weight=
|
||||||
#ynh_install_nodejs --nodejs_version=14
|
#ynh_install_nodejs --nodejs_version=14
|
||||||
#ynh_use_nodejs
|
#ynh_use_nodejs
|
||||||
#ynh_npm install -g coffeescript
|
#ynh_npm install -g coffeescript
|
||||||
npm install -g coffeescript
|
ynh_use_nodejs
|
||||||
|
ynh_npm install -g coffeescript
|
||||||
|
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
#SETTING MULTIMEDIA DIRECTORY
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Setting up Multimedia directory..." --weight=9
|
||||||
|
|
||||||
|
ynh_multimedia_build_main_dir
|
||||||
|
ynh_multimedia_addfolder --source_dir="$final_path/assets/cores" --dest_dir="/Game"
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE CRON FILE
|
# RESTORE THE CRON FILE
|
||||||
|
|
|
@ -108,13 +108,6 @@ ynh_script_progression --message="Upgrading dependencies..." --time --weight=1
|
||||||
|
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
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
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC UPGRADE
|
# SPECIFIC UPGRADE
|
||||||
|
@ -122,6 +115,16 @@ ynh_system_user_create --username=$app
|
||||||
# ...
|
# ...
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
#SETTING MULTIMEDIA DIRECTORY
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Setting up Multimedia directory..." --weight=9
|
||||||
|
|
||||||
|
ynh_multimedia_build_main_dir
|
||||||
|
ynh_multimedia_addfolder --source_dir="$final_path/assets/cores" --dest_dir="/Game"
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STORE THE CONFIG FILE CHECKSUM
|
# STORE THE CONFIG FILE CHECKSUM
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
Loading…
Reference in a new issue