Skip to content

Commit

Permalink
Enhance key identification logic to handle missing settings.conf file
Browse files Browse the repository at this point in the history
  • Loading branch information
rix committed Jan 24, 2025
1 parent 241f124 commit 5949efc
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions root/etc/my_init.d/ripper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,19 @@ fi
# settings dir
mkdir -p "$HOME/.MakeMKV"

# identify existing key
CURRENT_KEY=$(grep -oP 'app_Key = "\K[^"]+' "$HOME/.MakeMKV/settings.conf" 2>/dev/null)
if [[ -f "$HOME/.MakeMKV/settings.conf" ]]; then
CURRENT_KEY=$(grep -oP 'app_Key = "\K[^"]+' "$HOME/.MakeMKV/settings.conf" 2>/dev/null)
else
CURRENT_KEY=""
fi

# Grab beta key
BETA_KEY=$(curl --silent 'https://forum.makemkv.com/forum/viewtopic.php?f=5&t=1053' | grep -oP 'T-[\w\d@]{66}')


if [ "$CURRENT_KEY" == "$KEY" ] || [ "$CURRENT_KEY" == "$BETA_KEY" ]; then
echo "Key in settings.conf matches the provided key. Skipping key setup."
if [ -n "$KEY" ] && [ "$CURRENT_KEY" == "$KEY" ] || [ "$CURRENT_KEY" == "$BETA_KEY" ]; then
echo "Key in settings.conf matches the provided key: $CURRENT_KEY"
echo "Skipping key update..."
else
if [ -n "$KEY" ]; then
echo "Using MakeMKV key from ENVIRONMENT variable \$KEY: $KEY"
Expand Down

0 comments on commit 5949efc

Please sign in to comment.