From 21e6d52b46d1b62217543304a69d8caa5f733ac9 Mon Sep 17 00:00:00 2001 From: aptalca Date: Mon, 15 Jul 2019 21:52:26 -0400 Subject: [PATCH] install heimdall during first run --- Dockerfile | 10 ++-------- Dockerfile.aarch64 | 12 +++--------- Dockerfile.armhf | 12 +++--------- root/etc/cont-init.d/50-config | 13 +++++++++++++ 4 files changed, 21 insertions(+), 26 deletions(-) diff --git a/Dockerfile b/Dockerfile index 4031c32..e522330 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,20 +21,14 @@ RUN \ tar && \ echo "**** install heimdall ****" && \ mkdir -p \ - /var/www/localhost/heimdall && \ + /heimdall && \ if [ -z ${HEIMDALL_RELEASE+x} ]; then \ HEIMDALL_RELEASE=$(curl -sX GET "https://api.github.com/repos/linuxserver/Heimdall/commits/master" \ | awk '/sha/{print $4;exit}' FS='[""]'); \ fi && \ curl -o \ - /tmp/heimdall.tar.gz -L \ + /heimdall/heimdall.tar.gz -L \ "https://github.com/linuxserver/Heimdall/archive/${HEIMDALL_RELEASE}.tar.gz" && \ - tar xf \ - /tmp/heimdall.tar.gz -C \ - /var/www/localhost/heimdall --strip-components=1 && \ - echo "**** configure nginx ****" && \ - echo -e '\n# Heimdall user authorization\nfastcgi_param PHP_AUTH_USER $remote_user;\nfastcgi_param PHP_AUTH_PW $http_authorization;' >> \ - /etc/nginx/fastcgi_params && \ echo "**** cleanup ****" && \ rm -rf \ /tmp/* diff --git a/Dockerfile.aarch64 b/Dockerfile.aarch64 index 7322f30..395f7de 100644 --- a/Dockerfile.aarch64 +++ b/Dockerfile.aarch64 @@ -21,20 +21,14 @@ RUN \ tar && \ echo "**** install heimdall ****" && \ mkdir -p \ - /var/www/localhost/heimdall && \ + /heimdall && \ if [ -z ${HEIMDALL_RELEASE+x} ]; then \ HEIMDALL_RELEASE=$(curl -sX GET "https://api.github.com/repos/linuxserver/Heimdall/commits/master" \ - | awk '/sha/{print $4;exit}' FS='[""]'); \ + | awk '/sha/{print $4;exit}' FS='[""]'); \ fi && \ curl -o \ - /tmp/heimdall.tar.gz -L \ + /heimdall/heimdall.tar.gz -L \ "https://github.com/linuxserver/Heimdall/archive/${HEIMDALL_RELEASE}.tar.gz" && \ - tar xf \ - /tmp/heimdall.tar.gz -C \ - /var/www/localhost/heimdall --strip-components=1 && \ - echo "**** configure nginx ****" && \ - echo -e '\n# Heimdall user authorization\nfastcgi_param PHP_AUTH_USER $remote_user;\nfastcgi_param PHP_AUTH_PW $http_authorization;' >> \ - /etc/nginx/fastcgi_params && \ echo "**** cleanup ****" && \ rm -rf \ /tmp/* diff --git a/Dockerfile.armhf b/Dockerfile.armhf index 80f0764..ffbc714 100644 --- a/Dockerfile.armhf +++ b/Dockerfile.armhf @@ -21,20 +21,14 @@ RUN \ tar && \ echo "**** install heimdall ****" && \ mkdir -p \ - /var/www/localhost/heimdall && \ + /heimdall && \ if [ -z ${HEIMDALL_RELEASE+x} ]; then \ HEIMDALL_RELEASE=$(curl -sX GET "https://api.github.com/repos/linuxserver/Heimdall/commits/master" \ - | awk '/sha/{print $4;exit}' FS='[""]'); \ + | awk '/sha/{print $4;exit}' FS='[""]'); \ fi && \ curl -o \ - /tmp/heimdall.tar.gz -L \ + /heimdall/heimdall.tar.gz -L \ "https://github.com/linuxserver/Heimdall/archive/${HEIMDALL_RELEASE}.tar.gz" && \ - tar xf \ - /tmp/heimdall.tar.gz -C \ - /var/www/localhost/heimdall --strip-components=1 && \ - echo "**** configure nginx ****" && \ - echo -e '\n# Heimdall user authorization\nfastcgi_param PHP_AUTH_USER $remote_user;\nfastcgi_param PHP_AUTH_PW $http_authorization;' >> \ - /etc/nginx/fastcgi_params && \ echo "**** cleanup ****" && \ rm -rf \ /tmp/* diff --git a/root/etc/cont-init.d/50-config b/root/etc/cont-init.d/50-config index 95b2cb4..2b42b61 100644 --- a/root/etc/cont-init.d/50-config +++ b/root/etc/cont-init.d/50-config @@ -3,8 +3,20 @@ # make our folders mkdir -p \ /config/www/{backgrounds,icons,avatars,SupportedApps} \ + /var/www/localhost/heimdall \ /config/log/heimdall +# install heimdall if necessary +[[ -f /heimdall/heimdall.tar.gz ]] && \ + echo "New container detected, installing Heimdall" && \ + tar xf \ + /heimdall/heimdall.tar.gz -C \ + /var/www/localhost/heimdall --strip-components=1 && \ + echo -e '\n# Heimdall user authorization\nfastcgi_param PHP_AUTH_USER $remote_user;\nfastcgi_param PHP_AUTH_PW $http_authorization;' >> \ + /etc/nginx/fastcgi_params && \ + rm -rf /heimdall && \ + chown -R abc:abc /var/www/localhost/heimdall + # create symlinks symlinks=( \ @@ -29,6 +41,7 @@ done # copy .env if not exists [[ ! -f /config/www/.env ]] && \ cp /var/www/localhost/heimdall/.env.example /config/www/.env && \ + echo "generating app key" php /var/www/localhost/heimdall/artisan key:generate # set queue driver to database sed -i 's/QUEUE_DRIVER=sync/QUEUE_DRIVER=database/' /config/www/.env