Commit graph

392 commits

Author SHA1 Message Date
Jools Wills
82bbd5b0ec
Merge pull request #3967 from s1eve-mcdichae1/genesis-standalone
fn mkRomDir - create symlink only if 'genesis' not already exist
2024-09-03 20:44:24 +01:00
s1eve-mcdichae1
72a598992e fn mkRomDir - create symlink only if 'genesis' not already exist
allows stand-alone genesis system and romdir by user config
2024-08-19 10:33:48 -07:00
G Derber
f7761fd635
Add ability to differentiate group ownership from user ownership. 2024-08-06 09:38:25 -04:00
Jools Wills
2e6fc4c7d9
Revert "helpers: map 'xorg' for Pi5 and for 'legacy' exclusion" 2024-03-07 16:54:11 +00:00
cmitu
c0790a90c5 helpers: map 'xorg' for Pi5 and for 'legacy' exclusion
The 'xorg' (meta)-package will install the necessary packages to run an Xorg server and to launch applications under an Xorg environment.
We need to map 'xorg' for:

 - Pi5 needs an additional package that provides configuration for Xorg, without it the server will not start. Unfortunately the package has no reverse dependency (for now), so it must be installed explicitely.
 - One of the recommended packages installed is the 'xserver-xorg-legacy' package, which breaks our x11 apps launched from `runcommand`. We already uninstall it when the setup script starts (regardless of how it was installed), but let's not install it ourselves when 'xorg' is a dependency for one of our own scriptmodules.
   NOTE: `runcommand` breakage under `-legacy` is due to our redirection of STDIN/STDOUT. The `-legacy` provided wrapper checks whether the current controlling tty is a 'real console' tty by looking at the major/minor device numbers and bails out if it's not 4/1.
2024-01-16 05:48:57 +00:00
cmitu
6b4c980892 systems: add support for Armbian
Added support for detecting if running on a Armbian built system.
Armbian is built on Debian/Ubuntu, so we're not changing the OS release/name.

* Added support for Armbian's Linux kernel package naming, in order to be able to install the kernel headers.
* Removed the ZRAM config from our own menu, Since Armbian has its own configuration tool (`armbian-config`) that handles it. ZRAM is configured and enabled y default on Armbian images.
2023-10-17 18:37:55 +01:00
cmitu
3807ed42e3 helpers: add support for the Bookworm Linux header packages
Starting with the Bookworm RaspiOS release, the Linux kernel package is no longer a monolithic package and it has been split in several packages, named after their build configuration, which in turn is dictated by the Pi model and architecture (`armhf`/`aarch64`).

This change adds support for the Linux kernel headers packages on the new OS release, which followed a similar split from the previously used `raspberrypi-kernel-headers` package.

NOTES:
 * mixed kernel/userland archs are not supported. By default, an `armhf` RaspiOS installation will boot the Pi4/Pi5 with the 64bit kernel, but the corresponding headers package is not installable. While the Pi4 can still boot a 32bit kernel by adding `arm_64bit=0` to `/boot{/firmware}/config.txt`, the Pi5 does not have this capability.
 * on the RaspiOS Bookworm images the Linux kernel images/headers are already installed, the mapping and installation will have effect if the user explicitely removes the header packages.
2023-10-15 16:25:58 +01:00
cmitu
285e6894ab helpers: handle deprecation of 'libfreetype6-dev'
The `libfreetype6-dev` package has been replaced with `libfreetype-dev` since Debian 11 _bullseye_ [1].
It's not present in the current Debian testing (_trixie_) and Ubuntu 23.10 [2]

Added a mapping for the package, since it will help installing RetroPie on Ubuntu 23.10.
When we stop supporting _buster_, we can remove the mapping and replace any `libfreetype6-dev` dependencies in the scriptmodules with the new package.

[1] https://packages.debian.org/bullseye/libfreetype6-dev - marked as 'transitional'
[2] https://packages.ubuntu.com/search?keywords=libfreetype6-dev - removed from Ubuntu 23.10
2023-10-14 04:18:34 +01:00
Jools Wills
e734c19c1c helpers / hasPackage - fix package detection on a multiarch system
On a multiarch system both amd64 and i386 versions of a package may be installed.

