mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-07-04 04:58:46 +02:00
External modules script
This commit is contained in:
33
.templates/ha_automodules.sh
Normal file
33
.templates/ha_automodules.sh
Normal 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
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user