Skip to content

Instantly share code, notes, and snippets.

@oddstr13
Created November 9, 2019 01:19
Show Gist options
  • Save oddstr13/ad70a6fe600f0b66dc5211849dd8e113 to your computer and use it in GitHub Desktop.
Save oddstr13/ad70a6fe600f0b66dc5211849dd8e113 to your computer and use it in GitHub Desktop.
#!/bin/bash
set -e
# Set this to your fork of jellyfin-kodi
#REPO="https://github.com/${USER}/jellyfin-kodi.git"
REPO="[email protected]:${USER}/jellyfin-kodi.git"
# Where to store the repository
PROJECT_PATH="${HOME}/Projects/Jellyfin"
mkdir -p "${PROJECT_PATH}"
pushd "${PROJECT_PATH}"
git clone "${REPO}" jellyfin-kodi
popd
# Configure upstream
pushd "${PROJECT_PATH}/jellyfin-kodi"
git remote add upstream https://github.com/jellyfin/jellyfin-kodi
git fetch --all
git branch --set-upstream-to=upstream/master master
# Prevent direct commits to master branch
cat << EOF > .git/hooks/pre-commit
#!/bin/bash
branch="$(git rev-parse --abbrev-ref HEAD)"
if [[ "$branch" == "master" ]]; then
echo "ERROR: You can't commit directly to the $branch branch."
exit 1
fi
EOF
chmod +x .git/hooks/pre-commit
popd
# Install Kodi addon
mkdir -p "${HOME}/.kodi/addons"
rm -rf "${HOME}/.kodi/addons/plugin.video.jellyfin"
ln -s "${PROJECT_PATH}/jellyfin-kodi" "${HOME}/.kodi/addons/plugin.video.jellyfin"
echo "You can now find the Jellyfin for Kodi repo at '${PROJECT_PATH}/jellyfin-kodi'."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment