From 7fd4a5aacb38dbfbe4224fe5b2dd52ae45325afc Mon Sep 17 00:00:00 2001 From: XargonWan Date: Wed, 8 Jan 2025 14:10:53 +0900 Subject: [PATCH] FRAMEWORK: adding more info at startup + logger tweak --- functions/global.sh | 5 +++++ functions/logger.sh | 2 +- runtime_checker.sh | 44 -------------------------------------------- 3 files changed, 6 insertions(+), 45 deletions(-) delete mode 100755 runtime_checker.sh diff --git a/functions/global.sh b/functions/global.sh index 73072c93..27637ea6 100644 --- a/functions/global.sh +++ b/functions/global.sh @@ -10,7 +10,12 @@ rd_logs_folder="/var/config/retrodeck/logs" # Static location to write all RetroDECK-related logs source /app/libexec/logger.sh rotate_logs + log i "Initializing RetroDECK" +log i "Running on $XDG_SESSION_DESKTOP, $XDG_SESSION_TYPE" +if [[ -n $container ]]; then + log i "$container environment" +fi source /app/libexec/050_save_migration.sh source /app/libexec/checks.sh diff --git a/functions/logger.sh b/functions/logger.sh index 395a803c..285dfe2c 100755 --- a/functions/logger.sh +++ b/functions/logger.sh @@ -34,7 +34,7 @@ log() { local colorize_terminal=true # Determine the calling function or use [FWORK] - local caller="${FUNCNAME[1]:-[FWORK]}" + local caller="${FUNCNAME[1]:-FWORK}" caller="${caller^^}" # Convert to uppercase # Check if the shell is sh (not bash or zsh) to avoid colorization diff --git a/runtime_checker.sh b/runtime_checker.sh deleted file mode 100755 index 778ead51..00000000 --- a/runtime_checker.sh +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/bash - -# TODO: finish me - -# Set the organization name -ORG="RetroDECK" - -# Get all non-archived repositories of the organization -repos=$(curl -s "https://api.github.com/orgs/$ORG/repos?per_page=100" | jq -r '.[] | select(has("archived") and .archived == false) | .name') - -# Iterate over each repository -for repo in $repos; do - echo "Checking repository: $repo" - - # Get the files in the root of the repository - files=$(curl -s "https://api.github.com/repos/$ORG/$repo/contents" | jq -r '.[] | select(.type == "file" and (.path | index("/") == null)) | .name') - - # Check for .yml, .yaml, and .json files - for ext in yml yaml json; do - file=$(echo "$files" | grep -E "\.$ext$") - if [ -n "$file" ]; then - # Download the file content - content=$(curl -s "https://raw.githubusercontent.com/$ORG/$repo/main/$file") - - # Check if it contains "runtime" - if echo "$content" | grep -q "runtime"; then - echo "Found in $file" - app_id=$(echo "$content" | grep "app-id" | awk '{print $2}') - runtime=$(echo "$content" | grep "runtime" | awk '{print $2}') - runtime-version=$(echo "$content" | grep "runtime-version" | awk '{print $2}') - sdk=$(echo "$content" | grep "sdk" | awk '{print $2}') - - echo "Repository: $repo" - echo "File: $file" - echo "app-id: $app_id" - echo "runtime: $runtime" - echo "runtime-version: $runtime_version" - echo "sdk: $sdk" - echo "-------------------------" - break - fi - fi - done -done \ No newline at end of file