External modules script

This commit is contained in:
Alexandre
2023-09-09 19:17:08 +02:00
parent 2e1a527f5a
commit f79352608d
83 changed files with 238 additions and 525 deletions

View File

@@ -0,0 +1,33 @@
#!/bin/sh
# shellcheck disable=SC2015
##############################
# Automatic modules download #
##############################
MODULES="$1"
# Install bash if not available
if ! command -v bash >/dev/null 2>/dev/null; then
(apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null
fi
# Install curl if not available
if ! command -v curl >/dev/null 2>/dev/null; then
(apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null
fi
# Install ca-certificates if not available
apt-get update && apt-get install -yqq --no-install-recommends ca-certificates || apk add --no-cache ca-certificates >/dev/null || true
# Create folder for scripts
mkdir -p /etc/cont-init.d
# Download scripts
for scripts in $MODULES; do
echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" &&
[ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] ||
(echo "script failed to install $scripts" && exit 1)
done
chmod -R 755 /etc/cont-init.d

View File

@@ -1,5 +1,9 @@
#!/bin/sh
# shellcheck disable=SC2086, SC2015, SC2013, SC2086
# shellcheck disable=SC2013,SC2016,SC2236
#############################
# Modify global lsio images #
#############################
# Set variable
CONFIGLOCATION="$1"
@@ -28,7 +32,7 @@ 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
if [ -f "$file" ] && [ ! -z "$(awk '/chown.*abc:abc.*\\/,/.*\/config( |$)/{print FILENAME}' "$file")" ]; then
sed -i "s|/config$|/data|g" "$file"
fi
done