libreelec-addons/docker.linuxserver.couchpotato/bin/docker.linuxserver.couchpotato
2017-01-29 22:24:22 -05:00

38 lines
1.0 KiB
Bash

#!/bin/sh
name="$(basename $0)"
. /etc/profile
if [ -f /storage/.cache/timezone ]; then
. /storage/.cache/timezone
else
TIMEZONE="America/New_York"
fi
oe_setup_addon "$name"
#get arch variable from os
LEARCHVAR=`sed -e '/LIBREELEC_ARCH/ !d' -e 's/[^.]*\.\([^"]*\).*/\1/' /etc/os-release`
#figure out which docker hub image to use
if [ "$LEARCHVAR" = "x86_64" ]; then
DOCKERIMAGE="linuxserver/couchpotato"
elif [ "$LEARCHVAR" = "arm" ] || [ "$LEARCHVAR" = "aarch64" ]; then
DOCKERIMAGE="lsioarmhf/couchpotato"
fi
docker rm "$name" 2>/dev/null
docker pull "$DOCKERIMAGE":latest
docker rmi $(docker images | grep "$DOCKERIMAGE" | grep '<none>' | sed 's/\s\+/\t/g' | cut -f3) 2> /dev/null
mkdir -p "$V_movies" "$V_downloads"
chown -R nobody:users "$V_movies" "$V_downloads"
docker run --name="$name" \
-e PUID="65534" \
-e PGID="100" \
-e TZ="$TIMEZONE" \
-v "$V_config":/config \
-v "$V_movies":/movies \
-v "$V_downloads":/downloads \
-p "$P_port":5050 \
"$DOCKERIMAGE":latest