Merge pull request #1689 from ayushtiwari134/ayushtiwari134-1655

fix: resolve config.env directory issue in free_games_claimer add-on (#1655)
This commit is contained in:
Alexandre
2024-12-29 14:57:43 +01:00
committed by GitHub
2 changed files with 6 additions and 9 deletions

View File

@@ -93,6 +93,6 @@
"slug": "free_games_claimer", "slug": "free_games_claimer",
"udev": true, "udev": true,
"url": "https://github.com/alexbelgium/hassio-addons", "url": "https://github.com/alexbelgium/hassio-addons",
"version": "1.6-5", "version": "1.6-6",
"webui": "[PROTO:ssl]://[HOST]:[PORT:6080]" "webui": "[PROTO:ssl]://[HOST]:[PORT:6080]"
} }

View File

@@ -19,9 +19,12 @@ else
bashio::log.info "Using existing config.env file in $CONFIG_HOME. Please customize according to https://github.com/vogler/free-games-claimer/tree/main#configuration--options and restart the add-on" bashio::log.info "Using existing config.env file in $CONFIG_HOME. Please customize according to https://github.com/vogler/free-games-claimer/tree/main#configuration--options and restart the add-on"
fi fi
# Remove erroneous folder named config.env # Remove erroneous folder named config.env (bug fix for looping issue)
if [ -d "$CONFIG_HOME/config.env" ]; then if [ -d "$CONFIG_HOME/config.env" ]; then
rm -r "$CONFIG_HOME/config.env" bashio::log.warning "Found directory named config.env, deleting it..."
rm -rf "$CONFIG_HOME/config.env" # Fix: Ensures directory removal even if it exists
cp /templates/config.env "$CONFIG_HOME/config.env" # Recreate as a valid file
chmod 755 "$CONFIG_HOME/config.env"
fi fi
# Copy new file # Copy new file
@@ -58,28 +61,22 @@ cd /data || true
# Fetch commands # Fetch commands
CMD_ARGUMENTS="$(bashio::config "CMD_ARGUMENTS")" CMD_ARGUMENTS="$(bashio::config "CMD_ARGUMENTS")"
IFS=';' IFS=';'
# shellcheck disable=SC2162
read -a strarr <<< "$CMD_ARGUMENTS" read -a strarr <<< "$CMD_ARGUMENTS"
# Sanitizes commands # Sanitizes commands
trim() { trim() {
local var="$*" local var="$*"
# remove leading whitespace characters
var="${var#"${var%%[![:space:]]*}"}" var="${var#"${var%%[![:space:]]*}"}"
# remove trailing whitespace characters
var="${var%"${var##*[![:space:]]}"}" var="${var%"${var##*[![:space:]]}"}"
printf '%s' "$var" printf '%s' "$var"
} }
# Add docker-entrypoint command # Add docker-entrypoint command
# Print each value of the array by using the loop
for val in "${strarr[@]}"; do for val in "${strarr[@]}"; do
#Removes whitespaces
val="$(trim "$val")" val="$(trim "$val")"
echo " " echo " "
bashio::log.info "Starting the app with arguments \"$val\"" bashio::log.info "Starting the app with arguments \"$val\""
echo " " echo " "
# shellcheck disable=SC2086
echo "$val" | xargs docker-entrypoint.sh || true echo "$val" | xargs docker-entrypoint.sh || true
done done