mirror of
https://github.com/RetroDECK/RetroDECK.git
synced 2024-11-22 05:55:38 +00:00
Move default RD logs folder to internal space, then dir_prep after user selects install location
This commit is contained in:
parent
4aba7708c5
commit
efad8a8ad9
|
@ -31,8 +31,9 @@ current_splash_file="/var/config/ES-DE/resources/graphics/splash.svg"
|
|||
default_splash_file="/var/config/ES-DE/resources/graphics/splash-orig.svg" # The default RetroDECK splash screen
|
||||
multi_user_emulator_config_dirs="$emuconfigs/defaults/retrodeck/reference_lists/multi_user_emulator_config_dirs.cfg" # A list of emulator config folders that can be safely linked/unlinked entirely in multi-user mode
|
||||
rd_es_themes="/app/share/es-de/themes" # The directory where themes packaged with RetroDECK are stored
|
||||
lockfile="/var/config/retrodeck/.lock" # where the lockfile is located
|
||||
lockfile="/var/config/retrodeck/.lock" # Where the lockfile is located
|
||||
default_sd="/run/media/mmcblk0p1" # Steam Deck SD default path
|
||||
rd_logs_folder="/var/config/retrodeck/logs/" # A static location for RetroDECK logs to be written
|
||||
hard_version="$(cat '/app/retrodeck/version')" # hardcoded version (in the readonly filesystem)
|
||||
rd_repo="https://github.com/XargonWan/RetroDECK" # The URL of the main RetroDECK GitHub repo
|
||||
es_themes_list="https://gitlab.com/es-de/themes/themes-list/-/raw/master/themes.json" # The URL of the ES-DE 2.0 themes list
|
||||
|
@ -127,6 +128,7 @@ fi
|
|||
# If there is no config file I initalize the file with the the default values
|
||||
if [[ ! -f "$rd_conf" ]]; then
|
||||
create_dir /var/config/retrodeck
|
||||
create_dir /var/config/retrodeck/logs
|
||||
log w "RetroDECK config file not found in $rd_conf"
|
||||
log i "Initializing"
|
||||
# if we are here means that the we are in a new installation, so the version is valorized with the hardcoded one
|
||||
|
@ -164,7 +166,7 @@ if [[ ! -f "$rd_conf" ]]; then
|
|||
|
||||
log i "Setting config file permissions"
|
||||
chmod +rw $rd_conf
|
||||
log i "RetroDECK config file initialized. Contents:\n\n$(cat $rd_conf\n)"
|
||||
log i "RetroDECK config file initialized. Contents:\n\n$(cat $rd_conf)\n"
|
||||
conf_read # Load new variables into memory
|
||||
tmplog_merger
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ log() {
|
|||
if [ -n "$3" ]; then
|
||||
logfile="$3"
|
||||
else
|
||||
logfile="$logs_folder/retrodeck.log"
|
||||
logfile="$rd_logs_folder/retrodeck.log"
|
||||
fi
|
||||
|
||||
# Check if the shell is sh (not bash or zsh) to avoid colorization
|
||||
|
@ -100,16 +100,16 @@ log() {
|
|||
# This function is merging the temporary log file into the actual one
|
||||
tmplog_merger() {
|
||||
|
||||
create_dir "$logs_folder"
|
||||
create_dir "$rd_logs_folder"
|
||||
|
||||
# Check if /tmp/retrodeck.log exists
|
||||
if [ -e "/tmp/retrodeck.log" ] && [ -e "$logs_folder/retrodeck.log" ]; then
|
||||
if [ -e "/tmp/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/retrodeck.log" "$logs_folder/retrodeck.log" > "$logs_folder/merged_logs.tmp"
|
||||
sort -k1,1n -k2,2M -k3,3n -k4,4n -k5,5n "/tmp/retrodeck.log" "$rd_logs_folder/retrodeck.log" > "$rd_logs_folder/merged_logs.tmp"
|
||||
|
||||
# Move the merged logs to replace the original log file
|
||||
mv "$logs_folder/merged_logs.tmp" "$logs_folder/retrodeck.log"
|
||||
mv "$rd_logs_folder/merged_logs.tmp" "$rd_logs_folder/retrodeck.log"
|
||||
|
||||
# Remove the temporary file
|
||||
rm "/tmp/retrodeck.log"
|
||||
|
@ -119,8 +119,8 @@ tmplog_merger() {
|
|||
# Check if the source file exists
|
||||
if [ -e "$ESDE_source_logs" ]; then
|
||||
# Create the symlink in the logs folder
|
||||
ln -sf "$ESDE_source_logs" "$logs_folder/ES-DE.log"
|
||||
log i "ES-DE log file linked to \"$logs_folder/ES-DE.log\""
|
||||
ln -sf "$ESDE_source_logs" "$rd_logs_folder/ES-DE.log"
|
||||
log i "ES-DE log file linked to \"$rd_logs_folder/ES-DE.log\""
|
||||
fi
|
||||
|
||||
}
|
||||
|
|
|
@ -24,6 +24,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"
|
||||
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
|
||||
|
@ -35,6 +36,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"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
|
Loading…
Reference in a new issue