Skip to content

Instantly share code, notes, and snippets.

@CvH
Created May 15, 2018 18:05
Show Gist options
  • Save CvH/00d9810b32537d10333b3dd2b0335834 to your computer and use it in GitHub Desktop.
Save CvH/00d9810b32537d10333b3dd2b0335834 to your computer and use it in GitHub Desktop.
#!/bin/sh
################################################################################
# This file is part of LibreELEC - https://libreelec.tv
# Copyright (C) 2018-present Team LibreELEC
#
# LibreELEC is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# LibreELEC is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with LibreELEC. If not, see <http://www.gnu.org/licenses/>.
################################################################################
. /etc/profile
oe_setup_addon service.emby
# set version to use
if [ -z "$1" ]; then
# if no input
echo -e "\nUsage:"
echo -e "${0##*/} 3.4.1.0"
echo -e "${0##*/} latest"
echo -e "\n====== last releases ======"
curl --silent "https://api.github.com/repos/MediaBrowser/Emby/releases" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/' | head -n 20
echo -e "==========================="
exit 0
# if input = latest
elif [ "$1" = "latest" ]; then
EMBY_VERSION=$(curl --silent "https://api.github.com/repos/MediaBrowser/Emby/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
echo "latest is $EMBY_VERSION"
read -p "continue (y/n)? " EMBY_CONT
if [ $EMBY_CONT = "Y" ] || [ $EMBY_CONT = "y" ]; then
echo ""
else
exit 0
fi
# if input = 1.2.3.4
else
EMBY_VERSION="$1"
fi
echo "1. stopping Emby service" && sleep 1
systemctl stop service.emby
echo "2. download Emby version $EMBY_VERSION" && sleep 1
rm -f /storage/.kodi/temp/Emby.Mono.zip
curl --progress-bar --fail -L -o /storage/.kodi/temp/Emby.Mono.zip https://github.com/MediaBrowser/Emby/releases/download/$EMBY_VERSION/Emby.Mono.zip || exit 1
echo "3. removing old install" && sleep 1
rm -rf $ADDON_DIR/Emby.Mono/*
echo "4. extracting Emby" && sleep 1
unzip -q /storage/.kodi/temp/Emby.Mono.zip -d $ADDON_DIR/Emby.Mono
sed -i 's/libMagickWand-6./libMagickWand-7./g' \
$ADDON_DIR/Emby.Mono/ImageMagickSharp.dll.config
sed -i 's/libsqlite3.so/libsqlite3.so.0/g' \
$ADDON_DIR/Emby.Mono/SQLitePCLRaw.provider.sqlite3.dll.config
echo "5. restarting Emby service" && sleep 1
systemctl start service.emby
echo "... done"
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment