libreelec-addons/docker.linuxserver.sabnzbd/bin/docker.linuxserver.sabnzbd
2016-12-06 12:35:48 -05:00

33 lines
1.0 KiB
Bash

#!/bin/sh
name="$(basename $0)"
. /etc/profile
. /storage/.cache/timezone
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/sabnzbd"
elif [ "$LEARCHVAR" = "arm" ] || [ "$LEARCHVAR" = "aarch64" ]; then
DOCKERIMAGE="lsioarmhf/sabnzbd"
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_downloads" "$V_incomplete"
chown -R nobody:users "$V_downloads" "$V_incomplete"
docker run --name="$name" \
-e PUID="65534" \
-e PGID="100" \
-e TZ="$TIMEZONE" \
-v "$V_config":/config \
-v "$V_downloads":/downloads \
-v "$V_incomplete":/incomplete-downloads \
-p "$P_port":8080 \
-p "$P_port2":9090 \
"$DOCKERIMAGE":latest