RetroDECK/retrodeck.sh

106 lines
2.7 KiB
Bash
Raw Normal View History

2022-03-27 13:30:22 +00:00
#!/bin/bash
source /app/libexec/global.sh
2022-11-18 20:10:17 +00:00
source /app/libexec/post_update.sh
# Arguments section
for i in "$@"; do
case $i in
-h*|--help*)
2022-09-06 12:46:59 +00:00
echo "RetroDECK v""$version"
echo "
Usage:
flatpak run [FLATPAK-RUN-OPTION] net.retrodeck-retrodeck [ARGUMENTS]
Arguments:
-h, --help Print this help
-v, --version Print RetroDECK version
2022-08-04 19:40:04 +00:00
--info-msg Print paths and config informations
--configure Starts the RetroDECK Configurator
--compress <file> Compresses target file to .chd format. Supports .cue, .iso and .gdi formats.
2022-11-18 20:10:17 +00:00
--reset-all Starts the initial RetroDECK installer (backup your data first!)
--reset-ra Resets RetroArch's config to the default values
--reset-sa Reset all standalone emulator configs to the default values
--reset-tools Recreate the tools section
For flatpak run specific options please run: flatpak run -h
https://retrodeck.net
"
exit
;;
--version*|-v*)
2022-09-06 12:46:59 +00:00
#conf_init
2022-08-04 19:40:04 +00:00
echo "RetroDECK v$version"
exit
;;
--info-msg*)
2022-09-06 12:46:59 +00:00
#conf_init
2022-08-04 19:40:04 +00:00
echo "RetroDECK v$version"
echo "RetroDECK config file is in: $rd_conf"
echo "Contents:"
cat $rd_conf
exit
;;
--compress*)
if [[ ! -z $2 ]]; then
if [[ -f $2 ]]; then
validate_for_chd $2
else
echo "File not found, please specify the full path to the file to be compressed."
fi
else
echo "Please use this command format \"--compress <full path to cue/gdi/iso file>\""
fi
shift
;;
--configure*)
sh /var/config/retrodeck/tools/configurator.sh
shift
;;
--reset-ra*)
ra_init
shift # past argument with no value
;;
--reset-sa*)
standalones_init
shift # past argument with no value
;;
--reset-tools*)
tools_init
shift # past argument with no value
;;
2022-11-18 20:10:17 +00:00
--reset-all*)
rm -f "$lockfile"
shift # past argument with no value
;;
-*|--*)
echo "Unknown option $i"
exit 1
;;
*)
;;
esac
done
# UPDATE TRIGGERED
2022-09-06 12:46:59 +00:00
# if lockfile exists
if [ -f "$lockfile" ]
then
2022-09-06 12:46:59 +00:00
# ...but the version doesn't match with the config file
2022-10-13 12:21:30 +00:00
if [ "$hard_version" != "$version" ];
2022-09-06 12:46:59 +00:00
then
echo "Config file's version is $version but the actual version is $hard_version"
post_update # Executing post update script
2022-09-06 12:46:59 +00:00
fi
# Else, LOCKFILE IS NOT EXISTING (WAS REMOVED)
# if the lock file doesn't exist at all means that it's a fresh install or a triggered reset
2022-10-13 12:21:30 +00:00
else
echo "Lockfile not found"
finit # Executing First/Force init
2022-04-02 09:21:05 +00:00
fi
# Normal Startup
2022-10-03 18:48:07 +00:00
start_retrodeck