packages - allow adding of 3rd party module repos

3rd party repositories can be checked out to RetroPie-Setup/ext

Repositories should be structured so you have:

ext/REPOSITORY/scriptmodules

Modules are only read from the following subfolders of scriptmodules
 * emulators
 * libretrocores
 * ports
 * supplementary
 * admin
This commit is contained in:
Jools Wills 2021-01-26 01:04:34 +00:00
parent c4527d433b
commit 48080d2d13
2 changed files with 26 additions and 6 deletions

13
ext/README.txt Normal file
View file

@ -0,0 +1,13 @@
You can checkout additional repositories here to add 3rd party modules.
Repositories should be structured so you have:
ext/REPOSITORY_NAME/scriptmodules
Modules are only read from the following subfolders of scriptmodules:
* emulators
* libretrocores
* ports
* supplementary
* admin

View file

@ -526,6 +526,8 @@ function rp_getPackageInfo() {
function rp_registerModule() {
local path="$1"
local type="$2"
# type is the last folder in the path as we now send a full path to rp_registerModule
type="${type##*/}"
local rp_module_id=""
local rp_module_desc=""
local rp_module_help=""
@ -599,10 +601,13 @@ function rp_registerModule() {
function rp_registerModuleDir() {
local dir="$1"
[[ ! -d "$dir" ]] && return 1
local module
while read module; do
rp_registerModule "$module" "$dir"
done < <(find "$scriptdir/scriptmodules/$dir" -maxdepth 1 -name "*.sh" | sort)
done < <(find "$dir" -mindepth 1 -maxdepth 1 -type f -name "*.sh" | sort)
return 0
}
function rp_registerAllModules() {
@ -610,11 +615,13 @@ function rp_registerAllModules() {
declare -Ag __mod_idx=()
declare -Ag __mod_info=()
rp_registerModuleDir "emulators"
rp_registerModuleDir "libretrocores"
rp_registerModuleDir "ports"
rp_registerModuleDir "supplementary"
rp_registerModuleDir "admin"
local dir
local type
while read dir; do
for type in emulators libretrocores ports supplementary admin; do
rp_registerModuleDir "$dir/$type"
done
done < <(find "$scriptdir"/scriptmodules "$scriptdir"/ext/*/scriptmodules -maxdepth 0 2>/dev/null)
}
function rp_getSectionIds() {