mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-01-10 09:51:02 +01:00
ha_lsio external script
This commit is contained in:
@@ -28,29 +28,10 @@ ENV S6_CMD_WAIT_FOR_SERVICES=1 \
|
||||
S6_CMD_WAIT_FOR_SERVICES_MAXTIME=0 \
|
||||
S6_SERVICES_GRACETIME=0
|
||||
|
||||
|
||||
# Global LSIO modifications
|
||||
ADD --chmod=744 "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/ha_lsio.sh" "/ha_lsio.sh"
|
||||
ARG CONFIGLOCATION="/share/grav"
|
||||
# hadolint ignore=SC2015, SC2013, SC2086
|
||||
RUN \
|
||||
# Avoid custom-init.d duplications
|
||||
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 \
|
||||
\
|
||||
# Create new config folder if needed
|
||||
&& for file in $(grep -srl "PUID" /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" /etc/cont-init.d /etc/s6-overlay/s6-rc.d); do sed -i 's/bash/bashio/g' $file && sed -i '1a PUID="$(if bashio::config.has_value "PUID"; then bashio::config "PUID"; else echo "0"; fi)"' $file && sed -i '1a PGID="$(if bashio::config.has_value "PGID"; then bashio::config "PGID"; else echo "0"; fi)"' $file; done \
|
||||
\
|
||||
# Correct config location
|
||||
&& for file in $(grep -Esril "/config[ '\"/]|/config\$" /etc /defaults); do sed -Ei "s=(/config)+(/| |$|\"|\')=$CONFIGLOCATION\2=g" $file; done \
|
||||
\
|
||||
# Avoid chmod /config
|
||||
&& for file in /etc/services.d/*/* /etc/cont-init.d/* /etc/s6-overlay/s6-rc.d/*/*;do if [ -f $file ] && [[ ! -z $(awk '/chown.*abc:abc.*\\/,/.*\/config( |$)/{print FILENAME}' $file) ]] ; then sed -i "s|/config$|/data|g" $file; fi ;done \
|
||||
|
||||
\
|
||||
# Replace lsiown if not found
|
||||
&& if [ ! -f /usr/bin/lsiown ]; then for file in $(grep -sril "lsiown" /etc); do sed -i "s|lsiown|chown|g" $file; done; fi
|
||||
RUN if grep -qr "lsio" /etc, then /ha_lsio.sh "$CONFIGLOCATION"; fi
|
||||
|
||||
##################
|
||||
# 3 Install apps #
|
||||
|
||||
Reference in New Issue
Block a user