mirror of
https://github.com/RetroDECK/RetroDECK.git
synced 2024-11-21 21:45:39 +00:00
LOGGER: more logging
This commit is contained in:
parent
e365c41cd6
commit
878e3e41ca
|
@ -8,24 +8,24 @@ source /app/libexec/logger.sh
|
|||
|
||||
# Fetch appdata version
|
||||
appdata_version=$(fetch_appdata_version)
|
||||
echo -e "Appdata:\t\t$appdata_version"
|
||||
log i "Appdata:\t\t$appdata_version"
|
||||
|
||||
# Defining manifest file location
|
||||
appdata_file="net.retrodeck.retrodeck.appdata.xml"
|
||||
|
||||
# Check if release with appdata_version already exists
|
||||
if grep -q "version=\"$appdata_version\"" "$appdata_file"; then
|
||||
echo "Deleting existing release version $appdata_version..."
|
||||
log i "Deleting existing release version $appdata_version..."
|
||||
|
||||
# Remove the existing release entry
|
||||
sed -i "/<release version=\"$appdata_version\"/,/<\/release>/d" "$appdata_file"
|
||||
fi
|
||||
|
||||
echo "Adding new release version $appdata_version..."
|
||||
log i "Adding new release version $appdata_version..."
|
||||
|
||||
# Get today's date in the required format (YYYY-MM-DD)
|
||||
today_date=$(date +"%Y-%m-%d")
|
||||
echo "Today is $today_date"
|
||||
log i "Today is $today_date"
|
||||
|
||||
# Construct the release snippet
|
||||
release_snippet="\
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
source /app/libexec/logger.sh
|
||||
|
||||
# Define the IWAD files list
|
||||
IWAD_FILES=("DOOM1.WAD" "DOOM.WAD" "DOOM2.WAD" "DOOM2F.WAD" "DOOM64.WAD" "TNT.WAD"
|
||||
"PLUTONIA.WAD" "HERETIC1.WAD" "HERETIC.WAD" "HEXEN.WAD" "HEXDD.WAD"
|
||||
|
@ -8,16 +10,6 @@ IWAD_FILES=("DOOM1.WAD" "DOOM.WAD" "DOOM2.WAD" "DOOM2F.WAD" "DOOM64.WAD" "TNT.WA
|
|||
"doom_complete.pk3"
|
||||
)
|
||||
|
||||
# Function to log messages to terminal and a log file
|
||||
log() {
|
||||
local message="$1"
|
||||
local logfile="$rdhome/logs/gzdoom.log"
|
||||
local timestamp="$(date +[%Y-%m-%d\ %H:%M:%S])"
|
||||
|
||||
echo "$timestamp $message" | tee -a "$logfile"
|
||||
}
|
||||
|
||||
|
||||
# Function to check if a file is an IWAD
|
||||
is_iwad() {
|
||||
local file="$1"
|
||||
|
@ -62,8 +54,8 @@ if [[ "${1##*.}" != "doom" ]]; then
|
|||
fi
|
||||
|
||||
# Log the command
|
||||
log "[INFO] Loading: \"$1\""
|
||||
log "[INFO] Executing command \"$command\""
|
||||
log i "Loading: \"$1\""
|
||||
log i "Executing command \"$command\""
|
||||
|
||||
# Execute the command
|
||||
eval "$command"
|
||||
|
@ -71,11 +63,11 @@ if [[ "${1##*.}" != "doom" ]]; then
|
|||
# Check if $1 is a .doom file
|
||||
else
|
||||
doom_file="$1"
|
||||
log "[INFO] Found a doom file: \"$1\""
|
||||
log i "Found a doom file: \"$1\""
|
||||
|
||||
# Check if the .doom file exists
|
||||
if [[ ! -e "$doom_file" ]]; then
|
||||
log "[Error] doom file not found in \"$doom_file\""
|
||||
log e "doom file not found in \"$doom_file\""
|
||||
zenity --error --no-wrap \
|
||||
--window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \
|
||||
--title "RetroDECK" \
|
||||
|
@ -103,15 +95,15 @@ else
|
|||
# Check if the file is an IWAD
|
||||
if [[ $(is_iwad "$found_file") == "true" ]]; then
|
||||
command+=" -iwad $found_file"
|
||||
log "[INFO] Appending the param \"-iwad $found_file\""
|
||||
log i "Appending the param \"-iwad $found_file\""
|
||||
else
|
||||
command+=" -file $found_file"
|
||||
log "[INFO] Appending the param \"-file $found_file\""
|
||||
log i "Appending the param \"-file $found_file\""
|
||||
fi
|
||||
done < "$doom_file"
|
||||
|
||||
# Log the command
|
||||
log "[INFO] Executing command \"$command\""
|
||||
log i "Executing command \"$command\""
|
||||
|
||||
# Execute the command
|
||||
eval "$command"
|
||||
|
|
|
@ -15,7 +15,7 @@ save_migration() {
|
|||
# ROMs on Internal
|
||||
roms_folder="$HOME/retrodeck/roms"
|
||||
fi
|
||||
echo "ROMs folder found at $roms_folder"
|
||||
log i "ROMs folder found at $roms_folder"
|
||||
|
||||
# Unhiding downloaded media from the previous versions
|
||||
if [ -d "$rdhome/.downloaded_media" ]
|
||||
|
@ -74,9 +74,9 @@ save_migration() {
|
|||
gamestoskip=
|
||||
|
||||
tar -C $rdhome -czf $save_backup_file saves # Backup save directory for safety
|
||||
echo "Saves backed up to" $save_backup_file >> $migration_logfile
|
||||
log i "Saves backed up to" $save_backup_file $migration_logfile
|
||||
tar -C $rdhome -czf $state_backup_file states # Backup state directory for safety
|
||||
echo "States backed up to" $state_backup_file >> $migration_logfile
|
||||
log i "States backed up to" $state_backup_file $migration_logfile
|
||||
|
||||
(
|
||||
movefile() { # Take matching save and rom files and sort save into appropriate system folder
|
||||
|
@ -94,21 +94,22 @@ save_migration() {
|
|||
gamestoskip+=("$1")
|
||||
return
|
||||
fi
|
||||
echo "INFO: Examining ROM file:" "$game" >> $migration_logfile
|
||||
echo "INFO: System detected as" $systemdir >> $migration_logfile
|
||||
log i "Examining ROM file:" "$game" $migration_logfile
|
||||
log i "System detected as" $systemdir $migration_logfile
|
||||
sosfile=$(sed -e "s/\^/ /g" <<< "$2") # Remove whitespace placeholder from s-ave o-r s-tate file
|
||||
sospurebasename="$(basename "$sosfile")" # Extract pure file name ie. /saves/game1.sav becomes game1
|
||||
echo "INFO: Current save or state being examined for match:" $sosfile >> $migration_logfile
|
||||
echo "INFO: Matching save or state" $sosfile "and game" $game "found." >> $migration_logfile
|
||||
echo "INFO: Moving save or state to" $current_dest_folder"/"$systemdir"/"$sosbasename >> $migration_logfile
|
||||
log i "Current save or state being examined for match:" $sosfile $migration_logfile
|
||||
log i "Matching save or state" $sosfile "and game" $game "found." $migration_logfile
|
||||
log i "Moving save or state to $current_dest_folder/$systemdir/$sosbasename" $migration_logfile
|
||||
if [[ ! -d $current_dest_folder"/"$systemdir ]]; then # If system directory doesn't exist for save yet, create it
|
||||
echo "WARNING: Creating missing system directory" $current_dest_folder"/"$systemdir
|
||||
log w "Creating missing system directory $current_dest_folder/$systemdir"
|
||||
mkdir $current_dest_folder/$systemdir
|
||||
fi
|
||||
mv "$sosfile" -t $current_dest_folder/$systemdir # Move save to appropriate system directory
|
||||
return
|
||||
else
|
||||
echo "WARNING: Game with name" "$(basename "$1" | sed -e "s/\^/ /g")" "already found. Skipping to next game..." >> $migration_logfile # Inform user of game being skipped due to duplicate ROM names
|
||||
local name="$(basename "$1" | sed -e "s/\^/ /g")"
|
||||
log w "Game with name \"$name\" already found. Skipping to next game..." $migration_logfile # Inform user of game being skipped due to duplicate ROM names
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -169,6 +170,6 @@ save_migration() {
|
|||
fi
|
||||
|
||||
else
|
||||
echo "Version" $version "is after the save and state organization was changed, no need to sort again"
|
||||
log i "Version $version is after the save and state organization was changed, no need to sort again"
|
||||
fi
|
||||
}
|
||||
|
|
|
@ -537,6 +537,6 @@ quit_retrodeck() {
|
|||
start_retrodeck() {
|
||||
easter_eggs # Check if today has a surprise splashscreen and load it if so
|
||||
# normal startup
|
||||
echo "Starting RetroDECK v$version"
|
||||
log i "Starting RetroDECK v$version"
|
||||
emulationstation --home /var/config/emulationstation
|
||||
}
|
||||
|
|
|
@ -118,13 +118,13 @@ fi
|
|||
# If there is no config file I initalize the file with the the default values
|
||||
if [[ ! -f "$rd_conf" ]]; then
|
||||
mkdir -p /var/config/retrodeck
|
||||
echo "RetroDECK config file not found in $rd_conf"
|
||||
echo "Initializing"
|
||||
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
|
||||
# Initializing the variables
|
||||
if [ -z $version]; then
|
||||
if [[ $(cat $lockfile) == *"0.4."* ]] || [[ $(cat $lockfile) == *"0.3."* ]] || [[ $(cat $lockfile) == *"0.2."* ]] || [[ $(cat $lockfile) == *"0.1."* ]]; then # If the previous version is very out of date, pre-rd_conf
|
||||
echo "Running version workaround"
|
||||
log d "Running version workaround"
|
||||
version=$(cat $lockfile)
|
||||
else
|
||||
version="$hard_version"
|
||||
|
@ -151,17 +151,16 @@ if [[ ! -f "$rd_conf" ]]; then
|
|||
set_setting_value $rd_conf "developer_options" "true" retrodeck "options"
|
||||
fi
|
||||
|
||||
echo "Setting config file permissions"
|
||||
log i "Setting config file permissions"
|
||||
chmod +rw $rd_conf
|
||||
echo "RetroDECK config file initialized. Contents:"
|
||||
echo
|
||||
cat $rd_conf
|
||||
log i "RetroDECK config file initialized. Contents:\n"
|
||||
log i "$(cat "$rd_conf")"
|
||||
conf_read # Load new variables into memory
|
||||
|
||||
# If the config file is existing i just read the variables
|
||||
else
|
||||
echo "Found RetroDECK config file in $rd_conf"
|
||||
echo "Loading it"
|
||||
log i "Found RetroDECK config file in $rd_conf"
|
||||
log i "Loading it"
|
||||
|
||||
if grep -qF "cooker" <<< $hard_version; then # If newly-installed version is a "cooker" build
|
||||
set_setting_value $rd_conf "update_repo" "RetroDECK-cooker" retrodeck "options"
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#!/bin/bash
|
||||
|
||||
# This script provides a logging function 'log' that can be sourced in other scripts.
|
||||
# It logs messages to both the terminal and a specified logfile, allowing different log levels.
|
||||
# The log function takes three parameters: log level, log message, and optionally the logfile. If no logfile is specified, it writes to retrodeck/logs/retrodeck.log
|
||||
|
@ -9,36 +7,86 @@
|
|||
# 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
|
||||
|
||||
exec > >(tee -a "$logs_folder/retrodeck.log") 2>&1
|
||||
|
||||
log() {
|
||||
local level="$1"
|
||||
local message="$2"
|
||||
local timestamp="$(date +[%Y-%m-%d\ %H:%M:%S])"
|
||||
local logfile="${3:-$logs_folder/retrodeck.log}" # Use specified logfile or default to retrodeck.log
|
||||
local colorize_terminal
|
||||
|
||||
# Use specified logfile or default to retrodeck.log
|
||||
local logfile
|
||||
if [ -n "$3" ]; then
|
||||
logfile="$3"
|
||||
else
|
||||
logfile="$logs_folder/retrodeck.log"
|
||||
fi
|
||||
|
||||
# Check if the shell is sh (not bash or zsh) to avoid colorization
|
||||
if [ "${SHELL##*/}" = "sh" ]; then
|
||||
colorize_terminal=false
|
||||
else
|
||||
colorize_terminal=true
|
||||
fi
|
||||
|
||||
case "$level" in
|
||||
w)
|
||||
# Warning (yellow) for terminal, no color for log file
|
||||
colored_message="\e[33m[WARN]\e[0m $message"
|
||||
echo "$timestamp $colored_message" | tee -a >(sed $'s,\e\\[[0-9;]*[a-zA-Z],,g' >> "$logfile")
|
||||
if [ "$colorize_terminal" = true ]; then
|
||||
# Warning (yellow) for terminal
|
||||
colored_message="\e[33m[WARN]\e[0m $message"
|
||||
else
|
||||
# Warning (no color for sh) for terminal
|
||||
colored_message="$timestamp [WARN] $message"
|
||||
fi
|
||||
# Write to log file without colorization
|
||||
log_message="$timestamp [WARN] $message"
|
||||
;;
|
||||
e)
|
||||
# Error (red) for terminal, no color for log file
|
||||
colored_message="\e[31m[ERROR]\e[0m $message"
|
||||
echo "$timestamp $colored_message" | tee -a >(sed $'s,\e\\[[0-9;]*[a-zA-Z],,g' >> "$logfile")
|
||||
if [ "$colorize_terminal" = true ]; then
|
||||
# Error (red) for terminal
|
||||
colored_message="\e[31m[ERROR]\e[0m $message"
|
||||
else
|
||||
# Error (no color for sh) for terminal
|
||||
colored_message="$timestamp [ERROR] $message"
|
||||
fi
|
||||
# Write to log file without colorization
|
||||
log_message="$timestamp [ERROR] $message"
|
||||
;;
|
||||
i)
|
||||
# Info (green) for terminal, no color for log file
|
||||
colored_message="\e[32m[INFO]\e[0m $message"
|
||||
echo "$timestamp $colored_message" | tee -a >(sed $'s,\e\\[[0-9;]*[a-zA-Z],,g' >> "$logfile")
|
||||
if [ "$colorize_terminal" = true ]; then
|
||||
# Info (green) for terminal
|
||||
colored_message="\e[32m[INFO]\e[0m $message"
|
||||
else
|
||||
# Info (no color for sh) for terminal
|
||||
colored_message="$timestamp [INFO] $message"
|
||||
fi
|
||||
# Write to log file without colorization
|
||||
log_message="$timestamp [INFO] $message"
|
||||
;;
|
||||
d)
|
||||
# Debug (green) for both terminal, no color for log file
|
||||
colored_message="\e[32m[DEBUG]\e[0m $message"
|
||||
echo "$timestamp $colored_message" | tee -a >(sed $'s,\e\\[[0-9;]*[a-zA-Z],,g' >> "$logfile")
|
||||
if [ "$colorize_terminal" = true ]; then
|
||||
# Debug (green) for terminal
|
||||
colored_message="\e[32m[DEBUG]\e[0m $message"
|
||||
else
|
||||
# Debug (no color for sh) for terminal
|
||||
colored_message="$timestamp [DEBUG] $message"
|
||||
fi
|
||||
# Write to log file without colorization
|
||||
log_message="$timestamp [DEBUG] $message"
|
||||
;;
|
||||
*)
|
||||
# Default (no color)
|
||||
echo "$timestamp $message" | tee -a "$logfile"
|
||||
# Default (no color for other shells) for terminal
|
||||
colored_message="$timestamp $message"
|
||||
# Write to log file without colorization
|
||||
log_message="$timestamp $message"
|
||||
;;
|
||||
esac
|
||||
|
||||
# Display the message in the terminal
|
||||
echo -e "$colored_message"
|
||||
|
||||
# Write the log message to the log file
|
||||
echo "$log_message" >> "$logfile"
|
||||
|
||||
}
|
|
@ -89,9 +89,9 @@ prepare_emulator() {
|
|||
# Shared actions
|
||||
|
||||
# PPSSPP
|
||||
echo "--------------------------------"
|
||||
echo "Initializing PPSSPP_LIBRETRO"
|
||||
echo "--------------------------------"
|
||||
log i "--------------------------------"
|
||||
log i "Initializing PPSSPP_LIBRETRO"
|
||||
log i "--------------------------------"
|
||||
if [ -d $bios_folder/PPSSPP/flash0/font ]
|
||||
then
|
||||
mv -fv $bios_folder/PPSSPP/flash0/font $bios_folder/PPSSPP/flash0/font.bak
|
||||
|
@ -103,16 +103,16 @@ prepare_emulator() {
|
|||
fi
|
||||
|
||||
# MSX / SVI / ColecoVision / SG-1000
|
||||
echo "-----------------------------------------------------------"
|
||||
echo "Initializing MSX / SVI / ColecoVision / SG-1000 LIBRETRO"
|
||||
echo "-----------------------------------------------------------"
|
||||
log i "-----------------------------------------------------------"
|
||||
log i "Initializing MSX / SVI / ColecoVision / SG-1000 LIBRETRO"
|
||||
log i "-----------------------------------------------------------"
|
||||
cp -rf "/app/retrodeck/extras/MSX/Databases" "$bios_folder/Databases"
|
||||
cp -rf "/app/retrodeck/extras/MSX/Machines" "$bios_folder/Machines"
|
||||
|
||||
# AMIGA
|
||||
echo "-----------------------------------------------------------"
|
||||
echo "Initializing AMIGA LIBRETRO"
|
||||
echo "-----------------------------------------------------------"
|
||||
log i "-----------------------------------------------------------"
|
||||
log i "Initializing AMIGA LIBRETRO"
|
||||
log i "-----------------------------------------------------------"
|
||||
cp -f "/app/retrodeck/extras/Amiga/capsimg.so" "$bios_folder/capsimg.so"
|
||||
|
||||
dir_prep "$texture_packs_folder/RetroArch-Mesen" "/var/config/retroarch/system/HdPacks"
|
||||
|
@ -158,9 +158,9 @@ prepare_emulator() {
|
|||
|
||||
if [[ "$emulator" =~ ^(cemu|Cemu|all)$ ]]; then
|
||||
if [[ "$action" == "reset" ]]; then # Run reset-only commands
|
||||
echo "----------------------"
|
||||
echo "Initializing CEMU"
|
||||
echo "----------------------"
|
||||
log i "----------------------"
|
||||
log i "Initializing CEMU"
|
||||
log i "----------------------"
|
||||
if [[ $multi_user_mode == "true" ]]; then # Multi-user actions
|
||||
rm -rf "$multi_user_data_folder/$SteamAppUser/config/Cemu"
|
||||
mkdir -p "$multi_user_data_folder/$SteamAppUser/config/Cemu"
|
||||
|
@ -187,9 +187,9 @@ prepare_emulator() {
|
|||
|
||||
if [[ "$emulator" =~ ^(citra|citra-emu|Citra|all)$ ]]; then
|
||||
if [[ "$action" == "reset" ]]; then # Run reset-only commands
|
||||
echo "------------------------"
|
||||
echo "Initializing CITRA"
|
||||
echo "------------------------"
|
||||
log i "------------------------"
|
||||
log i "Initializing CITRA"
|
||||
log i "------------------------"
|
||||
if [[ $multi_user_mode == "true" ]]; then # Multi-user actions
|
||||
rm -rf "$multi_user_data_folder/$SteamAppUser/config/citra-emu"
|
||||
mkdir -p "$multi_user_data_folder/$SteamAppUser/config/citra-emu"
|
||||
|
@ -234,9 +234,9 @@ prepare_emulator() {
|
|||
|
||||
if [[ "$emulator" =~ ^(dolphin|dolphin-emu|Dolphin|all)$ ]]; then
|
||||
if [[ "$action" == "reset" ]]; then # Run reset-only commands
|
||||
echo "----------------------"
|
||||
echo "Initializing DOLPHIN"
|
||||
echo "----------------------"
|
||||
log i "----------------------"
|
||||
log i "Initializing DOLPHIN"
|
||||
log i "----------------------"
|
||||
if [[ $multi_user_mode == "true" ]]; then # Multi-user actions
|
||||
rm -rf "$multi_user_data_folder/$SteamAppUser/config/dolphin-emu"
|
||||
mkdir -p "$multi_user_data_folder/$SteamAppUser/config/dolphin-emu"
|
||||
|
@ -289,9 +289,9 @@ prepare_emulator() {
|
|||
|
||||
if [[ "$emulator" =~ ^(duckstation|Duckstation|all)$ ]]; then
|
||||
if [[ "$action" == "reset" ]]; then # Run reset-only commands
|
||||
echo "------------------------"
|
||||
echo "Initializing DUCKSTATION"
|
||||
echo "------------------------"
|
||||
log i "------------------------"
|
||||
log i "Initializing DUCKSTATION"
|
||||
log i "------------------------"
|
||||
if [[ $multi_user_mode == "true" ]]; then # Multi-user actions
|
||||
rm -rf "$multi_user_data_folder/$SteamAppUser/config/duckstation"
|
||||
mkdir -p "$multi_user_data_folder/$SteamAppUser/data/duckstation/"
|
||||
|
@ -335,9 +335,9 @@ prepare_emulator() {
|
|||
|
||||
if [[ "$emulator" =~ ^(melonds|melonDS|MelonDS|all)$ ]]; then
|
||||
if [[ "$action" == "reset" ]]; then # Run reset-only commands
|
||||
echo "----------------------"
|
||||
echo "Initializing MELONDS"
|
||||
echo "----------------------"
|
||||
log i "----------------------"
|
||||
log i "Initializing MELONDS"
|
||||
log i "----------------------"
|
||||
if [[ $multi_user_mode == "true" ]]; then # Multi-user actions
|
||||
rm -rf "$multi_user_data_folder/$SteamAppUser/config/melonDS"
|
||||
mkdir -pv "$multi_user_data_folder/$SteamAppUser/config/melonDS/"
|
||||
|
@ -375,9 +375,9 @@ prepare_emulator() {
|
|||
|
||||
if [[ "$emulator" =~ ^(pcsx2|PCSX2|all)$ ]]; then
|
||||
if [[ "$action" == "reset" ]]; then # Run reset-only commands
|
||||
echo "----------------------"
|
||||
echo "Initializing PCSX2"
|
||||
echo "----------------------"
|
||||
log i "----------------------"
|
||||
log i "Initializing PCSX2"
|
||||
log i "----------------------"
|
||||
if [[ $multi_user_mode == "true" ]]; then # Multi-user actions
|
||||
rm -rf "$multi_user_data_folder/$SteamAppUser/config/PCSX2"
|
||||
mkdir -p "$multi_user_data_folder/$SteamAppUser/config/PCSX2/inis"
|
||||
|
@ -431,9 +431,9 @@ prepare_emulator() {
|
|||
|
||||
if [[ "$emulator" =~ ^(ppsspp|PPSSPP|all)$ ]]; then
|
||||
if [[ "$action" == "reset" ]]; then # Run reset-only commands
|
||||
echo "------------------------"
|
||||
echo "Initializing PPSSPPSDL"
|
||||
echo "------------------------"
|
||||
log i "------------------------"
|
||||
log i "Initializing PPSSPPSDL"
|
||||
log i "------------------------"
|
||||
if [[ $multi_user_mode == "true" ]]; then # Multi-user actions
|
||||
rm -rf "$multi_user_data_folder/$SteamAppUser/config/ppsspp"
|
||||
mkdir -p "$multi_user_data_folder/$SteamAppUser/config/ppsspp/PSP/SYSTEM/"
|
||||
|
@ -461,9 +461,9 @@ prepare_emulator() {
|
|||
|
||||
if [[ "$emulator" =~ ^(primehack|Primehack|all)$ ]]; then
|
||||
if [[ "$action" == "reset" ]]; then # Run reset-only commands
|
||||
echo "----------------------"
|
||||
echo "Initializing Primehack"
|
||||
echo "----------------------"
|
||||
log i "----------------------"
|
||||
log i "Initializing Primehack"
|
||||
log i "----------------------"
|
||||
if [[ $multi_user_mode == "true" ]]; then # Multi-user actions
|
||||
rm -rf "$multi_user_data_folder/$SteamAppUser/config/primehack"
|
||||
mkdir -p "$multi_user_data_folder/$SteamAppUser/config/primehack"
|
||||
|
@ -505,9 +505,9 @@ prepare_emulator() {
|
|||
|
||||
if [[ "$emulator" =~ ^(rpcs3|RPCS3|all)$ ]]; then
|
||||
if [[ "$action" == "reset" ]]; then # Run reset-only commands
|
||||
echo "------------------------"
|
||||
echo "Initializing RPCS3"
|
||||
echo "------------------------"
|
||||
log i "------------------------"
|
||||
log i "Initializing RPCS3"
|
||||
log i "------------------------"
|
||||
if [[ $multi_user_mode == "true" ]]; then # Multi-user actions
|
||||
rm -rf "$multi_user_data_folder/$SteamAppUser/config/rpcs3"
|
||||
mkdir -pv "$multi_user_data_folder/$SteamAppUser/config/rpcs3/"
|
||||
|
@ -543,9 +543,9 @@ prepare_emulator() {
|
|||
|
||||
if [[ "$emulator" =~ ^(ryujunx|Ryujinx|all)$ ]]; then
|
||||
if [[ "$action" == "reset" ]]; then # Run reset-only commands
|
||||
echo "------------------------"
|
||||
echo "Initializing RYUJINX"
|
||||
echo "------------------------"
|
||||
log i "------------------------"
|
||||
log i "Initializing RYUJINX"
|
||||
log i "------------------------"
|
||||
if [[ $multi_user_mode == "true" ]]; then
|
||||
rm -rf "$multi_user_data_folder/$SteamAppUser/config/Ryujinx"
|
||||
mkdir -p "$multi_user_data_folder/$SteamAppUser/config/Ryujinx/system"
|
||||
|
@ -570,9 +570,9 @@ prepare_emulator() {
|
|||
|
||||
if [[ "$emulator" =~ ^(xemu|XEMU|all)$ ]]; then
|
||||
if [[ "$action" == "reset" ]]; then # Run reset-only commands
|
||||
echo "------------------------"
|
||||
echo "Initializing XEMU"
|
||||
echo "------------------------"
|
||||
log i "------------------------"
|
||||
log i "Initializing XEMU"
|
||||
log i "------------------------"
|
||||
if [[ $multi_user_mode == "true" ]]; then # Multi-user actions
|
||||
rm -rf /var/config/xemu
|
||||
rm -rf /var/data/xemu
|
||||
|
@ -615,9 +615,9 @@ prepare_emulator() {
|
|||
|
||||
if [[ "$emulator" =~ ^(yuzu|Yuzu|all)$ ]]; then
|
||||
if [[ "$action" == "reset" ]]; then # Run reset-only commands
|
||||
echo "----------------------"
|
||||
echo "Initializing YUZU"
|
||||
echo "----------------------"
|
||||
log i "----------------------"
|
||||
log i "Initializing YUZU"
|
||||
log i "----------------------"
|
||||
if [[ $multi_user_mode == "true" ]]; then # Multi-user actions
|
||||
rm -rf "$multi_user_data_folder/$SteamAppUser/config/yuzu"
|
||||
mkdir -p "$multi_user_data_folder/$SteamAppUser/config/yuzu"
|
||||
|
@ -671,11 +671,11 @@ prepare_emulator() {
|
|||
|
||||
if [[ "$emulator" =~ ^(vita3k|Vita3K|all)$ ]]; then
|
||||
if [[ "$action" == "reset" ]]; then # Run reset-only commands
|
||||
echo "----------------------"
|
||||
echo "Initializing Vita3K"
|
||||
echo "----------------------"
|
||||
log i "----------------------"
|
||||
log i "Initializing Vita3K"
|
||||
log i "----------------------"
|
||||
if [[ $multi_user_mode == "true" ]]; then # Multi-user actions
|
||||
echo "Figure out what Vita3k needs for multi-user"
|
||||
log d "Figure out what Vita3k needs for multi-user"
|
||||
else # Single-user actions
|
||||
# NOTE: the emulator is writing in "." so it must be placed in the rw filesystem. A symlink of the binary is already placed in /app/bin/Vita3K
|
||||
rm -rf "/var/data/Vita3K"
|
||||
|
@ -706,9 +706,9 @@ prepare_emulator() {
|
|||
if [[ "$emulator" =~ ^(mame|MAME|all)$ ]]; then
|
||||
# TODO: do a proper script
|
||||
# This is just a placeholder script to test the emulator's flow
|
||||
echo "----------------------"
|
||||
echo "Initializing MAME"
|
||||
echo "----------------------"
|
||||
log i "----------------------"
|
||||
log i "Initializing MAME"
|
||||
log i "----------------------"
|
||||
|
||||
mkdir -p $saves_folder/mame-sa
|
||||
mkdir -p "/var/config/mame"
|
||||
|
@ -723,9 +723,9 @@ prepare_emulator() {
|
|||
if [[ "$emulator" =~ ^(gzdoom|GZDOOM|all)$ ]]; then
|
||||
# TODO: do a proper script
|
||||
# This is just a placeholder script to test the emulator's flow
|
||||
echo "----------------------"
|
||||
echo "Initializing GZDOOM"
|
||||
echo "----------------------"
|
||||
log i "----------------------"
|
||||
log i "Initializing GZDOOM"
|
||||
log i "----------------------"
|
||||
|
||||
mkdir -p "/var/config/gzdoom"
|
||||
mkdir -p "/var/data/gzdoom"
|
||||
|
|
10
retrodeck.sh
10
retrodeck.sh
|
@ -118,7 +118,7 @@ done
|
|||
if [ -f "$lockfile" ]; then
|
||||
# ...but the version doesn't match with the config file
|
||||
if [ "$hard_version" != "$version" ]; then
|
||||
echo "Config file's version is $version but the actual version is $hard_version"
|
||||
log i "Config file's version is $version but the actual version is $hard_version"
|
||||
if grep -qF "cooker" <<< $hard_version; then # If newly-installed version is a "cooker" build
|
||||
configurator_generic_dialog "RetroDECK Cooker Warning" "RUNNING COOKER VERSIONS OF RETRODECK CAN BE EXTREMELY DANGEROUS AND ALL OF YOUR RETRODECK DATA\n(INCLUDING BIOS FILES, BORDERS, DOWNLOADED MEDIA, GAMELISTS, MODS, ROMS, SAVES, STATES, SCREENSHOTS, TEXTURE PACKS AND THEMES)\nARE AT RISK BY CONTINUING!"
|
||||
set_setting_value $rd_conf "update_repo" "RetroDECK-cooker" retrodeck "options"
|
||||
|
@ -132,7 +132,7 @@ if [ -f "$lockfile" ]; then
|
|||
rc=$? # Capture return code, as "Yes" button has no text value
|
||||
if [[ $rc == "1" ]]; then # If any button other than "Yes" was clicked
|
||||
if [[ $choice == "Don't Upgrade" ]]; then # If user wants to bypass the post_update.sh process this time.
|
||||
echo "Skipping upgrade process for cooker build, updating stored version in retrodeck.cfg"
|
||||
log i "Skipping upgrade process for cooker build, updating stored version in retrodeck.cfg"
|
||||
set_setting_value $rd_conf "version" "$hard_version" retrodeck # Set version of currently running RetroDECK to updated retrodeck.cfg
|
||||
elif [[ $choice == "Full Wipe and Fresh Install" ]]; then # Remove all RetroDECK data and start a fresh install
|
||||
if [[ $(configurator_generic_question_dialog "RetroDECK Cooker Reset" "This is going to remove all of the data in all locations used by RetroDECK!\n\n(INCLUDING BIOS FILES, BORDERS, DOWNLOADED MEDIA, GAMELISTS, MODS, ROMS, SAVES, STATES, SCREENSHOTS, TEXTURE PACKS AND THEMES)\n\nAre you sure you want to contine?") == "true" ]]; then
|
||||
|
@ -140,7 +140,7 @@ if [ -f "$lockfile" ]; then
|
|||
if [[ $(configurator_generic_question_dialog "RetroDECK Cooker Reset" "But are you super DUPER sure? We REAAAALLLLLYY want to make sure you know what is happening here.\n\nThe ~/retrodeck and ~/.var/app/net.retrodeck.retrodeck folders and ALL of their contents\nare about to be PERMANENTLY removed.\n\nStill sure you want to proceed?") == "true" ]]; then
|
||||
configurator_generic_dialog "RetroDECK Cooker Reset" "Ok, if you're that sure, here we go!"
|
||||
if [[ $(configurator_generic_question_dialog "RetroDECK Cooker Reset" "(Are you actually being serious here? Because we are...\n\nNo backsies.)") == "true" ]]; then
|
||||
echo "Removing RetroDECK data and starting fresh"
|
||||
log w "Removing RetroDECK data and starting fresh"
|
||||
rm -rf /var
|
||||
rm -rf "$HOME/retrodeck"
|
||||
source /app/libexec/global.sh
|
||||
|
@ -151,7 +151,7 @@ if [ -f "$lockfile" ]; then
|
|||
fi
|
||||
fi
|
||||
else
|
||||
echo "Performing normal upgrade process for version" $cooker_base_version
|
||||
log i "Performing normal upgrade process for version" $cooker_base_version
|
||||
version=$cooker_base_version # Temporarily assign cooker base version to $version so update script can read it properly.
|
||||
post_update
|
||||
fi
|
||||
|
@ -170,7 +170,7 @@ if [ -f "$lockfile" ]; then
|
|||
# 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
|
||||
else
|
||||
echo "Lockfile not found"
|
||||
log w "Lockfile not found"
|
||||
finit # Executing First/Force init
|
||||
fi
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ source /app/libexec/logger.sh
|
|||
|
||||
# Check if a function was specified
|
||||
if [[ $# -lt 1 ]]; then
|
||||
echo "Usage: $0 function_name [args...]"
|
||||
log e "Usage: $0 function_name [args...]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
@ -18,7 +18,7 @@ shift
|
|||
|
||||
# Check if the function exists
|
||||
if ! declare -f "$function_name" >/dev/null 2>&1; then
|
||||
echo "Function '$function_name' not found"
|
||||
log e "Function \'$function_name\' not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
|
Loading…
Reference in a new issue