diff --git a/root/etc/cont-init.d/41-plexdrive-first-run b/root/etc/cont-init.d/41-plexdrive-first-run new file mode 100644 index 0000000..2aa8805 --- /dev/null +++ b/root/etc/cont-init.d/41-plexdrive-first-run @@ -0,0 +1,23 @@ +#!/usr/bin/with-contenv bash + +# If the first run completed successfully, we are done +if [ -e /.firstPlexdriveRunComplete ]; then + exit 0 +fi + +home="$(echo ~plex)" +configSubDir="${home}/${PLEXDRIVE_CONFIG_DIR}" + +# Update ownership of dirs we need to write +if [ "${CHANGE_PLEXDRIVE_CONFIG_DIR_OWNERSHIP,,}" = "true" ]; then + if [ -d "${configSubDir}" ]; then + chown -Rc plex:plex ${configSubDir} + else + echo "Plexdrive config folder does not exist" + fi +fi + +mkdir -p ${PLEXDRIVE_MOUNT_POINT} 2>/dev/null +chown -Rc plex:plex ${PLEXDRIVE_MOUNT_POINT} + +touch /.firstPlexdriveRunComplete diff --git a/root/etc/services.d/plexdrive/finish b/root/etc/services.d/plexdrive/finish new file mode 100644 index 0000000..7a15639 --- /dev/null +++ b/root/etc/services.d/plexdrive/finish @@ -0,0 +1,8 @@ +#!/usr/bin/with-contenv bash + +echo "Stopping Plexdrive" +home="$(echo ~plex)" + +exec s6-setuidgid plex \ + /bin/sh -c \ + "/bin/fusermount -u -z ${PLEXDRIVE_MOUNT_POINT}" diff --git a/root/etc/services.d/plexdrive/run b/root/etc/services.d/plexdrive/run new file mode 100644 index 0000000..1fda4df --- /dev/null +++ b/root/etc/services.d/plexdrive/run @@ -0,0 +1,7 @@ +#!/usr/bin/with-contenv bash + +echo "Starting Plexdrive" + +exec s6-setuidgid plex \ + /bin/sh -c \ + "/usr/local/bin/plexdrive mount -v 2 -c ${HOME}/${PLEXDRIVE_CONFIG_DIR} --cache-file=${HOME}/${PLEXDRIVE_CONFIG_DIR}/cache.bolt -o allow_other ${PLEXDRIVE_MOUNT_POINT}" diff --git a/root/plexdrive-install.sh b/root/plexdrive-install.sh new file mode 100644 index 0000000..ca2e93e --- /dev/null +++ b/root/plexdrive-install.sh @@ -0,0 +1,10 @@ +#!/bin/sh +# Plexdrive updater +cd /tmp +wget $(curl -s https://api.github.com/repos/dweidenfeld/plexdrive/releases/latest | grep 'browser_' | cut -d\" -f4 | grep plexdrive-linux-amd64) -q -O plexdrive +chmod -c +x /tmp/plexdrive +version=$(/tmp/plexdrive --version) +echo "Installing Plexdrive v. ${version}" +#install plexdrive +mv -v /tmp/plexdrive /usr/local/bin/ +chown -c root:root /usr/local/bin/plexdrive