fix: auto-fix linting issues

This commit is contained in:
alexbelgium
2025-07-23 08:58:09 +00:00
committed by github-actions[bot]
parent 3539f328fb
commit f5428e0950
224 changed files with 5663 additions and 5662 deletions

View File

@@ -7,31 +7,31 @@ set -e
# Automatic modules download #
##############################
if [ -e "/MODULESFILE" ]; then
MODULES=$(</MODULESFILE)
MODULES=$(< /MODULESFILE)
MODULES="${MODULES:-00-banner.sh}"
echo "Executing modules script : $MODULES"
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 &&
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 &&
apt-get update && apt-get install -yqq --no-install-recommends ca-certificates || apk add --no-cache ca-certificates >/dev/null || true &&
mkdir -p /etc/cont-init.d &&
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
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 \
&& 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 \
&& apt-get update && apt-get install -yqq --no-install-recommends ca-certificates || apk add --no-cache ca-certificates > /dev/null || true \
&& mkdir -p /etc/cont-init.d \
&& 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
fi
#######################
# Automatic installer #
#######################
if [ -e "/ENVFILE" ]; then
PACKAGES=$(</ENVFILE)
PACKAGES=$(< /ENVFILE)
echo "Executing dependency script with custom elements : $PACKAGES"
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 &&
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 &&
curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/ha_automatic_packages.sh" --output /ha_automatic_packages.sh &&
chmod 777 /ha_automatic_packages.sh &&
eval /./ha_automatic_packages.sh "${PACKAGES:-}" &&
rm /ha_automatic_packages.sh
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 \
&& 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 \
&& curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/ha_automatic_packages.sh" --output /ha_automatic_packages.sh \
&& chmod 777 /ha_automatic_packages.sh \
&& eval /./ha_automatic_packages.sh "${PACKAGES:-}" \
&& rm /ha_automatic_packages.sh
fi
if [ -e "/MODULESFILE" ] && [ ! -f /ha_entrypoint.sh ]; then

View File

@@ -5,7 +5,7 @@ set -e
# Displays a simple add-on banner on startup
# ==============================================================================
if ! bashio::supervisor.ping 2>/dev/null; then
if ! bashio::supervisor.ping 2> /dev/null; then
# Degraded mode if no homeassistant
bashio::log.blue \
'-----------------------------------------------------------'
@@ -67,7 +67,7 @@ bashio::log.blue \
# ==============================================================================
# Global actions for all addons
# ==============================================================================
if bashio::config.has_value "PUID" && bashio::config.has_value "PGID" && id abc &>/dev/null; then
if bashio::config.has_value "PUID" && bashio::config.has_value "PGID" && id abc &> /dev/null; then
bashio::log.green ' Defining permissions for main user : '
PUID="$(bashio::config "PUID")"
PGID="$(bashio::config "PGID")"
@@ -81,4 +81,4 @@ if bashio::config.has_value "PUID" && bashio::config.has_value "PGID" && id abc
fi
# Clean bashrc file safely
if [ -f ~/.bashrc ]; then : >~/.bashrc; fi
if [ -f ~/.bashrc ]; then : > ~/.bashrc; fi

View File