This would cause both to be returned by dpkg-query on a single line causing the extracting of version and install status to fail.

It now splits the output onto multiple lines and grabs the first line to workaround this.

Fixes #3679
2023-03-12 17:14:17 +00:00
cmitu
7ca41aa29f helpers: updates to the 'inputBox' function
Added more info about the usage and mentioned the return value to differentiate between ok/cancel buttons.
Modified the prompt text for the `dialog` based inputbox so it's similar to how the OSK script shows it.
2023-02-25 18:24:06 +00:00
Jools Wills
e1935ab5da helpers - added inputBox function that uses the OSK
If the OSK is installed it will be used for input, otherwise it will fall back to using dialog --inputbox

function takes 3 parameters:

The title of the dialog, the default text and a minimum number of characters to accept.

Adjusted wifi module to use the new inputBox. There is no need to redirect cmd output with 2>&1 >/dev/tty as the inputBox function does this.
2023-02-24 21:47:22 +00:00
Jools Wills
61c46aa005 Use bash operators instead of compareVersions for __os_debian_ver
There was a mix of compareVersions "$__os_debian_ver" OP $arg and [[ "$__os_debian_ver OP $arg ]] around the code.

As $__os_debian_ver is always an integer, use the bash built in operators for performance.

The compareVersions call is significantly slower as it uses an external command (dpkg).
2022-12-03 16:02:39 +00:00
Jools Wills
b0759ff2d2 helpers - fix sdl1 dependency installing on non RPi platforms.
In the past unsupported scriptmodules for a platform were not loaded, so rp_hasModule would only return true if the module was available for the platform.

As we now load all modules for displaying of information in retropie_setup / retropie_packages output, rp_hasModule function will return true, so we need to use rp_isEnabled instead.

This fixes installing scriptmodules with an sdl1.2-dev dependency on non RPi (eg x86/x11), that previously forced our custom sdl1 and then failed as it's disabled for the target.
2022-05-25 05:30:10 +01:00
Jools Wills
b5f3816f5d helpers - added defaultRAConfig to replace ensureSystemretroconfig
Removed deprecated and unused shader parameter support from ensureSystemretroconfig.

defaultRAConfig takes a single parameter for the system name, but also allows additional
parameter pairs to be added to set default ini configuration key/values

eg. defaultRAConfig "dreamcast" "fps_show" "true"

It also uses $md_conf_root as a base, which ensureSystemretroconfig didn't handle, so we save and reset
this for backward compatibility for anything still using ensureSystemretroconfig
2022-05-22 13:09:12 +01:00
Jools Wills
cde7334b4d helpers / gitPullOrClone - support shallow cloning of submodules
When doing a shallow clone, also add --shallow-submodules which will do a shallow clone of submodules
with depth 1.

This significantly speeds up checkouts of repositories with a lot of submodules (eg lr-tic80).
2021-12-05 17:08:51 +00:00
Jools Wills
1f56852835 helpers / gitPullOrClone - fixup / improve persistent repos support
When env __persistent_repos is 1, we do full checkouts of repositories. This allows users with diskspace to spare
to speed up source updates, by avoiding doing a shallow clone everytime.

However, it was not working for cases where a module switched to a newer tag/branch as remote changes were not
fetched first. This is now fixed.

Also fixed errors thrown when calling gitPullOrClone on an existing repository when doing git pull, when HEAD
is detached (for tags) or there is no tracking branch.
2021-12-05 17:08:51 +00:00
cmitu
066f02b585 helpers: teach aptUpdate to hop releases
When the release of the remote repository is changed, `apt-get` will not update its packages without
`--allow-releaseinfo-change`, so fix that.
2021-08-23 05:51:30 +01:00
Jools Wills
50ed2e781e joy2key - split out into standalone module and rework helper code
Move much of the helpers.sh start/stop logic and default parameters to a joy2key wrapper script.

Switch runcommand.sh to use new wrapper script

Add tab button to "y" key for use in edit dialogs

Remove runcommand $md_inst on update. If old joy2key is present in runcommand install, trigger joy2key module install.

Remove system.sh python3-sdl2 dependency check - moved to joy2key_depends
2021-08-04 00:03:32 +01:00
Jools Wills
3da3ca7548
Merge pull request #3368 from joolswills/atari800_backends
Atari800 backends
2021-07-21 02:22:25 +01:00
Jools Wills
86a1acc5ff
Merge pull request #3356 from cmitu/joy2key-rework
joy2key: new version using PySDL2
2021-06-28 04:48:18 +01:00
cmitu
fab62e2aa3 joy2key: new version using PySDL2
Added a new `joy2key` implementation, using PySDL2 for joystick event handling.
PySDL2 is a python module that wraps SDL2 (and other SDL libraries) using the built-in `ctypes` module.

Pros:
 * event handling is simplified a bit, using SDL's event loop.
 * (subjective) the code is a bit more structured and easy to follow.
 * joystick handling is rewritten based on EmulationStation code, movement is smoother and scrolling is improved.
 * support for input repeat to improve scrolling, just keep the input pressed and scrolling continues

Cons:
 * module is a bit larger (296 LOC vs 224 in current joy2key.py)
 * needs PySDL2 (which might not be packaged, see the notes below) and SDL2
 * arguably, device config to keyboard event mapping is more complex (abstracted as InputDev)

Notes:
 * availability of PySDL2 as a system package is good, but it's not standard in Debian 10 (stable) at the moment.
   The module is present though (as a backport) in Ubuntu 18.04 (and later) and Raspberry Pi OS (Buster).
   When it will be universally available, we should probably revisit the code that checks for the version and make it a hard requirement in `get_retropie_depends`, similar to `python3-pyudev`.

 * added PgUp/PgDown to the default parameters for `joy2key`, they are mapped in a similar fashion to EmulationStation to the shoulder buttons. This doesn't apply to Runcommand's invocation, since it uses a different set of parameters.

 * added a configuration option in `runcommand` for selecting the joy2key version used. Default is the SDL version (when PySDL2 is installed), with the ability to fallback to the previous version (udev based).
2021-06-28 04:14:41 +01:00
Jools Wills
7c97ba81bb helpers / backends - added getBackend function
This replaces the function __get_current_backends from backends.sh and makes it available to other modules.

Reworded the setBackend function description using emulator.cfg key instead of module_id as some modules
have multiple emulator entries, and the backend config is managed per entry.
2021-06-28 03:30:24 +01:00
Jools Wills
76d450b092 helpers / ensureSystemretroconfig - skip function if called on module removal 2021-06-16 04:49:44 +01:00
Jools Wills
e57df9e30b helpers / download - added --no-buffer when dest is stdout to avoid errors when piping
Curl can throw an error "(23) Failed writing body" if piping the output to grep, or something that closes the stream
early due to the way curl buffers. Adding --no-buffer when output is stdout (dest of "-") fixes this. This error
didn't cause any failures but _get_branch_mame could cause this error to be logged.

Also switched "-s" to "--silent". We have a lot of curl arguments and it's more intuitive to use the descriptive
names.
2021-06-10 06:41:38 +01:00
Aaron Pfeifer
4faa335ead Fix __curl_opts environment variable being ignored when present 2021-06-03 21:19:21 -04:00
Jools Wills
1e23d581ba helpers / download - added --fail parameter for curl so we don't return 0 on 404s etc 2021-05-11 02:15:58 +01:00
Jools Wills
dd024cc697 Allow configuration of backends for sdl1/sdl2 modules
This replaces the dispmanx module functionality and reworks the way backend configuration is done,
including adding support for choosing to use X11 for modules using sdl1 or sdl2. A new supplementary
module "backends" handles the configuration (replacing the dispmanx module).

On upgrade /opt/retropie/configs/all/dispmanx.cfg is renamed to /opt/retropie/configs/all/backends.cfg

Existing settings in this file will still work, but will be updated when using the backends configuration.

Previously for some modules that use sdl1, a flag "dispmanx" was set to specify that the code worked
with the sdl1 dispmanx driver on videocore/fkms on the RPI.

This has been replaced with the flags "sdl1" "sdl2" and "sdl1-videocore"

The backend module will use the flags to determine which driver backends are available for current system.
For modules such as advmame which use sdl1 on videocore and sdl2 on other systems, the sdl1-videocore flag
can be used which will only apply to the rpi1-3 using the legacy drivers.

The setDispmanx call to default a module to the dispmanx driver has been replaced with setBackend,
but the setDispmanx function is left for 3rd party module compatibility.

Calls to setDispmanx should be replaced with a call such as:

  setBackend "$md_id" "dispmanx"

But support for dispmanx should be checked in the module - eg

  hasPlatform "dispmanx" && setBackend "$md_id" "dispmanx"

Module hooks for configure_dispmanx_on / conigure_dispmanx_off are no longer used (only used by fuse).
Instead a function _backend_set_ID is called, with the backend to use, and a force parameter.

By default no existing backend configuration is changed when calling setBackend, unless an additional
parameter of 1 is added. This is so a module won't overwrite a user's existing configuration.

If a module is set to launch under dispmanx, runcommand will handle it as before, but will also
now handle launching sdl1 and sdl2 modules under X. It will also run the matchbox-window-manager
which is required by some software.

If switching a module to launch under X it will check for the correct dependencies. If not installed
the user will be asked to confirm installation.
2021-04-19 03:30:09 +01:00
Jools Wills
0212b0249c helpers - fix doxygen error(s) caused by missing () in runCurl 2021-03-11 18:50:57 +00:00
Jools Wills
43e9d5532f Rework the checks and error messages displayed on network error
Create a new function isConnected in helpers.sh which calls getIPAddress, but also sets a new global
__NET_ERRMSG if not connected. This is used in setup.sh and packages.sh so we don't duplicate the same
message between files.

Split out a new function runCurl from the download function, to do lower level curl calls, but capture any
errors into __NET_ERRMSG for display in setup.sh or via the packaging functions. Use a connect timeout of 10
in the download function rather than 60 which is quite long, but keep the 60 second limit on no data transfer.

Adjust rp_remoteFileExists to use runCurl, so we can capture any error when checking a remote file,
and use this value for display in setup and in logs etc. Switch to using long versions of curl options for
readability, and add --show-error so we still output errors when being silent.

Also switch rp_getFileDate to use new runCurl function, so that any curl argument overrides are handled, and use
long format parameters also. No error handling is done here though.
2021-03-02 05:52:34 +00:00
Jools Wills
d31164668a helpers / setup - add --ff-only for git pull to avoid warnings on recent versions of git 2021-02-16 00:31:03 +00:00
Jools Wills
25573f57d9 packages / helpers - record git checkout dir in gitPullOrClone for use in rp_setPackageInfo 2021-02-15 23:54:13 +00:00
Jools Wills
272777bb36 packages / helpers - allow rp_module_repo to have function hooks as parameters
rp_module_repo is currently in the format

TYPE URL BRANCH COMMIT

where type is file, git or svn

If rp_module_repo URL BRANCH or COMMIT starts with a : the rest is considered to be a function that
will return the URL, BRANCH, or COMMIT via an echo. This allows for using of the new rp_module_repo
by modules that use some logic to determine what branch / commit is used.

eg. Some modules will use an older branch based on the system they are running on.

These variables are resolved before use, as some modules query the net for information, so we only
want to check these just before they are used.
2021-02-15 23:54:13 +00:00
Jools Wills
2b1895f5db helpers - allow gitPullOrClone to be used without parameters if md_module_repo is set 2021-02-15 23:54:13 +00:00
Jools Wills
e95fa96632 helpers - remove unneeded helper_libs array and add missing local helper var 2021-02-02 04:15:37 +00:00
Jools Wills
c71ddc7288 helpers - only try and rm $dest on download failure if not using stdout and file exists 2021-01-26 03:15:29 +00:00
Jools Wills
b9fca20882 helpers - rework the curl stdout/stderr output + stderr capturing
curl outputs the download progress to stderr, and there doesn't seem a way to output progress
to stdout and errors to stderr.

this means we capture the progress also, but on error, extract the last line of output for error display
2021-01-21 06:20:05 +00:00
Jools Wills
bd16e36281 helpers - set curl connection timeout defaults
Use a connect timeout of 60, with a speed limit of 1, and speed time of 60, so curl will abort if no data
is transferred for 60 seconds.

__curl_args can be set to override curl options - these are added after the defaults, which will override
them if provided.
2021-01-21 05:20:29 +00:00
Jools Wills
6ce3e82fb3 helpers - add --location parameter to curl in download function, to follow 301 redirects 2021-01-21 05:20:28 +00:00
Jools Wills
fe91c69508 helpers - detect if destination for download function is a folder
adjust download and downloadAndVerify functions to use bash builtin to extract basename of url,
and test if destination is a folder. If it's a folder download to basename of url to that folder
2021-01-21 05:20:28 +00:00
Jools Wills
22c103eaa5 helpers - add support for to download function to output to stdout using -
A destination parameter of - will now output to stdout, for use in modules where they call wget directly.
We can now replace them with a download call, and also catch/log errors, but it also de-duplicates having
each function handle wget/curl itself. It can also be used to capture output into a variable etc.
2021-01-21 05:20:28 +00:00
Jools Wills
123470f33d helpers - rewrite downloadAndExtract to use download function 2021-01-21 05:18:32 +00:00
Jools Wills
8e60e50665 helpers - switch download function to use curl 2021-01-21 05:18:32 +00:00
Jools Wills
bb5beb27dc
Merge pull request #3292 from cmitu/dkms-update-1
helpers: improve DKMS module installation
2021-01-21 02:36:45 +00:00
freddii
4ac341ac9f
fixed some incorrectly spelt words (#3293) 2021-01-21 02:32:29 +00:00
cmitu
756d31ba0c helpers: improve DKMS module installation
Modified the `dkmsManager` function to account for cases when the running
kernel is replaced before the module installation, so `dkms` cannot build the module.
If the module cannot be built for the running kernel version, then instruct `dkms` to build
for the installed kernels that have a valid `build` folder/symlink present.

Installations performed under a 'chroot' are also handled with the new additions,
so there is no need for separate handling.

This covers situations when the user does an upgrade of the distro's packages and
RetroPie's drivers at the same time. Raspberry Pi OS replaces the current kernel
and the kernel headers for the running version are no longer found, so the driver(s) installed
are not updated from their scriptmodule by `dkmsManager`.

As a side note, Raspberry Pi OS has 4 kernels shipped with the same package:
 - kernel.img ($ver+) for Pi 0/1
 - kernel7.img ($ver-v7+) for Pi 2/3
 - kernel7l.img ($ver-v7l+) for Pi4
 - kernel8.img ($ver-v8+) for Pi4 with the `aarch64` architecture (enabled by `arm_64bit` option in `configtxt`)
For each kernel, there's a corresponding folder under `/lib/modules`. Explained in [1].

The 'chroot' installation didn't install the module for all the versions on the RPI image, it chose
the last sub-folder (which would be the `$ver-v8+`, for `aarch64`), so the latest images don't have the `xpad` driver installed correctly.

Ref:
 [1] the `kernel` option from https://www.raspberrypi.org/documentation/configuration/config-txt/boot.md
2021-01-19 04:45:58 +00:00
Jools Wills
994bb42e55 helpers - fix custom sdl2 installing when no ini value set
* 6fa33497 broke defaulting to custom sdl2 as [[ "" -eq 0 ]] evaluates as true - use string matching as previously.
2021-01-11 05:54:34 +00:00
Jools Wills
6fa3349731 helpers - fix own_sdl2 ini config logic - fixes #3279
* switched to use -eq so it will be less strict with for example whitespace in value
 * do a test for -eq 0 rather than just else, to avoid defaulting to 0 in the case of a bad config
2021-01-07 04:57:48 +00:00
Jools Wills
d380574e45 helpers / packages - split off signing a file to function signFile for use by modules 2020-09-10 06:49:17 +01:00
Jools Wills
e7ecb41e86 helpers - allow omitting dest file for download / downloadAndVerify functions (will use current folder) 2020-09-10 06:35:45 +01:00
Jools Wills
7842e33871 helpers / packages - split out download / sig check functionality to downloadAndVerify 2020-09-10 06:25:51 +01:00