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 # # Automatic modules download #
############################## ##############################
if [ -e "/MODULESFILE" ]; then if [ -e "/MODULESFILE" ]; then
MODULES=$(</MODULESFILE) MODULES=$(< /MODULESFILE)
MODULES="${MODULES:-00-banner.sh}" MODULES="${MODULES:-00-banner.sh}"
echo "Executing modules script : $MODULES" 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 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 && && 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 && && 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 && && 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 && && 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 && chmod -R 755 /etc/cont-init.d
fi fi
####################### #######################
# Automatic installer # # Automatic installer #
####################### #######################
if [ -e "/ENVFILE" ]; then if [ -e "/ENVFILE" ]; then
PACKAGES=$(</ENVFILE) PACKAGES=$(< /ENVFILE)
echo "Executing dependency script with custom elements : $PACKAGES" 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 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 && && 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 && && 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 && && chmod 777 /ha_automatic_packages.sh \
eval /./ha_automatic_packages.sh "${PACKAGES:-}" && && eval /./ha_automatic_packages.sh "${PACKAGES:-}" \
rm /ha_automatic_packages.sh && rm /ha_automatic_packages.sh
fi fi
if [ -e "/MODULESFILE" ] && [ ! -f /ha_entrypoint.sh ]; then if [ -e "/MODULESFILE" ] && [ ! -f /ha_entrypoint.sh ]; then

View File

@@ -5,7 +5,7 @@ set -e
# Displays a simple add-on banner on startup # 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 # Degraded mode if no homeassistant
bashio::log.blue \ bashio::log.blue \
'-----------------------------------------------------------' '-----------------------------------------------------------'
@@ -67,7 +67,7 @@ bashio::log.blue \
# ============================================================================== # ==============================================================================
# Global actions for all addons # 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 : ' bashio::log.green ' Defining permissions for main user : '
PUID="$(bashio::config "PUID")" PUID="$(bashio::config "PUID")"
PGID="$(bashio::config "PGID")" PGID="$(bashio::config "PGID")"
@@ -81,4 +81,4 @@ if bashio::config.has_value "PUID" && bashio::config.has_value "PGID" && id abc
fi fi
# Clean bashrc file safely # 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 # shellcheck shell=bash
set -e set -e
if ! bashio::supervisor.ping 2>/dev/null; then if ! bashio::supervisor.ping 2> /dev/null; then
echo "..." echo "..."
exit 0 exit 0
fi fi
@@ -91,26 +91,26 @@ for KEYS in "${arr[@]}"; do
# shellcheck disable=SC2163 # shellcheck disable=SC2163
export "$line" export "$line"
# export to python # export to python
if command -v "python3" &>/dev/null; then if command -v "python3" &> /dev/null; then
[ ! -f /env.py ] && echo "import os" >/env.py [ ! -f /env.py ] && echo "import os" > /env.py
# Escape \ # Escape \
VALUEPY="${VALUE//\\/\\\\}" VALUEPY="${VALUE//\\/\\\\}"
# Avoid " and ' # Avoid " and '
VALUEPY="${VALUEPY//[\"\']/}" VALUEPY="${VALUEPY//[\"\']/}"
echo "os.environ['${KEYS}'] = '$VALUEPY'" >>/env.py echo "os.environ['${KEYS}'] = '$VALUEPY'" >> /env.py
python3 /env.py python3 /env.py
fi fi
# set .env # set .env
echo "$line" >>/.env || true echo "$line" >> /.env || true
# set /etc/environment # set /etc/environment
mkdir -p /etc mkdir -p /etc
echo "$line" >>/etc/environment echo "$line" >> /etc/environment
# For non s6 # 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/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/cont-init.d/*run* &> /dev/null; then sed -i "1a export $line" /etc/cont-init.d/*run* 2> /dev/null; fi
# For s6 # For s6
if [ -d /var/run/s6/container_environment ]; then printf "%s" "${VALUE}" >/var/run/s6/container_environment/"${KEYS}"; fi if [ -d /var/run/s6/container_environment ]; then printf "%s" "${VALUE}" > /var/run/s6/container_environment/"${KEYS}"; fi
echo "export ${KEYS}='${VALUE}'" >>~/.bashrc echo "export ${KEYS}='${VALUE}'" >> ~/.bashrc
fi fi
done done
@@ -122,6 +122,6 @@ set +eu
if [ -n "$TZ" ] && [ -f /etc/localtime ]; then if [ -n "$TZ" ] && [ -f /etc/localtime ]; then
if [ -f /usr/share/zoneinfo/"$TZ" ]; then if [ -f /usr/share/zoneinfo/"$TZ" ]; then
echo "Timezone set from $(cat /etc/timezone) to $TZ" 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
fi fi

View File

@@ -2,7 +2,7 @@
# shellcheck shell=bash # shellcheck shell=bash
set -e set -e
if ! bashio::supervisor.ping 2>/dev/null; then if ! bashio::supervisor.ping 2> /dev/null; then
echo "..." echo "..."
exit 0 exit 0
fi fi
@@ -15,8 +15,8 @@ fi
if bashio::config.has_value 'localdisks'; then if bashio::config.has_value 'localdisks'; then
# Available devices # Available devices
blkid | awk '{print substr($1, 0, length($1) - 1)}' | awk -F'/' '{print $NF}' >availabledisks blkid | awk '{print substr($1, 0, length($1) - 1)}' | awk -F'/' '{print $NF}' > availabledisks
echo "NAME" >>availabledisks echo "NAME" >> availabledisks
## List available Disk with Labels and Id ## List available Disk with Labels and Id
bashio::log.blue "---------------------------------------------------" bashio::log.blue "---------------------------------------------------"
@@ -26,7 +26,7 @@ if bashio::config.has_value 'localdisks'; then
rm availabledisks 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 # 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 "Supported fs : ${fstypessupport}"
bashio::log.green "Inspired from : github.com/dianlight" bashio::log.green "Inspired from : github.com/dianlight"
bashio::log.blue "---------------------------------------------------" bashio::log.blue "---------------------------------------------------"
@@ -99,8 +99,8 @@ if bashio::config.has_value 'localdisks'; then
if [ -d /share/"$disk" ]; then dirpath="/share"; fi if [ -d /share/"$disk" ]; then dirpath="/share"; fi
# shellcheck disable=SC2015 # 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." bashio::log.fatal "Unable to mount local drives! Please check the name."
rmdir /mnt/"$disk" rmdir /mnt/"$disk"
bashio::addon.stop bashio::addon.stop

View File

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

View File

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

View File

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

View File

@@ -12,7 +12,7 @@ if [ -f "${JSONTOCHECK}" ]; then
echo "Checking settings.json format" echo "Checking settings.json format"
# Check if json file valid or not # 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 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" 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 mv "${JSONSOURCE}" "${JSONSOURCE}"_old
@@ -39,7 +39,7 @@ if [ -f "${JSONTOCHECK}" ]; then
done done
# Show structure in a nice way # 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 # Message
bashio::log.info "Your settings.json was checked and seems perfectly normal!" 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 # Create index.html
touch /etc/ingress.html touch /etc/ingress.html
cat >/etc/ingress.html <<EOF cat > /etc/ingress.html << EOF
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>

View File

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

View File

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

View File

@@ -14,9 +14,9 @@ if bashio::config.has_value "graphic_driver"; then
# Get installer type # Get installer type
if [ -f /usr/bin/apt ]; then if [ -f /usr/bin/apt ]; then
bashio::log.info "... Distribution detected : Debian/Ubuntu" bashio::log.info "... Distribution detected : Debian/Ubuntu"
apt-get install -yqq software-properties-common >/dev/null apt-get install -yqq software-properties-common > /dev/null
add-apt-repository ppa:kisak/kisak-mesa >/dev/null add-apt-repository ppa:kisak/kisak-mesa > /dev/null
apt-get update >/dev/null apt-get update > /dev/null
apt-get install -yqq mesa apt-get install -yqq mesa
elif [ -f /usr/bin/apk ]; then elif [ -f /usr/bin/apk ]; then
bashio::log.info "... Distribution detected : Alpine" bashio::log.info "... Distribution detected : Alpine"
@@ -24,7 +24,7 @@ if bashio::config.has_value "graphic_driver"; then
# Detect GPU # Detect GPU
# shellcheck disable=SC2207 # 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[*]}" bashio::log.info "... GPU detected: ${GPU_DETECTED[*]}"
graphic_driver="" graphic_driver=""
@@ -56,27 +56,27 @@ if bashio::config.has_value "graphic_driver"; then
case "$graphic_driver" in case "$graphic_driver" in
x64_AMD) x64_AMD)
if [[ "$BUILD_ARCH" != amd64 ]]; then bashio::log.fatal "Wrong architecture, $graphic_driver doesn't support $BUILD_ARCH"; fi 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/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/apk ] && apk add --no-cache mesa-dri-classic mesa-vdpau-gallium linux-firmware-radeon > /dev/null && bashio::log.green "... done"
;; ;;
x64_NVIDIA) x64_NVIDIA)
if [[ "$BUILD_ARCH" != amd64 ]]; then bashio::log.fatal "Wrong architecture, $graphic_driver doesn't support $BUILD_ARCH"; fi 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/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/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) x64_Intel)
if [[ "$BUILD_ARCH" != amd64 ]]; then bashio::log.fatal "Wrong architecture, $graphic_driver doesn't support $BUILD_ARCH"; fi 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/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/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) aarch64_rpi)
if [[ "$BUILD_ARCH" != arm64 ]]; then bashio::log.fatal "Wrong architecture, $graphic_driver doesn't support $BUILD_ARCH"; fi 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" 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/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/apt ] && apt-get -yqq install libgles2-mesa libgles2-mesa-dev xorg-dev > /dev/null && bashio::log.green "... done"
;; ;;
esac esac
@@ -131,8 +131,8 @@ if bashio::config.has_value "graphic_driver"; then
curl -f --retry 10 --retry-max-time 60 --retry-connrefused \ curl -f --retry 10 --retry-max-time 60 --retry-connrefused \
--silent \ --silent \
--header 'GET' \ --header 'GET' \
"${AUTH_URL}" | "${AUTH_URL}" \
jq -r '.token' | jq -r '.token'
)" )"
# Determine first and only layer of image # Determine first and only layer of image
SHALAYER=$(get_blob_sha "${MODE}" "${TOKEN}" "${MANIFEST_URL}") SHALAYER=$(get_blob_sha "${MODE}" "${TOKEN}" "${MANIFEST_URL}")
@@ -163,7 +163,7 @@ if bashio::config.has_value "graphic_driver"; then
shopt -u dotglob shopt -u dotglob
rm -rf /tmp/mod rm -rf /tmp/mod
rm -rf /modtarball.tar.xz rm -rf /modtarball.tar.xz
echo "${SHALAYER}" >"/${FILENAME}" echo "${SHALAYER}" > "/${FILENAME}"
echo "[mod-init] ${DOCKER_MOD} applied to container" echo "[mod-init] ${DOCKER_MOD} applied to container"
fi fi
done done

