From 9d64ee46367464b949a75fbc70bcbc79163da2dd Mon Sep 17 00:00:00 2001 From: Ryan Kuba Date: Thu, 28 Mar 2019 15:02:54 +0800 Subject: [PATCH] #72 fix chowning (#125) * #72 only chown once using new logic, rebase to alpine 3.9, increase make threads now that arm boxes are single threaded * typo --- Dockerfile | 16 ++++++++-------- Dockerfile.aarch64 | 16 ++++++++-------- Dockerfile.armhf | 16 ++++++++-------- README.md | 1 + readme-vars.yml | 1 + root/etc/cont-init.d/30-config | 30 ++++++++++++++++++++++++++---- 6 files changed, 52 insertions(+), 28 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6e6441d..7bfe791 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM lsiobase/alpine:3.8 as buildstage +FROM lsiobase/alpine:3.9 as buildstage ############## build stage ############## # package versions @@ -137,7 +137,7 @@ RUN \ sed "s/\(lib\/Ask\/Term.pm';\)/.\/\1/" -i Makefile.PL && \ PERL5LIB=`pwd` && \ echo -e "yes" | perl Makefile.PL PREFIX=/usr/ INSTALLDIRS=vendor && \ - make && \ + make -j 2 && \ make test && \ make DESTDIR=/tmp/xmltv-build install @@ -184,7 +184,7 @@ RUN \ --mandir=/usr/share/man \ --prefix=/usr \ --sysconfdir=/config && \ - make && \ + make -j 2 && \ make DESTDIR=/tmp/tvheadend-build install RUN \ @@ -202,7 +202,7 @@ RUN \ cd /tmp/argtable && \ ./configure \ --prefix=/usr && \ - make && \ + make -j 2 && \ make check && \ make DESTDIR=/tmp/argtable-build install && \ echo "**** copy to /usr for comskip dependency ****" && \ @@ -216,11 +216,11 @@ RUN \ ./configure \ --bindir=/usr/bin \ --sysconfdir=/config/comskip && \ - make && \ + make -j 2 && \ make DESTDIR=/tmp/comskip-build install ############## runtime stage ############## -FROM lsiobase/alpine:3.8 +FROM lsiobase/alpine:3.9 # set version label ARG BUILD_DATE @@ -240,11 +240,11 @@ RUN \ ffmpeg \ ffmpeg-libs \ gzip \ - libcrypto1.0 \ + libcrypto1.1 \ libcurl \ libdvbcsa \ libhdhomerun-libs \ - libssl1.0 \ + libssl1.1 \ libva \ libva-intel-driver \ libvpx \ diff --git a/Dockerfile.aarch64 b/Dockerfile.aarch64 index 3a065f4..10bee57 100644 --- a/Dockerfile.aarch64 +++ b/Dockerfile.aarch64 @@ -1,4 +1,4 @@ -FROM lsiobase/alpine:arm64v8-3.8 as buildstage +FROM lsiobase/alpine:arm64v8-3.9 as buildstage ############## build stage ############## # package versions @@ -136,7 +136,7 @@ RUN \ sed "s/\(lib\/Ask\/Term.pm';\)/.\/\1/" -i Makefile.PL && \ PERL5LIB=`pwd` && \ echo -e "yes" | perl Makefile.PL PREFIX=/usr/ INSTALLDIRS=vendor && \ - make && \ + make -j 2 && \ make test && \ make DESTDIR=/tmp/xmltv-build install @@ -182,7 +182,7 @@ RUN \ --mandir=/usr/share/man \ --prefix=/usr \ --sysconfdir=/config && \ - make && \ + make -j 2 && \ make DESTDIR=/tmp/tvheadend-build install RUN \ @@ -200,7 +200,7 @@ RUN \ cd /tmp/argtable && \ ./configure \ --prefix=/usr && \ - make && \ + make -j 2 && \ make check && \ make DESTDIR=/tmp/argtable-build install && \ echo "**** copy to /usr for comskip dependency ****" && \ @@ -214,11 +214,11 @@ RUN \ ./configure \ --bindir=/usr/bin \ --sysconfdir=/config/comskip && \ - make && \ + make -j 2 && \ make DESTDIR=/tmp/comskip-build install ############## runtime stage ############## -FROM lsiobase/alpine:arm64v8-3.8 +FROM lsiobase/alpine:arm64v8-3.9 # set version label ARG BUILD_DATE @@ -238,11 +238,11 @@ RUN \ ffmpeg \ ffmpeg-libs \ gzip \ - libcrypto1.0 \ + libcrypto1.1 \ libcurl \ libdvbcsa \ libhdhomerun-libs \ - libssl1.0 \ + libssl1.1 \ libvpx \ libxml2 \ libxslt \ diff --git a/Dockerfile.armhf b/Dockerfile.armhf index adc2748..b9249dd 100644 --- a/Dockerfile.armhf +++ b/Dockerfile.armhf @@ -1,4 +1,4 @@ -FROM lsiobase/alpine:arm32v7-3.8 as buildstage +FROM lsiobase/alpine:arm32v7-3.9 as buildstage ############## build stage ############## # package versions @@ -136,7 +136,7 @@ RUN \ sed "s/\(lib\/Ask\/Term.pm';\)/.\/\1/" -i Makefile.PL && \ PERL5LIB=`pwd` && \ echo -e "yes" | perl Makefile.PL PREFIX=/usr/ INSTALLDIRS=vendor && \ - make && \ + make -j 2 && \ make test && \ make DESTDIR=/tmp/xmltv-build install @@ -182,7 +182,7 @@ RUN \ --mandir=/usr/share/man \ --prefix=/usr \ --sysconfdir=/config && \ - make && \ + make -j 2 && \ make DESTDIR=/tmp/tvheadend-build install RUN \ @@ -200,7 +200,7 @@ RUN \ cd /tmp/argtable && \ ./configure \ --prefix=/usr && \ - make && \ + make -j 2 && \ make check && \ make DESTDIR=/tmp/argtable-build install && \ echo "**** copy to /usr for comskip dependency ****" && \ @@ -214,11 +214,11 @@ RUN \ ./configure \ --bindir=/usr/bin \ --sysconfdir=/config/comskip && \ - make && \ + make -j 2 && \ make DESTDIR=/tmp/comskip-build install ############## runtime stage ############## -FROM lsiobase/alpine:arm32v7-3.8 +FROM lsiobase/alpine:arm32v7-3.9 # set version label ARG BUILD_DATE @@ -238,11 +238,11 @@ RUN \ ffmpeg \ ffmpeg-libs \ gzip \ - libcrypto1.0 \ + libcrypto1.1 \ libcurl \ libdvbcsa \ libhdhomerun-libs \ - libssl1.0 \ + libssl1.1 \ libvpx \ libxml2 \ libxslt \ diff --git a/README.md b/README.md index d71981d..b09e2a4 100644 --- a/README.md +++ b/README.md @@ -245,6 +245,7 @@ Below are the instructions for updating containers: ## Versions +* **27.03.19:** - Rebase to Alpine 3.9, fix init logic to only chown once. * **23.03.19:** - Switching to new Base images, shift to arm32v7 tag. * **01.03.19:** - Bump xmltv to 0.6.1. * **28.02.19:** - add perl-lwp-useragent-determined. diff --git a/readme-vars.yml b/readme-vars.yml index 556b275..da607b7 100644 --- a/readme-vars.yml +++ b/readme-vars.yml @@ -125,6 +125,7 @@ app_setup_block: | # changelog changelogs: + - { date: "27.03.19:", desc: "Rebase to Alpine 3.9, fix init logic to only chown once." } - { date: "23.03.19:", desc: "Switching to new Base images, shift to arm32v7 tag." } - { date: "01.03.19:", desc: "Bump xmltv to 0.6.1." } - { date: "28.02.19:", desc: "add perl-lwp-useragent-determined." } diff --git a/root/etc/cont-init.d/30-config b/root/etc/cont-init.d/30-config index 6fff236..7f80035 100644 --- a/root/etc/cont-init.d/30-config +++ b/root/etc/cont-init.d/30-config @@ -13,7 +13,29 @@ mkdir -p \ (cp /defaults/config /config/config) -# permissions -chown -R abc:abc \ - /config \ - /picons + +# function to randomly sample 10 files for their owner and only chown if not abc +chowner () { +files=(${1}/*) +for i in {1..10}; do + user=$(stat -c '%U' $(printf "%s\n" "${files[RANDOM % ${#files[@]}]}")) + if [ "${user}" != "abc" ]; then + chown -R abc:abc ${1} + break + fi +done +} + +# permissions +echo "Setting permissions" +abc_dirs=( \ +/config \ +/picons \ +) +for i in "${abc_dirs[@]}"; do + if [ "$(ls -A ${i})" ]; then + chowner ${i} + else + chown -R abc:abc ${i} + fi +done