mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-01-11 02:11:01 +01:00
Correct LSIO logic
This commit is contained in:
@@ -26,29 +26,24 @@ ENV S6_CMD_WAIT_FOR_SERVICES=1 \
|
||||
S6_CMD_WAIT_FOR_SERVICES_MAXTIME=0 \
|
||||
S6_SERVICES_GRACETIME=0
|
||||
|
||||
# hadolint ignore=DL4006,SC2013
|
||||
# Global LSIO modifications
|
||||
ARG CONFIGLOCATION="/data/organizr"
|
||||
# hadolint ignore=SC2015, SC2013
|
||||
RUN \
|
||||
########################################
|
||||
# Correct upstream image folders links #
|
||||
########################################
|
||||
# Avoid custom-init.d duplications
|
||||
grep -sril "Potential tampering with custom" /etc/cont-init.d /etc/s6-overlay/s6-rc.d | xargs -r rm \
|
||||
for file in $(grep -sril 'Potential tampering with custom' /etc/cont-init.d /etc/services.d /etc/s6-overlay/s6-rc.d); do rm -f "$file"; done \
|
||||
\
|
||||
# Prevent changing ownership of /config
|
||||
#&& grep -sril "/config" /etc/cont-init.d /etc/s6-overlay/s6-rc.d | xargs grep -riL "/config/" | xargs -r rm \
|
||||
&& if [ -f /etc/cont-init.d/10-adduser ]; then sed -i "/chown abc:abc \/config$/d" /etc/cont-init.d/10-adduser; fi \
|
||||
# Create new config folder if needed
|
||||
&& for file in $(grep -srl "PUID:-911" /etc/cont-init.d /etc/s6-overlay/s6-rc.d); do sed -i "1a mkdir -p $CONFIGLOCATION" "$file"; done \
|
||||
\
|
||||
# Allow UID and GID setting
|
||||
&& for file in $(grep -srl "PUID:-911" /etc/cont-init.d /etc/s6-overlay/s6-rc.d); do \
|
||||
sed -i 's/bash/bashio/g' "$file" && \
|
||||
sed -i 's/{PUID:-911}/(bashio::config "PUID")/g' "$file" && \
|
||||
sed -i 's/{PGID:-911}/(bashio::config "PGID")/g' "$file"; done \
|
||||
&& for file in $(grep -srl "PUID:-911" /etc/cont-init.d /etc/s6-overlay/s6-rc.d); do sed -i 's/bash/bashio/g' "$file" && sed -i 's/{PUID:-911}/(bashio::config "PUID")/g' "$file" && sed -i 's/{PGID:-911}/(bashio::config "PGID")/g' "$file"; done \
|
||||
\
|
||||
# Allow custom config folder
|
||||
&& grep -rl '/config' /defaults/ | xargs sed -i 's|/config|/data/organizr|g' \
|
||||
&& grep -rl '/config' /etc/cont-init.d/ | xargs sed -i 's|/config|/data/organizr|g' \
|
||||
&& grep -rl '/config' /etc/logrotate.d/ | xargs sed -i 's|/config|/data/organizr|g' \
|
||||
&& grep -rl '/config' /etc/services.d/ | xargs sed -i 's|/config|/data/organizr|g'
|
||||
# Correct config location
|
||||
&& for file in $(grep -Esril '/config[ /]|/config$' /etc/logrotate.d /defaults /etc/cont-init.d /etc/services.d /etc/s6-overlay/s6-rc.d); do sed -i "s=/config=$CONFIGLOCATION=g" "$file"; done \
|
||||
\
|
||||
# Avoid changing /config permissions
|
||||
&& for file in $(grep -srl "chown abc:abc \/config" /etc/cont-init.d /etc/s6-overlay/s6-rc.d); do sed -i "/chown abc:abc \/config/d" "$file"; done
|
||||
|
||||
##################
|
||||
# 3 Install apps #
|
||||
|
||||
Reference in New Issue
Block a user