mirror of
https://github.com/RetroDECK/RetroDECK.git
synced 2024-11-22 05:55:38 +00:00
Merge branch 'cooker-0.8.0b' of https://github.com/XargonWan/RetroDECK into cooker-0.8.0b
This commit is contained in:
commit
4c8d9f00fd
|
@ -17,6 +17,7 @@ source /app/libexec/presets.sh
|
|||
# Static variables
|
||||
rd_conf="/var/config/retrodeck/retrodeck.cfg" # RetroDECK config file path
|
||||
rd_conf_backup="/var/config/retrodeck/retrodeck.bak" # Backup of RetroDECK config file from update
|
||||
rd_logs_folder="/var/config/retrodeck/logs" # Static location to write all RetroDECK-related logs
|
||||
emuconfigs="/app/retrodeck/emu-configs" # folder with all the default emulator configs
|
||||
rd_defaults="$emuconfigs/defaults/retrodeck/retrodeck.cfg" # A default RetroDECK config file
|
||||
rd_update_patch="/var/config/retrodeck/rd_update.patch" # A static location for the temporary patch file used during retrodeck.cfg updates
|
||||
|
@ -65,6 +66,7 @@ citraconf="/var/config/citra-emu/qt-config.ini"
|
|||
|
||||
export ESDE_APPDATA_DIR="/var/config/ES-DE"
|
||||
es_settings="/var/config/ES-DE/settings/es_settings.xml"
|
||||
es_source_logs="/var/config/ES-DE/logs"
|
||||
|
||||
# RetroArch config files
|
||||
|
||||
|
@ -121,6 +123,14 @@ mameconf="/var/config/mame/ini/mame.ini"
|
|||
mameuiconf="/var/config/mame/ini/ui.ini"
|
||||
mamedefconf="/var/config/mame/cfg/default.cfg"
|
||||
|
||||
# Initialize logging location if it doesn't exist, before anything else happens
|
||||
if [ ! -d "$rd_logs_folder" ]; then
|
||||
create_dir "$rd_logs_folder"
|
||||
fi
|
||||
if [[ ! -d "$rd_logs_folder/ES-DE" ]]; then
|
||||
dir_prep "$rd_logs_folder/ES-DE" "$es_source_logs"
|
||||
fi
|
||||
|
||||
# We moved the lockfile in /var/config/retrodeck in order to solve issue #53 - Remove in a few versions
|
||||
if [[ -f "$HOME/retrodeck/.lock" ]]; then
|
||||
mv "$HOME/retrodeck/.lock" $lockfile
|
||||
|
|
|
@ -16,41 +16,8 @@
|
|||
# log e "bar" -> logs an error with message bar in the default log file retrodeck/logs/retrodeck.log
|
||||
# log i "par" rekku.log -> logs an information with message in the specified log file inside the logs folder retrodeck/logs/rekku.log
|
||||
|
||||
# This function is merging the temporary log file into the actual one
|
||||
# tmplog_merger() {
|
||||
|
||||
# log d "Starting log merger function"
|
||||
# create_dir "$rd_logs_folder"
|
||||
|
||||
# # Check if /tmp/rdlogs/retrodeck.log exists
|
||||
# if [ -e "/tmp/rdlogs/retrodeck.log" ] && [ -e "$rd_logs_folder/retrodeck.log" ]; then
|
||||
|
||||
# # Sort both temporary and existing log files by timestamp
|
||||
# #sort -k1,1n -k2,2M -k3,3n -k4,4n -k5,5n "/tmp/rdlogs/retrodeck.log" "$rd_logs_folder/retrodeck.log" > "$rd_logs_folder/merged_logs.tmp"
|
||||
|
||||
# # Move the merged logs to replace the original log file
|
||||
# #mv "$rd_logs_folder/merged_logs.tmp" "$rd_logs_folder/retrodeck.log"
|
||||
|
||||
# mv "/tmp/rdlogs/retrodeck.log" "$rd_logs_folder/retrodeck.log"
|
||||
|
||||
# # Remove the temporary folder
|
||||
# rm -rf "/tmp/rdlogs"
|
||||
# fi
|
||||
|
||||
# local ESDE_source_logs="/var/config/ES-DE/logs"
|
||||
# # Check if the source file exists
|
||||
# if [ -e "$ESDE_source_logs" ]; then
|
||||
# # Create the symlink in the logs folder
|
||||
# ln -sf "$ESDE_source_logs" "$rd_logs_folder/ES-DE"
|
||||
# log i "ES-DE log folder linked to \"$rd_logs_folder/ES-DE\""
|
||||
# fi
|
||||
|
||||
# }
|
||||
|
||||
log() {
|
||||
|
||||
# exec > >(tee "$logs_folder/retrodeck.log") 2>&1 # this is broken, creates strange artifacts and corrupts the log file
|
||||
|
||||
local level="$1"
|
||||
local message="$2"
|
||||
local timestamp="$(date +[%Y-%m-%d\ %H:%M:%S.%3N])"
|
||||
|
@ -61,41 +28,11 @@ log() {
|
|||
if [ -n "$3" ]; then
|
||||
logfile="$3"
|
||||
else
|
||||
if [ -z $rd_logs_folder ]; then
|
||||
# echo "Logger: case 1, rd_logs_folder not found, rd_logs_folder=$rd_logs_folder" # TODO: Debug, delete me
|
||||
rd_logs_folder="/tmp/rdlogs"
|
||||
create_dir "$rd_logs_folder"
|
||||
fi
|
||||
if [ ! -z $rdhome ]; then
|
||||
# echo "Logger: case 2, rdhome is found, rdhome=$rdhome" # TODO: Debug, delete me
|
||||
rd_logs_folder="$(get_setting_value "$rd_conf" "logs_folder" "retrodeck" "paths")"
|
||||
mkdir -p "$rd_logs_folder"
|
||||
# echo "Logger: case 2, rdhome is found, rd_logs_folder=$rd_logs_folder" # TODO: Debug, delete me
|
||||
logfile="$rd_logs_folder/retrodeck.log"
|
||||
fi
|
||||
if [[ ! -f "$logfile" ]]; then
|
||||
touch "$logfile"
|
||||
local ESDE_source_logs="/var/config/ES-DE/logs"
|
||||
# Check if the source file exists
|
||||
if [ -e "$ESDE_source_logs" ] && [ ! -d "$rd_logs_folder/ES-DE" ]; then
|
||||
# Create the symlink in the logs folder
|
||||
# echo "Logger: case 2, symlinking \"$ESDE_source_logs\" in \"$rd_logs_folder/ES-DE\"" # TODO: Debug, delete me
|
||||
ln -sf "$ESDE_source_logs" "$rd_logs_folder/ES-DE"
|
||||
ln -sf "$HOME/.var/app/net.retrodeck.retrodeck/config/ES-DE/logs" "$rd_logs_folder/ES-DE-outflatpak" # TODO: think a smarter way
|
||||
fi
|
||||
else
|
||||
# echo "Logger: case 3" # TODO: Debug, delete me
|
||||
logfile="/tmp/rdlogs/retrodeck.log"
|
||||
echo "$timestamp [WARN] retrodeck folder not found, temporary writing logs in \"$logfile\""
|
||||
fi
|
||||
|
||||
if [ -z $rdhome ] && [ -d "/tmp/rdlogs" ]; then
|
||||
# echo "Logger: case 4, rdhome is found, rdhome=$rdhome, and /tmp/rdlogs is found as well" # TODO: Debug, delete me
|
||||
# echo "Logger: case 4, creating the acutal log dir in $rd_logs_folder" # TODO: Debug, delete me
|
||||
mkdir -p "$rd_logs_folder"
|
||||
# echo "Logger: case 4, moving \"/tmp/rdlogs/retrodeck.log\" in \"$rd_logs_folder/retrodeck.log\"" # TODO: Debug, delete me
|
||||
mv "/tmp/rdlogs/retrodeck.log" "$rd_logs_folder/retrodeck.log"
|
||||
rm -rf "/tmp/rdlogs"
|
||||
# echo "Logger: deleting /tmp/rdlogs" # TODO: Debug, delete me
|
||||
fi
|
||||
echo "$timestamp [WARN] \"$logfile\" not found, creating."
|
||||
fi
|
||||
|
||||
# Check if the shell is sh (not bash or zsh) to avoid colorization
|
||||
|
|
|
@ -26,7 +26,7 @@ prepare_component() {
|
|||
fi
|
||||
done < <(grep -v '^\s*$' $rd_conf | awk '/^\[paths\]/{f=1;next} /^\[/{f=0} f')
|
||||
create_dir "/var/config/retrodeck/godot"
|
||||
dir_prep "$rd_logs_folder" "$logs_folder"
|
||||
dir_prep "$logs_folder" "$rd_logs_folder"
|
||||
fi
|
||||
if [[ "$action" == "postmove" ]]; then # Update the paths of any folders that came with the retrodeck folder during a move
|
||||
while read -r config_line; do
|
||||
|
@ -38,7 +38,7 @@ prepare_component() {
|
|||
fi
|
||||
fi
|
||||
done < <(grep -v '^\s*$' $rd_conf | awk '/^\[paths\]/{f=1;next} /^\[/{f=0} f')
|
||||
dir_prep "$rd_logs_folder" "$logs_folder"
|
||||
dir_prep "$logs_folder" "$rd_logs_folder"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@ -55,6 +55,7 @@ prepare_component() {
|
|||
set_setting_value "$es_settings" "MediaDirectory" "$media_folder" "es_settings"
|
||||
set_setting_value "$es_settings" "UserThemeDirectory" "$themes_folder" "es_settings"
|
||||
dir_prep "$rdhome/gamelists" "/var/config/ES-DE/gamelists"
|
||||
dir_prep "$rd_logs_folder/ES-DE" "$es_source_logs"
|
||||
log d "Generating roms system folders"
|
||||
#es-de --home /var/config/ES-DE --create-system-dirs
|
||||
es-de --create-system-dirs
|
||||
|
|
Loading…
Reference in a new issue