View File

@@ -10,13 +10,13 @@ PACKAGES="$1"
echo "To install : $PACKAGES" echo "To install : $PACKAGES"
# Install bash if needed # Install bash if needed
if ! command -v bash >/dev/null 2>/dev/null; then 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 (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) > /dev/null
fi fi
# Install curl if needed # Install curl if needed
if ! command -v curl >/dev/null 2>/dev/null; then 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 (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) > /dev/null
fi fi
# Call apps installer script if needed # Call apps installer script if needed

View File

@@ -8,11 +8,11 @@ set -e
#Verbose or not #Verbose or not
VERBOSE=false VERBOSE=false
#Avoid fails on non declared variables #Avoid fails on non declared variables
set +u 2>/dev/null || true set +u 2> /dev/null || true
#If no packages, empty #If no packages, empty
PACKAGES="${*:-}" PACKAGES="${*:-}"
#Avoids messages if non interactive #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" [ "$VERBOSE" = true ] && echo "ENV : $PACKAGES"
@@ -20,15 +20,15 @@ PACKAGES="${*:-}"
# CHECK WHICH BASE IS USED # # CHECK WHICH BASE IS USED #
############################ ############################
if command -v "apk" &>/dev/null; then if command -v "apk" &> /dev/null; then
# If apk based # If apk based
[ "$VERBOSE" = true ] && echo "apk based" [ "$VERBOSE" = true ] && echo "apk based"
PACKMANAGER="apk" PACKMANAGER="apk"
elif command -v "apt" &>/dev/null; then elif command -v "apt" &> /dev/null; then
# If apt-get based # If apt-get based
[ "$VERBOSE" = true ] && echo "apt based" [ "$VERBOSE" = true ] && echo "apt based"
PACKMANAGER="apt" PACKMANAGER="apt"
elif command -v "pacman" &>/dev/null; then elif command -v "pacman" &> /dev/null; then
# If apt-get based # If apt-get based
[ "$VERBOSE" = true ] && echo "pacman based" [ "$VERBOSE" = true ] && echo "pacman based"
PACKMANAGER="pacman" PACKMANAGER="pacman"
@@ -49,16 +49,16 @@ PACKAGES="$PACKAGES jq curl ca-certificates"
# Scripts # Scripts
for files in "/etc/cont-init.d" "/etc/services.d"; do for files in "/etc/cont-init.d" "/etc/services.d"; do
# Next directory if does not exists # 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 # Test each possible command
COMMAND="nginx" 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" [ "$VERBOSE" = true ] && echo "$COMMAND required"
[ "$PACKMANAGER" = "apk" ] && PACKAGES="$PACKAGES nginx" [ "$PACKMANAGER" = "apk" ] && PACKAGES="$PACKAGES nginx"
[ "$PACKMANAGER" = "apt" ] && PACKAGES="$PACKAGES nginx" [ "$PACKMANAGER" = "apt" ] && PACKAGES="$PACKAGES nginx"
[ "$PACKMANAGER" = "pacman" ] && 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 fi
COMMAND="mount" COMMAND="mount"
@@ -70,7 +70,7 @@ for files in "/etc/cont-init.d" "/etc/services.d"; do
fi fi
COMMAND="ping" 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" [ "$VERBOSE" = true ] && echo "$COMMAND required"
[ "$PACKMANAGER" = "apk" ] && PACKAGES="$PACKAGES iputils" [ "$PACKMANAGER" = "apk" ] && PACKAGES="$PACKAGES iputils"
[ "$PACKMANAGER" = "apt" ] && PACKAGES="$PACKAGES iputils-ping" [ "$PACKMANAGER" = "apt" ] && PACKAGES="$PACKAGES iputils-ping"
@@ -94,7 +94,7 @@ for files in "/etc/cont-init.d" "/etc/services.d"; do
fi fi
COMMAND="smbclient" 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" [ "$VERBOSE" = true ] && echo "$COMMAND required"
[ "$PACKMANAGER" = "apk" ] && PACKAGES="$PACKAGES samba samba-client ntfs-3g" [ "$PACKMANAGER" = "apk" ] && PACKAGES="$PACKAGES samba samba-client ntfs-3g"
[ "$PACKMANAGER" = "apt" ] && PACKAGES="$PACKAGES samba smbclient 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 fi
COMMAND="dos2unix" 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" [ "$VERBOSE" = true ] && echo "$COMMAND required"
[ "$PACKMANAGER" = "apk" ] && PACKAGES="$PACKAGES dos2unix" [ "$PACKMANAGER" = "apk" ] && PACKAGES="$PACKAGES dos2unix"
[ "$PACKMANAGER" = "apt" ] && PACKAGES="$PACKAGES dos2unix" [ "$PACKMANAGER" = "apt" ] && PACKAGES="$PACKAGES dos2unix"
@@ -110,7 +110,7 @@ for files in "/etc/cont-init.d" "/etc/services.d"; do
fi fi
COMMAND="openvpn" 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" [ "$VERBOSE" = true ] && echo "$COMMAND required"
[ "$PACKMANAGER" = "apk" ] && PACKAGES="$PACKAGES coreutils openvpn" [ "$PACKMANAGER" = "apk" ] && PACKAGES="$PACKAGES coreutils openvpn"
[ "$PACKMANAGER" = "apt" ] && 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 fi
COMMAND="jq" 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" [ "$VERBOSE" = true ] && echo "$COMMAND required"
[ "$PACKMANAGER" = "apk" ] && PACKAGES="$PACKAGES jq" [ "$PACKMANAGER" = "apk" ] && PACKAGES="$PACKAGES jq"
[ "$PACKMANAGER" = "apt" ] && PACKAGES="$PACKAGES jq" [ "$PACKMANAGER" = "apt" ] && PACKAGES="$PACKAGES jq"
@@ -126,7 +126,7 @@ for files in "/etc/cont-init.d" "/etc/services.d"; do
fi fi
COMMAND="yamllint" 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" [ "$VERBOSE" = true ] && echo "$COMMAND required"
[ "$PACKMANAGER" = "apk" ] && PACKAGES="$PACKAGES yamllint" [ "$PACKMANAGER" = "apk" ] && PACKAGES="$PACKAGES yamllint"
[ "$PACKMANAGER" = "apt" ] && PACKAGES="$PACKAGES yamllint" [ "$PACKMANAGER" = "apt" ] && PACKAGES="$PACKAGES yamllint"
@@ -134,7 +134,7 @@ for files in "/etc/cont-init.d" "/etc/services.d"; do
fi fi
COMMAND="git" 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" [ "$VERBOSE" = true ] && echo "$COMMAND required"
[ "$PACKMANAGER" = "apk" ] && PACKAGES="$PACKAGES git" [ "$PACKMANAGER" = "apk" ] && PACKAGES="$PACKAGES git"
[ "$PACKMANAGER" = "apt" ] && PACKAGES="$PACKAGES git" [ "$PACKMANAGER" = "apt" ] && PACKAGES="$PACKAGES git"
@@ -142,7 +142,7 @@ for files in "/etc/cont-init.d" "/etc/services.d"; do
fi fi
COMMAND="sponge" 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" [ "$VERBOSE" = true ] && echo "$COMMAND required"
[ "$PACKMANAGER" = "apk" ] && PACKAGES="$PACKAGES moreutils" [ "$PACKMANAGER" = "apk" ] && PACKAGES="$PACKAGES moreutils"
[ "$PACKMANAGER" = "apt" ] && PACKAGES="$PACKAGES moreutils" [ "$PACKMANAGER" = "apt" ] && PACKAGES="$PACKAGES moreutils"
@@ -150,7 +150,7 @@ for files in "/etc/cont-init.d" "/etc/services.d"; do
fi fi
COMMAND="sqlite3" 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" [ "$VERBOSE" = true ] && echo "$COMMAND required"
[ "$PACKMANAGER" = "apk" ] && PACKAGES="$PACKAGES sqlite" [ "$PACKMANAGER" = "apk" ] && PACKAGES="$PACKAGES sqlite"
[ "$PACKMANAGER" = "apt" ] && PACKAGES="$PACKAGES sqlite3" [ "$PACKMANAGER" = "apt" ] && PACKAGES="$PACKAGES sqlite3"
@@ -158,7 +158,7 @@ for files in "/etc/cont-init.d" "/etc/services.d"; do
fi fi
COMMAND="pip" 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" [ "$VERBOSE" = true ] && echo "$COMMAND required"
[ "$PACKMANAGER" = "apk" ] && PACKAGES="$PACKAGES py3-pip" [ "$PACKMANAGER" = "apk" ] && PACKAGES="$PACKAGES py3-pip"
[ "$PACKMANAGER" = "apt" ] && PACKAGES="$PACKAGES pip" [ "$PACKMANAGER" = "apt" ] && PACKAGES="$PACKAGES pip"
@@ -166,7 +166,7 @@ for files in "/etc/cont-init.d" "/etc/services.d"; do
fi fi
COMMAND="wget" 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" [ "$VERBOSE" = true ] && echo "$COMMAND required"
[ "$PACKMANAGER" = "apk" ] && PACKAGES="$PACKAGES wget" [ "$PACKMANAGER" = "apk" ] && PACKAGES="$PACKAGES wget"
[ "$PACKMANAGER" = "apt" ] && PACKAGES="$PACKAGES wget" [ "$PACKMANAGER" = "apt" ] && PACKAGES="$PACKAGES wget"
@@ -181,29 +181,29 @@ done
# Install apps # Install apps
[ "$VERBOSE" = true ] && echo "installing packages $PACKAGES" [ "$VERBOSE" = true ] && echo "installing packages $PACKAGES"
if [ "$PACKMANAGER" = "apt" ]; then apt-get update >/dev/null; fi if [ "$PACKMANAGER" = "apt" ]; then apt-get update > /dev/null; fi
if [ "$PACKMANAGER" = "pacman" ]; then pacman -Sy >/dev/null; fi if [ "$PACKMANAGER" = "pacman" ]; then pacman -Sy > /dev/null; fi
# Install apps one by one to allow failures # Install apps one by one to allow failures
# shellcheck disable=SC2086 # shellcheck disable=SC2086
for packagestoinstall in $PACKAGES; do for packagestoinstall in $PACKAGES; do
[ "$VERBOSE" = true ] && echo "... $packagestoinstall" [ "$VERBOSE" = true ] && echo "... $packagestoinstall"
if [ "$PACKMANAGER" = "apk" ]; then 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 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 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 fi
[ "$VERBOSE" = true ] && echo "... $packagestoinstall done" [ "$VERBOSE" = true ] && echo "... $packagestoinstall done"
done done
# Clean after install # Clean after install
[ "$VERBOSE" = true ] && echo "Cleaning apt cache" [ "$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 # 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" [ "$VERBOSE" = true ] && echo "replace nginx2"
rm -r /etc/nginx rm -r /etc/nginx
mv /etc/nginx2 /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 for files in "/etc/services.d" "/etc/cont-init.d"; do
# Next directory if does not exists # 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 # Bashio
if grep -q -rnw "$files/" -e 'bashio' && [ ! -f "/usr/bin/bashio" ]; then 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 # Lastversion
COMMAND="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" [ "$VERBOSE" = true ] && echo "install $COMMAND"
pip install $COMMAND pip install $COMMAND
fi fi
@@ -255,17 +255,17 @@ for files in "/etc/services.d" "/etc/cont-init.d"; do
# Mustache # Mustache
COMMAND="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" [ "$VERBOSE" = true ] && echo "$COMMAND required"
[ "$PACKMANAGER" = "apk" ] && apk add --no-cache go npm && [ "$PACKMANAGER" = "apk" ] && apk add --no-cache go npm \
apk upgrade --no-cache && && apk upgrade --no-cache \
apk add --no-cache --virtual .build-deps build-base git go && && apk add --no-cache --virtual .build-deps build-base git go \
go get -u github.com/quantumew/mustache-cli && && go get -u github.com/quantumew/mustache-cli \
cp "$GOPATH"/bin/* /usr/bin/ && && cp "$GOPATH"/bin/* /usr/bin/ \
rm -rf "$GOPATH" /var/cache/apk/* /tmp/src && && rm -rf "$GOPATH" /var/cache/apk/* /tmp/src \
apk del .build-deps xz build-base && apk del .build-deps xz build-base
[ "$PACKMANAGER" = "apt" ] && apt-get update && [ "$PACKMANAGER" = "apt" ] && apt-get update \
apt-get install -yqq go npm node-mustache && apt-get install -yqq go npm node-mustache
fi fi
done 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" echo "To download : $MODULES"
# Install bash if not available # Install bash if not available
if ! command -v bash >/dev/null 2>/dev/null; then 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 (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) > /dev/null
fi fi
# Install curl if not available # Install curl if not available
if ! command -v curl >/dev/null 2>/dev/null; then 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 (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) > /dev/null
fi fi
# Install ca-certificates if not available # 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 # Create folder for scripts
mkdir -p /etc/cont-init.d mkdir -p /etc/cont-init.d
# Download scripts # Download scripts
for scripts in $MODULES; do 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" && 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")" != "" ] || && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] \
(echo "script failed to install $scripts" && exit 1) || (echo "script failed to install $scripts" && exit 1)
done done
chmod -R 755 /etc/cont-init.d 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 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 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%% *}" 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" echo "Valid shebang: $shebang"
break break
fi fi
@@ -39,7 +39,7 @@ for SCRIPTS in /etc/cont-init.d/*; do
fi fi
# Use source to share env variables when requested # 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/(.*\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.nok/return 1/g" "$SCRIPTS"
sed -i "s/bashio::exit.ok/return 0/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 # 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" sed -i -E 's|^s6-setuidgid[[:space:]]+([a-zA-Z0-9._-]+)[[:space:]]+(.*)$|su -s /bin/bash \1 -c "\2"|g' "$runfile"
chmod +x "$runfile" chmod +x "$runfile"
( exec "$runfile" ) & true (exec "$runfile") &
true
fi fi
done done
@@ -76,19 +77,19 @@ if [ "$$" -eq 1 ]; then
terminate() { terminate() {
echo "Termination signal received, forwarding to subprocesses..." echo "Termination signal received, forwarding to subprocesses..."
# Terminate all subprocesses # Terminate all subprocesses
if command -v pgrep &>/dev/null; then if command -v pgrep &> /dev/null; then
for pid in $(pgrep -P $$); do for pid in $(pgrep -P $$); do
echo "Terminating child PID $pid" 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 done
else else
# Fallback to iterating through /proc if pgrep is not available # Fallback to iterating through /proc if pgrep is not available
for pid in /proc/[0-9]*/; do for pid in /proc/[0-9]*/; do
pid=${pid#/proc/} pid=${pid#/proc/}
pid=${pid%/} 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" 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 fi
done done
fi fi

View File

@@ -40,7 +40,7 @@ mkdir -p /run/s6/container_environment
# Check if shebang exists # 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 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%% *}" 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" echo "Valid shebang: $shebang"
break break
fi fi

View File

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

View File

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

View File

@@ -22,7 +22,7 @@ if [ "$(uname -m)" == "x86_64" ]; then
fi fi
# Make sure bats model is on # 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 # Disable monitoring service
sed -i "1a sleep infinity" /custom-services.d/30-monitoring.sh 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" mkdir -p "/config/$BIRDSONGS_FOLDER"
fi fi
if [ -d "/data/$BIRDSONGS_FOLDER" ]; then 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"/ cp -rf /data/"$BIRDSONGS_FOLDER"/* "/config/$BIRDSONGS_FOLDER"/
fi fi
rm -r "/data/$BIRDSONGS_FOLDER" 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 " " echo " "
# Adjust microphone volume if needed # Adjust microphone volume if needed
if command -v amixer >/dev/null 2>/dev/null; then 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 current_volume="$(amixer sget Capture | grep -oP '\[\d+%\]' | tr -d '[]%' | head -1 2> /dev/null || echo "100")" || true
if [[ "$current_volume" -eq 0 ]]; then if [[ "$current_volume" -eq 0 ]]; then
amixer sset Capture 70% amixer sset Capture 70%
bashio::log.warning "Microphone was off, volume set to 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" export TZ="$TZ_VALUE"
# Update caddyfile with password # 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" echo "Starting service: caddy"
/usr/bin/caddy run --config /etc/caddy/Caddyfile /usr/bin/caddy run --config /etc/caddy/Caddyfile

View File

@@ -61,7 +61,7 @@ DISK_USAGE_THRESHOLD=95
same_file_counter=0 same_file_counter=0
SAME_FILE_THRESHOLD=2 SAME_FILE_THRESHOLD=2
if [[ -f "$ANALYZING_NOW_FILE" ]]; then if [[ -f "$ANALYZING_NOW_FILE" ]]; then
analyzing_now=$(<"$ANALYZING_NOW_FILE") analyzing_now=$(< "$ANALYZING_NOW_FILE")
else else
analyzing_now="" analyzing_now=""
fi fi
@@ -148,7 +148,7 @@ check_disk_space() {
check_analyzing_now() { check_analyzing_now() {
local current_file 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 if [[ "$current_file" == "$analyzing_now" ]]; then
((same_file_counter++)) ((same_file_counter++))
else 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") 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 for file in "${DEFAULT_FILES[@]}"; do
if [ ! -f "/config/$file" ]; then if [ ! -f "/config/$file" ]; then
echo "" >"/config/$file" echo "" > "/config/$file"
fi fi
done done
touch /config/include_species_list.txt # Ensure this is always created 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 # Check if the variable is in configcurrent, if not, append it
if ! grep -q "^$var=" "$configcurrent"; then if ! grep -q "^$var=" "$configcurrent"; then
bashio::log.warning "...$var was missing from your birdnet.conf file, it was re-added" bashio::log.warning "...$var was missing from your birdnet.conf file, it was re-added"
grep "^$var=" "$configtemplate" >>"$configcurrent" grep "^$var=" "$configtemplate" >> "$configcurrent"
fi fi
# Check for duplicates # Check for duplicates
if [ "$(grep -c "^$var=" "$configcurrent")" -gt 1 ]; then if [ "$(grep -c "^$var=" "$configcurrent")" -gt 1 ]; then

View File

@@ -21,7 +21,7 @@ fi
common_steps() { common_steps() {
# Attempt to connect to the MQTT broker # Attempt to connect to the MQTT broker
TOPIC="birdnet" 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 # Adapt script with MQTT settings
sed -i "s|%%mqtt_server%%|$MQTT_HOST|g" /helpers/birdnet_to_mqtt.py 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 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 # HA specific elements
###################### ######################
if bashio::supervisor.ping 2>/dev/null; then if bashio::supervisor.ping 2> /dev/null; then
# Remove services tab from webui # Remove services tab from webui
echo "... removing System Controls from webui as should be used from HA" echo "... removing System Controls from webui as should be used from HA"
sed -i '/>System Controls/d' "$HOME/BirdNET-Pi/homepage/views.php" 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" echo "... adapting labels according to birdnet.conf"
if export "$(grep "^DATABASE_LANG" /config/birdnet.conf)"; then if export "$(grep "^DATABASE_LANG" /config/birdnet.conf)"; then
bashio::log.info "Setting language to ${DATABASE_LANG:-en}" 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 else
bashio::log.warning "DATABASE_LANG not found in configuration. Using default labels." bashio::log.warning "DATABASE_LANG not found in configuration. Using default labels."
fi fi

View File

@@ -47,7 +47,7 @@ fi
sed -i "/View Log/d" "$HOME/BirdNET-Pi/homepage/views.php" sed -i "/View Log/d" "$HOME/BirdNET-Pi/homepage/views.php"
echo "... ensuring restricted area access" echo "... ensuring restricted area access"
echo "${ingress_entry}" >/ingress_url echo "${ingress_entry}" > /ingress_url
# Modify PHP file safely # Modify PHP file safely
php_file="$HOME/BirdNET-Pi/scripts/common.php" 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 "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" bashio::log.warning "You could try also Birdnet-Go which should supports your cpu"
source /home/pi/BirdNET-Pi/birdnet/bin/activate source /home/pi/BirdNET-Pi/birdnet/bin/activate
mkdir -p /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 chmod 777 /home/pi/.cache/pip || true &> /dev/null
pip3 uninstall -y tflite_runtime pip3 uninstall -y tflite_runtime
pip install --upgrade packaging==23.2 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" 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)." echo "... timezone set to $TZ_VALUE as defined in add-on options (BirdNET config ignored)."
else 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" 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 fi
# Use BirdNET-defined timezone if no add-on option is provided # Use BirdNET-defined timezone if no add-on option is provided
elif [ -f /data/timezone ]; then elif [ -f /data/timezone ]; then
BIRDN_CONFIG_TZ="$(cat /data/timezone)" 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 if timedatectl set-timezone "$BIRDN_CONFIG_TZ"; then
echo "... set to $BIRDN_CONFIG_TZ as defined in BirdNET config." echo "... set to $BIRDN_CONFIG_TZ as defined in BirdNET config."
else else
bashio::log.warning "Couldn't set timezone to $BIRDN_CONFIG_TZ. Reverting to automatic timezone." 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 fi
# Fallback to automatic timezone if no manual settings are found # Fallback to automatic timezone if no manual settings are found
else else
if timedatectl set-ntp true &>/dev/null; then if timedatectl set-ntp true &> /dev/null; then
bashio::log.info "... automatic timezone enabled." bashio::log.info "... automatic timezone enabled."
else else
bashio::log.fatal "Couldn't set automatic timezone! Please set a manual one from the options." 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 # Fix timezone as per installer
CURRENT_TIMEZONE="$(timedatectl show --value --property=Timezone)" 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 system services"
bashio::log.info "Starting cron service" bashio::log.info "Starting cron service"
systemctl start cron >/dev/null systemctl start cron > /dev/null
bashio::log.info "Starting dbus service" bashio::log.info "Starting dbus service"
service dbus start >/dev/null service dbus start > /dev/null
bashio::log.info "Starting BirdNET-Pi services" bashio::log.info "Starting BirdNET-Pi services"
chmod +x "$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 "$HOME/BirdNET-Pi/scripts/restart_services.sh" > /dev/null
# Start livestream services if enabled in configuration # Start livestream services if enabled in configuration
if bashio::config.true "LIVESTREAM_BOOT_ENABLED"; then if bashio::config.true "LIVESTREAM_BOOT_ENABLED"; then
echo "... starting livestream services" echo "... starting livestream services"
systemctl enable icecast2 >/dev/null systemctl enable icecast2 > /dev/null
systemctl start icecast2.service >/dev/null systemctl start icecast2.service > /dev/null
systemctl enable --now livestream.service >/dev/null systemctl enable --now livestream.service > /dev/null
fi fi
# Start # Start

View File

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

View File

@@ -45,7 +45,7 @@ done
# Correct home location # Correct home location
for folders in /defaults /etc/cont-init.d /etc/services.d /etc/s6-overlay/s6-rc.d; do for folders in /defaults /etc/cont-init.d /etc/services.d /etc/s6-overlay/s6-rc.d; do
if [ -d "$folders" ]; then 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 fi
done done
@@ -53,12 +53,12 @@ done
usermod --home "$LOCATION" abc usermod --home "$LOCATION" abc
# Add environment variables # 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/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/FM_HOME; fi
{ {
printf "%s\n" "HOME=\"$LOCATION\"" printf "%s\n" "HOME=\"$LOCATION\""
printf "%s\n" "FM_HOME=\"$LOCATION\"" printf "%s\n" "FM_HOME=\"$LOCATION\""
} >>~/.bashrc } >> ~/.bashrc
# Create folder # Create folder
echo "Creating $LOCATION" echo "Creating $LOCATION"

View File

@@ -10,12 +10,12 @@ if bashio::config.has_value 'additional_apps'; then
NEWAPPS=$(bashio::config 'additional_apps') NEWAPPS=$(bashio::config 'additional_apps')
for packagestoinstall in ${NEWAPPS//,/ }; do for packagestoinstall in ${NEWAPPS//,/ }; do
bashio::log.green "... $packagestoinstall" bashio::log.green "... $packagestoinstall"
if command -v "apk" &>/dev/null; then if command -v "apk" &> /dev/null; then
apk add --no-cache "$packagestoinstall" &>/dev/null || (bashio::log.fatal "Error : $packagestoinstall not found") apk add --no-cache "$packagestoinstall" &> /dev/null || (bashio::log.fatal "Error : $packagestoinstall not found")
elif command -v "apt" &>/dev/null; then elif command -v "apt" &> /dev/null; then
apt-get install -yqq --no-install-recommends "$packagestoinstall" &>/dev/null || (bashio::log.fatal "Error : $packagestoinstall not found") apt-get install -yqq --no-install-recommends "$packagestoinstall" &> /dev/null || (bashio::log.fatal "Error : $packagestoinstall not found")
elif command -v "pacman" &>/dev/null; then elif command -v "pacman" &> /dev/null; then
pacman --noconfirm -S "$packagestoinstall" &>/dev/null || (bashio::log.fatal "Error : $packagestoinstall not found") pacman --noconfirm -S "$packagestoinstall" &> /dev/null || (bashio::log.fatal "Error : $packagestoinstall not found")
fi fi
done done
fi fi
@@ -25,7 +25,7 @@ if bashio::config.has_value 'TZ'; then
TIMEZONE=$(bashio::config 'TZ') TIMEZONE=$(bashio::config 'TZ')
bashio::log.info "Setting timezone to $TIMEZONE" bashio::log.info "Setting timezone to $TIMEZONE"
ln -snf /usr/share/zoneinfo/"$TIMEZONE" /etc/localtime 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") 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 # 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" bashio::log.info "Setting password to the value defined in options"
CLI_ARGS=$(bashio::config 'CLI_ARGS') CLI_ARGS=$(bashio::config 'CLI_ARGS')
bashio::log.info "Setting arguments to $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 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 printf "%s\n" "CLI_ARGS=\"$CLI_ARGS\"" >> ~/.bashrc
fi || true fi || true
# Set keyboard # Set keyboard
if bashio::config.has_value 'KEYBOARD'; then if bashio::config.has_value 'KEYBOARD'; then
KEYBOARD=$(bashio::config 'KEYBOARD') KEYBOARD=$(bashio::config 'KEYBOARD')
bashio::log.info "Setting keyboard to $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 if [ -d /var/run/s6/container_environment ]; then printf "%s" "$KEYBOARD" > /var/run/s6/container_environment/KEYBOARD; fi
printf "%s\n" "KEYBOARD=\"$KEYBOARD\"" >>~/.bashrc printf "%s\n" "KEYBOARD=\"$KEYBOARD\"" >> ~/.bashrc
fi || true fi || true
# Set password # Set password

View File

@@ -9,7 +9,7 @@ SUBFOLDER="$(bashio::addon.ingress_entry)"
# Copy template # Copy template
cp /defaults/default.conf "${NGINX_CONFIG}" cp /defaults/default.conf "${NGINX_CONFIG}"
# Remove ssl part # 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}" mv tmpfile "${NGINX_CONFIG}"
# Remove ipv6 # 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" /defaults/*
sed -i "s|/config|$LOCATION|g" /etc/cont-init.d/* sed -i "s|/config|$LOCATION|g" /etc/cont-init.d/*
sed -i "s|/config|$LOCATION|g" /etc/services.d/*/run 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/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/FM_HOME; fi
printf "%s\n" "HOME=\"$LOCATION\"" >>~/.bashrc printf "%s\n" "HOME=\"$LOCATION\"" >> ~/.bashrc
printf "%s\n" "FM_HOME=\"$LOCATION\"" >>~/.bashrc printf "%s\n" "FM_HOME=\"$LOCATION\"" >> ~/.bashrc
usermod --home "$LOCATION" abc usermod --home "$LOCATION" abc

View File

@@ -7,11 +7,11 @@ set -e
if bashio::config.has_value 'TZ'; then if bashio::config.has_value 'TZ'; then
TIMEZONE=$(bashio::config 'TZ') TIMEZONE=$(bashio::config 'TZ')
bashio::log.info "Setting timezone to $TIMEZONE" 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 fi
bashio::log.info "Install libnss3" 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 # Set Ingress login
if [ ! -f /config/app.db ]; then 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 while read -r line; do
urls+=("$line") urls+=("$line")
done <<<"$(bashio::config 'csrf_allowed')" done <<< "$(bashio::config 'csrf_allowed')"
fi fi
# Add internal and external URL as it # Add internal and external URL as it
@@ -53,5 +53,5 @@ done
CSRF=${CSRF::-1} CSRF=${CSRF::-1}
# Save CSFR # 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}" 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" bashio::log.info "Setting timezone to $TIMEZONE"
if [ -f /usr/share/zoneinfo/"$TIMEZONE" ]; then if [ -f /usr/share/zoneinfo/"$TIMEZONE" ]; then
ln -snf /usr/share/zoneinfo/"$TIMEZONE" /etc/localtime ln -snf /usr/share/zoneinfo/"$TIMEZONE" /etc/localtime
echo "$TIMEZONE" >/etc/timezone echo "$TIMEZONE" > /etc/timezone
else else
bashio::log.fatal "$TIMEZONE not found, are you sure it is a valid timezone?" bashio::log.fatal "$TIMEZONE not found, are you sure it is a valid timezone?"
fi fi

View File

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

View File

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

View File

@@ -21,7 +21,7 @@ if bashio::config.true 'mqtt_autodiscover'; then
# Export variables # 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 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 # Log
bashio::log.blue "$variables" bashio::log.blue "$variables"
done done

View File

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

View File

@@ -104,11 +104,6 @@
"DAC_READ_SEARCH" "DAC_READ_SEARCH"
], ],
"schema": { "schema": {
"cifsdomain": "str?",
"cifspassword": "str?",
"cifsusername": "str?",
"localdisks": "str?",
"networkdisks": "str?",
"DB_DATABASE_NAME": "str?", "DB_DATABASE_NAME": "str?",
"DB_HOSTNAME": "str?", "DB_HOSTNAME": "str?",
"DB_PASSWORD": "str", "DB_PASSWORD": "str",
@@ -120,7 +115,12 @@
"MINIO_ROOT_PASSWORD": "str", "MINIO_ROOT_PASSWORD": "str",
"MINIO_ROOT_USER": "str", "MINIO_ROOT_USER": "str",
"TZ": "str?", "TZ": "str?",
"USE_EXTERNAL_DB": "bool?" "USE_EXTERNAL_DB": "bool?",
"cifsdomain": "str?",
"cifspassword": "str?",
"cifsusername": "str?",
"localdisks": "str?",
"networkdisks": "str?"
}, },
"slug": "ente", "slug": "ente",
"udev": true, "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_b64() { head -c "$1" /dev/urandom | base64 | tr -d '\n'; }
_rand_b64url() { head -c "$1" /dev/urandom | base64 | tr '+/' '-_' | tr -d '\n'; } _rand_b64url() { head -c "$1" /dev/urandom | base64 | tr '+/' '-_' | tr -d '\n'; }
cat >"$CFG" <<EOF cat > "$CFG" << EOF
key: key:
encryption: $(_rand_b64 32) encryption: $(_rand_b64 32)
hash: $(_rand_b64 64) hash: $(_rand_b64 64)
@@ -141,10 +141,12 @@ start_postgres() {
wait_postgres_ready() { wait_postgres_ready() {
local host port local host port
if $USE_EXTERNAL_DB; then 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}..." bashio::log.info "Waiting for EXTERNAL Postgres at ${host}:${port}..."
else else
host="$DB_HOST_INTERNAL"; port="$DB_PORT_INTERNAL" host="$DB_HOST_INTERNAL"
port="$DB_PORT_INTERNAL"
bashio::log.info "Waiting for internal Postgres..." bashio::log.info "Waiting for internal Postgres..."
fi fi
until pg_isready -q -h "$host" -p "$port"; do sleep 1; done until pg_isready -q -h "$host" -p "$port"; do sleep 1; done
@@ -192,7 +194,7 @@ start_minio() {
wait_minio_ready_and_bucket() { wait_minio_ready_and_bucket() {
bashio::log.info "Waiting for MinIO API..." 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 sleep 1
done done
bashio::log.info "Ensuring buckets..." bashio::log.info "Ensuring buckets..."
@@ -216,7 +218,7 @@ start_web() {
# Running ente-web-prepare # Running ente-web-prepare
echo "[ente-web-prepare] Substituting origins…" echo "[ente-web-prepare] Substituting origins…"
find /www -name '*.js' | xargs sed -i "s#ENTE_API_ORIGIN_PLACEHOLDER#${ENTE_API_ORIGIN}#g" 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 mkdir -p /run/nginx /var/log/nginx
@@ -236,7 +238,7 @@ start_museum_foreground() {
bashio::log.error "$CFG missing; cannot start museum." bashio::log.error "$CFG missing; cannot start museum."
return 1 return 1
fi 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." bashio::log.error "Museum binary not found; cannot launch Ente API."
return 1 return 1
fi fi

View File

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

View File

@@ -27,7 +27,7 @@ CURRENT=$(sed -e '/^[<blank><tab>]*$/d' /config/addons_config/fireflyiii/APP_KEY
# Save if new # Save if new
if [ "$CURRENT" != "$APP_KEY" ]; then 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 fi
# Update permissions # Update permissions
@@ -43,8 +43,8 @@ chmod -R 775 /config/addons_config/fireflyiii
bashio::log.info "Defining database" bashio::log.info "Defining database"
case $(bashio::config 'DB_CONNECTION') in case $(bashio::config 'DB_CONNECTION') in
# Use sqlite # Use sqlite
sqlite_internal) sqlite_internal)
bashio::log.info "Using built in sqlite" bashio::log.info "Using built in sqlite"
# Set variable # Set variable
@@ -77,7 +77,7 @@ sqlite_internal)
;; ;;
# Use MariaDB # Use MariaDB
mariadb_addon) mariadb_addon)
bashio::log.info "Using MariaDB addon. Requirements : running MariaDB addon. Detecting values..." bashio::log.info "Using MariaDB addon. Requirements : running MariaDB addon. Detecting values..."
if ! bashio::services.available 'mysql'; then if ! bashio::services.available 'mysql'; then
bashio::log.fatal \ bashio::log.fatal \
@@ -112,7 +112,7 @@ mariadb_addon)
;; ;;
# Use remote # Use remote
*) *)
bashio::log.info "Using remote database. Requirement : filling all addon options fields, and making sure the database already exists" 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 for conditions in "DB_HOST" "DB_PORT" "DB_DATABASE" "DB_USERNAME" "DB_PASSWORD"; do
if ! bashio::config.has_value "$conditions"; then 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 for i in $(seq 4 2 12); do
hour=" $i" hour=" $i"
freqDir="/etc/periodic/daily$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" mkdir "$freqDir"
done done
@@ -46,7 +46,7 @@ if bashio::config.has_value 'Updates'; then
# Starts cron # Starts cron
echo "Timezone $TZ" echo "Timezone $TZ"
export TZ export TZ
crond -l 2 -f >/dev/stdout 2>/dev/stderr & crond -l 2 -f > /dev/stdout 2> /dev/stderr &
# Export variables # Export variables
IMPORT_DIR_WHITELIST="${CONFIGSOURCE}/import_files" 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 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" 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 else
php -S 0.0.0.0:8080 /app/index.php php -S 0.0.0.0:8080 /app/index.php
fi 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 if [ -f "/homeassistant/addons_config/$slug/config.yaml" ] && [ ! -f "/homeassistant/addons_config/$slug/migrated" ]; then
bashio::log.warning "Migrating config.yaml" bashio::log.warning "Migrating config.yaml"
mv "/homeassistant/addons_config/$slug"/* /config/ || true 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 fi
if [ -f "/homeassistant/addons_autoscripts/$slug.sh" ]; then if [ -f "/homeassistant/addons_autoscripts/$slug.sh" ]; then

View File

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

View File

@@ -25,7 +25,7 @@ if bashio::config.true 'mqtt_autodiscover'; then
# Export variables # 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 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 # Log
bashio::log.blue "$variables" bashio::log.blue "$variables"
done done

View File

@@ -37,7 +37,7 @@ else
if [ ! -s /config/secret/secret ]; then if [ ! -s /config/secret/secret ]; then
bashio::log.warning "No secret key found in /config/secret/secret, generating a new one." bashio::log.warning "No secret key found in /config/secret/secret, generating a new one."
mkdir -p /config/secret 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" bashio::log.warning "New secret key generated and stored in /config/secret/secret"
fi fi
bashio::log.warning "Using existing secret key from /config/secret/secret." bashio::log.warning "Using existing secret key from /config/secret/secret."

View File

@@ -68,8 +68,8 @@
"/dev/nvme2" "/dev/nvme2"
], ],
"environment": { "environment": {
"PGDATA": "/config/postgres", "GUACAMOLE_HOME": "/config",
"GUACAMOLE_HOME": "/config" "PGDATA": "/config/postgres"
}, },
"image": "ghcr.io/alexbelgium/guacamole-{arch}", "image": "ghcr.io/alexbelgium/guacamole-{arch}",
"ingress": true, "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 # Move autoscript
if [ -f /homeassistant/addons_autoscrips/immich.sh ]; then 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" bashio::log.yellow "... moved $PREVIOUS_FOLDER.sh from /config/addons_autoscripts to /addon_configs/$HOSTNAME"
fi fi

View File

@@ -34,9 +34,9 @@ bashio::log.info "Setting data location"
DATA_LOCATION="$(bashio::config 'data_location')" DATA_LOCATION="$(bashio::config 'data_location')"
export IMMICH_MEDIA_LOCATION="$DATA_LOCATION" export IMMICH_MEDIA_LOCATION="$DATA_LOCATION"
if [ -d /var/run/s6/container_environment ]; then 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 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" echo "... check $DATA_LOCATION folder exists"
mkdir -p "$DATA_LOCATION" mkdir -p "$DATA_LOCATION"
@@ -87,8 +87,8 @@ fi
# REDIS LOCATION # # REDIS LOCATION #
################## ##################
echo "sed -i \"s=/config/redis=/data/redis=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 echo "sed -i \"s=/config/log/redis=/data/log=g\" /etc/s6*/s6*/*/run" >> /docker-mods
mkdir -p /data/redis mkdir -p /data/redis
mkdir -p /data/log mkdir -p /data/log
chmod 777 /data/redis 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" bashio::log.warning "DB_HOSTNAME was set to homeassistant.local. Using detected IP: $DB_HOSTNAME"
fi 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 "------------------------------------"
bashio::log.warning "DB_HOSTNAME ($DB_HOSTNAME) is not reachable." bashio::log.warning "DB_HOSTNAME ($DB_HOSTNAME) is not reachable."
bashio::log.warning "Please set it to the IP address of your database." 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 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 for var in DB_USERNAME DB_PASSWORD DB_DATABASE_NAME DB_PORT DB_HOSTNAME JWT_SECRET; do
if [ -n "${!var:-}" ]; then if [ -n "${!var:-}" ]; then
printf "%s" "${!var}" >"/var/run/s6/container_environment/${var}" printf "%s" "${!var}" > "/var/run/s6/container_environment/${var}"
fi fi
done done
fi fi
@@ -88,26 +88,26 @@ setup_root_user() {
export DB_ROOT_PASSWORD="$(bashio::config 'DB_ROOT_PASSWORD')" export DB_ROOT_PASSWORD="$(bashio::config 'DB_ROOT_PASSWORD')"
else else
bashio::log.warning "DB_ROOT_PASSWORD not set. Generating a random 12-character alphanumeric password and storing it in the addon options." 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}" bashio::addon.option "DB_ROOT_PASSWORD" "${DB_ROOT_PASSWORD}"
# Store generated password in the s6 environment if available # Store generated password in the s6 environment if available
if [ -d /var/run/s6/container_environment ]; then 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
fi fi
# Try to connect as root using the default insecure password. # 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..." 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}'; ALTER ROLE root WITH PASSWORD '${DB_ROOT_PASSWORD}';
EOF EOF
else else
# Check if the root user exists. # 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 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..." 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}'; CREATE ROLE root WITH LOGIN SUPERUSER CREATEDB CREATEROLE PASSWORD '${DB_ROOT_PASSWORD}';
EOF EOF
else else
@@ -124,7 +124,7 @@ setup_database() {
if ! psql "postgres://${DB_USERNAME}:${DB_PASSWORD}@${DB_HOSTNAME}:${DB_PORT}/postgres" -tAc \ 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 "SELECT 1 FROM pg_database WHERE datname='${DB_DATABASE_NAME}';" | grep -q 1; then
bashio::log.info "Database does not exist. Creating it now..." 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}; CREATE DATABASE ${DB_DATABASE_NAME};
EOF EOF
else else
@@ -132,7 +132,7 @@ EOF
fi fi
# Ensure the user exists and update its password # 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 \$\$ DO \$\$
BEGIN BEGIN
IF NOT EXISTS (SELECT FROM pg_roles WHERE rolname = '${DB_USERNAME}') THEN IF NOT EXISTS (SELECT FROM pg_roles WHERE rolname = '${DB_USERNAME}') THEN
@@ -145,7 +145,7 @@ END
EOF EOF
# Ensure the user has full privileges on the database # 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}; GRANT ALL PRIVILEGES ON DATABASE ${DB_DATABASE_NAME} TO ${DB_USERNAME};
EOF EOF

View File

@@ -5,7 +5,7 @@ set -e
################# #################
# Create config # # 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 # Check it
/usr/sbin/inadyn --check-config /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 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")" 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 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 fi
mkdir -p /data/joal 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 chown -R "$(id -u):$(id -g)" /data/joal
rm /data/joal/jack-of* rm /data/joal/jack-of*
bashio::log.info "Joal updated" bashio::log.info "Joal updated"
@@ -89,7 +89,7 @@ mkdir -p /var/log/nginx && touch /var/log/nginx/error.log
if [ "$VERBOSE" = true ]; then 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" 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 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 & fi &
bashio::log.info "Please wait, loading..." bashio::log.info "Please wait, loading..."
@@ -118,9 +118,9 @@ exec nginx &
if bashio::config.has_value 'run_duration'; then if bashio::config.has_value 'run_duration'; then
RUNTIME=$(bashio::config 'run_duration') RUNTIME=$(bashio::config 'run_duration')
bashio::log.info "Addon will stop after $RUNTIME" bashio::log.info "Addon will stop after $RUNTIME"
sleep "$RUNTIME" && sleep "$RUNTIME" \
bashio::log.info "Timeout achieved, addon will stop !" && && bashio::log.info "Timeout achieved, addon will stop !" \
exit 0 && exit 0
else else
bashio::log.info "Run_duration option not defined, addon will run continuously" bashio::log.info "Run_duration option not defined, addon will run continuously"
fi fi

View File

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

View File

@@ -21,8 +21,8 @@ bashio::log.info "Data selected : $database"
case "$database" in case "$database" in
# Use sqlite # Use sqlite
sqlite) sqlite)
DB_DATABASE="/config/database.sqlite" DB_DATABASE="/config/database.sqlite"
export DB_DATABASE export DB_DATABASE
DB_CONNECTION=sqlite DB_CONNECTION=sqlite
@@ -34,8 +34,8 @@ sqlite)
bashio::log.blue "Using $DB_DATABASE" bashio::log.blue "Using $DB_DATABASE"
;; ;;
# Use Mariadb_addon # Use Mariadb_addon
MariaDB_addon) MariaDB_addon)
# Use MariaDB # Use MariaDB
DB_CONNECTION=mysql DB_CONNECTION=mysql
export DB_CONNECTION export DB_CONNECTION
@@ -66,8 +66,8 @@ MariaDB_addon)
;; ;;
# Use Mariadb_addon # Use Mariadb_addon
Mysql_external) Mysql_external)
DB_CONNECTION=mysql DB_CONNECTION=mysql
export DB_CONNECTION export DB_CONNECTION
for var in DB_DATABASE DB_HOST DB_PASSWORD DB_PORT DB_USERNAME; do 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::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" 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 bashio::addon.restart
fi fi
APP_KEY="$(bashio::config "APP_KEY")" APP_KEY="$(bashio::config "APP_KEY")"

View File

@@ -45,7 +45,7 @@ execute_main_logic() {
echo "... Scanning network for changes" echo "... Scanning network for changes"
# Ensure arp-scan is installed # 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." bashio::log.error "arp-scan command not found. Please install arp-scan to proceed."
exit 1 exit 1
fi fi
@@ -70,10 +70,10 @@ execute_main_logic() {
NEW_SCAN_SUBNETS="${SCAN_SUBNETS%]}, '${local_ip}/24 --interface=${interface}']" NEW_SCAN_SUBNETS="${SCAN_SUBNETS%]}, '${local_ip}/24 --interface=${interface}']"
sed -i "/^SCAN_SUBNETS/c\\$NEW_SCAN_SUBNETS" "$config_file" sed -i "/^SCAN_SUBNETS/c\\$NEW_SCAN_SUBNETS" "$config_file"
# Check availability of hosts # Check availability of hosts
VALUE="$(arp-scan --interface="$interface" "${local_ip}/24" 2>/dev/null | VALUE="$(arp-scan --interface="$interface" "${local_ip}/24" 2> /dev/null \
grep "responded" | | grep "responded" \
awk -F'.' '{print $NF}' | | awk -F'.' '{print $NF}' \
awk '{print $1}' || true)" | awk '{print $1}' || true)"
echo "... $interface is available in Home Assistant (with $VALUE devices), added to app.conf" echo "... $interface is available in Home Assistant (with $VALUE devices), added to app.conf"
fi fi
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 if [ -f "/homeassistant/addons_config/$slug/config.yaml" ] && [ ! -f "/homeassistant/addons_config/$slug/migrated" ]; then
bashio::log.warning "Migrating config.yaml" bashio::log.warning "Migrating config.yaml"
mv "/homeassistant/addons_config/$slug"/* /config/ || true 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 fi
if [ -f "/homeassistant/addons_autoscripts/$slug.sh" ]; then 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")" PUID="$(bashio::config "PUID")"
PGID="$(bashio::config "PGID")" PGID="$(bashio::config "PGID")"
bashio::log.green "Setting user to $PUID:$PGID" bashio::log.green "Setting user to $PUID:$PGID"
id -u abc &>/dev/null || usermod -o -u "$PUID" abc || true id -u abc &> /dev/null || usermod -o -u "$PUID" abc || true
id -g abc &>/dev/null || groupmod -o -g "$PGID" abc || true id -g abc &> /dev/null || groupmod -o -g "$PGID" abc || true
fi fi
echo "Updating permissions..." echo "Updating permissions..."

View File

@@ -86,8 +86,8 @@ fi
########################### ###########################
echo "... Clean potential errors" 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" > /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-share-owner" > /dev/null || true
sudo -u abc -s /bin/bash -c "php /app/www/public/occ maintenance:mode --off" || 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 sudo -u abc php /app/www/public/occ config:system:set enable_previews --value=true
i=0 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 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)) i=$((i + 1))
done done
else else

View File

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

View File

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

View File

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

View File

@@ -22,15 +22,16 @@ if bashio::config.has_value 'trusted_domains'; then
bashio::log.info "Currently set trusted domains :" 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" $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 # # Remove previous trusted domains #
################################### ###################################
bashio::log.info "... removing previously added trusted domain (except for first one created)" bashio::log.info "... removing previously added trusted domain (except for first one created)"
i=2 i=2
until [ $i -gt 5 ]; do until [ $i -gt 5 ]; do
$LAUNCHER config:system:delete trusted_domains $i && $LAUNCHER config:system:delete trusted_domains $i \
((i = i + 1)) || exit && ((i = i + 1)) || exit
done 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 # Use ssl
if [ -d /ssl ]; then if [ -d /ssl ]; then
mkdir -p /cert mkdir -p /cert
cp /ssl/* /cert 2>/dev/null cp /ssl/* /cert 2> /dev/null
chown -R 508:508 /cert chown -R 508:508 /cert
fi fi

View File

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

View File

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

View File

@@ -11,12 +11,12 @@ bashio::log.info "Defining database"
case $(bashio::config 'DB_TYPE') in case $(bashio::config 'DB_TYPE') in
# Use sqlite # Use sqlite
sqlite) sqlite)
bashio::log.info "Using a local sqlite database" bashio::log.info "Using a local sqlite database"
;; ;;
mariadb_addon) mariadb_addon)
bashio::log.info "Using MariaDB addon. Requirements : running MariaDB addon. Discovering values..." bashio::log.info "Using MariaDB addon. Requirements : running MariaDB addon. Discovering values..."
if ! bashio::services.available 'mysql'; then if ! bashio::services.available 'mysql'; then
bashio::log.fatal \ bashio::log.fatal \
@@ -26,7 +26,7 @@ mariadb_addon)
fi fi
# Install mysqlclient # Install mysqlclient
pip install pymysql &>/dev/null || true pip install pymysql &> /dev/null || true
# Use values # Use values
PHOTOPRISM_DATABASE_DRIVER="mysql" PHOTOPRISM_DATABASE_DRIVER="mysql"
@@ -34,16 +34,16 @@ mariadb_addon)
PHOTOPRISM_DATABASE_NAME="photoprism" PHOTOPRISM_DATABASE_NAME="photoprism"
PHOTOPRISM_DATABASE_USER="$(bashio::services 'mysql' 'username')" PHOTOPRISM_DATABASE_USER="$(bashio::services 'mysql' 'username')"
PHOTOPRISM_DATABASE_PASSWORD="$(bashio::services 'mysql' 'password')" PHOTOPRISM_DATABASE_PASSWORD="$(bashio::services 'mysql' 'password')"
export PHOTOPRISM_DATABASE_DRIVER && export PHOTOPRISM_DATABASE_DRIVER \
bashio::log.blue "PHOTOPRISM_DATABASE_DRIVER=$PHOTOPRISM_DATABASE_DRIVER" && bashio::log.blue "PHOTOPRISM_DATABASE_DRIVER=$PHOTOPRISM_DATABASE_DRIVER"
export PHOTOPRISM_DATABASE_SERVER && export PHOTOPRISM_DATABASE_SERVER \
bashio::log.blue "PHOTOPRISM_DATABASE_SERVER=$PHOTOPRISM_DATABASE_SERVER" && bashio::log.blue "PHOTOPRISM_DATABASE_SERVER=$PHOTOPRISM_DATABASE_SERVER"
export PHOTOPRISM_DATABASE_NAME && export PHOTOPRISM_DATABASE_NAME \
bashio::log.blue "PHOTOPRISM_DATABASE_NAME=$PHOTOPRISM_DATABASE_NAME" && bashio::log.blue "PHOTOPRISM_DATABASE_NAME=$PHOTOPRISM_DATABASE_NAME"
export PHOTOPRISM_DATABASE_USER && export PHOTOPRISM_DATABASE_USER \
bashio::log.blue "PHOTOPRISM_DATABASE_USER=$PHOTOPRISM_DATABASE_USER" && bashio::log.blue "PHOTOPRISM_DATABASE_USER=$PHOTOPRISM_DATABASE_USER"
export PHOTOPRISM_DATABASE_PASSWORD && export PHOTOPRISM_DATABASE_PASSWORD \
bashio::log.blue "PHOTOPRISM_DATABASE_PASSWORD=$PHOTOPRISM_DATABASE_PASSWORD" && bashio::log.blue "PHOTOPRISM_DATABASE_PASSWORD=$PHOTOPRISM_DATABASE_PASSWORD"
{ {
echo "export PHOTOPRISM_DATABASE_DRIVER=\"${PHOTOPRISM_DATABASE_DRIVER}\"" 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_NAME=\"${PHOTOPRISM_DATABASE_NAME}\""
echo "export PHOTOPRISM_DATABASE_USER=\"${PHOTOPRISM_DATABASE_USER}\"" echo "export PHOTOPRISM_DATABASE_USER=\"${PHOTOPRISM_DATABASE_USER}\""
echo "export PHOTOPRISM_DATABASE_PASSWORD=\"${PHOTOPRISM_DATABASE_PASSWORD}\"" echo "export PHOTOPRISM_DATABASE_PASSWORD=\"${PHOTOPRISM_DATABASE_PASSWORD}\""
} >>~/.bashrc } >> ~/.bashrc
bashio::log.warning "Photoprism is using the Maria DB addon" bashio::log.warning "Photoprism is using the Maria DB addon"
bashio::log.warning "Please ensure this is included in your backups" bashio::log.warning "Please ensure this is included in your backups"
@@ -77,7 +77,7 @@ if bashio::config.true "ingress_disabled"; then
else else
PHOTOPRISM_SITE_URL="$(bashio::addon.ingress_entry)/" PHOTOPRISM_SITE_URL="$(bashio::addon.ingress_entry)/"
export PHOTOPRISM_SITE_URL 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" 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 fi
@@ -103,7 +103,7 @@ export PHOTOPRISM_BACKUP_PATH
echo "export PHOTOPRISM_ORIGINALS_PATH=\"${PHOTOPRISM_ORIGINALS_PATH}\"" echo "export PHOTOPRISM_ORIGINALS_PATH=\"${PHOTOPRISM_ORIGINALS_PATH}\""
echo "export PHOTOPRISM_IMPORT_PATH=\"${PHOTOPRISM_IMPORT_PATH}\"" echo "export PHOTOPRISM_IMPORT_PATH=\"${PHOTOPRISM_IMPORT_PATH}\""
echo "export PHOTOPRISM_BACKUP_PATH=\"${PHOTOPRISM_BACKUP_PATH}\"" echo "export PHOTOPRISM_BACKUP_PATH=\"${PHOTOPRISM_BACKUP_PATH}\""
} >>~/.bashrc } >> ~/.bashrc
# Test configs # Test configs
for variabletest in $PHOTOPRISM_STORAGE_PATH $PHOTOPRISM_ORIGINALS_PATH $PHOTOPRISM_IMPORT_PATH $PHOTOPRISM_BACKUP_PATH; do 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_UID=\"${PHOTOPRISM_UID}\""
echo "export PHOTOPRISM_GID=\"${PHOTOPRISM_GID}\"" echo "export PHOTOPRISM_GID=\"${PHOTOPRISM_GID}\""
} >>~/.bashrc } >> ~/.bashrc
fi fi
# Start messages # 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" chown "$(id -u)":"$(id -g)" "$SCRIPTS"
chmod a+x $SCRIPTS chmod a+x $SCRIPTS
sed -i 's|/usr/bin/with-contenv bashio|/usr/bin/env bashio|g' $SCRIPTS sed -i 's|/usr/bin/with-contenv bashio|/usr/bin/env bashio|g' $SCRIPTS
/.$SCRIPTS && /.$SCRIPTS \
true || true # Prevents script crash on failure && true || true # Prevents script crash on failure
echo "exit $?" echo "exit $?"
done 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_ORIGINALS_PATH=\"${PHOTOPRISM_ORIGINALS_PATH}\""
printf "%s\n" "PHOTOPRISM_IMPORT_PATH=\"${PHOTOPRISM_IMPORT_PATH}\"" printf "%s\n" "PHOTOPRISM_IMPORT_PATH=\"${PHOTOPRISM_IMPORT_PATH}\""
printf "%s\n" "PHOTOPRISM_BACKUP_PATH=\"${PHOTOPRISM_BACKUP_PATH}\"" printf "%s\n" "PHOTOPRISM_BACKUP_PATH=\"${PHOTOPRISM_BACKUP_PATH}\""
} >>~/.bashrc } >> ~/.bashrc
if bashio::config.has_value 'CUSTOM_OPTIONS'; then if bashio::config.has_value 'CUSTOM_OPTIONS'; then
CUSTOMOPTIONS=$(bashio::config 'CUSTOM_OPTIONS') CUSTOMOPTIONS=$(bashio::config 'CUSTOM_OPTIONS')

View File

View File

@@ -29,7 +29,7 @@ bashio::var.json \
protocol "${portainer_protocol}" \ protocol "${portainer_protocol}" \
certfile "$(bashio::config 'certfile')" \ certfile "$(bashio::config 'certfile')" \
keyfile "$(bashio::config 'keyfile')" \ keyfile "$(bashio::config 'keyfile')" \
ssl "^$(bashio::config 'ssl')" | ssl "^$(bashio::config 'ssl')" \
tempio \ | tempio \
-template /etc/nginx/templates/ingress.gtpl \ -template /etc/nginx/templates/ingress.gtpl \
-out /etc/nginx/servers/ingress.conf -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 # Launch app
cd /app || true cd /app || true
if bashio::config.has_value 'PORTAINER_AGENT_ARGS'; then if bashio::config.has_value 'PORTAINER_AGENT_ARGS'; then
./agent "$PORTAINER_AGENT_ARGS" 2>/dev/null ./agent "$PORTAINER_AGENT_ARGS" 2> /dev/null
else else
./agent ./agent
fi fi

View File

@@ -110,7 +110,7 @@ start_postgres() {
wait_for_postgres() { wait_for_postgres() {
local tries=0 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=$((tries + 1))
[ "$tries" -ge 60 ] && { [ "$tries" -ge 60 ] && {
bashio::log.error "Postgres did not start after 2minutes, aborting." bashio::log.error "Postgres did not start after 2minutes, aborting."
@@ -132,7 +132,7 @@ restart_immich_addons_if_flagged() {
return 1 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 for slug in $(echo "$addons_json" | jq -r '.addons[] | select(.state=="started") | .slug'); do
if [[ "$slug" == *immich* ]]; then if [[ "$slug" == *immich* ]]; then
bashio::log.info "Restarting addon $slug" bashio::log.info "Restarting addon $slug"
@@ -171,14 +171,14 @@ export DB_PORT DB_HOSTNAME DB_USERNAME DB_PASSWORD
get_available_extension_version() { get_available_extension_version() {
local extname="$1" local extname="$1"
psql "postgres://$DB_USERNAME:$DB_PASSWORD@$DB_HOSTNAME:$DB_PORT/postgres" -v ON_ERROR_STOP=1 -tAc \ 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() { is_extension_available() {
local extname="$1" local extname="$1"
local result local result
result=$(psql "postgres://$DB_USERNAME:$DB_PASSWORD@$DB_HOSTNAME:$DB_PORT/postgres" -v ON_ERROR_STOP=1 -tAc \ 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" ]] [[ "$result" == "1" ]]
} }
@@ -190,7 +190,7 @@ get_user_databases() {
get_installed_extension_version() { get_installed_extension_version() {
local extname="$1" dbname="$2" local extname="$1" dbname="$2"
psql "postgres://$DB_USERNAME:$DB_PASSWORD@$DB_HOSTNAME:$DB_PORT/$dbname" -v ON_ERROR_STOP=1 -tAc \ 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() { compare_versions() {
@@ -208,7 +208,7 @@ show_db_extensions() {
if [ -n "$exts" ]; then if [ -n "$exts" ]; then
while read -r ext; do while read -r ext; do
[ -n "$ext" ] && bashio::log.info " - $ext" [ -n "$ext" ] && bashio::log.info " - $ext"
done <<<"$exts" done <<< "$exts"
else else
bashio::log.info " (no extensions enabled)" bashio::log.info " (no extensions enabled)"
fi fi
@@ -263,7 +263,7 @@ upgrade_postgres_if_needed() {
export DATA_DIR="$PGDATA" BINARIES_DIR="/usr/lib/postgresql" BACKUP_DIR="/config/backups" 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" 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" apt-get install -y procps rsync "postgresql-$IMAGE_VERSION" "postgresql-$CLUSTER_VERSION"
[ -d "$BINARIES_DIR/$CLUSTER_VERSION/bin" ] || { [ -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 "----------------------------------------"
bashio::log.warning "Migrating configuration to the new addon" bashio::log.warning "Migrating configuration to the new addon"
bashio::log.warning "----------------------------------------" 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/addons_config ]; then rm -r /config/qBittorrent/addons_config; fi
if [ -d /config/qBittorrent/qBittorrent ]; then rm -r /config/qBittorrent/qBittorrent; 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)" bashio::log.yellow "... moved files from /config/addons_config/qBittorrent to /addon_configs/$HOSTNAME/qBitorrent (must be accessed with my Filebrowser addon)"
MIGRATED=true MIGRATED=true
fi fi
@@ -32,21 +32,21 @@ fi
# Move openvpn # Move openvpn
if [ -d /homeassistant/openvpn ]; then if [ -d /homeassistant/openvpn ]; then
if [ ! -f /homeassistant/openvpn/migrated ] && [ "$(ls -A /homeassistant/openvpn)" ]; then if [ ! -f /homeassistant/openvpn/migrated ] && [ "$(ls -A /homeassistant/openvpn)" ]; then
cp -rnf /homeassistant/openvpn/* /config/openvpn &>/dev/null || true cp -rnf /homeassistant/openvpn/* /config/openvpn &> /dev/null || true
echo "Files moved to /addon_configs/$HOSTNAME/openvpn" >/homeassistant/openvpn/migrated echo "Files moved to /addon_configs/$HOSTNAME/openvpn" > /homeassistant/openvpn/migrated
fi fi
fi fi
# Move config.yaml # Move config.yaml
if [ -f /homeassistant/addons_config/qbittorrent/config.yaml ] && [ ! -f /homeassistant/addons_config/qbittorrent/migrated ]; then 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 rm -r /homeassistant/addons_config/qbittorrent
bashio::log.yellow "... moved config.yaml from /config/addons_config/qbittorrent to /addon_configs/$HOSTNAME" bashio::log.yellow "... moved config.yaml from /config/addons_config/qbittorrent to /addon_configs/$HOSTNAME"
fi fi
# Move autoscript # Move autoscript
if [ -f /homeassistant/addons_autoscrips/qbittorrent.sh ]; then 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 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" bashio::log.yellow "... moved qbittorrent.sh from /config/addons_autoscripts to /addon_configs/$HOSTNAME"
fi fi

View File

@@ -189,8 +189,8 @@ if [ "$CUSTOMUI" = default ]; then
sed -i '/AlternativeUIEnabled/d' qBittorrent.conf sed -i '/AlternativeUIEnabled/d' qBittorrent.conf
sed -i '/RootFolder/d' qBittorrent.conf sed -i '/RootFolder/d' qBittorrent.conf
# Update ingress webui # 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 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 unzip -o vuetorrent.zip -d / > /dev/null
rm vuetorrent.zip rm vuetorrent.zip
fi fi
@@ -202,18 +202,18 @@ if bashio::config.has_value 'customUI' && [ ! "$CUSTOMUI" = default ] && [ ! "$C
### Download WebUI ### Download WebUI
case $CUSTOMUI in case $CUSTOMUI in
"vuetorrent") "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") "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 "" echo ""
bashio::log.warning "qbit-matUI selected ! It will not work for ingress, which will stay with vuetorrent" bashio::log.warning "qbit-matUI selected ! It will not work for ingress, which will stay with vuetorrent"
echo "" echo ""
;; ;;
"qb-web") "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; } 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 "----------------------------" bashio::log.info "----------------------------"
# Get current ip # Get current ip
curl -s ipecho.net/plain >/currentip curl -s ipecho.net/plain > /currentip
# Function to check for files path # Function to check for files path
function check_path() { function check_path() {
@@ -77,7 +77,7 @@ if bashio::config.true 'openvpn_enabled'; then
fi fi
fi fi
fi fi
done </tmpfile done < /tmpfile
rm /tmpfile rm /tmpfile
# Standardize lf # Standardize lf
@@ -119,7 +119,7 @@ if bashio::config.true 'openvpn_enabled'; then
fi fi
# If openvpn_config not set, but folder is not empty # 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 # Look for openvpn files
# Wildcard search for openvpn config files and store results in array # Wildcard search for openvpn config files and store results in array
mapfile -t VPN_CONFIGS < <(find /config/openvpn -maxdepth 1 -name "*.ovpn" -print) 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 # Set credentials
if bashio::config.has_value "openvpn_username"; then if bashio::config.has_value "openvpn_username"; then
openvpn_username=$(bashio::config 'openvpn_username') openvpn_username=$(bashio::config 'openvpn_username')
echo "${openvpn_username}" >/etc/openvpn/credentials echo "${openvpn_username}" > /etc/openvpn/credentials
else else
bashio::exit.nok "Openvpn is enabled, but openvpn_username option is empty! Exiting" bashio::exit.nok "Openvpn is enabled, but openvpn_username option is empty! Exiting"
fi fi
if bashio::config.has_value "openvpn_password"; then if bashio::config.has_value "openvpn_password"; then
openvpn_password=$(bashio::config 'openvpn_password') openvpn_password=$(bashio::config 'openvpn_password')
echo "${openvpn_password}" >>/etc/openvpn/credentials echo "${openvpn_password}" >> /etc/openvpn/credentials
else else
bashio::exit.nok "Openvpn is enabled, but openvpn_password option is empty! Exiting" bashio::exit.nok "Openvpn is enabled, but openvpn_password option is empty! Exiting"
fi 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/i # specified auth-user-pass file not found, disabling' /config/openvpn/"$openvpn_config"
sed -i '/^auth-user-pass/s/^/#/' /config/openvpn/"$openvpn_config" sed -i '/^auth-user-pass/s/^/#/' /config/openvpn/"$openvpn_config"
# No credentials specified, using addons username and password # 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 "# 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 "auth-user-pass /etc/openvpn/credentials" >> /etc/openvpn/"$openvpn_config"
fi fi
else else
# Standardize just to be sure # Standardize just to be sure
@@ -179,8 +179,8 @@ if bashio::config.true 'openvpn_enabled'; then
fi fi
else else
# No credentials specified, using addons username and password # 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 "# 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 "auth-user-pass /etc/openvpn/credentials" >> /config/openvpn/"$openvpn_config"
fi fi
# Permissions # Permissions

View File

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

View File

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

View File

@@ -13,14 +13,15 @@ else
######################################################## ########################################################
# DRAFT : Start wireguard if needed # DRAFT : Start wireguard if needed
if bashio::config.true 'wireguard_enabled'; then if bashio::config.true 'wireguard_enabled'; then
wg-quick up /config/wireguard/config.conf & true wg-quick up /config/wireguard/config.conf &
true
fi fi
######################################################## ########################################################
if bashio::config.true 'silent'; then if bashio::config.true 'silent'; then
exec \ exec \
s6-notifyoncheck -d -n 300 -w 1000 -c "nc -z localhost ${WEBUI_PORT}" \ 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 else
exec \ exec \
s6-notifyoncheck -d -n 300 -w 1000 -c "nc -z localhost ${WEBUI_PORT}" \ 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 # Check vpn is working
if [ -f /currentip ]; then if [ -f /currentip ]; then
nginx || nginx -s reload & \ nginx || nginx -s reload &
while true; do while true; do
# Get vpn ip # Get vpn ip
if ! bashio::config.true 'wireguard_enabled' && bashio::config.true 'openvpn_alt_mode'; then if ! bashio::config.true 'wireguard_enabled' && bashio::config.true 'openvpn_alt_mode'; then
@@ -26,7 +26,7 @@ if [ -f /currentip ]; then
fi fi
# Get ip location # 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 # Inform by message
bashio::log.info "VPN is up and running with ip $(cat /vpnip), based in country : $COUNTRY" 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 if [ -f "$config_location/config.yaml" ] && [ ! -f "$config_location/migrated" ]; then
bashio::log.warning "Migrating config.yaml" bashio::log.warning "Migrating config.yaml"
cp -rf "/homeassistant/addons_config/$slug"/* /config/ || true 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 fi
if [ -f "/homeassistant/addons_autoscripts/$slug.sh" ]; then if [ -f "/homeassistant/addons_autoscripts/$slug.sh" ]; then

View File

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