From 0ed3207e20a5bb694b9b6f84ae7daf9c589bc274 Mon Sep 17 00:00:00 2001 From: sparklyballs Date: Sat, 28 Jan 2017 10:31:44 +0000 Subject: [PATCH] blah --- Dockerfile | 10 ++++-- .../lychee/.user.ini => defaults/user.ini} | 0 root/etc/cont-init.d/40-config | 36 ++++++++++--------- 3 files changed, 27 insertions(+), 19 deletions(-) rename root/{usr/share/webapps/lychee/.user.ini => defaults/user.ini} (100%) diff --git a/Dockerfile b/Dockerfile index 0a703b9..c28483c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,7 +7,6 @@ ARG VERSION LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}" # package version -ARG LYCHEE_VERSION="3.1.5" ARG PHP_IMAGICK_VER="3.4.2" # install build packages @@ -35,14 +34,19 @@ RUN \ php7-session \ php7-zip && \ +# install lychee mkdir -p \ /usr/share/webapps/lychee && \ + lychee_tag=$(curl -sX GET "https://api.github.com/repos/electerious/Lychee/releases/latest" \ + | awk '/tag_name/{print $4;exit}' FS='[""]') && \ curl -o \ /tmp/lychee.tar.gz -L \ - "https://github.com/electerious/Lychee/archive/v${LYCHEE_VERSION}.tar.gz" && \ + "https://github.com/electerious/Lychee/archive/${lychee_tag}.tar.gz" && \ tar xf \ /tmp/lychee.tar.gz -C \ /usr/share/webapps/lychee --strip-components=1 && \ + if [ -e /usr/share/webapps/lychee/.user.ini ]; then rm /usr/share/webapps/lychee/.user.ini; fi && \ + # install php imagemagick mkdir -p \ /tmp/imagick-src && \ @@ -72,4 +76,4 @@ COPY root/ / # ports and volumes EXPOSE 80 -VOLUME /config +VOLUME /config /pictures diff --git a/root/usr/share/webapps/lychee/.user.ini b/root/defaults/user.ini similarity index 100% rename from root/usr/share/webapps/lychee/.user.ini rename to root/defaults/user.ini diff --git a/root/etc/cont-init.d/40-config b/root/etc/cont-init.d/40-config index 7a1c81e..64a771d 100644 --- a/root/etc/cont-init.d/40-config +++ b/root/etc/cont-init.d/40-config @@ -1,26 +1,30 @@ #!/usr/bin/with-contenv bash -# make symlinks -[[ ! -e /var/www/localhost/lychee ]] && \ +# create our folders + mkdir -p \ + /config/lychee \ + /pictures/{big,import,medium,thumb} + +# copy config +[[ ! -e /config/lychee/user.ini ]] && \ + cp /defaults/user.ini /config/lychee/user.ini +cp /config/lychee/user.ini /usr/share/webapps/lychee/.user.ini + +# create symlinks +[[ ! -L /var/www/localhost/lychee ]] && \ ln -s /usr/share/webapps/lychee /var/www/localhost/lychee - -[[ ! -e /config/lychee/data ]] - mkdir -p /config/lychee && \ - cp -R /usr/share/webapps/lychee/data /config/lychee && \ - rm -rf /usr/share/webapps/lychee/data - -[[ ! -e /config/lychee/uploads ]] - cp -R /usr/share/webapps/lychee/uploads /config/lychee && \ +[[ -d /usr/share/webapps/lychee/uploads ]] && \ rm -rf /usr/share/webapps/lychee/uploads - -[[ ! -e /usr/share/webapps/lychee/data ]] -ln -s /config/lychee/data /usr/share/webapps/lychee/data - -[[ ! -e /usr/share/webapps/lychee/uploads ]] -ln -s /config/lychee/uploads /usr/share/webapps/lychee/uploads +[[ ! -L /usr/share/webapps/lychee/uploads ]] && \ + ln -s /pictures /usr/share/webapps/lychee/uploads +[[ -d /usr/share/webapps/lychee/data ]] && \ + rm -rf /usr/share/webapps/lychee/data +[[ ! -L /usr/share/webapps/lychee/data ]] + ln -s /config/lychee /usr/share/webapps/lychee/data # permissions chown -R abc:abc \ /config \ + /pictures \ /usr/share/webapps/lychee \ /var/www/localhost/lychee