forked from Ivasoft/docker-tvheadend
extract picons during build
This commit is contained in:
20
Dockerfile
20
Dockerfile
@@ -1,5 +1,10 @@
|
|||||||
# syntax=docker/dockerfile:1
|
# syntax=docker/dockerfile:1
|
||||||
|
|
||||||
|
############## picons stage ##############
|
||||||
|
# built by https://github.com/linuxserver/picons-builder
|
||||||
|
FROM ghcr.io/linuxserver/picons-builder as piconsstage
|
||||||
|
|
||||||
|
|
||||||
FROM ghcr.io/linuxserver/baseimage-alpine:3.17 as buildstage
|
FROM ghcr.io/linuxserver/baseimage-alpine:3.17 as buildstage
|
||||||
############## build stage ##############
|
############## build stage ##############
|
||||||
|
|
||||||
@@ -12,8 +17,9 @@ ARG TZ="Etc/UTC"
|
|||||||
ARG TVHEADEND_COMMIT
|
ARG TVHEADEND_COMMIT
|
||||||
ENV HOME="/config"
|
ENV HOME="/config"
|
||||||
|
|
||||||
# copy patches
|
# copy patches and picons
|
||||||
COPY patches/ /tmp/patches/
|
COPY patches/ /tmp/patches/
|
||||||
|
COPY --from=piconsstage /picons.tar.bz2 /picons.tar.bz2
|
||||||
|
|
||||||
RUN \
|
RUN \
|
||||||
echo "**** install build packages ****" && \
|
echo "**** install build packages ****" && \
|
||||||
@@ -211,10 +217,12 @@ RUN \
|
|||||||
make -j 2 && \
|
make -j 2 && \
|
||||||
make DESTDIR=/tmp/comskip-build install
|
make DESTDIR=/tmp/comskip-build install
|
||||||
|
|
||||||
############## picons stage ##############
|
RUN \
|
||||||
# built by https://github.com/linuxserver/picons-builder
|
echo "***** extract picons ****" && \
|
||||||
FROM ghcr.io/linuxserver/picons-builder as piconsstage
|
mkdir -p /picons && \
|
||||||
|
tar xf \
|
||||||
|
/picons.tar.bz2 -C \
|
||||||
|
/picons
|
||||||
|
|
||||||
############## runtime stage ##############
|
############## runtime stage ##############
|
||||||
FROM ghcr.io/linuxserver/baseimage-alpine:3.17
|
FROM ghcr.io/linuxserver/baseimage-alpine:3.17
|
||||||
@@ -313,7 +321,7 @@ COPY --from=buildstage /tmp/tvheadend-build/usr/ /usr/
|
|||||||
COPY --from=buildstage /tmp/xmltv-build/usr/ /usr/
|
COPY --from=buildstage /tmp/xmltv-build/usr/ /usr/
|
||||||
COPY --from=buildstage /usr/local/share/man/ /usr/local/share/man/
|
COPY --from=buildstage /usr/local/share/man/ /usr/local/share/man/
|
||||||
COPY --from=buildstage /usr/local/share/perl5/ /usr/local/share/perl5/
|
COPY --from=buildstage /usr/local/share/perl5/ /usr/local/share/perl5/
|
||||||
COPY --from=piconsstage /picons.tar.bz2 /picons.tar.bz2
|
COPY --from=buildstage /picons /picons
|
||||||
COPY root/ /
|
COPY root/ /
|
||||||
|
|
||||||
# ports and volumes
|
# ports and volumes
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
# syntax=docker/dockerfile:1
|
# syntax=docker/dockerfile:1
|
||||||
|
|
||||||
|
############## picons stage ##############
|
||||||
|
# built by https://github.com/linuxserver/picons-builder
|
||||||
|
FROM ghcr.io/linuxserver/picons-builder as piconsstage
|
||||||
|
|
||||||
|
|
||||||
FROM ghcr.io/linuxserver/baseimage-alpine:arm64v8-3.17 as buildstage
|
FROM ghcr.io/linuxserver/baseimage-alpine:arm64v8-3.17 as buildstage
|
||||||
############## build stage ##############
|
############## build stage ##############
|
||||||
|
|
||||||
@@ -12,8 +17,9 @@ ARG TZ="Etc/UTC"
|
|||||||
ARG TVHEADEND_COMMIT
|
ARG TVHEADEND_COMMIT
|
||||||
ENV HOME="/config"
|
ENV HOME="/config"
|
||||||
|
|
||||||
# copy patches
|
# copy patches and picons
|
||||||
COPY patches/ /tmp/patches/
|
COPY patches/ /tmp/patches/
|
||||||
|
COPY --from=piconsstage /picons.tar.bz2 /picons.tar.bz2
|
||||||
|
|
||||||
RUN \
|
RUN \
|
||||||
echo "**** install build packages ****" && \
|
echo "**** install build packages ****" && \
|
||||||
@@ -211,9 +217,12 @@ RUN \
|
|||||||
make -j 2 && \
|
make -j 2 && \
|
||||||
make DESTDIR=/tmp/comskip-build install
|
make DESTDIR=/tmp/comskip-build install
|
||||||
|
|
||||||
############## picons stage ##############
|
RUN \
|
||||||
# built by https://github.com/linuxserver/picons-builder
|
echo "***** extract picons ****" && \
|
||||||
FROM ghcr.io/linuxserver/picons-builder as piconsstage
|
mkdir -p /picons && \
|
||||||
|
tar xf \
|
||||||
|
/picons.tar.bz2 -C \
|
||||||
|
/picons
|
||||||
|
|
||||||
|
|
||||||
############## runtime stage ##############
|
############## runtime stage ##############
|
||||||
@@ -311,7 +320,7 @@ COPY --from=buildstage /tmp/tvheadend-build/usr/ /usr/
|
|||||||
COPY --from=buildstage /tmp/xmltv-build/usr/ /usr/
|
COPY --from=buildstage /tmp/xmltv-build/usr/ /usr/
|
||||||
COPY --from=buildstage /usr/local/share/man/ /usr/local/share/man/
|
COPY --from=buildstage /usr/local/share/man/ /usr/local/share/man/
|
||||||
COPY --from=buildstage /usr/local/share/perl5/ /usr/local/share/perl5/
|
COPY --from=buildstage /usr/local/share/perl5/ /usr/local/share/perl5/
|
||||||
COPY --from=piconsstage /picons.tar.bz2 /picons.tar.bz2
|
COPY --from=buildstage /picons /picons
|
||||||
COPY root/ /
|
COPY root/ /
|
||||||
|
|
||||||
# ports and volumes
|
# ports and volumes
|
||||||
|
|||||||
@@ -301,6 +301,7 @@ Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64
|
|||||||
|
|
||||||
## Versions
|
## Versions
|
||||||
|
|
||||||
|
* **17.03.23:** - Extract picons during build instead of init.
|
||||||
* **23.02.23:** - Rebase to Alpine 3.17, migrate to s6v3, drop armhf support.
|
* **23.02.23:** - Rebase to Alpine 3.17, migrate to s6v3, drop armhf support.
|
||||||
* **31.08.22:** - Update sample env vars and how RUN_OPTS are handled.
|
* **31.08.22:** - Update sample env vars and how RUN_OPTS are handled.
|
||||||
* **19.08.22:** - Switch to new picons builder.
|
* **19.08.22:** - Switch to new picons builder.
|
||||||
|
|||||||
@@ -123,6 +123,7 @@ app_setup_block: |
|
|||||||
|
|
||||||
# changelog
|
# changelog
|
||||||
changelogs:
|
changelogs:
|
||||||
|
- { date: "17.03.23:", desc: "Extract picons during build instead of init." }
|
||||||
- { date: "23.02.23:", desc: "Rebase to Alpine 3.17, migrate to s6v3, drop armhf support." }
|
- { date: "23.02.23:", desc: "Rebase to Alpine 3.17, migrate to s6v3, drop armhf support." }
|
||||||
- { date: "31.08.22:", desc: "Update sample env vars and how RUN_OPTS are handled." }
|
- { date: "31.08.22:", desc: "Update sample env vars and how RUN_OPTS are handled." }
|
||||||
- { date: "19.08.22:", desc: "Switch to new picons builder." }
|
- { date: "19.08.22:", desc: "Switch to new picons builder." }
|
||||||
|
|||||||
@@ -3,37 +3,28 @@
|
|||||||
|
|
||||||
# make folders
|
# make folders
|
||||||
mkdir -p \
|
mkdir -p \
|
||||||
/config/comskip
|
/config/comskip
|
||||||
|
|
||||||
# copy config
|
# copy config
|
||||||
if [[ ! -e /config/dvr/config ]]; then
|
if [[ ! -e /config/dvr/config ]]; then
|
||||||
(mkdir -p /config/dvr/config && cp /defaults/7a5edfbe189851e5b1d1df19c93962f0 /config/dvr/config/7a5edfbe189851e5b1d1df19c93962f0)
|
(mkdir -p /config/dvr/config && cp /defaults/7a5edfbe189851e5b1d1df19c93962f0 /config/dvr/config/7a5edfbe189851e5b1d1df19c93962f0)
|
||||||
fi
|
fi
|
||||||
if [[ ! -e /config/comskip/comskip.ini ]]; then
|
if [[ ! -e /config/comskip/comskip.ini ]]; then
|
||||||
cp /defaults/comskip.ini.org /config/comskip/comskip.ini
|
cp /defaults/comskip.ini.org /config/comskip/comskip.ini
|
||||||
fi
|
fi
|
||||||
if [[ ! -e /config/config ]]; then
|
if [[ ! -e /config/config ]]; then
|
||||||
(cp /defaults/config /config/config)
|
(cp /defaults/config /config/config)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# extract picons on first run
|
|
||||||
if [[ -f /picons.tar.bz2 ]]; then
|
|
||||||
mkdir -p /picons
|
|
||||||
tar xf \
|
|
||||||
/picons.tar.bz2 -C \
|
|
||||||
/picons &&
|
|
||||||
rm -f /picons.tar.bz2
|
|
||||||
fi
|
|
||||||
|
|
||||||
# function to randomly sample 5 files for their owner and only chown if not abc
|
# function to randomly sample 5 files for their owner and only chown if not abc
|
||||||
chowner () {
|
chowner () {
|
||||||
files=(${1}/*)
|
files=(${1}/*)
|
||||||
for i in {1..5}; do
|
for i in {1..5}; do
|
||||||
user=$(stat -c '%U' $(printf "%s\n" "${files[RANDOM % ${#files[@]}]}"))
|
user=$(stat -c '%U' $(printf "%s\n" "${files[RANDOM % ${#files[@]}]}"))
|
||||||
if [ "${user}" != "abc" ]; then
|
if [ "${user}" != "abc" ]; then
|
||||||
chown -R abc:abc ${1}
|
chown -R abc:abc ${1}
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44,9 +35,9 @@ abc_dirs=( \
|
|||||||
/picons \
|
/picons \
|
||||||
)
|
)
|
||||||
for i in "${abc_dirs[@]}"; do
|
for i in "${abc_dirs[@]}"; do
|
||||||
if [ "$(ls -A ${i})" ]; then
|
if [ "$(ls -A ${i})" ]; then
|
||||||
chowner ${i}
|
chowner ${i}
|
||||||
else
|
else
|
||||||
chown -R abc:abc ${i}
|
chown -R abc:abc ${i}
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|||||||
@@ -5,23 +5,23 @@ FILES=$(find /dev/dri /dev/dvb -type c -print 2>/dev/null)
|
|||||||
|
|
||||||
for i in $FILES
|
for i in $FILES
|
||||||
do
|
do
|
||||||
VIDEO_GID=$(stat -c '%g' "$i")
|
VIDEO_GID=$(stat -c '%g' "$i")
|
||||||
if id -G abc | grep -qw "$VIDEO_GID"; then
|
if id -G abc | grep -qw "$VIDEO_GID"; then
|
||||||
touch /groupadd
|
touch /groupadd
|
||||||
else
|
else
|
||||||
if [ ! "${VIDEO_GID}" == '0' ]; then
|
if [ ! "${VIDEO_GID}" == '0' ]; then
|
||||||
VIDEO_NAME=$(getent group "${VIDEO_GID}" | awk -F: '{print $1}')
|
VIDEO_NAME=$(getent group "${VIDEO_GID}" | awk -F: '{print $1}')
|
||||||
if [ -z "${VIDEO_NAME}" ]; then
|
if [ -z "${VIDEO_NAME}" ]; then
|
||||||
VIDEO_NAME="video$(head /dev/urandom | tr -dc 'a-z0-9' | head -c8)"
|
VIDEO_NAME="video$(head /dev/urandom | tr -dc 'a-z0-9' | head -c8)"
|
||||||
groupadd "$VIDEO_NAME"
|
groupadd "$VIDEO_NAME"
|
||||||
groupmod -g "$VIDEO_GID" "$VIDEO_NAME"
|
groupmod -g "$VIDEO_GID" "$VIDEO_NAME"
|
||||||
fi
|
fi
|
||||||
usermod -a -G "$VIDEO_NAME" abc
|
usermod -a -G "$VIDEO_NAME" abc
|
||||||
touch /groupadd
|
touch /groupadd
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ -n "${FILES}" ] && [ ! -f "/groupadd" ]; then
|
if [ -n "${FILES}" ] && [ ! -f "/groupadd" ]; then
|
||||||
usermod -a -G root abc
|
usermod -a -G root abc
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user