@@ -2,7 +2,7 @@
# shellcheck shell=bash
set -e
if ! bashio::supervisor.ping 2>/dev/null; then
if ! bashio::supervisor.ping 2> /dev/null; then
echo "..."
exit 0
fi
@@ -91,26 +91,26 @@ for KEYS in "${arr[@]}"; do
# shellcheck disable=SC2163
export "$line"
# export to python
if command -v "python3" &>/dev/null; then
[ ! -f /env.py ] && echo "import os" >/env.py
if command -v "python3" &> /dev/null; then
[ ! -f /env.py ] && echo "import os" > /env.py
# Escape \
VALUEPY="${VALUE//\\/\\\\}"
# Avoid " and '
VALUEPY="${VALUEPY//[\"\']/}"
echo "os.environ['${KEYS}'] = '$VALUEPY'" >>/env.py
echo "os.environ['${KEYS}'] = '$VALUEPY'" >> /env.py
python3 /env.py
fi
# set .env
echo "$line" >>/.env || true
echo "$line" >> /.env || true
# set /etc/environment
mkdir -p /etc
echo "$line" >>/etc/environment
echo "$line" >> /etc/environment
# For non s6
if cat /etc/services.d/*/*run* &>/dev/null; then sed -i "1a export $line" /etc/services.d/*/*run* 2>/dev/null; fi
if cat /etc/cont-init.d/*run* &>/dev/null; then sed -i "1a export $line" /etc/cont-init.d/*run* 2>/dev/null; fi
if cat /etc/services.d/*/*run* &> /dev/null; then sed -i "1a export $line" /etc/services.d/*/*run* 2> /dev/null; fi
if cat /etc/cont-init.d/*run* &> /dev/null; then sed -i "1a export $line" /etc/cont-init.d/*run* 2> /dev/null; fi
# For s6
if [ -d /var/run/s6/container_environment ]; then printf "%s" "${VALUE}" >/var/run/s6/container_environment/"${KEYS}"; fi
echo "export ${KEYS}='${VALUE}'" >>~/.bashrc
if [ -d /var/run/s6/container_environment ]; then printf "%s" "${VALUE}" > /var/run/s6/container_environment/"${KEYS}"; fi
echo "export ${KEYS}='${VALUE}'" >> ~/.bashrc
fi
done
@@ -122,6 +122,6 @@ set +eu
if [ -n "$TZ" ] && [ -f /etc/localtime ]; then
if [ -f /usr/share/zoneinfo/"$TZ" ]; then
echo "Timezone set from $(cat /etc/timezone) to $TZ"
ln -snf /usr/share/zoneinfo/"$TZ" /etc/localtime && echo "$TZ" >/etc/timezone
ln -snf /usr/share/zoneinfo/"$TZ" /etc/localtime && echo "$TZ" > /etc/timezone
fi
fi

View File

@@ -2,7 +2,7 @@
# shellcheck shell=bash
set -e
if ! bashio::supervisor.ping 2>/dev/null; then
if ! bashio::supervisor.ping 2> /dev/null; then
echo "..."
exit 0
fi
@@ -15,8 +15,8 @@ fi
if bashio::config.has_value 'localdisks'; then
# Available devices
blkid | awk '{print substr($1, 0, length($1) - 1)}' | awk -F'/' '{print $NF}' >availabledisks
echo "NAME" >>availabledisks
blkid | awk '{print substr($1, 0, length($1) - 1)}' | awk -F'/' '{print $NF}' > availabledisks
echo "NAME" >> availabledisks
## List available Disk with Labels and Id
bashio::log.blue "---------------------------------------------------"
@@ -26,7 +26,7 @@ if bashio::config.has_value 'localdisks'; then
rm availabledisks
# Show support fs https://github.com/dianlight/hassio-addons/blob/2e903184254617ac2484fe7c03a6e33e6987151c/sambanas/rootfs/etc/s6-overlay/s6-rc.d/init-automount/run#L106
fstypessupport=$(grep -v nodev </proc/filesystems | awk '{$1=" "$1}1' | tr -d '\n\t')
fstypessupport=$(grep -v nodev < /proc/filesystems | awk '{$1=" "$1}1' | tr -d '\n\t')
bashio::log.green "Supported fs : ${fstypessupport}"
bashio::log.green "Inspired from : github.com/dianlight"
bashio::log.blue "---------------------------------------------------"
@@ -99,8 +99,8 @@ if bashio::config.has_value 'localdisks'; then
if [ -d /share/"$disk" ]; then dirpath="/share"; fi
# shellcheck disable=SC2015
mount -t $type "$devpath"/"$disk" "$dirpath"/"$disk" -o $options && bashio::log.info "Success! $disk mounted to /mnt/$disk" ||
(
mount -t $type "$devpath"/"$disk" "$dirpath"/"$disk" -o $options && bashio::log.info "Success! $disk mounted to /mnt/$disk" \
|| (
bashio::log.fatal "Unable to mount local drives! Please check the name."
rmdir /mnt/"$disk"
bashio::addon.stop

View File

@@ -3,7 +3,7 @@
# shellcheck disable=
set -e
if ! bashio::supervisor.ping 2>/dev/null; then
if ! bashio::supervisor.ping 2> /dev/null; then
bashio::log.blue "Disabled : please use another method"
exit 0
fi
@@ -52,7 +52,7 @@ mount_drive() {
MOUNTOPTIONS="$1"
# Try mounting
mount -t cifs -o "$MOUNTOPTIONS" "$disk" /mnt/"$diskname" 2>ERRORCODE || MOUNTED=false
mount -t cifs -o "$MOUNTOPTIONS" "$disk" /mnt/"$diskname" 2> ERRORCODE || MOUNTED=false
# Test if succesful
if [[ "$MOUNTED" == "true" ]]; then
@@ -152,8 +152,8 @@ if bashio::config.has_value 'networkdisks'; then
# Does server exists
output="$(nmap -F $server -T5 -oG -)"
if ! echo "$output" | grep 445/open &>/dev/null; then
if echo "$output" | grep /open &>/dev/null; then
if ! echo "$output" | grep 445/open &> /dev/null; then
if echo "$output" | grep /open &> /dev/null; then
bashio::log.fatal "...... $server is reachable but SMB port not opened, stopping script"
touch ERRORCODE
continue
@@ -172,7 +172,7 @@ if bashio::config.has_value 'networkdisks'; then
bashio::log.fatal "...... incorrect Username, Password, or Domain! Script will stop."
touch ERRORCODE
# Should there be a workgroup
if ! smbclient -t 2 -L $disk -N $DOMAINCLIENT -c "exit" &>/dev/null; then
if ! smbclient -t 2 -L $disk -N $DOMAINCLIENT -c "exit" &> /dev/null; then
bashio::log.fatal "...... perhaps a workgroup must be specified"
touch ERRORCODE
fi
@@ -191,7 +191,7 @@ if bashio::config.has_value 'networkdisks'; then
# Extracting SMB versions and normalize output
# shellcheck disable=SC2210,SC2094
SMBVERS="$(nmap --script smb-protocols "$server" -p 445 2>1 | awk '/ [0-9]/' | awk '{print $NF}' | cut -c -3 | sort -V | tail -n 1 || true)"
SMBVERS="$(nmap --script smb-protocols "$server" -p 445 2> 1 | awk '/ [0-9]/' | awk '{print $NF}' | cut -c -3 | sort -V | tail -n 1 || true)"
# Avoid :
SMBVERS="${SMBVERS/:/.}"
# Manage output
@@ -216,7 +216,7 @@ if bashio::config.has_value 'networkdisks'; then
esac
echo "...... SMB version detected : $SMBVERS"
SMBVERS=",vers=$SMBVERS"
elif smbclient -t 2 -L "$server" -m NT1 -N $DOMAINCLIENT &>/dev/null; then
elif smbclient -t 2 -L "$server" -m NT1 -N $DOMAINCLIENT &> /dev/null; then
echo "...... SMB version : only SMBv1 is supported, this can lead to issues"
SECVERS=",sec=ntlm"
SMBVERS=",vers=1.0"
@@ -266,10 +266,10 @@ if bashio::config.has_value 'networkdisks'; then
PGID=""
CHARSET=""
mount_drive "rw,file_mode=0775,dir_mode=0775,username=${USERNAME},password=${PASSWORD},nobrl${SMBVERS}${SECVERS}${PUID}${PGID}${CHARSET}${DOMAIN}"
bashio::log.fatal "Error read : $(<ERRORCODE), addon will stop in 1 min"
bashio::log.fatal "Error read : $(< ERRORCODE), addon will stop in 1 min"
# clean folder
umount "/mnt/$diskname" 2>/dev/null || true
umount "/mnt/$diskname" 2> /dev/null || true
rmdir "/mnt/$diskname" || true
# Stop addon

View File

@@ -6,7 +6,7 @@
##################
# Disable if config not present
if [ ! -d /config ] || ! bashio::supervisor.ping 2>/dev/null; then
if [ ! -d /config ] || ! bashio::supervisor.ping 2> /dev/null; then
echo "..."
exit 0
fi
@@ -76,7 +76,7 @@ fi
if [[ "$CONFIGSOURCE" == *".yaml" ]]; then
echo "Setting permissions for the config.yaml directory"
mkdir -p "$(dirname "${CONFIGSOURCE}")"
chmod -R 755 "$(dirname "${CONFIGSOURCE}")" 2>/dev/null
chmod -R 755 "$(dirname "${CONFIGSOURCE}")" 2> /dev/null
fi
####################
@@ -115,7 +115,7 @@ cp "$CONFIGSOURCE" /tempenv
sed -i '/^#/d' /tempenv
sed -i '/^[[:space:]]*$/d' /tempenv
sed -i '/^$/d' /tempenv
echo "" >>/tempenv
echo "" >> /tempenv
# Exit if empty
if [ ! -s /tempenv ]; then
@@ -125,7 +125,7 @@ fi
# Check if yaml is valid
EXIT_CODE=0
yamllint -d relaxed /tempenv &>ERROR || EXIT_CODE=$?
yamllint -d relaxed /tempenv &> ERROR || EXIT_CODE=$?
if [ "$EXIT_CODE" != 0 ]; then
cat ERROR
bashio::log.yellow "... config file has an invalid yaml format. Please check the file in $CONFIGSOURCE. Errors list above."
@@ -174,29 +174,29 @@ while IFS= read -r line; do
line="${KEYS}=${VALUE}"
export "$line"
# export to python
if command -v "python3" &>/dev/null; then
[ ! -f /env.py ] && echo "import os" >/env.py
if command -v "python3" &> /dev/null; then
[ ! -f /env.py ] && echo "import os" > /env.py
# Escape single quotes in VALUE
VALUE_ESCAPED="${VALUE//\'/\'\"\'\"\'}"
echo "os.environ['${KEYS}'] = '${VALUE_ESCAPED}'" >>/env.py
echo "os.environ['${KEYS}'] = '${VALUE_ESCAPED}'" >> /env.py
python3 /env.py
fi
# set .env
echo "$line" >>/.env
echo "$line" >> /.env
# set environment
mkdir -p /etc
echo "$line" >>/etc/environment
echo "$line" >> /etc/environment
# Export to scripts
if cat /etc/services.d/*/*run* &>/dev/null; then sed -i "1a export $line" /etc/services.d/*/*run* 2>/dev/null; fi
if cat /etc/cont-init.d/*run* &>/dev/null; then sed -i "1a export $line" /etc/cont-init.d/*run* 2>/dev/null; fi
if cat /etc/services.d/*/*run* &> /dev/null; then sed -i "1a export $line" /etc/services.d/*/*run* 2> /dev/null; fi
if cat /etc/cont-init.d/*run* &> /dev/null; then sed -i "1a export $line" /etc/cont-init.d/*run* 2> /dev/null; fi
# For s6
if [ -d /var/run/s6/container_environment ]; then printf "%s" "${VALUE}" >/var/run/s6/container_environment/"${KEYS}"; fi
echo "export $line" >>~/.bashrc
if [ -d /var/run/s6/container_environment ]; then printf "%s" "${VALUE}" > /var/run/s6/container_environment/"${KEYS}"; fi
echo "export $line" >> ~/.bashrc
# Show in log
if ! bashio::config.false "verbose"; then bashio::log.blue "$line"; fi
else
bashio::log.red "Skipping line that does not follow the correct structure: $line"
fi
done <"/tempenv"
done < "/tempenv"
rm /tempenv

View File

@@ -7,7 +7,7 @@ set -e
##################
# Exit if /config is not mounted or HA not used
if [ ! -d /config ] || ! bashio::supervisor.ping 2>/dev/null; then
if [ ! -d /config ] || ! bashio::supervisor.ping 2> /dev/null; then
echo "..."
exit 0
fi
@@ -42,7 +42,7 @@ if [ ! -f "$CONFIGSOURCE" ]; then
fi
# Convert scripts to linux
dos2unix "$CONFIGSOURCE" &>/dev/null || true
dos2unix "$CONFIGSOURCE" &> /dev/null || true
chmod +x "$CONFIGSOURCE"
# Get current shebang, if not available use another
@@ -63,4 +63,4 @@ while IFS= read -r line; do
/."$CONFIGSOURCE"
break
fi
done <"$CONFIGSOURCE"
done < "$CONFIGSOURCE"

View File

@@ -12,7 +12,7 @@ if [ -f "${JSONTOCHECK}" ]; then
echo "Checking settings.json format"
# Check if json file valid or not
jq . -S "${JSONTOCHECK}" &>/dev/null && ERROR=false || ERROR=true
jq . -S "${JSONTOCHECK}" &> /dev/null && ERROR=false || ERROR=true
if [ "$ERROR" = true ]; then
bashio::log.fatal "Settings.json structure is abnormal, restoring options from scratch. Your old file is renamed as settings.json_old"
mv "${JSONSOURCE}" "${JSONSOURCE}"_old
@@ -39,7 +39,7 @@ if [ -f "${JSONTOCHECK}" ]; then
done
# Show structure in a nice way
jq . -S "${JSONTOCHECK}" | cat >temp.json && mv temp.json "${JSONTOCHECK}"
jq . -S "${JSONTOCHECK}" | cat > temp.json && mv temp.json "${JSONTOCHECK}"
# Message
bashio::log.info "Your settings.json was checked and seems perfectly normal!"

View File

@@ -16,7 +16,7 @@ if bashio::config.true "ingress_disabled"; then
# Create index.html
touch /etc/ingress.html
cat >/etc/ingress.html <<EOF
cat > /etc/ingress.html << EOF
<!DOCTYPE html>
<html>
<head>

View File

@@ -18,7 +18,7 @@ if bashio::config.has_value 'DNS_server'; then
# shellcheck disable=SC2086
for server in ${DNSSERVER//,/ }; do # Separate comma separated values
# Only add DNS if successful
if ping -c 1 "$server" &>/dev/null; then
if ping -c 1 "$server" &> /dev/null; then
DNS="${DNS}nameserver $server\n"
DNSLIST="$server $DNSLIST"
else
@@ -31,7 +31,7 @@ if bashio::config.has_value 'DNS_server'; then
if [[ -n "${DNS:-}" ]]; then
# Write resolv.conf
# shellcheck disable=SC2059
printf "${DNS}" >/etc/resolv.conf
printf "${DNS}" > /etc/resolv.conf
chmod 644 /etc/resolv.conf
bashio::log.info "DNS SERVERS set to $DNSLIST"
else

View File

@@ -8,7 +8,7 @@ set -e
if bashio::config.true 'silent'; then
APPEND=' > /dev/null'
sed -i '$s|$|'"$APPEND"'|' /etc/services.d/*/run &>/dev/null || true
sed -i '$s|$|'"$APPEND"'|' /etc/cont-init.d/*/*run* &>/dev/null || true
sed -i '$s|$|'"$APPEND"'|' /etc/services.d/*/run &> /dev/null || true
sed -i '$s|$|'"$APPEND"'|' /etc/cont-init.d/*/*run* &> /dev/null || true
bashio::log.info 'Silent mode activated, all logs from emby server are hidden. Disable this option if you need to troubleshoot the addon.'
fi

View File

@@ -14,9 +14,9 @@ if bashio::config.has_value "graphic_driver"; then
# Get installer type
if [ -f /usr/bin/apt ]; then
bashio::log.info "... Distribution detected : Debian/Ubuntu"
apt-get install -yqq software-properties-common >/dev/null
add-apt-repository ppa:kisak/kisak-mesa >/dev/null
apt-get update >/dev/null
apt-get install -yqq software-properties-common > /dev/null
add-apt-repository ppa:kisak/kisak-mesa > /dev/null
apt-get update > /dev/null
apt-get install -yqq mesa
elif [ -f /usr/bin/apk ]; then
bashio::log.info "... Distribution detected : Alpine"
@@ -24,7 +24,7 @@ if bashio::config.has_value "graphic_driver"; then
# Detect GPU
# shellcheck disable=SC2207
GPU_DETECTED=($(lshw -c display -json 2>/dev/null | jq -r '.[].configuration.driver'))
GPU_DETECTED=($(lshw -c display -json 2> /dev/null | jq -r '.[].configuration.driver'))
bashio::log.info "... GPU detected: ${GPU_DETECTED[*]}"
graphic_driver=""
@@ -56,27 +56,27 @@ if bashio::config.has_value "graphic_driver"; then
case "$graphic_driver" in
x64_AMD)
if [[ "$BUILD_ARCH" != amd64 ]]; then bashio::log.fatal "Wrong architecture, $graphic_driver doesn't support $BUILD_ARCH"; fi
[ -f /usr/bin/apt ] && DOCKER_MODS=linuxserver/mods:jellyfin-amd && run_mods >/dev/null && bashio::log.green "... done"
[ -f /usr/bin/apk ] && apk add --no-cache mesa-dri-classic mesa-vdpau-gallium linux-firmware-radeon >/dev/null && bashio::log.green "... done"
[ -f /usr/bin/apt ] && DOCKER_MODS=linuxserver/mods:jellyfin-amd && run_mods > /dev/null && bashio::log.green "... done"
[ -f /usr/bin/apk ] && apk add --no-cache mesa-dri-classic mesa-vdpau-gallium linux-firmware-radeon > /dev/null && bashio::log.green "... done"
;;
x64_NVIDIA)
if [[ "$BUILD_ARCH" != amd64 ]]; then bashio::log.fatal "Wrong architecture, $graphic_driver doesn't support $BUILD_ARCH"; fi
[ -f /usr/bin/apk ] && apk add --no-cache linux-firmware-radeon >/dev/null && bashio::log.green "... done"
[ -f /usr/bin/apt ] && apt-get -yqq install libcuda1 libnvcuvid1 libnvidia-encode1 nvidia-opencl-icd nvidia-vdpau-driver nvidia-driver-libs nvidia-kernel-dkms libva2 vainfo libva-wayland2 >/dev/null && bashio::log.green "... done"
[ -f /usr/bin/apk ] && apk add --no-cache linux-firmware-radeon > /dev/null && bashio::log.green "... done"
[ -f /usr/bin/apt ] && apt-get -yqq install libcuda1 libnvcuvid1 libnvidia-encode1 nvidia-opencl-icd nvidia-vdpau-driver nvidia-driver-libs nvidia-kernel-dkms libva2 vainfo libva-wayland2 > /dev/null && bashio::log.green "... done"
;;
x64_Intel)
if [[ "$BUILD_ARCH" != amd64 ]]; then bashio::log.fatal "Wrong architecture, $graphic_driver doesn't support $BUILD_ARCH"; fi
[ -f /usr/bin/apk ] && apk add --no-cache opencl mesa-dri-gallium mesa-vulkan-intel mesa-dri-intel intel-media-driver >/dev/null && bashio::log.green "... done"
[ -f /usr/bin/apt ] && DOCKER_MODS=linuxserver/mods:jellyfin-opencl-intel && run_mods && apt-get -yqq install intel-opencl-icd intel-media-va-driver-non-free i965-va-driver-shaders mesa-va-drivers libmfx1 libva2 vainfo libva-wayland2 >/dev/null && bashio::log.green "... done"
[ -f /usr/bin/apk ] && apk add --no-cache opencl mesa-dri-gallium mesa-vulkan-intel mesa-dri-intel intel-media-driver > /dev/null && bashio::log.green "... done"
[ -f /usr/bin/apt ] && DOCKER_MODS=linuxserver/mods:jellyfin-opencl-intel && run_mods && apt-get -yqq install intel-opencl-icd intel-media-va-driver-non-free i965-va-driver-shaders mesa-va-drivers libmfx1 libva2 vainfo libva-wayland2 > /dev/null && bashio::log.green "... done"
;;
aarch64_rpi)
if [[ "$BUILD_ARCH" != arm64 ]]; then bashio::log.fatal "Wrong architecture, $graphic_driver doesn't support $BUILD_ARCH"; fi
bashio::log.info "Installing Rpi graphic drivers"
[ -f /usr/bin/apk ] && apk add --no-cache mesa-dri-vc4 mesa-dri-swrast mesa-gbm xf86-video-fbdev >/dev/null && bashio::log.green "... done"
[ -f /usr/bin/apt ] && apt-get -yqq install libgles2-mesa libgles2-mesa-dev xorg-dev >/dev/null && bashio::log.green "... done"
[ -f /usr/bin/apk ] && apk add --no-cache mesa-dri-vc4 mesa-dri-swrast mesa-gbm xf86-video-fbdev > /dev/null && bashio::log.green "... done"
[ -f /usr/bin/apt ] && apt-get -yqq install libgles2-mesa libgles2-mesa-dev xorg-dev > /dev/null && bashio::log.green "... done"
;;
esac
@@ -131,8 +131,8 @@ if bashio::config.has_value "graphic_driver"; then
curl -f --retry 10 --retry-max-time 60 --retry-connrefused \
--silent \
--header 'GET' \
"${AUTH_URL}" |
jq -r '.token'
"${AUTH_URL}" \
| jq -r '.token'
)"
# Determine first and only layer of image
SHALAYER=$(get_blob_sha "${MODE}" "${TOKEN}" "${MANIFEST_URL}")
@@ -163,7 +163,7 @@ if bashio::config.has_value "graphic_driver"; then
shopt -u dotglob
rm -rf /tmp/mod
rm -rf /modtarball.tar.xz
echo "${SHALAYER}" >"/${FILENAME}"
echo "${SHALAYER}" > "/${FILENAME}"
echo "[mod-init] ${DOCKER_MOD} applied to container"
fi
done

View File

@@ -10,13 +10,13 @@ PACKAGES="$1"
echo "To install : $PACKAGES"
# Install bash if needed
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
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 needed
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
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
# Call apps installer script if needed

View File

@@ -8,11 +8,11 @@ set -e
#Verbose or not
VERBOSE=false
#Avoid fails on non declared variables
set +u 2>/dev/null || true
set +u 2> /dev/null || true
#If no packages, empty
PACKAGES="${*:-}"
#Avoids messages if non interactive
(echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections) &>/dev/null || true
(echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections) &> /dev/null || true
[ "$VERBOSE" = true ] && echo "ENV : $PACKAGES"
@@ -20,15 +20,15 @@ PACKAGES="${*:-}"
# CHECK WHICH BASE IS USED #
############################
if command -v "apk" &>/dev/null; then
if command -v "apk" &> /dev/null; then
# If apk based
[ "$VERBOSE" = true ] && echo "apk based"
PACKMANAGER="apk"
elif command -v "apt" &>/dev/null; then
elif command -v "apt" &> /dev/null; then
# If apt-get based
[ "$VERBOSE" = true ] && echo "apt based"
PACKMANAGER="apt"
elif command -v "pacman" &>/dev/null; then
elif command -v "pacman" &> /dev/null; then
# If apt-get based
[ "$VERBOSE" = true ] && echo "pacman based"
PACKMANAGER="pacman"
@@ -49,16 +49,16 @@ PACKAGES="$PACKAGES jq curl ca-certificates"
# Scripts
for files in "/etc/cont-init.d" "/etc/services.d"; do
# Next directory if does not exists
if ! ls $files 1>/dev/null 2>&1; then continue; fi
if ! ls $files 1> /dev/null 2>&1; then continue; fi
# Test each possible command
COMMAND="nginx"
if grep -q -rnw "$files/" -e "$COMMAND" && ! command -v $COMMAND &>/dev/null; then
if grep -q -rnw "$files/" -e "$COMMAND" && ! command -v $COMMAND &> /dev/null; then
[ "$VERBOSE" = true ] && echo "$COMMAND required"
[ "$PACKMANAGER" = "apk" ] && PACKAGES="$PACKAGES nginx"
[ "$PACKMANAGER" = "apt" ] && PACKAGES="$PACKAGES nginx"
[ "$PACKMANAGER" = "pacman" ] && PACKAGES="$PACKAGES nginx"
if ls /etc/nginx 1>/dev/null 2>&1; then mv /etc/nginx /etc/nginx2; fi
if ls /etc/nginx 1> /dev/null 2>&1; then mv /etc/nginx /etc/nginx2; fi
fi
COMMAND="mount"
@@ -70,7 +70,7 @@ for files in "/etc/cont-init.d" "/etc/services.d"; do
fi
COMMAND="ping"
if grep -q -rnw "$files/" -e "$COMMAND" && ! command -v $COMMAND &>/dev/null; then
if grep -q -rnw "$files/" -e "$COMMAND" && ! command -v $COMMAND &> /dev/null; then
[ "$VERBOSE" = true ] && echo "$COMMAND required"
[ "$PACKMANAGER" = "apk" ] && PACKAGES="$PACKAGES iputils"
[ "$PACKMANAGER" = "apt" ] && PACKAGES="$PACKAGES iputils-ping"
@@ -94,7 +94,7 @@ for files in "/etc/cont-init.d" "/etc/services.d"; do
fi
COMMAND="smbclient"
if grep -q -rnw "$files/" -e "$COMMAND" && ! command -v $COMMAND &>/dev/null; then
if grep -q -rnw "$files/" -e "$COMMAND" && ! command -v $COMMAND &> /dev/null; then
[ "$VERBOSE" = true ] && echo "$COMMAND required"
[ "$PACKMANAGER" = "apk" ] && PACKAGES="$PACKAGES samba samba-client ntfs-3g"
[ "$PACKMANAGER" = "apt" ] && PACKAGES="$PACKAGES samba smbclient ntfs-3g"
@@ -102,7 +102,7 @@ for files in "/etc/cont-init.d" "/etc/services.d"; do
fi
COMMAND="dos2unix"
if grep -q -rnw "$files/" -e "$COMMAND" && ! command -v $COMMAND &>/dev/null; then
if grep -q -rnw "$files/" -e "$COMMAND" && ! command -v $COMMAND &> /dev/null; then
[ "$VERBOSE" = true ] && echo "$COMMAND required"
[ "$PACKMANAGER" = "apk" ] && PACKAGES="$PACKAGES dos2unix"
[ "$PACKMANAGER" = "apt" ] && PACKAGES="$PACKAGES dos2unix"
@@ -110,7 +110,7 @@ for files in "/etc/cont-init.d" "/etc/services.d"; do
fi
COMMAND="openvpn"
if grep -q -rnw "$files/" -e "$COMMAND" && ! command -v $COMMAND &>/dev/null; then
if grep -q -rnw "$files/" -e "$COMMAND" && ! command -v $COMMAND &> /dev/null; then
[ "$VERBOSE" = true ] && echo "$COMMAND required"
[ "$PACKMANAGER" = "apk" ] && PACKAGES="$PACKAGES coreutils openvpn"
[ "$PACKMANAGER" = "apt" ] && PACKAGES="$PACKAGES coreutils openvpn"
@@ -118,7 +118,7 @@ for files in "/etc/cont-init.d" "/etc/services.d"; do
fi
COMMAND="jq"
if grep -q -rnw "$files/" -e "$COMMAND" && ! command -v $COMMAND &>/dev/null; then
if grep -q -rnw "$files/" -e "$COMMAND" && ! command -v $COMMAND &> /dev/null; then
[ "$VERBOSE" = true ] && echo "$COMMAND required"
[ "$PACKMANAGER" = "apk" ] && PACKAGES="$PACKAGES jq"
[ "$PACKMANAGER" = "apt" ] && PACKAGES="$PACKAGES jq"
@@ -126,7 +126,7 @@ for files in "/etc/cont-init.d" "/etc/services.d"; do
fi
COMMAND="yamllint"
if grep -q -rnw "$files/" -e "$COMMAND" && ! command -v $COMMAND &>/dev/null; then
if grep -q -rnw "$files/" -e "$COMMAND" && ! command -v $COMMAND &> /dev/null; then
[ "$VERBOSE" = true ] && echo "$COMMAND required"
[ "$PACKMANAGER" = "apk" ] && PACKAGES="$PACKAGES yamllint"
[ "$PACKMANAGER" = "apt" ] && PACKAGES="$PACKAGES yamllint"
@@ -134,7 +134,7 @@ for files in "/etc/cont-init.d" "/etc/services.d"; do
fi
COMMAND="git"
if grep -q -rnw "$files/" -e "$COMMAND" && ! command -v $COMMAND &>/dev/null; then
if grep -q -rnw "$files/" -e "$COMMAND" && ! command -v $COMMAND &> /dev/null; then
[ "$VERBOSE" = true ] && echo "$COMMAND required"
[ "$PACKMANAGER" = "apk" ] && PACKAGES="$PACKAGES git"
[ "$PACKMANAGER" = "apt" ] && PACKAGES="$PACKAGES git"
@@ -142,7 +142,7 @@ for files in "/etc/cont-init.d" "/etc/services.d"; do
fi
COMMAND="sponge"
if grep -q -rnw "$files/" -e "$COMMAND" && ! command -v $COMMAND &>/dev/null; then
if grep -q -rnw "$files/" -e "$COMMAND" && ! command -v $COMMAND &> /dev/null; then
[ "$VERBOSE" = true ] && echo "$COMMAND required"
[ "$PACKMANAGER" = "apk" ] && PACKAGES="$PACKAGES moreutils"
[ "$PACKMANAGER" = "apt" ] && PACKAGES="$PACKAGES moreutils"
@@ -150,7 +150,7 @@ for files in "/etc/cont-init.d" "/etc/services.d"; do
fi
COMMAND="sqlite3"
if grep -q -rnw "$files/" -e "$COMMAND" && ! command -v $COMMAND &>/dev/null; then
if grep -q -rnw "$files/" -e "$COMMAND" && ! command -v $COMMAND &> /dev/null; then
[ "$VERBOSE" = true ] && echo "$COMMAND required"
[ "$PACKMANAGER" = "apk" ] && PACKAGES="$PACKAGES sqlite"
[ "$PACKMANAGER" = "apt" ] && PACKAGES="$PACKAGES sqlite3"
@@ -158,7 +158,7 @@ for files in "/etc/cont-init.d" "/etc/services.d"; do
fi
COMMAND="pip"
if grep -q -rnw "$files/" -e "$COMMAND" && ! command -v $COMMAND &>/dev/null; then
if grep -q -rnw "$files/" -e "$COMMAND" && ! command -v $COMMAND &> /dev/null; then
[ "$VERBOSE" = true ] && echo "$COMMAND required"
[ "$PACKMANAGER" = "apk" ] && PACKAGES="$PACKAGES py3-pip"
[ "$PACKMANAGER" = "apt" ] && PACKAGES="$PACKAGES pip"
@@ -166,7 +166,7 @@ for files in "/etc/cont-init.d" "/etc/services.d"; do
fi
COMMAND="wget"
if grep -q -rnw "$files/" -e "$COMMAND" && ! command -v $COMMAND &>/dev/null; then
if grep -q -rnw "$files/" -e "$COMMAND" && ! command -v $COMMAND &> /dev/null; then
[ "$VERBOSE" = true ] && echo "$COMMAND required"
[ "$PACKMANAGER" = "apk" ] && PACKAGES="$PACKAGES wget"
[ "$PACKMANAGER" = "apt" ] && PACKAGES="$PACKAGES wget"
@@ -181,29 +181,29 @@ done
# Install apps
[ "$VERBOSE" = true ] && echo "installing packages $PACKAGES"
if [ "$PACKMANAGER" = "apt" ]; then apt-get update >/dev/null; fi
if [ "$PACKMANAGER" = "pacman" ]; then pacman -Sy >/dev/null; fi
if [ "$PACKMANAGER" = "apt" ]; then apt-get update > /dev/null; fi
if [ "$PACKMANAGER" = "pacman" ]; then pacman -Sy > /dev/null; fi
# Install apps one by one to allow failures
# shellcheck disable=SC2086
for packagestoinstall in $PACKAGES; do
[ "$VERBOSE" = true ] && echo "... $packagestoinstall"
if [ "$PACKMANAGER" = "apk" ]; then
apk add --no-cache "$packagestoinstall" &>/dev/null || (echo "Error : $packagestoinstall not found" && touch /ERROR)
apk add --no-cache "$packagestoinstall" &> /dev/null || (echo "Error : $packagestoinstall not found" && touch /ERROR)
elif [ "$PACKMANAGER" = "apt" ]; then
apt-get install -yqq --no-install-recommends "$packagestoinstall" &>/dev/null || (echo "Error : $packagestoinstall not found" && touch /ERROR)
apt-get install -yqq --no-install-recommends "$packagestoinstall" &> /dev/null || (echo "Error : $packagestoinstall not found" && touch /ERROR)
elif [ "$PACKMANAGER" = "pacman" ]; then
pacman --noconfirm -S "$packagestoinstall" &>/dev/null || (echo "Error : $packagestoinstall not found" && touch /ERROR)
pacman --noconfirm -S "$packagestoinstall" &> /dev/null || (echo "Error : $packagestoinstall not found" && touch /ERROR)
fi
[ "$VERBOSE" = true ] && echo "... $packagestoinstall done"
done
# Clean after install
[ "$VERBOSE" = true ] && echo "Cleaning apt cache"
if [ "$PACKMANAGER" = "apt" ]; then apt-get clean >/dev/null; fi
if [ "$PACKMANAGER" = "apt" ]; then apt-get clean > /dev/null; fi
# Replace nginx if installed
if ls /etc/nginx2 1>/dev/null 2>&1; then
if ls /etc/nginx2 1> /dev/null 2>&1; then
[ "$VERBOSE" = true ] && echo "replace nginx2"
rm -r /etc/nginx
mv /etc/nginx2 /etc/nginx
@@ -224,7 +224,7 @@ micro -plugin install filemanager || true
for files in "/etc/services.d" "/etc/cont-init.d"; do
# Next directory if does not exists
if ! ls $files 1>/dev/null 2>&1; then continue; fi
if ! ls $files 1> /dev/null 2>&1; then continue; fi
# Bashio
if grep -q -rnw "$files/" -e 'bashio' && [ ! -f "/usr/bin/bashio" ]; then
@@ -239,7 +239,7 @@ for files in "/etc/services.d" "/etc/cont-init.d"; do
# Lastversion
COMMAND="lastversion"
if grep -q -rnw "$files/" -e "$COMMAND" && ! command -v $COMMAND &>/dev/null; then
if grep -q -rnw "$files/" -e "$COMMAND" && ! command -v $COMMAND &> /dev/null; then
[ "$VERBOSE" = true ] && echo "install $COMMAND"
pip install $COMMAND
fi
@@ -255,17 +255,17 @@ for files in "/etc/services.d" "/etc/cont-init.d"; do
# Mustache
COMMAND="mustache"
if grep -q -rnw "$files/" -e "$COMMAND" && ! command -v $COMMAND &>/dev/null; then
if grep -q -rnw "$files/" -e "$COMMAND" && ! command -v $COMMAND &> /dev/null; then
[ "$VERBOSE" = true ] && echo "$COMMAND required"
[ "$PACKMANAGER" = "apk" ] && apk add --no-cache go npm &&
apk upgrade --no-cache &&
apk add --no-cache --virtual .build-deps build-base git go &&
go get -u github.com/quantumew/mustache-cli &&
cp "$GOPATH"/bin/* /usr/bin/ &&
rm -rf "$GOPATH" /var/cache/apk/* /tmp/src &&
apk del .build-deps xz build-base
[ "$PACKMANAGER" = "apt" ] && apt-get update &&
apt-get install -yqq go npm node-mustache
[ "$PACKMANAGER" = "apk" ] && apk add --no-cache go npm \
&& apk upgrade --no-cache \
&& apk add --no-cache --virtual .build-deps build-base git go \
&& go get -u github.com/quantumew/mustache-cli \
&& cp "$GOPATH"/bin/* /usr/bin/ \
&& rm -rf "$GOPATH" /var/cache/apk/* /tmp/src \
&& apk del .build-deps xz build-base
[ "$PACKMANAGER" = "apt" ] && apt-get update \
&& apt-get install -yqq go npm node-mustache
fi
done

View File

@@ -11,26 +11,26 @@ MODULES="$MODULES 00-banner.sh 01-custom_script.sh 01-config_yaml.sh 00-global_v
echo "To download : $MODULES"
# 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
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
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
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)
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

15
.templates/ha_entrypoint.sh Executable file → Normal file
View File

@@ -30,7 +30,7 @@ for SCRIPTS in /etc/cont-init.d/*; do
if [ ! -f "${currentshebang%% *}" ]; then
for shebang in "/command/with-contenv bashio" "/usr/bin/with-contenv bashio" "/usr/bin/env bashio" "/usr/bin/bashio" "/usr/bin/bash" "/usr/bin/sh" "/bin/bash" "/bin/sh"; do
command_path="${shebang%% *}"
if [ -x "$command_path" ] && "$command_path" echo "yes" >/dev/null 2>&1; then
if [ -x "$command_path" ] && "$command_path" echo "yes" > /dev/null 2>&1; then
echo "Valid shebang: $shebang"
break
fi
@@ -39,7 +39,7 @@ for SCRIPTS in /etc/cont-init.d/*; do
fi
# Use source to share env variables when requested
if [ "${ha_entry_source:-null}" = true ] && command -v "source" &>/dev/null; then
if [ "${ha_entry_source:-null}" = true ] && command -v "source" &> /dev/null; then
sed -i "s/(.*\s|^)exit \([0-9]\+\)/ \1 return \2 || exit \2/g" "$SCRIPTS"
sed -i "s/bashio::exit.nok/return 1/g" "$SCRIPTS"
sed -i "s/bashio::exit.ok/return 0/g" "$SCRIPTS"
@@ -61,7 +61,8 @@ for service_dir in /etc/services.d/*; do
# Replace s6-setuidgid with su-based equivalent
sed -i -E 's|^s6-setuidgid[[:space:]]+([a-zA-Z0-9._-]+)[[:space:]]+(.*)$|su -s /bin/bash \1 -c "\2"|g' "$runfile"
chmod +x "$runfile"
( exec "$runfile" ) & true
(exec "$runfile") &
true
fi
done
@@ -76,19 +77,19 @@ if [ "$$" -eq 1 ]; then
terminate() {
echo "Termination signal received, forwarding to subprocesses..."
# Terminate all subprocesses
if command -v pgrep &>/dev/null; then
if command -v pgrep &> /dev/null; then
for pid in $(pgrep -P $$); do
echo "Terminating child PID $pid"
kill -TERM "$pid" 2>/dev/null || echo "Failed to terminate PID $pid"
kill -TERM "$pid" 2> /dev/null || echo "Failed to terminate PID $pid"
done
else
# Fallback to iterating through /proc if pgrep is not available
for pid in /proc/[0-9]*/; do
pid=${pid#/proc/}
pid=${pid%/}
if [[ "$pid" -ne 1 ]] && grep -q "^PPid:\s*$$" "/proc/$pid/status" 2>/dev/null; then
if [[ "$pid" -ne 1 ]] && grep -q "^PPid:\s*$$" "/proc/$pid/status" 2> /dev/null; then
echo "Terminating child PID $pid"
kill -TERM "$pid" 2>/dev/null || echo "Failed to terminate PID $pid"
kill -TERM "$pid" 2> /dev/null || echo "Failed to terminate PID $pid"
fi
done
fi

View File

@@ -40,7 +40,7 @@ mkdir -p /run/s6/container_environment
# Check if shebang exists
for shebang in "/command/with-contenv bashio" "/usr/bin/with-contenv bashio" "/usr/bin/env bashio" "/usr/bin/bashio" "/usr/bin/bash" "/usr/bin/sh" "/bin/bash" "/bin/sh"; do
command_path="${shebang%% *}"
if [ -x "$command_path" ] && "$command_path" echo "yes" >/dev/null 2>&1; then
if [ -x "$command_path" ] && "$command_path" echo "yes" > /dev/null 2>&1; then
echo "Valid shebang: $shebang"
break
fi

View File

@@ -42,8 +42,8 @@ if [ ! -d "/data/$BASENAME" ]; then
else
LOGINFO="... updating ${REPOSITORY}" && if [ "$VERBOSE" = true ]; then bashio::log.info "$LOGINFO"; fi
cd "/data/$BASENAME" || exit
git pull --rebase origin >/dev/null || git reset --hard origin/master >/dev/null
git pull --rebase origin >/dev/null || (rm -r "/data/$BASENAME" && git clone "https://github.com/${REPOSITORY}")
git pull --rebase origin > /dev/null || git reset --hard origin/master > /dev/null
git pull --rebase origin > /dev/null || (rm -r "/data/$BASENAME" && git clone "https://github.com/${REPOSITORY}")
fi
LOGINFO="... parse addons" && if [ "$VERBOSE" = true ]; then bashio::log.info "$LOGINFO"; fi
@@ -59,8 +59,8 @@ for f in */; do
# Rebase
LOGINFO="... updating ${REPOSITORY}" && if [ "$VERBOSE" = true ]; then bashio::log.info "$LOGINFO"; fi
cd "/data/$BASENAME" || exit
git pull --rebase &>/dev/null || git reset --hard &>/dev/null
git pull --rebase &>/dev/null
git pull --rebase &> /dev/null || git reset --hard &> /dev/null
git pull --rebase &> /dev/null
#Define the folder addon
LOGINFO="... $SLUG : checking slug exists in repo" && if [ "$VERBOSE" = true ]; then bashio::log.info "$LOGINFO"; fi
@@ -97,8 +97,8 @@ for f in */; do
#Find current version
LOGINFO="... $SLUG : get current version" && if [ "$VERBOSE" = true ]; then bashio::log.info "$LOGINFO"; fi
CURRENT=$(jq .upstream_version updater.json) ||
{
CURRENT=$(jq .upstream_version updater.json) \
|| {
bashio::log.error "$SLUG addon upstream tag not found in updater.json. Exiting."
continue
}
@@ -124,45 +124,45 @@ for f in */; do
DOCKERHUB_REPO="${UPSTREAM%%/*}"
DOCKERHUB_IMAGE=$(echo "$UPSTREAM" | cut -d "/" -f2)
LASTVERSION=$(
curl -f -L -s --fail "https://hub.docker.com/v2/repositories/${DOCKERHUB_REPO}/${DOCKERHUB_IMAGE}/tags?page_size=$LISTSIZE$FILTER_TEXT" |
jq '.results | .[] | .name' -r |
sed -e '/.*latest.*/d' |
sed -e '/.*dev.*/d' |
sed -e '/.*nightly.*/d' |
sed -e '/.*beta.*/d' |
sed -e "/.*$EXCLUDE_TEXT.*/d" |
sort -V |
tail -n 1
curl -f -L -s --fail "https://hub.docker.com/v2/repositories/${DOCKERHUB_REPO}/${DOCKERHUB_IMAGE}/tags?page_size=$LISTSIZE$FILTER_TEXT" \
| jq '.results | .[] | .name' -r \
| sed -e '/.*latest.*/d' \
| sed -e '/.*dev.*/d' \
| sed -e '/.*nightly.*/d' \
| sed -e '/.*beta.*/d' \
| sed -e "/.*$EXCLUDE_TEXT.*/d" \
| sort -V \
| tail -n 1
)
[ "${BETA}" = true ] &&
LASTVERSION=$(
curl -f -L -s --fail "https://hub.docker.com/v2/repositories/${DOCKERHUB_REPO}/${DOCKERHUB_IMAGE}/tags?page_size=$LISTSIZE$FILTER_TEXT" |
jq '.results | .[] | .name' -r |
sed -e '/.*latest.*/d' |
sed -e '/.*dev.*/!d' |
sed -e "/.*$EXCLUDE_TEXT.*/d" |
sort -V |
tail -n 1
[ "${BETA}" = true ] \
&& LASTVERSION=$(
curl -f -L -s --fail "https://hub.docker.com/v2/repositories/${DOCKERHUB_REPO}/${DOCKERHUB_IMAGE}/tags?page_size=$LISTSIZE$FILTER_TEXT" \
| jq '.results | .[] | .name' -r \
| sed -e '/.*latest.*/d' \
| sed -e '/.*dev.*/!d' \
| sed -e "/.*$EXCLUDE_TEXT.*/d" \
| sort -V \
| tail -n 1
)
[ "${BYDATE}" = true ] &&
LASTVERSION=$(
curl -f -L -s --fail "https://hub.docker.com/v2/repositories/${DOCKERHUB_REPO}/${DOCKERHUB_IMAGE}/tags?page_size=${LISTSIZE}&ordering=last_updated$FILTER_TEXT" |
jq '.results | .[] | .name' -r |
sed -e '/.*latest.*/d' |
sed -e '/.*dev.*/d' |
sed -e '/.*nightly.*/d' |
sed -e "/.*$EXCLUDE_TEXT.*/d" |
sort -V |
tail -n 1
) &&
DATE=$(
curl -f -L -s --fail "https://hub.docker.com/v2/repositories/${DOCKERHUB_REPO}/${DOCKERHUB_IMAGE}/tags/?page_size=${LISTSIZE}&ordering=last_updated$FILTER_TEXT" |
jq '.results[] | select(.name==$LASTVERSION) | .last_updated' -r --arg LASTVERSION "$LASTVERSION"
) &&
DATE="${DATE%T*}" &&
LASTVERSION="$LASTVERSION-$DATE"
[ "${BYDATE}" = true ] \
&& LASTVERSION=$(
curl -f -L -s --fail "https://hub.docker.com/v2/repositories/${DOCKERHUB_REPO}/${DOCKERHUB_IMAGE}/tags?page_size=${LISTSIZE}&ordering=last_updated$FILTER_TEXT" \
| jq '.results | .[] | .name' -r \
| sed -e '/.*latest.*/d' \
| sed -e '/.*dev.*/d' \
| sed -e '/.*nightly.*/d' \
| sed -e "/.*$EXCLUDE_TEXT.*/d" \
| sort -V \
| tail -n 1
) \
&& DATE=$(
curl -f -L -s --fail "https://hub.docker.com/v2/repositories/${DOCKERHUB_REPO}/${DOCKERHUB_IMAGE}/tags/?page_size=${LISTSIZE}&ordering=last_updated$FILTER_TEXT" \
| jq '.results[] | select(.name==$LASTVERSION) | .last_updated' -r --arg LASTVERSION "$LASTVERSION"
) \
&& DATE="${DATE%T*}" \
&& LASTVERSION="$LASTVERSION-$DATE"
LOGINFO="... $SLUG : bydate is true, version is $LASTVERSION" && if [ "$VERBOSE" = true ]; then bashio::log.info "$LOGINFO"; fi
else
@@ -226,13 +226,13 @@ for f in */; do
if [[ "$(echo -n "$last_packages" | grep -c '^')" -gt 0 ]]; then
bashio::log.warning "A total of $(echo -n "$last_packages" | grep -c '^') packages were found, using $last_package"
LASTVERSION=""
LASTVERSION="$(curl -s -L https://github.com/"$UPSTREAM"/pkgs/container/"$last_package" | sed -n "s/.*?tag=\([^\"]*\)\">.*/\1/p" |
sed -e '/.*latest.*/d' |
sed -e '/.*dev.*/d' |
sed -e '/.*nightly.*/d' |
sed -e '/.*beta.*/d' |
sort -V |
tail -n 1)" || true
LASTVERSION="$(curl -s -L https://github.com/"$UPSTREAM"/pkgs/container/"$last_package" | sed -n "s/.*?tag=\([^\"]*\)\">.*/\1/p" \
| sed -e '/.*latest.*/d' \
| sed -e '/.*dev.*/d' \
| sed -e '/.*nightly.*/d' \
| sed -e '/.*beta.*/d' \
| sort -V \
| tail -n 1)" || true
if [[ "$LASTVERSION" == "" ]]; then
# Continue to next
bashio::log.warning "No packages found"
@@ -306,15 +306,15 @@ for f in */; do
#Git commit and push
git add -A # add all modified files
git commit -m "Updater bot : $SLUG updated to ${LASTVERSION}" >/dev/null
git commit -m "Updater bot : $SLUG updated to ${LASTVERSION}" > /dev/null
LOGINFO="... $SLUG : push to github" && if [ "$VERBOSE" = true ]; then bashio::log.info "$LOGINFO"; fi
git remote set-url origin "https://${GITUSER}:${GITHUB_API_TOKEN}@github.com/${REPOSITORY}" &>/dev/null
git remote set-url origin "https://${GITUSER}:${GITHUB_API_TOKEN}@github.com/${REPOSITORY}" &> /dev/null
# Push
if ! bashio::config.true "dry_run"; then
git push &>/dev/null
git push &> /dev/null
fi
#Log

View File

@@ -8,6 +8,6 @@ chown -R nginx:nginx /data
# Start app
# Find the PHP FPM service script and start it
find /etc/init.d -type f -name "php*-fpm" -exec {} start \; &&
chown -R nginx:nginx /data/Specific &&
nginx -g "daemon off;"
find /etc/init.d -type f -name "php*-fpm" -exec {} start \; \
&& chown -R nginx:nginx /data/Specific \
&& nginx -g "daemon off;"

View File

@@ -22,7 +22,7 @@ if [ "$(uname -m)" == "x86_64" ]; then
fi
# Make sure bats model is on
echo 'sed -i "/BATS_ANALYSIS=/c\BATS_ANALYSIS=1" /config/birdnet.conf' >>/etc/cont-init.d/81-modifications.sh
echo 'sed -i "/BATS_ANALYSIS=/c\BATS_ANALYSIS=1" /config/birdnet.conf' >> /etc/cont-init.d/81-modifications.sh
# Disable monitoring service
sed -i "1a sleep infinity" /custom-services.d/30-monitoring.sh

View File

@@ -41,7 +41,7 @@ if [[ ! "$BIRDSONGS_FOLDER" == /* ]]; then
mkdir -p "/config/$BIRDSONGS_FOLDER"
fi
if [ -d "/data/$BIRDSONGS_FOLDER" ]; then
if [ -n "$(ls -A /data/"$BIRDSONGS_FOLDER" 2>/dev/null)" ]; then
if [ -n "$(ls -A /data/"$BIRDSONGS_FOLDER" 2> /dev/null)" ]; then
cp -rf /data/"$BIRDSONGS_FOLDER"/* "/config/$BIRDSONGS_FOLDER"/
fi
rm -r "/data/$BIRDSONGS_FOLDER"

View File

@@ -10,8 +10,8 @@ bashio::log.info "ALSA_CARD option is set to $(bashio::config "ALSA_CARD"). If t
echo " "
# Adjust microphone volume if needed
if command -v amixer >/dev/null 2>/dev/null; then
current_volume="$(amixer sget Capture | grep -oP '\[\d+%\]' | tr -d '[]%' | head -1 2>/dev/null || echo "100")" || true
if command -v amixer > /dev/null 2> /dev/null; then
current_volume="$(amixer sget Capture | grep -oP '\[\d+%\]' | tr -d '[]%' | head -1 2> /dev/null || echo "100")" || true
if [[ "$current_volume" -eq 0 ]]; then
amixer sset Capture 70%
bashio::log.warning "Microphone was off, volume set to 70%."

View File

@@ -19,7 +19,7 @@ TZ_VALUE="$(timedatectl show -p Timezone --value)"
export TZ="$TZ_VALUE"
# Update caddyfile with password
/."$HOME"/BirdNET-Pi/scripts/update_caddyfile.sh &>/dev/null || true
/."$HOME"/BirdNET-Pi/scripts/update_caddyfile.sh &> /dev/null || true
echo "Starting service: caddy"
/usr/bin/caddy run --config /etc/caddy/Caddyfile

View File

@@ -61,7 +61,7 @@ DISK_USAGE_THRESHOLD=95
same_file_counter=0
SAME_FILE_THRESHOLD=2
if [[ -f "$ANALYZING_NOW_FILE" ]]; then
analyzing_now=$(<"$ANALYZING_NOW_FILE")
analyzing_now=$(< "$ANALYZING_NOW_FILE")
else
analyzing_now=""
fi
@@ -148,7 +148,7 @@ check_disk_space() {
check_analyzing_now() {
local current_file
current_file=$(cat "$ANALYZING_NOW_FILE" 2>/dev/null)
current_file=$(cat "$ANALYZING_NOW_FILE" 2> /dev/null)
if [[ "$current_file" == "$analyzing_now" ]]; then
((same_file_counter++))
else

View File

@@ -24,7 +24,7 @@ echo "... creating default files"
DEFAULT_FILES=("apprise.txt" "exclude_species_list.txt" "IdentifiedSoFar.txt" "disk_check_exclude.txt" "confirmed_species_list.txt" "blacklisted_images.txt" "whitelist_species_list.txt")
for file in "${DEFAULT_FILES[@]}"; do
if [ ! -f "/config/$file" ]; then
echo "" >"/config/$file"
echo "" > "/config/$file"
fi
done
touch /config/include_species_list.txt # Ensure this is always created

View File

@@ -34,7 +34,7 @@ grep -o '^[^#=]*=' "$configtemplate" | sed 's/=//' | while read -r var; do
# Check if the variable is in configcurrent, if not, append it
if ! grep -q "^$var=" "$configcurrent"; then
bashio::log.warning "...$var was missing from your birdnet.conf file, it was re-added"
grep "^$var=" "$configtemplate" >>"$configcurrent"
grep "^$var=" "$configtemplate" >> "$configcurrent"
fi
# Check for duplicates
if [ "$(grep -c "^$var=" "$configcurrent")" -gt 1 ]; then

View File

@@ -21,7 +21,7 @@ fi
common_steps() {
# Attempt to connect to the MQTT broker
TOPIC="birdnet"
if mosquitto_pub -h "$MQTT_HOST" -p "$MQTT_PORT" -t "$TOPIC" -m "test" -u "$MQTT_USER" -P "$MQTT_PASS" -q 1 -d --will-topic "$TOPIC" --will-payload "Disconnected" --will-qos 1 --will-retain >/dev/null 2>&1; then
if mosquitto_pub -h "$MQTT_HOST" -p "$MQTT_PORT" -t "$TOPIC" -m "test" -u "$MQTT_USER" -P "$MQTT_PASS" -q 1 -d --will-topic "$TOPIC" --will-payload "Disconnected" --will-qos 1 --will-retain > /dev/null 2>&1; then
# Adapt script with MQTT settings
sed -i "s|%%mqtt_server%%|$MQTT_HOST|g" /helpers/birdnet_to_mqtt.py
sed -i "s|\"%%mqtt_port%%\"|$MQTT_PORT|g" /helpers/birdnet_to_mqtt.py

View File

@@ -22,7 +22,7 @@ bashio::log.info "Adapting webui"
# HA specific elements
######################
if bashio::supervisor.ping 2>/dev/null; then
if bashio::supervisor.ping 2> /dev/null; then
# Remove services tab from webui
echo "... removing System Controls from webui as should be used from HA"
sed -i '/>System Controls/d' "$HOME/BirdNET-Pi/homepage/views.php"
@@ -157,7 +157,7 @@ mkdir -p /tmp
echo "... adapting labels according to birdnet.conf"
if export "$(grep "^DATABASE_LANG" /config/birdnet.conf)"; then
bashio::log.info "Setting language to ${DATABASE_LANG:-en}"
"$HOME/BirdNET-Pi/scripts/install_language_label_nm.sh" -l "${DATABASE_LANG:-}" &>/dev/null || bashio::log.warning "Failed to update language labels"
"$HOME/BirdNET-Pi/scripts/install_language_label_nm.sh" -l "${DATABASE_LANG:-}" &> /dev/null || bashio::log.warning "Failed to update language labels"
else
bashio::log.warning "DATABASE_LANG not found in configuration. Using default labels."
fi

View File

@@ -47,7 +47,7 @@ fi
sed -i "/View Log/d" "$HOME/BirdNET-Pi/homepage/views.php"
echo "... ensuring restricted area access"
echo "${ingress_entry}" >/ingress_url
echo "${ingress_entry}" > /ingress_url
# Modify PHP file safely
php_file="$HOME/BirdNET-Pi/scripts/common.php"

View File

@@ -26,8 +26,8 @@ if [[ "$(uname -m)" = "x86_64" ]]; then
bashio::log.warning "Trying to install tensorflow instead of tflite_runtime instead. This might take some time (up to 5 minutes)."
bashio::log.warning "You could try also Birdnet-Go which should supports your cpu"
source /home/pi/BirdNET-Pi/birdnet/bin/activate
mkdir -p /home/pi/.cache/pip || true &>/dev/null
chmod 777 /home/pi/.cache/pip || true &>/dev/null
mkdir -p /home/pi/.cache/pip || true &> /dev/null
chmod 777 /home/pi/.cache/pip || true &> /dev/null
pip3 uninstall -y tflite_runtime
pip install --upgrade packaging==23.2
pip3 install --upgrade --force-reinstall "https://github.com/snowzach/tensorflow-multiarch/releases/download/v2.16.1/tensorflow-2.16.1-cp311-cp311-linux_x86_64.whl"

View File

@@ -33,21 +33,21 @@ if bashio::config.has_value 'TZ'; then
echo "... timezone set to $TZ_VALUE as defined in add-on options (BirdNET config ignored)."
else
bashio::log.warning "Couldn't set timezone to $TZ_VALUE. Refer to the list of valid timezones: https://manpages.ubuntu.com/manpages/focal/man3/DateTime::TimeZone::Catalog.3pm.html"
timedatectl set-ntp true &>/dev/null
timedatectl set-ntp true &> /dev/null
fi
# Use BirdNET-defined timezone if no add-on option is provided
elif [ -f /data/timezone ]; then
BIRDN_CONFIG_TZ="$(cat /data/timezone)"
timedatectl set-ntp false &>/dev/null
timedatectl set-ntp false &> /dev/null
if timedatectl set-timezone "$BIRDN_CONFIG_TZ"; then
echo "... set to $BIRDN_CONFIG_TZ as defined in BirdNET config."
else
bashio::log.warning "Couldn't set timezone to $BIRDN_CONFIG_TZ. Reverting to automatic timezone."
timedatectl set-ntp true &>/dev/null
timedatectl set-ntp true &> /dev/null
fi
# Fallback to automatic timezone if no manual settings are found
else
if timedatectl set-ntp true &>/dev/null; then
if timedatectl set-ntp true &> /dev/null; then
bashio::log.info "... automatic timezone enabled."
else
bashio::log.fatal "Couldn't set automatic timezone! Please set a manual one from the options."
@@ -66,26 +66,26 @@ fi
# Fix timezone as per installer
CURRENT_TIMEZONE="$(timedatectl show --value --property=Timezone)"
[ -f /etc/timezone ] && echo "$CURRENT_TIMEZONE" | sudo tee /etc/timezone >/dev/null
[ -f /etc/timezone ] && echo "$CURRENT_TIMEZONE" | sudo tee /etc/timezone > /dev/null
bashio::log.info "Starting system services"
bashio::log.info "Starting cron service"
systemctl start cron >/dev/null
systemctl start cron > /dev/null
bashio::log.info "Starting dbus service"
service dbus start >/dev/null
service dbus start > /dev/null
bashio::log.info "Starting BirdNET-Pi services"
chmod +x "$HOME/BirdNET-Pi/scripts/restart_services.sh" >/dev/null
"$HOME/BirdNET-Pi/scripts/restart_services.sh" >/dev/null
chmod +x "$HOME/BirdNET-Pi/scripts/restart_services.sh" > /dev/null
"$HOME/BirdNET-Pi/scripts/restart_services.sh" > /dev/null
# Start livestream services if enabled in configuration
if bashio::config.true "LIVESTREAM_BOOT_ENABLED"; then
echo "... starting livestream services"
systemctl enable icecast2 >/dev/null
systemctl start icecast2.service >/dev/null
systemctl enable --now livestream.service >/dev/null
systemctl enable icecast2 > /dev/null
systemctl start icecast2.service > /dev/null
systemctl enable --now livestream.service > /dev/null
fi
# Start

View File

@@ -7,7 +7,7 @@ set +u
source /etc/birdnet/birdnet.conf
# Create ingress configuration for Caddyfile
cat <<EOF >>/etc/caddy/Caddyfile
cat << EOF >> /etc/caddy/Caddyfile
:8082 {
root * ${EXTRACTED}
file_server browse

View File

@@ -45,7 +45,7 @@ done
# Correct home location
for folders in /defaults /etc/cont-init.d /etc/services.d /etc/s6-overlay/s6-rc.d; do
if [ -d "$folders" ]; then
sed -i "s|/config|$LOCATION|g" $(find "$folders" -type f) &>/dev/null || true
sed -i "s|/config|$LOCATION|g" $(find "$folders" -type f) &> /dev/null || true
fi
done
@@ -53,12 +53,12 @@ done
usermod --home "$LOCATION" abc
# Add environment variables
if [ -d /var/run/s6/container_environment ]; then printf "%s" "$LOCATION" >/var/run/s6/container_environment/HOME; fi
if [ -d /var/run/s6/container_environment ]; then printf "%s" "$LOCATION" >/var/run/s6/container_environment/FM_HOME; fi
if [ -d /var/run/s6/container_environment ]; then printf "%s" "$LOCATION" > /var/run/s6/container_environment/HOME; fi
if [ -d /var/run/s6/container_environment ]; then printf "%s" "$LOCATION" > /var/run/s6/container_environment/FM_HOME; fi
{
printf "%s\n" "HOME=\"$LOCATION\""
printf "%s\n" "FM_HOME=\"$LOCATION\""
} >>~/.bashrc
} >> ~/.bashrc
# Create folder
echo "Creating $LOCATION"

View File

@@ -10,12 +10,12 @@ if bashio::config.has_value 'additional_apps'; then
NEWAPPS=$(bashio::config 'additional_apps')
for packagestoinstall in ${NEWAPPS//,/ }; do
bashio::log.green "... $packagestoinstall"
if command -v "apk" &>/dev/null; then
apk add --no-cache "$packagestoinstall" &>/dev/null || (bashio::log.fatal "Error : $packagestoinstall not found")
elif command -v "apt" &>/dev/null; then
apt-get install -yqq --no-install-recommends "$packagestoinstall" &>/dev/null || (bashio::log.fatal "Error : $packagestoinstall not found")
elif command -v "pacman" &>/dev/null; then
pacman --noconfirm -S "$packagestoinstall" &>/dev/null || (bashio::log.fatal "Error : $packagestoinstall not found")
if command -v "apk" &> /dev/null; then
apk add --no-cache "$packagestoinstall" &> /dev/null || (bashio::log.fatal "Error : $packagestoinstall not found")
elif command -v "apt" &> /dev/null; then
apt-get install -yqq --no-install-recommends "$packagestoinstall" &> /dev/null || (bashio::log.fatal "Error : $packagestoinstall not found")
elif command -v "pacman" &> /dev/null; then
pacman --noconfirm -S "$packagestoinstall" &> /dev/null || (bashio::log.fatal "Error : $packagestoinstall not found")
fi
done
fi
@@ -25,7 +25,7 @@ if bashio::config.has_value 'TZ'; then
TIMEZONE=$(bashio::config 'TZ')
bashio::log.info "Setting timezone to $TIMEZONE"
ln -snf /usr/share/zoneinfo/"$TIMEZONE" /etc/localtime
echo "$TIMEZONE" >/etc/timezone
echo "$TIMEZONE" > /etc/timezone
fi || (bashio::log.fatal "Error : $TIMEZONE not found. Here is a list of valid timezones : https://manpages.ubuntu.com/manpages/focal/man3/DateTime::TimeZone::Catalog.3pm.html")
# Set cli args
@@ -33,16 +33,16 @@ if bashio::config.has_value 'CLI_ARGS'; then
bashio::log.info "Setting password to the value defined in options"
CLI_ARGS=$(bashio::config 'CLI_ARGS')
bashio::log.info "Setting arguments to $CLI_ARGS"
if [ -d /var/run/s6/container_environment ]; then printf "%s" "$CLI_ARGS" >/var/run/s6/container_environment/CLI_ARGS; fi
printf "%s\n" "CLI_ARGS=\"$CLI_ARGS\"" >>~/.bashrc
if [ -d /var/run/s6/container_environment ]; then printf "%s" "$CLI_ARGS" > /var/run/s6/container_environment/CLI_ARGS; fi
printf "%s\n" "CLI_ARGS=\"$CLI_ARGS\"" >> ~/.bashrc
fi || true
# Set keyboard
if bashio::config.has_value 'KEYBOARD'; then
KEYBOARD=$(bashio::config 'KEYBOARD')
bashio::log.info "Setting keyboard to $KEYBOARD"
if [ -d /var/run/s6/container_environment ]; then printf "%s" "$KEYBOARD" >/var/run/s6/container_environment/KEYBOARD; fi
printf "%s\n" "KEYBOARD=\"$KEYBOARD\"" >>~/.bashrc
if [ -d /var/run/s6/container_environment ]; then printf "%s" "$KEYBOARD" > /var/run/s6/container_environment/KEYBOARD; fi
printf "%s\n" "KEYBOARD=\"$KEYBOARD\"" >> ~/.bashrc
fi || true
# Set password

View File

@@ -9,7 +9,7 @@ SUBFOLDER="$(bashio::addon.ingress_entry)"
# Copy template
cp /defaults/default.conf "${NGINX_CONFIG}"
# Remove ssl part
awk -v n=4 '/server/{n--}; n > 0' "${NGINX_CONFIG}" >tmpfile
awk -v n=4 '/server/{n--}; n > 0' "${NGINX_CONFIG}" > tmpfile
mv tmpfile "${NGINX_CONFIG}"
# Remove ipv6

View File

@@ -37,10 +37,10 @@ sed -i "1a export FM_HOME=$LOCATION" /etc/services.d/*/run
sed -i "s|/config|$LOCATION|g" /defaults/*
sed -i "s|/config|$LOCATION|g" /etc/cont-init.d/*
sed -i "s|/config|$LOCATION|g" /etc/services.d/*/run
if [ -d /var/run/s6/container_environment ]; then printf "%s" "$LOCATION" >/var/run/s6/container_environment/HOME; fi
if [ -d /var/run/s6/container_environment ]; then printf "%s" "$LOCATION" >/var/run/s6/container_environment/FM_HOME; fi
printf "%s\n" "HOME=\"$LOCATION\"" >>~/.bashrc
printf "%s\n" "FM_HOME=\"$LOCATION\"" >>~/.bashrc
if [ -d /var/run/s6/container_environment ]; then printf "%s" "$LOCATION" > /var/run/s6/container_environment/HOME; fi
if [ -d /var/run/s6/container_environment ]; then printf "%s" "$LOCATION" > /var/run/s6/container_environment/FM_HOME; fi
printf "%s\n" "HOME=\"$LOCATION\"" >> ~/.bashrc
printf "%s\n" "FM_HOME=\"$LOCATION\"" >> ~/.bashrc
usermod --home "$LOCATION" abc

View File

@@ -7,11 +7,11 @@ set -e
if bashio::config.has_value 'TZ'; then
TIMEZONE=$(bashio::config 'TZ')
bashio::log.info "Setting timezone to $TIMEZONE"
ln -snf /usr/share/zoneinfo/"$TIMEZONE" /etc/localtime && echo "$TIMEZONE" >/etc/timezone
ln -snf /usr/share/zoneinfo/"$TIMEZONE" /etc/localtime && echo "$TIMEZONE" > /etc/timezone
fi
bashio::log.info "Install libnss3"
apt-get update && apt-get install libnss3 &>/dev/null
apt-get update && apt-get install libnss3 &> /dev/null
# Set Ingress login
if [ ! -f /config/app.db ]; then

0
calibre_web/rootfs/etc/services.d/nginx/run Normal file → Executable file
View File

View File

@@ -28,7 +28,7 @@ if bashio::config.has_value 'csrf_allowed'; then
while read -r line; do
urls+=("$line")
done <<<"$(bashio::config 'csrf_allowed')"
done <<< "$(bashio::config 'csrf_allowed')"
fi
# Add internal and external URL as it
@@ -53,5 +53,5 @@ done
CSRF=${CSRF::-1}
# Save CSFR
echo -n "${CSRF}" >/var/run/s6/container_environment/PAPERLESS_CSRF_TRUSTED_ORIGINS
echo -n "${CSRF}" > /var/run/s6/container_environment/PAPERLESS_CSRF_TRUSTED_ORIGINS
bashio::log.blue "PAPERLESS_CSRF_TRUSTED_ORIGINS is set to ${CSRF}"

View File

@@ -10,7 +10,7 @@ if bashio::config.has_value 'TZ'; then
bashio::log.info "Setting timezone to $TIMEZONE"
if [ -f /usr/share/zoneinfo/"$TIMEZONE" ]; then
ln -snf /usr/share/zoneinfo/"$TIMEZONE" /etc/localtime
echo "$TIMEZONE" >/etc/timezone
echo "$TIMEZONE" > /etc/timezone
else
bashio::log.fatal "$TIMEZONE not found, are you sure it is a valid timezone?"
fi

View File

@@ -10,7 +10,7 @@ if bashio::config.has_value 'TZ'; then
bashio::log.info "Setting timezone to $TIMEZONE"
if [ -f /usr/share/zoneinfo/"$TIMEZONE" ]; then
ln -snf /usr/share/zoneinfo/"$TIMEZONE" /etc/localtime
echo "$TIMEZONE" >/etc/timezone
echo "$TIMEZONE" > /etc/timezone
else
bashio::log.fatal "$TIMEZONE not found, are you sure it is a valid timezone?"
fi

0
emby/rootfs/etc/services.d/nginx/run Normal file → Executable file
View File

0
emby_beta/rootfs/etc/services.d/nginx/run Normal file → Executable file
View File

View File

@@ -21,7 +21,7 @@ if bashio::config.true 'mqtt_autodiscover'; then
# Export variables
for variables in "MQTT_HOST=$MQTT_HOST" "MQTT_PORT=$MQTT_PORT" "MQTT_SSL=$MQTT_SSL" "MQTT_USERNAME=$MQTT_USERNAME" "MQTT_PASSWORD=$MQTT_PASSWORD"; do
sed -i "1a export $variables" /etc/cont-init.d/*/*run* 2>/dev/null || true
sed -i "1a export $variables" /etc/cont-init.d/*/*run* 2> /dev/null || true
# Log
bashio::log.blue "$variables"
done

View File

@@ -82,7 +82,7 @@ if [ -f "$CONFIGSOURCE" ]; then
# Check if yaml is valid
EXIT_CODE=0
yamllint -d relaxed "$CONFIGSOURCE" &>ERROR || EXIT_CODE=$?
yamllint -d relaxed "$CONFIGSOURCE" &> ERROR || EXIT_CODE=$?
if [ "$EXIT_CODE" = 0 ]; then
echo "Config file is a valid yaml"
else

View File

@@ -21,7 +21,7 @@ if bashio::config.true 'mqtt_autodiscover'; then
# Export variables
for variables in "MQTT_HOST=$MQTT_HOST" "MQTT_PORT=$MQTT_PORT" "MQTT_SSL=$MQTT_SSL" "MQTT_USERNAME=$MQTT_USERNAME" "MQTT_PASSWORD=$MQTT_PASSWORD"; do
sed -i "1a export $variables" /etc/cont-init.d/*/*run* 2>/dev/null || true
sed -i "1a export $variables" /etc/cont-init.d/*/*run* 2> /dev/null || true
# Log
bashio::log.blue "$variables"
done

View File

@@ -82,7 +82,7 @@ if [ -f "$CONFIGSOURCE" ]; then
# Check if yaml is valid
EXIT_CODE=0
yamllint -d relaxed "$CONFIGSOURCE" &>ERROR || EXIT_CODE=$?
yamllint -d relaxed "$CONFIGSOURCE" &> ERROR || EXIT_CODE=$?
if [ "$EXIT_CODE" = 0 ]; then
echo "Config file is a valid yaml"
else

View File

@@ -104,11 +104,6 @@
"DAC_READ_SEARCH"
],
"schema": {
"cifsdomain": "str?",
"cifspassword": "str?",
"cifsusername": "str?",
"localdisks": "str?",
"networkdisks": "str?",
"DB_DATABASE_NAME": "str?",
"DB_HOSTNAME": "str?",
"DB_PASSWORD": "str",
@@ -120,7 +115,12 @@
"MINIO_ROOT_PASSWORD": "str",
"MINIO_ROOT_USER": "str",
"TZ": "str?",
"USE_EXTERNAL_DB": "bool?"
"USE_EXTERNAL_DB": "bool?",
"cifsdomain": "str?",
"cifspassword": "str?",
"cifsusername": "str?",
"localdisks": "str?",
"networkdisks": "str?"
},
"slug": "ente",
"udev": true,

14
ente/rootfs/etc/cont-init.d/99-run.sh Executable file → Normal file
View File

@@ -86,7 +86,7 @@ create_config() {
_rand_b64() { head -c "$1" /dev/urandom | base64 | tr -d '\n'; }
_rand_b64url() { head -c "$1" /dev/urandom | base64 | tr '+/' '-_' | tr -d '\n'; }
cat >"$CFG" <<EOF
cat > "$CFG" << EOF
key:
encryption: $(_rand_b64 32)
hash: $(_rand_b64 64)
@@ -141,10 +141,12 @@ start_postgres() {
wait_postgres_ready() {
local host port
if $USE_EXTERNAL_DB; then
host="$DB_HOST_EXT"; port="$DB_PORT_EXT"
host="$DB_HOST_EXT"
port="$DB_PORT_EXT"
bashio::log.info "Waiting for EXTERNAL Postgres at ${host}:${port}..."
else
host="$DB_HOST_INTERNAL"; port="$DB_PORT_INTERNAL"
host="$DB_HOST_INTERNAL"
port="$DB_PORT_INTERNAL"
bashio::log.info "Waiting for internal Postgres..."
fi
until pg_isready -q -h "$host" -p "$port"; do sleep 1; done
@@ -192,7 +194,7 @@ start_minio() {
wait_minio_ready_and_bucket() {
bashio::log.info "Waiting for MinIO API..."
until "$MC_BIN" alias set h0 http://127.0.0.1:3200 "$MINIO_USER" "$MINIO_PASS" 2>/dev/null; do
until "$MC_BIN" alias set h0 http://127.0.0.1:3200 "$MINIO_USER" "$MINIO_PASS" 2> /dev/null; do
sleep 1
done
bashio::log.info "Ensuring buckets..."
@@ -216,7 +218,7 @@ start_web() {
# Running ente-web-prepare
echo "[ente-web-prepare] Substituting origins…"
find /www -name '*.js' | xargs sed -i "s#ENTE_API_ORIGIN_PLACEHOLDER#${ENTE_API_ORIGIN}#g"
find /www/photos -name '*.js'| xargs sed -i "s#ENTE_ALBUMS_ORIGIN_PLACEHOLDER#${ENTE_ALBUMS_ORIGIN}#g"
find /www/photos -name '*.js' | xargs sed -i "s#ENTE_ALBUMS_ORIGIN_PLACEHOLDER#${ENTE_ALBUMS_ORIGIN}#g"
mkdir -p /run/nginx /var/log/nginx
@@ -236,7 +238,7 @@ start_museum_foreground() {
bashio::log.error "$CFG missing; cannot start museum."
return 1
fi
if [ ! -x "$MUSEUM_BIN" ] && ! command -v "$MUSEUM_BIN" >/dev/null 2>&1; then
if [ ! -x "$MUSEUM_BIN" ] && ! command -v "$MUSEUM_BIN" > /dev/null 2>&1; then
bashio::log.error "Museum binary not found; cannot launch Ente API."
return 1
fi

View File

@@ -11,7 +11,7 @@ if bashio::config.has_value 'TZ'; then
bashio::log.info "Setting timezone to $TIMEZONE"
if [ -f /usr/share/zoneinfo/"$TIMEZONE" ]; then
ln -snf /usr/share/zoneinfo/"$TIMEZONE" /etc/localtime
echo "$TIMEZONE" >/etc/timezone
echo "$TIMEZONE" > /etc/timezone
else
bashio::log.fatal "$TIMEZONE not found, are you sure it is a valid timezone?"
fi
@@ -68,8 +68,8 @@ NOAUTH=""
if bashio::config.true 'NoAuth'; then
if ! bashio::fs.file_exists "/data/noauth"; then
rm /data/auth &>/dev/null || true
rm /config/filebrowser.dB &>/dev/null || true
rm /data/auth &> /dev/null || true
rm /config/filebrowser.dB &> /dev/null || true
touch /data/noauth
NOAUTH="--noauth"
bashio::log.warning "Auth method change, database reset"
@@ -77,8 +77,8 @@ if bashio::config.true 'NoAuth'; then
bashio::log.info "NoAuth option selected"
else
if ! bashio::fs.file_exists "/data/auth"; then
rm /data/noauth &>/dev/null || true
rm /config/filebrowser.dB &>/dev/null || true
rm /data/noauth &> /dev/null || true
rm /config/filebrowser.dB &> /dev/null || true
touch /data/auth
bashio::log.warning "Auth method change, database reset"
fi

View File

@@ -27,7 +27,7 @@ CURRENT=$(sed -e '/^[<blank><tab>]*$/d' /config/addons_config/fireflyiii/APP_KEY
# Save if new
if [ "$CURRENT" != "$APP_KEY" ]; then
echo "$APP_KEY" >>/config/addons_config/fireflyiii/APP_KEY_BACKUP.txt
echo "$APP_KEY" >> /config/addons_config/fireflyiii/APP_KEY_BACKUP.txt
fi
# Update permissions
@@ -43,8 +43,8 @@ chmod -R 775 /config/addons_config/fireflyiii
bashio::log.info "Defining database"
case $(bashio::config 'DB_CONNECTION') in
# Use sqlite
sqlite_internal)
# Use sqlite
sqlite_internal)
bashio::log.info "Using built in sqlite"
# Set variable
@@ -77,7 +77,7 @@ sqlite_internal)
;;
# Use MariaDB
mariadb_addon)
mariadb_addon)
bashio::log.info "Using MariaDB addon. Requirements : running MariaDB addon. Detecting values..."
if ! bashio::services.available 'mysql'; then
bashio::log.fatal \
@@ -112,7 +112,7 @@ mariadb_addon)
;;
# Use remote
*)
*)
bashio::log.info "Using remote database. Requirement : filling all addon options fields, and making sure the database already exists"
for conditions in "DB_HOST" "DB_PORT" "DB_DATABASE" "DB_USERNAME" "DB_PASSWORD"; do
if ! bashio::config.has_value "$conditions"; then

View File

@@ -31,7 +31,7 @@ if bashio::config.has_value 'Updates'; then
for i in $(seq 4 2 12); do
hour=" $i"
freqDir="/etc/periodic/daily$i"
echo "0 ${hour:(-4)} * * * run-parts \"$freqDir\"" >>/etc/crontabs/root
echo "0 ${hour:(-4)} * * * run-parts \"$freqDir\"" >> /etc/crontabs/root
mkdir "$freqDir"
done
@@ -46,7 +46,7 @@ if bashio::config.has_value 'Updates'; then
# Starts cron
echo "Timezone $TZ"
export TZ
crond -l 2 -f >/dev/stdout 2>/dev/stderr &
crond -l 2 -f > /dev/stdout 2> /dev/stderr &
# Export variables
IMPORT_DIR_WHITELIST="${CONFIGSOURCE}/import_files"
@@ -68,7 +68,7 @@ bashio::log.info "Please wait while the app is loading !"
if bashio::config.true 'silent'; then
bashio::log.warning "Silent mode activated. Only errors will be shown. Please disable in addon options if you need to debug"
php -S 0.0.0.0:8080 /app/index.php >/dev/null
php -S 0.0.0.0:8080 /app/index.php > /dev/null
else
php -S 0.0.0.0:8080 /app/index.php
fi

View File

@@ -5,7 +5,7 @@ slug="free_games_claimer"
if [ -f "/homeassistant/addons_config/$slug/config.yaml" ] && [ ! -f "/homeassistant/addons_config/$slug/migrated" ]; then
bashio::log.warning "Migrating config.yaml"
mv "/homeassistant/addons_config/$slug"/* /config/ || true
echo "Migrated to internal config folder accessible at /addon_configs/xxx-$slug" >"/homeassistant/addons_config/$slug/migrated"
echo "Migrated to internal config folder accessible at /addon_configs/xxx-$slug" > "/homeassistant/addons_config/$slug/migrated"
fi
if [ -f "/homeassistant/addons_autoscripts/$slug.sh" ]; then

View File

@@ -61,7 +61,7 @@ cd /data || true
# Fetch commands
CMD_ARGUMENTS="$(bashio::config "CMD_ARGUMENTS")"
IFS=';'
read -ar strarr <<<"$CMD_ARGUMENTS"
read -ar strarr <<< "$CMD_ARGUMENTS"
# Sanitizes commands
trim() {

View File

@@ -25,7 +25,7 @@ if bashio::config.true 'mqtt_autodiscover'; then
# Export variables
for variables in "MQTT_HOST=$MQTT_HOST" "MQTT_PORT=$MQTT_PORT" "MQTT_SSL=$MQTT_SSL" "MQTT_USERNAME=$MQTT_USERNAME" "MQTT_PASSWORD=$MQTT_PASSWORD"; do
sed -i "1a export $variables" /etc/services.d/*/*run* 2>/dev/null || true
sed -i "1a export $variables" /etc/services.d/*/*run* 2> /dev/null || true
# Log
bashio::log.blue "$variables"
done

View File

@@ -37,7 +37,7 @@ else
if [ ! -s /config/secret/secret ]; then
bashio::log.warning "No secret key found in /config/secret/secret, generating a new one."
mkdir -p /config/secret
python3 -c "import secrets; print(secrets.token_urlsafe(32))" | tr -d "\n" >/config/secret/secret
python3 -c "import secrets; print(secrets.token_urlsafe(32))" | tr -d "\n" > /config/secret/secret
bashio::log.warning "New secret key generated and stored in /config/secret/secret"
fi
bashio::log.warning "Using existing secret key from /config/secret/secret."

View File

@@ -68,8 +68,8 @@
"/dev/nvme2"
],
"environment": {
"PGDATA": "/config/postgres",
"GUACAMOLE_HOME": "/config"
"GUACAMOLE_HOME": "/config",
"PGDATA": "/config/postgres"
},
"image": "ghcr.io/alexbelgium/guacamole-{arch}",
"ingress": true,

0
guacamole/rootfs/etc/services.d/nginx/run Normal file → Executable file
View File

View File

@@ -16,6 +16,6 @@ fi
# Move autoscript
if [ -f /homeassistant/addons_autoscrips/immich.sh ]; then
cp -rnf /homeassistant/addons_autoscrips/"$PREVIOUS_FOLDER".sh /config/ &>/dev/null || true
cp -rnf /homeassistant/addons_autoscrips/"$PREVIOUS_FOLDER".sh /config/ &> /dev/null || true
bashio::log.yellow "... moved $PREVIOUS_FOLDER.sh from /config/addons_autoscripts to /addon_configs/$HOSTNAME"
fi

View File

@@ -34,9 +34,9 @@ bashio::log.info "Setting data location"
DATA_LOCATION="$(bashio::config 'data_location')"
export IMMICH_MEDIA_LOCATION="$DATA_LOCATION"
if [ -d /var/run/s6/container_environment ]; then
printf "%s" "$DATA_LOCATION" >/var/run/s6/container_environment/IMMICH_MEDIA_LOCATION
printf "%s" "$DATA_LOCATION" > /var/run/s6/container_environment/IMMICH_MEDIA_LOCATION
fi
printf "%s\n" "IMMICH_MEDIA_LOCATION=\"$DATA_LOCATION\"" >>~/.bashrc
printf "%s\n" "IMMICH_MEDIA_LOCATION=\"$DATA_LOCATION\"" >> ~/.bashrc
echo "... check $DATA_LOCATION folder exists"
mkdir -p "$DATA_LOCATION"
@@ -87,8 +87,8 @@ fi
# REDIS LOCATION #
##################
echo "sed -i \"s=/config/redis=/data/redis=g\" /etc/s6*/s6*/*/run" >>/docker-mods
echo "sed -i \"s=/config/log/redis=/data/log=g\" /etc/s6*/s6*/*/run" >>/docker-mods
echo "sed -i \"s=/config/redis=/data/redis=g\" /etc/s6*/s6*/*/run" >> /docker-mods
echo "sed -i \"s=/config/log/redis=/data/log=g\" /etc/s6*/s6*/*/run" >> /docker-mods
mkdir -p /data/redis
mkdir -p /data/log
chmod 777 /data/redis

View File

@@ -32,7 +32,7 @@ check_db_hostname() {
bashio::log.warning "DB_HOSTNAME was set to homeassistant.local. Using detected IP: $DB_HOSTNAME"
fi
if ! ping -c 1 -W 3 "$DB_HOSTNAME" >/dev/null 2>&1; then
if ! ping -c 1 -W 3 "$DB_HOSTNAME" > /dev/null 2>&1; then
bashio::log.warning "------------------------------------"
bashio::log.warning "DB_HOSTNAME ($DB_HOSTNAME) is not reachable."
bashio::log.warning "Please set it to the IP address of your database."
@@ -75,7 +75,7 @@ export_db_env() {
if [ -d /var/run/s6/container_environment ]; then
for var in DB_USERNAME DB_PASSWORD DB_DATABASE_NAME DB_PORT DB_HOSTNAME JWT_SECRET; do
if [ -n "${!var:-}" ]; then
printf "%s" "${!var}" >"/var/run/s6/container_environment/${var}"
printf "%s" "${!var}" > "/var/run/s6/container_environment/${var}"
fi
done
fi
@@ -88,26 +88,26 @@ setup_root_user() {
export DB_ROOT_PASSWORD="$(bashio::config 'DB_ROOT_PASSWORD')"
else
bashio::log.warning "DB_ROOT_PASSWORD not set. Generating a random 12-character alphanumeric password and storing it in the addon options."
export DB_ROOT_PASSWORD="$(tr -dc 'A-Za-z0-9' </dev/urandom | head -c12)"
export DB_ROOT_PASSWORD="$(tr -dc 'A-Za-z0-9' < /dev/urandom | head -c12)"
bashio::addon.option "DB_ROOT_PASSWORD" "${DB_ROOT_PASSWORD}"
# Store generated password in the s6 environment if available
if [ -d /var/run/s6/container_environment ]; then
printf "%s" "${DB_ROOT_PASSWORD}" >"/var/run/s6/container_environment/DB_ROOT_PASSWORD"
printf "%s" "${DB_ROOT_PASSWORD}" > "/var/run/s6/container_environment/DB_ROOT_PASSWORD"
fi
fi
# Try to connect as root using the default insecure password.
if psql "postgres://root:securepassword@${DB_HOSTNAME}:${DB_PORT}/postgres" -c '\q' 2>/dev/null; then
if psql "postgres://root:securepassword@${DB_HOSTNAME}:${DB_PORT}/postgres" -c '\q' 2> /dev/null; then
bashio::log.info "Detected root user with default password. Updating to new DB_ROOT_PASSWORD..."
psql "postgres://${DB_USERNAME}:${DB_PASSWORD}@${DB_HOSTNAME}:${DB_PORT}" <<EOF
psql "postgres://${DB_USERNAME}:${DB_PASSWORD}@${DB_HOSTNAME}:${DB_PORT}" << EOF
ALTER ROLE root WITH PASSWORD '${DB_ROOT_PASSWORD}';
EOF
else
# Check if the root user exists.
if ! psql "postgres://${DB_USERNAME}:${DB_PASSWORD}@${DB_HOSTNAME}:${DB_PORT}" -tAc "SELECT 1 FROM pg_roles WHERE rolname='root'" | grep -q 1; then
bashio::log.info "Root user does not exist. Creating root user with DB_ROOT_PASSWORD..."
psql "postgres://${DB_USERNAME}:${DB_PASSWORD}@${DB_HOSTNAME}:${DB_PORT}" <<EOF
psql "postgres://${DB_USERNAME}:${DB_PASSWORD}@${DB_HOSTNAME}:${DB_PORT}" << EOF
CREATE ROLE root WITH LOGIN SUPERUSER CREATEDB CREATEROLE PASSWORD '${DB_ROOT_PASSWORD}';
EOF
else
@@ -124,7 +124,7 @@ setup_database() {
if ! psql "postgres://${DB_USERNAME}:${DB_PASSWORD}@${DB_HOSTNAME}:${DB_PORT}/postgres" -tAc \
"SELECT 1 FROM pg_database WHERE datname='${DB_DATABASE_NAME}';" | grep -q 1; then
bashio::log.info "Database does not exist. Creating it now..."
psql "postgres://${DB_USERNAME}:${DB_PASSWORD}@${DB_HOSTNAME}:${DB_PORT}" <<EOF
psql "postgres://${DB_USERNAME}:${DB_PASSWORD}@${DB_HOSTNAME}:${DB_PORT}" << EOF
CREATE DATABASE ${DB_DATABASE_NAME};
EOF
else
@@ -132,7 +132,7 @@ EOF
fi
# Ensure the user exists and update its password
psql "postgres://${DB_USERNAME}:${DB_PASSWORD}@${DB_HOSTNAME}:${DB_PORT}" <<EOF
psql "postgres://${DB_USERNAME}:${DB_PASSWORD}@${DB_HOSTNAME}:${DB_PORT}" << EOF
DO \$\$
BEGIN
IF NOT EXISTS (SELECT FROM pg_roles WHERE rolname = '${DB_USERNAME}') THEN
@@ -145,7 +145,7 @@ END
EOF
# Ensure the user has full privileges on the database
psql "postgres://${DB_USERNAME}:${DB_PASSWORD}@${DB_HOSTNAME}:${DB_PORT}" <<EOF
psql "postgres://${DB_USERNAME}:${DB_PASSWORD}@${DB_HOSTNAME}:${DB_PORT}" << EOF
GRANT ALL PRIVILEGES ON DATABASE ${DB_DATABASE_NAME} TO ${DB_USERNAME};
EOF

View File

@@ -5,7 +5,7 @@ set -e
#################
# Create config #
#################
mustache-cli /data/options.json /templates/inadyn.mustache >/etc/inadyn.conf
mustache-cli /data/options.json /templates/inadyn.mustache > /etc/inadyn.conf
# Check it
/usr/sbin/inadyn --check-config

0
jellyfin/rootfs/etc/services.d/nginx/run Normal file → Executable file
View File

View File

@@ -21,10 +21,10 @@ fi
if [ "$VERBOSE" = true ]; then
curl --progress-bar -f -J -L -o /tmp/joal.tar.gz "$(curl -f -s -L https://api.github.com/repos/anthonyraymond/joal/releases/latest | grep -o "http.*joal.tar.gz")"
else
curl --progress-bar -f -S -J -L -o /tmp/joal.tar.gz "$(curl -f -s -L https://api.github.com/repos/anthonyraymond/joal/releases/latest | grep -o "http.*joal.tar.gz")" >/dev/null
curl --progress-bar -f -S -J -L -o /tmp/joal.tar.gz "$(curl -f -s -L https://api.github.com/repos/anthonyraymond/joal/releases/latest | grep -o "http.*joal.tar.gz")" > /dev/null
fi
mkdir -p /data/joal
tar zxvf /tmp/joal.tar.gz -C /data/joal >/dev/null
tar zxvf /tmp/joal.tar.gz -C /data/joal > /dev/null
chown -R "$(id -u):$(id -g)" /data/joal
rm /data/joal/jack-of*
bashio::log.info "Joal updated"
@@ -89,7 +89,7 @@ mkdir -p /var/log/nginx && touch /var/log/nginx/error.log
if [ "$VERBOSE" = true ]; then
nohup java -jar /joal/joal.jar --joal-conf=/data/joal --spring.main.web-environment=true --server.port="8081" --joal.ui.path.prefix="${UIPATH}" --joal.ui.secret-token="$TOKEN"
else
nohup java -jar /joal/joal.jar --joal-conf=/data/joal --spring.main.web-environment=true --server.port="8081" --joal.ui.path.prefix="${UIPATH}" --joal.ui.secret-token="$TOKEN" >/dev/null
nohup java -jar /joal/joal.jar --joal-conf=/data/joal --spring.main.web-environment=true --server.port="8081" --joal.ui.path.prefix="${UIPATH}" --joal.ui.secret-token="$TOKEN" > /dev/null
fi &
bashio::log.info "Please wait, loading..."
@@ -118,9 +118,9 @@ exec nginx &
if bashio::config.has_value 'run_duration'; then
RUNTIME=$(bashio::config 'run_duration')
bashio::log.info "Addon will stop after $RUNTIME"
sleep "$RUNTIME" &&
bashio::log.info "Timeout achieved, addon will stop !" &&
exit 0
sleep "$RUNTIME" \
&& bashio::log.info "Timeout achieved, addon will stop !" \
&& exit 0
else
bashio::log.info "Run_duration option not defined, addon will run continuously"
fi

View File

@@ -40,7 +40,7 @@ if [[ "$DATABASE_URL" == *"localhost"* ]]; then
# Create database if does not exist
echo "CREATE DATABASE linkwarden; GRANT ALL PRIVILEGES ON DATABASE linkwarden to postgres;
\q" >setup_postgres.sql
\q" > setup_postgres.sql
sudo -u postgres bash -c 'cat setup_postgres.sql | psql "postgres://postgres:homeassistant@localhost:5432"' || true
fi

View File

@@ -21,8 +21,8 @@ bashio::log.info "Data selected : $database"
case "$database" in
# Use sqlite
sqlite)
# Use sqlite
sqlite)
DB_DATABASE="/config/database.sqlite"
export DB_DATABASE
DB_CONNECTION=sqlite
@@ -34,8 +34,8 @@ sqlite)
bashio::log.blue "Using $DB_DATABASE"
;;
# Use Mariadb_addon
MariaDB_addon)
# Use Mariadb_addon
MariaDB_addon)
# Use MariaDB
DB_CONNECTION=mysql
export DB_CONNECTION
@@ -66,8 +66,8 @@ MariaDB_addon)
;;
# Use Mariadb_addon
Mysql_external)
# Use Mariadb_addon
Mysql_external)
DB_CONNECTION=mysql
export DB_CONNECTION
for var in DB_DATABASE DB_HOST DB_PASSWORD DB_PORT DB_USERNAME; do
@@ -107,7 +107,7 @@ if [ -z "$APP_KEY" ] || [ ${#APP_KEY} -lt 32 ]; then
)"
bashio::addon.option "APP_KEY" "${APP_KEY}"
bashio::log.warning "The APP_KEY set was invalid, generated a random one: ${APP_KEY}. Restarting to take it into account"
echo "${APP_KEY}" >>/config/APP_KEY
echo "${APP_KEY}" >> /config/APP_KEY
bashio::addon.restart
fi
APP_KEY="$(bashio::config "APP_KEY")"

View File

@@ -45,7 +45,7 @@ execute_main_logic() {
echo "... Scanning network for changes"
# Ensure arp-scan is installed
if ! command -v arp-scan &>/dev/null; then
if ! command -v arp-scan &> /dev/null; then
bashio::log.error "arp-scan command not found. Please install arp-scan to proceed."
exit 1
fi
@@ -70,10 +70,10 @@ execute_main_logic() {
NEW_SCAN_SUBNETS="${SCAN_SUBNETS%]}, '${local_ip}/24 --interface=${interface}']"
sed -i "/^SCAN_SUBNETS/c\\$NEW_SCAN_SUBNETS" "$config_file"
# Check availability of hosts
VALUE="$(arp-scan --interface="$interface" "${local_ip}/24" 2>/dev/null |
grep "responded" |
awk -F'.' '{print $NF}' |
awk '{print $1}' || true)"
VALUE="$(arp-scan --interface="$interface" "${local_ip}/24" 2> /dev/null \
| grep "responded" \
| awk -F'.' '{print $NF}' \
| awk '{print $1}' || true)"
echo "... $interface is available in Home Assistant (with $VALUE devices), added to app.conf"
fi
fi

View File

@@ -5,7 +5,7 @@ slug="nextcloud-ocr"
if [ -f "/homeassistant/addons_config/$slug/config.yaml" ] && [ ! -f "/homeassistant/addons_config/$slug/migrated" ]; then
bashio::log.warning "Migrating config.yaml"
mv "/homeassistant/addons_config/$slug"/* /config/ || true
echo "Migrated to internal config folder accessible at /addon_configs/xxx-$slug" >"/homeassistant/addons_config/$slug/migrated"
echo "Migrated to internal config folder accessible at /addon_configs/xxx-$slug" > "/homeassistant/addons_config/$slug/migrated"
fi
if [ -f "/homeassistant/addons_autoscripts/$slug.sh" ]; then

View File

@@ -6,8 +6,8 @@ if bashio::config.has_value "PUID" && bashio::config.has_value "PGID"; then
PUID="$(bashio::config "PUID")"
PGID="$(bashio::config "PGID")"
bashio::log.green "Setting user to $PUID:$PGID"
id -u abc &>/dev/null || usermod -o -u "$PUID" abc || true
id -g abc &>/dev/null || groupmod -o -g "$PGID" abc || true
id -u abc &> /dev/null || usermod -o -u "$PUID" abc || true
id -g abc &> /dev/null || groupmod -o -g "$PGID" abc || true
fi
echo "Updating permissions..."

View File

@@ -86,8 +86,8 @@ fi
###########################
echo "... Clean potential errors"
sudo -u abc -s /bin/bash -c "php /app/www/public/occ maintenance:repair" >/dev/null || true
sudo -u abc -s /bin/bash -c "php /app/www/public/occ maintenance:repair-share-owner" >/dev/null || true
sudo -u abc -s /bin/bash -c "php /app/www/public/occ maintenance:repair" > /dev/null || true
sudo -u abc -s /bin/bash -c "php /app/www/public/occ maintenance:repair-share-owner" > /dev/null || true
sudo -u abc -s /bin/bash -c "php /app/www/public/occ maintenance:mode --off" || true
##############
@@ -142,7 +142,7 @@ if bashio::config.true "enable_thumbnails"; then
sudo -u abc php /app/www/public/occ config:system:set enable_previews --value=true
i=0
for element in AVI BMP Font GIF HEIC Image JPEG Krita MarkDown MKV Movie MP3 MP4 OpenDocument PDF PNG SVG TIFF TXT XBitmap; do # Comma separated values
sudo -u abc php /app/www/public/occ config:system:set enabledPreviewProviders "$i" --value="OC\\Preview\\${element}" >/dev/null
sudo -u abc php /app/www/public/occ config:system:set enabledPreviewProviders "$i" --value="OC\\Preview\\${element}" > /dev/null
i=$((i + 1))
done
else

View File

@@ -12,7 +12,7 @@ if [ ! -d /data/config/www/nextcloud/apps/pdfannotate ]; then
cd /data/config/www/nextcloud/apps || exit
git clone https://gitlab.com/nextcloud-other/nextcloud-annotate pdfannotate
cd "$CURRENT" || exit
apk add --no-cache ghostscript >/dev/null
apk add --no-cache ghostscript > /dev/null
echo "Nextcloud annotate app added to Nextcloud app store"
fi
@@ -23,7 +23,7 @@ if bashio::config.has_value 'additional_apps'; then
OIFS=$IFS
IFS=","
re='^( *).*'
read -ra array <<<"$NEWAPPS"
read -ra array <<< "$NEWAPPS"
IFS=$OIFS
for element in "${array[@]}"; do
if [[ $element =~ $re ]]; then
@@ -31,7 +31,7 @@ if bashio::config.has_value 'additional_apps'; then
APP="${element#${BASH_REMATCH[1]}}"
bashio::log.green "... $APP"
# shellcheck disable=SC2015,SC2086
apk add --no-cache $APP >/dev/null || bashio::log.red "... not successful, please check $APP package name"
apk add --no-cache $APP > /dev/null || bashio::log.red "... not successful, please check $APP package name"
fi
done
fi

View File

@@ -15,7 +15,7 @@ PUID=$(bashio::config "PUID")
PGID=$(bashio::config "PGID")
LAUNCHER="sudo -u abc php /app/www/public/occ"
if $LAUNCHER fulltextsearch:test &>/dev/null; then
if $LAUNCHER fulltextsearch:test &> /dev/null; then
echo "Full Text Search is already working"
############
@@ -32,8 +32,8 @@ if $LAUNCHER fulltextsearch:test &>/dev/null; then
echo "Installing Full Text Search"
for app in "${APPS[@]}"; do
echo "... installing apps : $app"
$LAUNCHER app:install $app >/dev/null
$LAUNCHER app:enable $app >/dev/null
$LAUNCHER app:install $app > /dev/null
$LAUNCHER app:enable $app > /dev/null
done
chown -R "$PUID":"$PGID" $NEXTCLOUD_PATH/apps
@@ -46,17 +46,17 @@ if $LAUNCHER fulltextsearch:test &>/dev/null; then
# Final setup
echo "... settings apps"
$LAUNCHER fulltextsearch_elasticsearch:configure "{\"elastic_host\":\"$HOST\"}" &>/dev/null
$LAUNCHER fulltextsearch_elasticsearch:configure "{\"elastic_index\":\"my_index\"}" &>/dev/null
$LAUNCHER fulltextsearch_elasticsearch:configure "{\"analyzer_tokenizer\":\"standard\"}" &>/dev/null
$LAUNCHER fulltextsearch:configure '{"search_platform":"OCA\\FullTextSearch_Elasticsearch\\Platform\\ElasticSearchPlatform"}' &>/dev/null || true
$LAUNCHER files_fulltextsearch:configure "{\"files_pdf\":\"1\",\"files_office\":\"1\"}" &>/dev/null || true
$LAUNCHER fulltextsearch_elasticsearch:configure "{\"elastic_host\":\"$HOST\"}" &> /dev/null
$LAUNCHER fulltextsearch_elasticsearch:configure "{\"elastic_index\":\"my_index\"}" &> /dev/null
$LAUNCHER fulltextsearch_elasticsearch:configure "{\"analyzer_tokenizer\":\"standard\"}" &> /dev/null
$LAUNCHER fulltextsearch:configure '{"search_platform":"OCA\\FullTextSearch_Elasticsearch\\Platform\\ElasticSearchPlatform"}' &> /dev/null || true
$LAUNCHER files_fulltextsearch:configure "{\"files_pdf\":\"1\",\"files_office\":\"1\"}" &> /dev/null || true
# Is server detected
# Wait further for cache for index to work
echo "Waiting for a few seconds before indexing starts..."
sleep 5s
if $LAUNCHER fulltextsearch:test &>/dev/null; then
if $LAUNCHER fulltextsearch:test &> /dev/null; then
bashio::log.info "Full Text Search was successfully installed using elasticsearch server $HOST!"
else

View File

@@ -16,8 +16,8 @@ if [ "$(bashio::config 'OCR')" = "true" ]; then
# Get Full Text Search app for nextcloud
echo "... installing apps : fulltextsearch"
occ app:install files_fulltextsearch_tesseract &>/dev/null || true
occ app:enable files_fulltextsearch_tesseract &>/dev/null || true
occ app:install files_fulltextsearch_tesseract &> /dev/null || true
occ app:enable files_fulltextsearch_tesseract &> /dev/null || true
echo "Installing OCR"
apk add --quiet --no-cache ocrmypdf
@@ -32,15 +32,15 @@ if [ "$(bashio::config 'OCR')" = "true" ]; then
bashio::log.info "OCR Language installed : $LANG" || bashio::log.fatal "Couldn't install OCR lang $LANG. Please check its format is conform"
# Downloading trainer data
cd /usr/share/tessdata || true
rm -r "$LANG".traineddata &>/dev/null || true
wget https://github.com/tesseract-ocr/tessdata/raw/main/"$LANG".traineddata &>/dev/null
rm -r "$LANG".traineddata &> /dev/null || true
wget https://github.com/tesseract-ocr/tessdata/raw/main/"$LANG".traineddata &> /dev/null
done
fi
elif [ "$(bashio::config 'OCR')" = "false" ]; then
bashio::log.info 'Removing OCR'
# Delete package
apk del tesseract-ocr.* &>/dev/null || true
apk del tesseract-ocr.* &> /dev/null || true
# Remove app
occ app:disable files_fulltextsearch_tesseract &>/dev/null || true
occ app:disable files_fulltextsearch_tesseract &> /dev/null || true
fi
fi

View File

@@ -22,15 +22,16 @@ if bashio::config.has_value 'trusted_domains'; then
bashio::log.info "Currently set trusted domains :"
$LAUNCHER config:system:get trusted_domains || bashio::log.info "No trusted domain set yet. The first one will be set when doing initial configuration"
bashio::log.info "Trusted domains set in the configuration. Refreshing domains." &&
bashio::log.info "Trusted domains set in the configuration. Refreshing domains." \
&&
###################################
# Remove previous trusted domains #
###################################
bashio::log.info "... removing previously added trusted domain (except for first one created)"
i=2
until [ $i -gt 5 ]; do
$LAUNCHER config:system:delete trusted_domains $i &&
((i = i + 1)) || exit
$LAUNCHER config:system:delete trusted_domains $i \
&& ((i = i + 1)) || exit
done
###########################

0
nextcloud/rootfs/etc/services.d/cron/run Normal file → Executable file
View File

0
nzbget/rootfs/etc/services.d/nginx/run Normal file → Executable file
View File

View File

@@ -7,7 +7,7 @@ CONFIGSOURCE="/data"
# Use ssl
if [ -d /ssl ]; then
mkdir -p /cert
cp /ssl/* /cert 2>/dev/null
cp /ssl/* /cert 2> /dev/null
chown -R 508:508 /cert
fi

View File

@@ -6,8 +6,8 @@ if bashio::config.has_value "PUID" && bashio::config.has_value "PGID"; then
PUID="$(bashio::config "PUID")"
PGID="$(bashio::config "PGID")"
bashio::log.green "Setting user to $PUID:$PGID"
id -u photoprism &>/dev/null || usermod -o -u "$PUID" photoprism || true
id -g photoprism &>/dev/null || groupmod -o -g "$PGID" photoprism || true
id -u photoprism &> /dev/null || usermod -o -u "$PUID" photoprism || true
id -g photoprism &> /dev/null || groupmod -o -g "$PGID" photoprism || true
fi
bashio::log.info "Preparing scripts"

View File

@@ -12,19 +12,19 @@ if bashio::config.has_value 'graphic_drivers'; then
"mesa")
apt-get update
apt-get install -yqq -- *mesa* >/dev/null
apt-get install -yqq -- *mesa* > /dev/null
echo "... done"
;;
"nvidia")
apt-get update
apt-get install -yqq -- *nvidia* >/dev/null
apt-get install -yqq -- *nvidia* > /dev/null
echo "... done"
;;
"radeon")
apt-get update
apt-get install -yqq -- *radeon* >/dev/null
apt-get install -yqq -- *radeon* > /dev/null
echo "... done"
;;

View File

@@ -11,12 +11,12 @@ bashio::log.info "Defining database"
case $(bashio::config 'DB_TYPE') in
# Use sqlite
sqlite)
# Use sqlite
sqlite)
bashio::log.info "Using a local sqlite database"
;;
mariadb_addon)
mariadb_addon)
bashio::log.info "Using MariaDB addon. Requirements : running MariaDB addon. Discovering values..."
if ! bashio::services.available 'mysql'; then
bashio::log.fatal \
@@ -26,7 +26,7 @@ mariadb_addon)
fi
# Install mysqlclient
pip install pymysql &>/dev/null || true
pip install pymysql &> /dev/null || true
# Use values
PHOTOPRISM_DATABASE_DRIVER="mysql"
@@ -34,16 +34,16 @@ mariadb_addon)
PHOTOPRISM_DATABASE_NAME="photoprism"
PHOTOPRISM_DATABASE_USER="$(bashio::services 'mysql' 'username')"
PHOTOPRISM_DATABASE_PASSWORD="$(bashio::services 'mysql' 'password')"
export PHOTOPRISM_DATABASE_DRIVER &&
bashio::log.blue "PHOTOPRISM_DATABASE_DRIVER=$PHOTOPRISM_DATABASE_DRIVER"
export PHOTOPRISM_DATABASE_SERVER &&
bashio::log.blue "PHOTOPRISM_DATABASE_SERVER=$PHOTOPRISM_DATABASE_SERVER"
export PHOTOPRISM_DATABASE_NAME &&
bashio::log.blue "PHOTOPRISM_DATABASE_NAME=$PHOTOPRISM_DATABASE_NAME"
export PHOTOPRISM_DATABASE_USER &&
bashio::log.blue "PHOTOPRISM_DATABASE_USER=$PHOTOPRISM_DATABASE_USER"
export PHOTOPRISM_DATABASE_PASSWORD &&
bashio::log.blue "PHOTOPRISM_DATABASE_PASSWORD=$PHOTOPRISM_DATABASE_PASSWORD"
export PHOTOPRISM_DATABASE_DRIVER \
&& bashio::log.blue "PHOTOPRISM_DATABASE_DRIVER=$PHOTOPRISM_DATABASE_DRIVER"
export PHOTOPRISM_DATABASE_SERVER \
&& bashio::log.blue "PHOTOPRISM_DATABASE_SERVER=$PHOTOPRISM_DATABASE_SERVER"
export PHOTOPRISM_DATABASE_NAME \
&& bashio::log.blue "PHOTOPRISM_DATABASE_NAME=$PHOTOPRISM_DATABASE_NAME"
export PHOTOPRISM_DATABASE_USER \
&& bashio::log.blue "PHOTOPRISM_DATABASE_USER=$PHOTOPRISM_DATABASE_USER"
export PHOTOPRISM_DATABASE_PASSWORD \
&& bashio::log.blue "PHOTOPRISM_DATABASE_PASSWORD=$PHOTOPRISM_DATABASE_PASSWORD"
{
echo "export PHOTOPRISM_DATABASE_DRIVER=\"${PHOTOPRISM_DATABASE_DRIVER}\""
@@ -51,7 +51,7 @@ mariadb_addon)
echo "export PHOTOPRISM_DATABASE_NAME=\"${PHOTOPRISM_DATABASE_NAME}\""
echo "export PHOTOPRISM_DATABASE_USER=\"${PHOTOPRISM_DATABASE_USER}\""
echo "export PHOTOPRISM_DATABASE_PASSWORD=\"${PHOTOPRISM_DATABASE_PASSWORD}\""
} >>~/.bashrc
} >> ~/.bashrc
bashio::log.warning "Photoprism is using the Maria DB addon"
bashio::log.warning "Please ensure this is included in your backups"
@@ -77,7 +77,7 @@ if bashio::config.true "ingress_disabled"; then
else
PHOTOPRISM_SITE_URL="$(bashio::addon.ingress_entry)/"
export PHOTOPRISM_SITE_URL
echo "export PHOTOPRISM_SITE_URL=\"${PHOTOPRISM_SITE_URL}\"" >>~/.bashrc
echo "export PHOTOPRISM_SITE_URL=\"${PHOTOPRISM_SITE_URL}\"" >> ~/.bashrc
bashio::log.warning "Ingress is enabled. To connect, you must add $PHOTOPRISM_SITE_URL to the end of your access point. Example : http://my-url:8123$PHOTOPRISM_SITE_URL"
fi
@@ -103,7 +103,7 @@ export PHOTOPRISM_BACKUP_PATH
echo "export PHOTOPRISM_ORIGINALS_PATH=\"${PHOTOPRISM_ORIGINALS_PATH}\""
echo "export PHOTOPRISM_IMPORT_PATH=\"${PHOTOPRISM_IMPORT_PATH}\""
echo "export PHOTOPRISM_BACKUP_PATH=\"${PHOTOPRISM_BACKUP_PATH}\""
} >>~/.bashrc
} >> ~/.bashrc
# Test configs
for variabletest in $PHOTOPRISM_STORAGE_PATH $PHOTOPRISM_ORIGINALS_PATH $PHOTOPRISM_IMPORT_PATH $PHOTOPRISM_BACKUP_PATH; do
@@ -130,7 +130,7 @@ if bashio::config.has_value "PUID" && bashio::config.has_value "PGID"; then
{
echo "export PHOTOPRISM_UID=\"${PHOTOPRISM_UID}\""
echo "export PHOTOPRISM_GID=\"${PHOTOPRISM_GID}\""
} >>~/.bashrc
} >> ~/.bashrc
fi
# Start messages

View File

@@ -12,8 +12,8 @@ for SCRIPTS in "/00-banner.sh" "/00-local_mounts.sh" "/00-smb_mounts.sh"; do
chown "$(id -u)":"$(id -g)" "$SCRIPTS"
chmod a+x $SCRIPTS
sed -i 's|/usr/bin/with-contenv bashio|/usr/bin/env bashio|g' $SCRIPTS
/.$SCRIPTS &&
true || true # Prevents script crash on failure
/.$SCRIPTS \
&& true || true # Prevents script crash on failure
echo "exit $?"
done
@@ -34,7 +34,7 @@ export PHOTOPRISM_BACKUP_PATH=$(bashio::config 'BACKUP_PATH')
printf "%s\n" "PHOTOPRISM_ORIGINALS_PATH=\"${PHOTOPRISM_ORIGINALS_PATH}\""
printf "%s\n" "PHOTOPRISM_IMPORT_PATH=\"${PHOTOPRISM_IMPORT_PATH}\""
printf "%s\n" "PHOTOPRISM_BACKUP_PATH=\"${PHOTOPRISM_BACKUP_PATH}\""
} >>~/.bashrc
} >> ~/.bashrc
if bashio::config.has_value 'CUSTOM_OPTIONS'; then
CUSTOMOPTIONS=$(bashio::config 'CUSTOM_OPTIONS')

View File

View File

@@ -29,7 +29,7 @@ bashio::var.json \
protocol "${portainer_protocol}" \
certfile "$(bashio::config 'certfile')" \
keyfile "$(bashio::config 'keyfile')" \
ssl "^$(bashio::config 'ssl')" |
tempio \
ssl "^$(bashio::config 'ssl')" \
| tempio \
-template /etc/nginx/templates/ingress.gtpl \
-out /etc/nginx/servers/ingress.conf

0
portainer/rootfs/etc/services.d/nginx/run Normal file → Executable file
View File

0
portainer/rootfs/etc/services.d/portainer/run Normal file → Executable file
View File

View File

@@ -13,7 +13,7 @@ bashio::log.info "Starting app"
# Launch app
cd /app || true
if bashio::config.has_value 'PORTAINER_AGENT_ARGS'; then
./agent "$PORTAINER_AGENT_ARGS" 2>/dev/null
./agent "$PORTAINER_AGENT_ARGS" 2> /dev/null
else
./agent
fi

View File

@@ -110,7 +110,7 @@ start_postgres() {
wait_for_postgres() {
local tries=0
while ! pg_isready -h "$DB_HOSTNAME" -p "$DB_PORT" -U "$DB_USERNAME" >/dev/null 2>&1; do
while ! pg_isready -h "$DB_HOSTNAME" -p "$DB_PORT" -U "$DB_USERNAME" > /dev/null 2>&1; do
tries=$((tries + 1))
[ "$tries" -ge 60 ] && {
bashio::log.error "Postgres did not start after 2minutes, aborting."
@@ -132,7 +132,7 @@ restart_immich_addons_if_flagged() {
return 1
}
if command -v jq >/dev/null; then
if command -v jq > /dev/null; then
for slug in $(echo "$addons_json" | jq -r '.addons[] | select(.state=="started") | .slug'); do
if [[ "$slug" == *immich* ]]; then
bashio::log.info "Restarting addon $slug"
@@ -171,14 +171,14 @@ export DB_PORT DB_HOSTNAME DB_USERNAME DB_PASSWORD
get_available_extension_version() {
local extname="$1"
psql "postgres://$DB_USERNAME:$DB_PASSWORD@$DB_HOSTNAME:$DB_PORT/postgres" -v ON_ERROR_STOP=1 -tAc \
"SELECT default_version FROM pg_available_extensions WHERE name = '$extname';" 2>/dev/null | xargs
"SELECT default_version FROM pg_available_extensions WHERE name = '$extname';" 2> /dev/null | xargs
}
is_extension_available() {
local extname="$1"
local result
result=$(psql "postgres://$DB_USERNAME:$DB_PASSWORD@$DB_HOSTNAME:$DB_PORT/postgres" -v ON_ERROR_STOP=1 -tAc \
"SELECT 1 FROM pg_available_extensions WHERE name = '$extname';" 2>/dev/null | xargs)
"SELECT 1 FROM pg_available_extensions WHERE name = '$extname';" 2> /dev/null | xargs)
[[ "$result" == "1" ]]
}
@@ -190,7 +190,7 @@ get_user_databases() {
get_installed_extension_version() {
local extname="$1" dbname="$2"
psql "postgres://$DB_USERNAME:$DB_PASSWORD@$DB_HOSTNAME:$DB_PORT/$dbname" -v ON_ERROR_STOP=1 -tAc \
"SELECT extversion FROM pg_extension WHERE extname = '$extname';" 2>/dev/null | xargs
"SELECT extversion FROM pg_extension WHERE extname = '$extname';" 2> /dev/null | xargs
}
compare_versions() {
@@ -208,7 +208,7 @@ show_db_extensions() {
if [ -n "$exts" ]; then
while read -r ext; do
[ -n "$ext" ] && bashio::log.info " - $ext"
done <<<"$exts"
done <<< "$exts"
else
bashio::log.info " (no extensions enabled)"
fi
@@ -263,7 +263,7 @@ upgrade_postgres_if_needed() {
export DATA_DIR="$PGDATA" BINARIES_DIR="/usr/lib/postgresql" BACKUP_DIR="/config/backups"
export PSQL_VERSION="$IMAGE_VERSION" SUPPORTED_POSTGRES_VERSIONS="$CLUSTER_VERSION $IMAGE_VERSION"
apt-get update &>/dev/null
apt-get update &> /dev/null
apt-get install -y procps rsync "postgresql-$IMAGE_VERSION" "postgresql-$CLUSTER_VERSION"
[ -d "$BINARIES_DIR/$CLUSTER_VERSION/bin" ] || {

View File

@@ -12,10 +12,10 @@ if [ -f /homeassistant/addons_config/qBittorrent/qBittorrent.conf ] && [ ! -f /h
bashio::log.warning "----------------------------------------"
bashio::log.warning "Migrating configuration to the new addon"
bashio::log.warning "----------------------------------------"
cp -rnp /homeassistant/addons_config/qBittorrent/* /config/qBittorrent/ &>/dev/null || true
cp -rnp /homeassistant/addons_config/qBittorrent/* /config/qBittorrent/ &> /dev/null || true
if [ -d /config/qBittorrent/addons_config ]; then rm -r /config/qBittorrent/addons_config; fi
if [ -d /config/qBittorrent/qBittorrent ]; then rm -r /config/qBittorrent/qBittorrent; fi
echo "Files moved to /addon_configs/$HOSTNAME/openvpn" >/homeassistant/addons_config/qBittorrent/migrated
echo "Files moved to /addon_configs/$HOSTNAME/openvpn" > /homeassistant/addons_config/qBittorrent/migrated
bashio::log.yellow "... moved files from /config/addons_config/qBittorrent to /addon_configs/$HOSTNAME/qBitorrent (must be accessed with my Filebrowser addon)"
MIGRATED=true
fi
@@ -32,21 +32,21 @@ fi
# Move openvpn
if [ -d /homeassistant/openvpn ]; then
if [ ! -f /homeassistant/openvpn/migrated ] && [ "$(ls -A /homeassistant/openvpn)" ]; then
cp -rnf /homeassistant/openvpn/* /config/openvpn &>/dev/null || true
echo "Files moved to /addon_configs/$HOSTNAME/openvpn" >/homeassistant/openvpn/migrated
cp -rnf /homeassistant/openvpn/* /config/openvpn &> /dev/null || true
echo "Files moved to /addon_configs/$HOSTNAME/openvpn" > /homeassistant/openvpn/migrated
fi
fi
# Move config.yaml
if [ -f /homeassistant/addons_config/qbittorrent/config.yaml ] && [ ! -f /homeassistant/addons_config/qbittorrent/migrated ]; then
cp -rnf /homeassistant/addons_config/qbittorrent/* /config/ &>/dev/null || true
cp -rnf /homeassistant/addons_config/qbittorrent/* /config/ &> /dev/null || true
rm -r /homeassistant/addons_config/qbittorrent
bashio::log.yellow "... moved config.yaml from /config/addons_config/qbittorrent to /addon_configs/$HOSTNAME"
fi
# Move autoscript
if [ -f /homeassistant/addons_autoscrips/qbittorrent.sh ]; then
cp -rnf /homeassistant/addons_autoscrips/qbittorrent.sh /config/ &>/dev/null || true
cp -rnf /homeassistant/addons_autoscrips/qbittorrent.sh /config/ &> /dev/null || true
mv /homeassistant/addons_autoscrips/qbittorrent.sh /homeassistant/addons_autoscrips/qbittorrent.sh.bak
bashio::log.yellow "... moved qbittorrent.sh from /config/addons_autoscripts to /addon_configs/$HOSTNAME"
fi

View File

@@ -189,8 +189,8 @@ if [ "$CUSTOMUI" = default ]; then
sed -i '/AlternativeUIEnabled/d' qBittorrent.conf
sed -i '/RootFolder/d' qBittorrent.conf
# Update ingress webui
curl -f -s -S -O -J -L "$(curl -f -s -L https://api.github.com/repos/WDaan/VueTorrent/releases | grep -o "http.*vuetorrent.zip" | head -1)" >/dev/null
unzip -o vuetorrent.zip -d / >/dev/null
curl -f -s -S -O -J -L "$(curl -f -s -L https://api.github.com/repos/WDaan/VueTorrent/releases | grep -o "http.*vuetorrent.zip" | head -1)" > /dev/null
unzip -o vuetorrent.zip -d / > /dev/null
rm vuetorrent.zip
fi
@@ -202,18 +202,18 @@ if bashio::config.has_value 'customUI' && [ ! "$CUSTOMUI" = default ] && [ ! "$C
### Download WebUI
case $CUSTOMUI in
"vuetorrent")
curl -f -s -S -J -L -o /webui/release.zip "$(curl -f -s -L https://api.github.com/repos/WDaan/VueTorrent/releases/latest | grep -o "http.*vuetorrent.zip" | head -1)" >/dev/null
curl -f -s -S -J -L -o /webui/release.zip "$(curl -f -s -L https://api.github.com/repos/WDaan/VueTorrent/releases/latest | grep -o "http.*vuetorrent.zip" | head -1)" > /dev/null
;;
"qbit-matUI")
curl -f -s -S -J -L -o /webui/release.zip "$(curl -f -s -L https://api.github.com/repos/bill-ahmed/qbit-matUI/releases/latest | grep -o "http.*Unix.*.zip" | head -1)" >/dev/null
curl -f -s -S -J -L -o /webui/release.zip "$(curl -f -s -L https://api.github.com/repos/bill-ahmed/qbit-matUI/releases/latest | grep -o "http.*Unix.*.zip" | head -1)" > /dev/null
echo ""
bashio::log.warning "qbit-matUI selected ! It will not work for ingress, which will stay with vuetorrent"
echo ""
;;
"qb-web")
curl -f -s -S -J -L -o /webui/release.zip "$(curl -f -s -L https://api.github.com/repos/CzBiX/qb-web/releases | grep -o "http.*qb-web-.*zip" | head -1)" >/dev/null
curl -f -s -S -J -L -o /webui/release.zip "$(curl -f -s -L https://api.github.com/repos/CzBiX/qb-web/releases | grep -o "http.*qb-web-.*zip" | head -1)" > /dev/null
;;
esac || { bashio::log.warning "$CUSTOMUI could not be downloaded, please raise an issue on the github repository. The default UI will be used" && exit 0; }

View File

@@ -15,7 +15,7 @@ if bashio::config.true 'openvpn_enabled'; then
bashio::log.info "----------------------------"
# Get current ip
curl -s ipecho.net/plain >/currentip
curl -s ipecho.net/plain > /currentip
# Function to check for files path
function check_path() {
@@ -77,7 +77,7 @@ if bashio::config.true 'openvpn_enabled'; then
fi
fi
fi
done </tmpfile
done < /tmpfile
rm /tmpfile
# Standardize lf
@@ -119,7 +119,7 @@ if bashio::config.true 'openvpn_enabled'; then
fi
# If openvpn_config not set, but folder is not empty
elif ls /config/openvpn/*.ovpn >/dev/null 2>&1; then
elif ls /config/openvpn/*.ovpn > /dev/null 2>&1; then
# Look for openvpn files
# Wildcard search for openvpn config files and store results in array
mapfile -t VPN_CONFIGS < <(find /config/openvpn -maxdepth 1 -name "*.ovpn" -print)
@@ -143,13 +143,13 @@ if bashio::config.true 'openvpn_enabled'; then
# Set credentials
if bashio::config.has_value "openvpn_username"; then
openvpn_username=$(bashio::config 'openvpn_username')
echo "${openvpn_username}" >/etc/openvpn/credentials
echo "${openvpn_username}" > /etc/openvpn/credentials
else
bashio::exit.nok "Openvpn is enabled, but openvpn_username option is empty! Exiting"
fi
if bashio::config.has_value "openvpn_password"; then
openvpn_password=$(bashio::config 'openvpn_password')
echo "${openvpn_password}" >>/etc/openvpn/credentials
echo "${openvpn_password}" >> /etc/openvpn/credentials
else
bashio::exit.nok "Openvpn is enabled, but openvpn_password option is empty! Exiting"
fi
@@ -170,8 +170,8 @@ if bashio::config.true 'openvpn_enabled'; then
sed -i '/^auth-user-pass/i # specified auth-user-pass file not found, disabling' /config/openvpn/"$openvpn_config"
sed -i '/^auth-user-pass/s/^/#/' /config/openvpn/"$openvpn_config"
# No credentials specified, using addons username and password
echo "# Please do not remove the line below, it allows using the addon username and password" >>/config/openvpn/"$openvpn_config"
echo "auth-user-pass /etc/openvpn/credentials" >>/etc/openvpn/"$openvpn_config"
echo "# Please do not remove the line below, it allows using the addon username and password" >> /config/openvpn/"$openvpn_config"
echo "auth-user-pass /etc/openvpn/credentials" >> /etc/openvpn/"$openvpn_config"
fi
else
# Standardize just to be sure
@@ -179,8 +179,8 @@ if bashio::config.true 'openvpn_enabled'; then
fi
else
# No credentials specified, using addons username and password
echo "# Please do not remove the line below, it allows using the addon username and password" >>/config/openvpn/"$openvpn_config"
echo "auth-user-pass /etc/openvpn/credentials" >>/config/openvpn/"$openvpn_config"
echo "# Please do not remove the line below, it allows using the addon username and password" >> /config/openvpn/"$openvpn_config"
echo "auth-user-pass /etc/openvpn/credentials" >> /config/openvpn/"$openvpn_config"
fi
# Permissions

View File

@@ -16,7 +16,7 @@ if [ "${PEER_DNS}" != "no" ]; then
elif [ -e /etc/resolv.conf-"${dev}".sv ]; then
# Important that we cat instead of move incase resolv.conf is
# a symlink and not an actual file
cat /etc/resolv.conf-"${dev}".sv >/etc/resolv.conf
cat /etc/resolv.conf-"${dev}".sv > /etc/resolv.conf
rm -f /etc/resolv.conf-"${dev}".sv
fi
fi
@@ -25,8 +25,8 @@ if [ -n "${RC_SVCNAME}" ]; then
# Re-enter the init script to start any dependant services
if /etc/init.d/"${RC_SVCNAME}" --quiet status; then
export IN_BACKGROUND=true
if [ -d /var/run/s6/container_environment ]; then printf "%s" "true" >/var/run/s6/container_environment/IN_BACKGROUND; fi
printf "%s\n" "IN_BACKGROUND=\"true\"" >>~/.bashrc
if [ -d /var/run/s6/container_environment ]; then printf "%s" "true" > /var/run/s6/container_environment/IN_BACKGROUND; fi
printf "%s\n" "IN_BACKGROUND=\"true\"" >> ~/.bashrc
/etc/init.d/"${RC_SVCNAME}" --quiet stop
fi
fi

View File

@@ -59,7 +59,7 @@ if [ "${PEER_DNS}" != "no" ]; then
if [ -e /etc/resolv.conf ]; then
cp /etc/resolv.conf /etc/resolv.conf-"${dev}".sv
fi
printf "${DNS}" >/etc/resolv.conf
printf "${DNS}" > /etc/resolv.conf
chmod 644 /etc/resolv.conf
fi
fi
@@ -78,8 +78,8 @@ if [ -n "${RC_SVCNAME}" ]; then
# Re-enter the init script to start any dependant services
if ! /etc/init.d/"${RC_SVCNAME}" --quiet status; then
export IN_BACKGROUND=true
if [ -d /var/run/s6/container_environment ]; then printf "%s" "true" >/var/run/s6/container_environment/IN_BACKGROUND; fi
printf "%s\n" "IN_BACKGROUND=\"true\"" >>~/.bashrc
if [ -d /var/run/s6/container_environment ]; then printf "%s" "true" > /var/run/s6/container_environment/IN_BACKGROUND; fi
printf "%s\n" "IN_BACKGROUND=\"true\"" >> ~/.bashrc
/etc/init.d/${RC_SVCNAME} --quiet start
fi
fi

View File

@@ -13,14 +13,15 @@ else
########################################################
# DRAFT : Start wireguard if needed
if bashio::config.true 'wireguard_enabled'; then
wg-quick up /config/wireguard/config.conf & true
wg-quick up /config/wireguard/config.conf &
true
fi
########################################################
if bashio::config.true 'silent'; then
exec \
s6-notifyoncheck -d -n 300 -w 1000 -c "nc -z localhost ${WEBUI_PORT}" \
s6-setuidgid abc /usr/bin/qbittorrent-nox --webui-port="${WEBUI_PORT}" >/dev/null
s6-setuidgid abc /usr/bin/qbittorrent-nox --webui-port="${WEBUI_PORT}" > /dev/null
else
exec \
s6-notifyoncheck -d -n 300 -w 1000 -c "nc -z localhost ${WEBUI_PORT}" \

4
qbittorrent/rootfs/etc/services.d/nginx/run Normal file → Executable file
View File

@@ -10,7 +10,7 @@ bashio::log.info "Starting NGinx..."
# Check vpn is working
if [ -f /currentip ]; then
nginx || nginx -s reload & \
nginx || nginx -s reload &
while true; do
# Get vpn ip
if ! bashio::config.true 'wireguard_enabled' && bashio::config.true 'openvpn_alt_mode'; then
@@ -26,7 +26,7 @@ if [ -f /currentip ]; then
fi
# Get ip location
COUNTRY=$(curl -s https://ipinfo.io/$(cat /vpnip) | grep country -i -m 1 | cut -d ':' -f 2 |xargs | awk 'gsub(/,$/,x)' || true)
COUNTRY=$(curl -s https://ipinfo.io/$(cat /vpnip) | grep country -i -m 1 | cut -d ':' -f 2 | xargs | awk 'gsub(/,$/,x)' || true)
# Inform by message
bashio::log.info "VPN is up and running with ip $(cat /vpnip), based in country : $COUNTRY"

0
qbittorrent/rootfs/etc/services.d/timer/run Normal file → Executable file
View File

0
radarr/rootfs/etc/services.d/nginx/run Normal file → Executable file
View File

0
readarr/rootfs/etc/services.d/nginx/run Normal file → Executable file
View File

View File

@@ -10,7 +10,7 @@ config_location="${config_location/\/config/\/homeassistant}"
if [ -f "$config_location/config.yaml" ] && [ ! -f "$config_location/migrated" ]; then
bashio::log.warning "Migrating config.yaml"
cp -rf "/homeassistant/addons_config/$slug"/* /config/ || true
echo "Migrated to internal config folder accessible at /addon_configs/xxx-$slug" >"/homeassistant/addons_config/$slug/migrated"
echo "Migrated to internal config folder accessible at /addon_configs/xxx-$slug" > "/homeassistant/addons_config/$slug/migrated"
fi
if [ -f "/homeassistant/addons_autoscripts/$slug.sh" ]; then

View File

@@ -39,11 +39,11 @@ change_folders() {
done
# Transfer files
if [ -d "$ORIGINALLOCATION" ] && [ "$(ls -A "$ORIGINALLOCATION" 2>/dev/null)" ]; then
if [ -d "$ORIGINALLOCATION" ] && [ "$(ls -A "$ORIGINALLOCATION" 2> /dev/null)" ]; then
echo "Files were existing in $ORIGINALLOCATION, they will be moved to $CONFIGLOCATION"
mv "$ORIGINALLOCATION"/* "$CONFIGLOCATION"/
rmdir "$ORIGINALLOCATION"
fi 2>/dev/null || true
fi 2> /dev/null || true
fi
# Create folders
@@ -79,7 +79,7 @@ chmod -R 777 /config
DIRS_TO_ADD=("/backup" "/media" "/share" "/addons")
echo "Checking dir_whitelist in /config/sync.json"
for DIR in "${DIRS_TO_ADD[@]}"; do
if ! jq -e ".webui.dir_whitelist | index(\"$DIR\")" /config/sync.json >/dev/null; then
if ! jq -e ".webui.dir_whitelist | index(\"$DIR\")" /config/sync.json > /dev/null; then
echo "Adding $DIR to dir_whitelist"
jq ".webui.dir_whitelist += [\"$DIR\"]" /config/sync.json | sponge /config/sync.json
fi

0
resiliosync/rootfs/etc/services.d/nginx/run Normal file → Executable file
View File

Some files were not shown because too many files have changed in this diff Show More