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 Feb 1, 2025
1 parent 5949efc commit 09aff14
Showing 1 changed file with 31 additions and 10 deletions.
41 changes: 31 additions & 10 deletions root/etc/my_init.d/ripper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,44 @@ 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}')

# Ensure KEY is set to the beta key if not provided
if [ -z "$KEY" ]; then
KEY=$BETA_KEY
echo "No custom key provided. Using MakeMKV beta key: $KEY"
else
echo "Using MakeMKV key from ENVIRONMENT variable \$KEY: $KEY"
fi

if [ -n "$KEY" ] && [ "$CURRENT_KEY" == "$KEY" ] || [ "$CURRENT_KEY" == "$BETA_KEY" ]; then
# Check the current key in settings.conf
CURRENT_KEY=$(grep -oP '(?<=app_Key = ").*(?=")' "$HOME/.MakeMKV/settings.conf" 2>/dev/null || echo "")

if [ "$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"
else
KEY=$BETA_KEY
echo "Using MakeMKV beta key: $KEY"
fi
# this sets the license key
echo "Updating MakeMKV registration key..."
# Ensure the directory exists
mkdir -p ~/.MakeMKV

# Update the license key in settings.conf
echo app_Key = "\"$KEY"\" >"$HOME/.MakeMKV/settings.conf"
# this might be optional:
makemkvcon reg "$KEY"
echo "MakeMKV key updated successfully."
fi

# Ensure full permissions on makemkv config
chmod -R 777 ~/.MakeMKV
# Run registration every time
echo "Executing: makemkvcon reg $KEY"
# DO NOT PUT THIS IN DOUBLE QUOTES; ELSE IT WILL FAIL
makemkvcon reg $KEY
# Show content of settings.conf
echo "Showing content of $HOME/.MakeMKV/settings.conf"
cat "$HOME/.MakeMKV/settings.conf"


# Log current registration status
makemkvcon info | grep -i "registration"

# move abcde.conf, if found
if [[ -f /config/abcde.conf ]]; then
echo "Found abcde.conf."
Expand Down

0 comments on commit 09aff14

Please sign in to comment.