From 0856eddea6ca5648b6a02d4f85c046c5ba9ada57 Mon Sep 17 00:00:00 2001 From: icenine451 Date: Thu, 28 Mar 2024 14:06:15 -0400 Subject: [PATCH 1/4] Remove extraneous newline from log entry --- functions/functions.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/functions.sh b/functions/functions.sh index 43dc82fb..b19dcd38 100644 --- a/functions/functions.sh +++ b/functions/functions.sh @@ -283,7 +283,7 @@ dir_prep() { rm -rf "$symlink.old" fi - log i "$symlink is now $real\n" + log i "$symlink is now $real" } check_bios_files() { From e03234548cfbe507aa6a15fe2666f4bc4a08843e Mon Sep 17 00:00:00 2001 From: icenine451 Date: Thu, 28 Mar 2024 14:06:40 -0400 Subject: [PATCH 2/4] Skip creating logs folder during finit as it is already created earlier --- functions/prepare_component.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/functions/prepare_component.sh b/functions/prepare_component.sh index f93c9961..51b625e2 100644 --- a/functions/prepare_component.sh +++ b/functions/prepare_component.sh @@ -22,7 +22,9 @@ prepare_component() { if [[ ! $current_setting_name =~ (rdhome|sdcard) ]]; then # Ignore these locations local current_setting_value=$(get_setting_value "$rd_conf" "$current_setting_name" "retrodeck" "paths") declare -g "$current_setting_name=$rdhome/$(basename $current_setting_value)" - create_dir "$rdhome/$(basename $current_setting_value)" + if [[ ! $current_setting_name == "logs_folder" ]]; then # Don't create this folder, as it has already been created internally and is linked later + create_dir "$rdhome/$(basename $current_setting_value)" + fi fi done < <(grep -v '^\s*$' $rd_conf | awk '/^\[paths\]/{f=1;next} /^\[/{f=0} f') create_dir "/var/config/retrodeck/godot" From 709908f06aecb30851bf2104cd3f2696caa5d08c Mon Sep 17 00:00:00 2001 From: icenine451 Date: Thu, 28 Mar 2024 14:27:20 -0400 Subject: [PATCH 3/4] Remove duplicate log file creation if not found --- functions/logger.sh | 4 ---- 1 file changed, 4 deletions(-) diff --git a/functions/logger.sh b/functions/logger.sh index 08bba936..d37dafb6 100755 --- a/functions/logger.sh +++ b/functions/logger.sh @@ -30,10 +30,6 @@ log() { else logfile="$rd_logs_folder/retrodeck.log" fi - if [[ ! -f "$logfile" ]]; then - touch "$logfile" - echo "$timestamp [WARN] \"$logfile\" not found, creating." - fi # Check if the shell is sh (not bash or zsh) to avoid colorization if [ "${SHELL##*/}" = "sh" ]; then From 254dc09d26c81da69f61ddeb25c0ae69549eb858 Mon Sep 17 00:00:00 2001 From: icenine451 Date: Thu, 28 Mar 2024 14:49:21 -0400 Subject: [PATCH 4/4] Fix how finit logs folder moving is handled --- functions/prepare_component.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/functions/prepare_component.sh b/functions/prepare_component.sh index 51b625e2..003c72fa 100644 --- a/functions/prepare_component.sh +++ b/functions/prepare_component.sh @@ -22,13 +22,17 @@ prepare_component() { if [[ ! $current_setting_name =~ (rdhome|sdcard) ]]; then # Ignore these locations local current_setting_value=$(get_setting_value "$rd_conf" "$current_setting_name" "retrodeck" "paths") declare -g "$current_setting_name=$rdhome/$(basename $current_setting_value)" - if [[ ! $current_setting_name == "logs_folder" ]]; then # Don't create this folder, as it has already been created internally and is linked later + if [[ ! $current_setting_name == "logs_folder" ]]; then # Don't create a logs folder normally, we want to maintain the current files exactly to not lose early-install logs. create_dir "$rdhome/$(basename $current_setting_value)" + else # Log folder-specific actions + mv "$rd_logs_folder" "$logs_folder" # Move existing logs folder from internal to userland + ln -sf "$logs_folder" "$rd_logs_folder" # Link userland logs folder back to statically-written location + log d "Logs folder moved to $logs_folder and linked back to $rd_logs_folder" fi fi done < <(grep -v '^\s*$' $rd_conf | awk '/^\[paths\]/{f=1;next} /^\[/{f=0} f') create_dir "/var/config/retrodeck/godot" - 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