jsaddiction / TrailerTech

Download Trailers for you movies
MIT License
13 stars 4 forks source link

Updating Failed #40

Closed fraser-mendeco closed 2 years ago

fraser-mendeco commented 2 years ago

Hi,

I noticed trailers weren't being downloaded any more. Looking in the logs when starting up Radarr I get the following:

********** UPDATING TrailerTech **********
Failed to update local repo. ERROR: fatal: unsafe repository ('/config/scripts/TrailerTech' is owned by someone else)
To add an exception for this directory, call:

    git config --global --add safe.directory /config/scripts/TrailerTech
********** Setting Permissions for TrailerTechnician **********
********* Installing TrailerTech Dependencies **********
[custom-init] Install_TrailerTech.sh: exited 0
[cont-init.d] 99-custom-scripts: exited 0.
[cont-init.d] done.

Here's my Install_TrailerTech.sh

#!/bin/bash

#### USER SETTINGS
# installDirectory: can not be a root directory default: /config/scripts/TrailerTech
# PUID is the id of the user who will be calling this script. Uncomment and set to appropriate values if KodiLibrarian files have wrong uid set
# PGID same as PUID but for group
installDirectory="/config/scripts/TrailerTech"
# ${PUID}=1234
# ${PGID}=1234

### Scripts variables
parentDir="$(dirname ${installDirectory})"
requirementsFile="${installDirectory}/requirements.txt"
## ubuntu/ Debian based part
if [[ -n "$(command -v apt-get)" ]]; then
   apt update -yq
   install="git python3 python3-pip ffmpeg"
   for i in ${install}; do
       echo "********** INSTALLING $i **********"
       apt install $i -yq
   done   
fi
## alpine install 
if [[ -n "$(command -v apk)" ]]; then
   apk -qU --no-cache update
   apk -qU --no-cache upgrade
   install="git python3 python3-pip ffmpeg"
   for i in ${install}; do
       echo "********** INSTALLING $i **********"
       apk -qU --no-cache --no-progres add $i
   done
fi

if [ ! -d ${parentDir} ]
then
    echo "*********** Creating script parent directory ************"
    error=$(mkdir -p ${parentDir} 2>&1) || { echo "Failed to create script parent directory ${parentDir}. ERROR: ${error}" ; exit 1; }
    error=$(chmod -R ug+rw ${parentDir} 2>&1) || { echo "Failed to set permissions on ${parentDir}. ERROR: ${error}" ; exit 1; }
fi

### Clone TrailerTech or update if already exists
if [ ! -d ${installDirectory} ]
then
    echo "********** CLONING TrailerTech **********"
    error=$(git clone https://github.com/jsaddiction/TrailerTech.git ${installDirectory} 2>&1) || { echo "Failed to clone repo into ${installDirectory}. ERROR: ${error}" ; exit 1; }
else
    echo "********** UPDATING TrailerTech **********"
    error=$(git -C ${installDirectory} pull 2>&1) || { echo "Failed to update local repo. ERROR: ${error}" ; }
fi

### Set permissions and install dependancies
echo "********** Setting Permissions for TrailerTechnician **********"
error=$(chown -R ${PUID}:${PGID} ${installDirectory} 2>&1) || { echo "Failed to set ownership on ${installDirectory}. ERROR: ${error}" ; }
error=$(chmod -R 775 ${installDirectory} 2>&1) || { echo "Failed to set permissions on ${installDirectory}. ERROR: ${error}" ; exit 1;}

echo "********** Installing TrailerTech Dependencies **********"
error=$(python3 -m pip install -r ${requirementsFile} 2>&1) || { echo "Failed to install dependencies. ERROR: ${error}" ; exit 1; }

Any help appreciated!

jsaddiction commented 2 years ago

The problem is listed in your log output. For now I don't have a confirmed fix.

Basically what has happened (from what I understand so far): GIT has forced its users to declare a directory as "safe". Essentially I own it and you are using it. GIT wants you to declare this repo as "safe" by running that command listed in your error log.

Quick work around: Since you are using the script I am going to assume you are running RADARR within a docker container.

  1. Open a terminal and ssh into your host running Radarr and issue the command docker exec -it radarr /bin/bash replace "radarr" if your container is named something else. This will connect you to a terminal instance within the container.

  2. Then run git config --global --add safe.directory /config/scripts/TrailerTech This should add that that repo to GIT's safe list.

  3. Then just to check that it works, cd into TrailerTech's install directory and run git pull which should update this script to the latest which adds yt-dlp functionality speeding up your trailer download speeds.

This fix will not persist container rebuilds.
I am working on fixing the install_TrailerTech.sh script so that it can be done for you restoring previous usability.

jsaddiction commented 2 years ago

OK just kidding.. I made some changes to the install_TrailerTech.sh script which includes a "working for me" addition. Please update your install script and try again, then report back here with your test results. Hopefully it works out for you!

fraser-mendeco commented 2 years ago

That seems to have fixed it. Thanks for the quick turnaround!