mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-06-06 23:55:56 +02:00
fix: auto-fix linting issues
This commit is contained in:
committed by
github-actions[bot]
parent
e5adbd266f
commit
f728166b14
@@ -16,8 +16,7 @@ if ! bashio::supervisor.ping 2>/dev/null; then
|
|||||||
'-----------------------------------------------------------'
|
'-----------------------------------------------------------'
|
||||||
# Use environment variables instead of addon options
|
# Use environment variables instead of addon options
|
||||||
echo "... convert scripts to use environment variables instead of addon options"
|
echo "... convert scripts to use environment variables instead of addon options"
|
||||||
while IFS= read -r scripts
|
while IFS= read -r scripts; do
|
||||||
do
|
|
||||||
sed -i -e 's/bashio::config.has_value[[:space:]]*["'"'"']\([^"'"'"']*\)["'"'"']/[ ! -z "${\1:-}" ]/g' \
|
sed -i -e 's/bashio::config.has_value[[:space:]]*["'"'"']\([^"'"'"']*\)["'"'"']/[ ! -z "${\1:-}" ]/g' \
|
||||||
-e 's/bashio::config.true[[:space:]]*["'"'"']\([^"'"'"']*\)["'"'"']/[ ! -z "${\1:-}" ] \&\& [ "${\1:-}" = "true" ]/g' \
|
-e 's/bashio::config.true[[:space:]]*["'"'"']\([^"'"'"']*\)["'"'"']/[ ! -z "${\1:-}" ] \&\& [ "${\1:-}" = "true" ]/g' \
|
||||||
-e 's/\$(bashio::config[[:space:]]*["'"'"']\([^"'"'"']*\)["'"'"'])/${\1:-}/g' \
|
-e 's/\$(bashio::config[[:space:]]*["'"'"']\([^"'"'"']*\)["'"'"'])/${\1:-}/g' \
|
||||||
@@ -82,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
|
||||||
|
|||||||
@@ -50,10 +50,10 @@ for KEYS in "${arr[@]}"; do
|
|||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
# Check if single match
|
# Check if single match
|
||||||
secretnum=$(sed -n "/$secret:/=" "$SECRETSOURCE" )
|
secretnum=$(sed -n "/$secret:/=" "$SECRETSOURCE")
|
||||||
[[ "$secretnum" == *' '* ]] && bashio::exit.nok "There are multiple matches for your password name. Please check your secrets.yaml file"
|
[[ "$secretnum" == *' '* ]] && bashio::exit.nok "There are multiple matches for your password name. Please check your secrets.yaml file"
|
||||||
# Get text
|
# Get text
|
||||||
secret=$(sed -n "/$secret:/p" "$SECRETSOURCE" )
|
secret=$(sed -n "/$secret:/p" "$SECRETSOURCE")
|
||||||
secret=${secret#*: }
|
secret=${secret#*: }
|
||||||
line="${line%%=*}='$secret'"
|
line="${line%%=*}='$secret'"
|
||||||
VALUE="$secret"
|
VALUE="$secret"
|
||||||
@@ -71,26 +71,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
|
||||||
|
|
||||||
|
|||||||
@@ -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 "---------------------------------------------------"
|
||||||
@@ -99,10 +99,12 @@ 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
|
||||||
|
)
|
||||||
done
|
done
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ fi
|
|||||||
# DEFINE FUNCTIONS #
|
# DEFINE FUNCTIONS #
|
||||||
####################
|
####################
|
||||||
|
|
||||||
test_mount () {
|
test_mount() {
|
||||||
|
|
||||||
# Set initial test
|
# Set initial test
|
||||||
MOUNTED=false
|
MOUNTED=false
|
||||||
@@ -45,7 +45,7 @@ test_mount () {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mount_drive () {
|
mount_drive() {
|
||||||
|
|
||||||
# Define options
|
# Define options
|
||||||
MOUNTED=true
|
MOUNTED=true
|
||||||
@@ -197,7 +197,7 @@ if bashio::config.has_value 'networkdisks'; then
|
|||||||
# Manage output
|
# Manage output
|
||||||
if [ -n "$SMBVERS" ]; then
|
if [ -n "$SMBVERS" ]; then
|
||||||
case $SMBVERS in
|
case $SMBVERS in
|
||||||
"202"|"200"|"20")
|
"202" | "200" | "20")
|
||||||
SMBVERS="2.0"
|
SMBVERS="2.0"
|
||||||
;;
|
;;
|
||||||
21)
|
21)
|
||||||
|
|||||||
@@ -186,20 +186,20 @@ while IFS= read -r line; do
|
|||||||
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
|
||||||
echo "os.environ['${KEYS}'] = '${VALUE//[\"\']/}'" >> /env.py
|
echo "os.environ['${KEYS}'] = '${VALUE//[\"\']/}'" >>/env.py
|
||||||
python3 /env.py
|
python3 /env.py
|
||||||
fi
|
fi
|
||||||
# set .env
|
# set .env
|
||||||
if [ -f /.env ]; then echo "$line" >> /.env; fi
|
if [ -f /.env ]; then echo "$line" >>/.env; fi
|
||||||
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
|
||||||
|
|||||||
@@ -53,8 +53,7 @@ if [ ! -f "${currentshebang%% *}" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Check if there is actual commands
|
# Check if there is actual commands
|
||||||
while IFS= read -r line
|
while IFS= read -r line; do
|
||||||
do
|
|
||||||
# Remove leading and trailing whitespaces
|
# Remove leading and trailing whitespaces
|
||||||
line="$(echo "$line" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')"
|
line="$(echo "$line" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')"
|
||||||
|
|
||||||
@@ -64,4 +63,4 @@ do
|
|||||||
/."$CONFIGSOURCE"
|
/."$CONFIGSOURCE"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
done < "$CONFIGSOURCE"
|
done <"$CONFIGSOURCE"
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|||||||
@@ -18,8 +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
|
if ping -c 1 "$server" &>/dev/null; then
|
||||||
then
|
|
||||||
DNS="${DNS}nameserver $server\n"
|
DNS="${DNS}nameserver $server\n"
|
||||||
DNSLIST="$server $DNSLIST"
|
DNSLIST="$server $DNSLIST"
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -86,7 +86,10 @@ if [ "$$" -eq 1 ]; then
|
|||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
trap terminate SIGTERM SIGINT
|
trap terminate SIGTERM SIGINT
|
||||||
while :; do sleep infinity & wait $!; done
|
while :; do
|
||||||
|
sleep infinity &
|
||||||
|
wait $!
|
||||||
|
done
|
||||||
else
|
else
|
||||||
echo " "
|
echo " "
|
||||||
echo -e "\033[0;32mStarting the upstream container\033[0m"
|
echo -e "\033[0;32mStarting the upstream container\033[0m"
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ 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
|
||||||
@@ -54,7 +54,7 @@ cd /data/"$BASENAME" || exit
|
|||||||
for f in */; do
|
for f in */; do
|
||||||
|
|
||||||
if [ -f /data/"$BASENAME"/"$f"/updater.json ]; then
|
if [ -f /data/"$BASENAME"/"$f"/updater.json ]; then
|
||||||
SLUG=${f//\/}
|
SLUG=${f//\//}
|
||||||
|
|
||||||
# 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
|
||||||
@@ -64,7 +64,10 @@ for f in */; do
|
|||||||
|
|
||||||
#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
|
||||||
cd /data/"${BASENAME}"/"${SLUG}" || { bashio::log.error "$SLUG addon not found in this repository. Exiting."; continue; }
|
cd /data/"${BASENAME}"/"${SLUG}" || {
|
||||||
|
bashio::log.error "$SLUG addon not found in this repository. Exiting."
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
# Get variables
|
# Get variables
|
||||||
UPSTREAM=$(jq -r .upstream_repo updater.json)
|
UPSTREAM=$(jq -r .upstream_repo updater.json)
|
||||||
@@ -87,12 +90,18 @@ for f in */; do
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
#Skip if paused
|
#Skip if paused
|
||||||
if [[ "$PAUSED" = true ]]; then bashio::log.magenta "... $SLUG addon updates are paused, skipping"; continue; fi
|
if [[ "$PAUSED" = true ]]; then
|
||||||
|
bashio::log.magenta "... $SLUG addon updates are paused, skipping"
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
#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."; continue; }
|
{
|
||||||
|
bashio::log.error "$SLUG addon upstream tag not found in updater.json. Exiting."
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
if [[ "$SOURCE" = dockerhub ]]; then
|
if [[ "$SOURCE" = dockerhub ]]; then
|
||||||
# Use dockerhub as upstream
|
# Use dockerhub as upstream
|
||||||
@@ -126,7 +135,7 @@ for f in */; do
|
|||||||
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 |
|
||||||
@@ -137,8 +146,9 @@ for f in */; do
|
|||||||
tail -n 1
|
tail -n 1
|
||||||
)
|
)
|
||||||
|
|
||||||
[ "${BYDATE}" = true ] && \
|
[ "${BYDATE}" = true ] &&
|
||||||
LASTVERSION=$(curl -f -L -s --fail "https://hub.docker.com/v2/repositories/${DOCKERHUB_REPO}/${DOCKERHUB_IMAGE}/tags?page_size=${LISTSIZE}&ordering=last_updated$FILTER_TEXT" |
|
LASTVERSION=$(
|
||||||
|
curl -f -L -s --fail "https://hub.docker.com/v2/repositories/${DOCKERHUB_REPO}/${DOCKERHUB_IMAGE}/tags?page_size=${LISTSIZE}&ordering=last_updated$FILTER_TEXT" |
|
||||||
jq '.results | .[] | .name' -r |
|
jq '.results | .[] | .name' -r |
|
||||||
sed -e '/.*latest.*/d' |
|
sed -e '/.*latest.*/d' |
|
||||||
sed -e '/.*dev.*/d' |
|
sed -e '/.*dev.*/d' |
|
||||||
@@ -146,11 +156,12 @@ for f in */; do
|
|||||||
sed -e "/.*$EXCLUDE_TEXT.*/d" |
|
sed -e "/.*$EXCLUDE_TEXT.*/d" |
|
||||||
sort -V |
|
sort -V |
|
||||||
tail -n 1
|
tail -n 1
|
||||||
) && \
|
) &&
|
||||||
DATE=$(curl -f -L -s --fail "https://hub.docker.com/v2/repositories/${DOCKERHUB_REPO}/${DOCKERHUB_IMAGE}/tags/?page_size=${LISTSIZE}&ordering=last_updated$FILTER_TEXT" |
|
DATE=$(
|
||||||
|
curl -f -L -s --fail "https://hub.docker.com/v2/repositories/${DOCKERHUB_REPO}/${DOCKERHUB_IMAGE}/tags/?page_size=${LISTSIZE}&ordering=last_updated$FILTER_TEXT" |
|
||||||
jq '.results[] | select(.name==$LASTVERSION) | .last_updated' -r --arg LASTVERSION "$LASTVERSION"
|
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
|
||||||
|
|
||||||
@@ -201,7 +212,7 @@ for f in */; do
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# If failure, checks if there is packages that could be used
|
# If failure, checks if there is packages that could be used
|
||||||
function test_packages () {
|
function test_packages() {
|
||||||
if [ "$VERBOSE" = true ]; then
|
if [ "$VERBOSE" = true ]; then
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
bashio::log.info "source : $SOURCE and LASTVERSION : $(lastversion "$UPSTREAM" $ARGUMENTS 2>&1 || true)"
|
bashio::log.info "source : $SOURCE and LASTVERSION : $(lastversion "$UPSTREAM" $ARGUMENTS 2>&1 || true)"
|
||||||
@@ -264,7 +275,7 @@ for f in */; do
|
|||||||
|
|
||||||
#Change all instances of version
|
#Change all instances of version
|
||||||
LOGINFO="... $SLUG : updating files" && if [ "$VERBOSE" = true ]; then bashio::log.info "$LOGINFO"; fi
|
LOGINFO="... $SLUG : updating files" && if [ "$VERBOSE" = true ]; then bashio::log.info "$LOGINFO"; fi
|
||||||
for files in "config.json" "config.yaml" "Dockerfile" "build.json" "build.yaml";do
|
for files in "config.json" "config.yaml" "Dockerfile" "build.json" "build.yaml"; do
|
||||||
if [ -f /data/"${BASENAME}"/"${SLUG}"/$files ]; then
|
if [ -f /data/"${BASENAME}"/"${SLUG}"/$files ]; then
|
||||||
sed -i "s/${CURRENT}/${LASTVERSION}/g" /data/"${BASENAME}"/"${SLUG}"/"$files"
|
sed -i "s/${CURRENT}/${LASTVERSION}/g" /data/"${BASENAME}"/"${SLUG}"/"$files"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -9,7 +9,8 @@ set -e
|
|||||||
# Set UrlBase
|
# Set UrlBase
|
||||||
|
|
||||||
bashio::log.info "Starting NGinx..."
|
bashio::log.info "Starting NGinx..."
|
||||||
nginx & true
|
nginx &
|
||||||
|
true
|
||||||
|
|
||||||
#############
|
#############
|
||||||
# Start app #
|
# Start app #
|
||||||
|
|||||||
@@ -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;"
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -14,4 +14,3 @@ ingress_entry=$(bashio::addon.ingress_entry)
|
|||||||
sed -i "s/%%port%%/${ingress_port}/g" /etc/nginx/servers/ingress.conf
|
sed -i "s/%%port%%/${ingress_port}/g" /etc/nginx/servers/ingress.conf
|
||||||
sed -i "s/%%interface%%/${ingress_interface}/g" /etc/nginx/servers/ingress.conf
|
sed -i "s/%%interface%%/${ingress_interface}/g" /etc/nginx/servers/ingress.conf
|
||||||
sed -i "s|%%ingress_entry%%|${ingress_entry}|g" /etc/nginx/servers/ingress.conf
|
sed -i "s|%%ingress_entry%%|${ingress_entry}|g" /etc/nginx/servers/ingress.conf
|
||||||
|
|
||||||
|
|||||||
@@ -9,24 +9,28 @@ set -e
|
|||||||
##################
|
##################
|
||||||
# Starting redis #
|
# Starting redis #
|
||||||
##################
|
##################
|
||||||
exec redis-server & bashio::log.info "Starting redis"
|
exec redis-server &
|
||||||
|
bashio::log.info "Starting redis"
|
||||||
|
|
||||||
####################
|
####################
|
||||||
# Starting mongodb #
|
# Starting mongodb #
|
||||||
####################
|
####################
|
||||||
mkdir -p /data/db
|
mkdir -p /data/db
|
||||||
exec mongod --bind_ip 127.0.0.1 & bashio::log.info "Starting mongod"
|
exec mongod --bind_ip 127.0.0.1 &
|
||||||
|
bashio::log.info "Starting mongod"
|
||||||
|
|
||||||
################
|
################
|
||||||
# Starting app #
|
# Starting app #
|
||||||
################
|
################
|
||||||
cd /srv || true
|
cd /srv || true
|
||||||
npm start docker-entrypoint.sh & bashio::log.info "Starting binance bot"
|
npm start docker-entrypoint.sh &
|
||||||
|
bashio::log.info "Starting binance bot"
|
||||||
|
|
||||||
#########################
|
#########################
|
||||||
# Starting Trading View #
|
# Starting Trading View #
|
||||||
#########################
|
#########################
|
||||||
python main.py & bashio::log.info "Starting trading view"
|
python main.py &
|
||||||
|
bashio::log.info "Starting trading view"
|
||||||
|
|
||||||
##################
|
##################
|
||||||
# Starting nginx #
|
# Starting nginx #
|
||||||
|
|||||||
@@ -12,4 +12,3 @@ if bashio::services.available 'mqtt'; then
|
|||||||
bashio::log.blue "MQTT broker : tcp://$(bashio::services "mqtt" "host"):$(bashio::services "mqtt" "port")"
|
bashio::log.blue "MQTT broker : tcp://$(bashio::services "mqtt" "host"):$(bashio::services "mqtt" "port")"
|
||||||
bashio::log.green "---"
|
bashio::log.green "---"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -24,10 +24,10 @@ fi
|
|||||||
|
|
||||||
bashio::log.info "Starting app..."
|
bashio::log.info "Starting app..."
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
/usr/bin/entrypoint.sh birdnet-go realtime & true
|
/usr/bin/entrypoint.sh birdnet-go realtime &
|
||||||
|
true
|
||||||
|
|
||||||
# Wait for app to become available to start nginx
|
# Wait for app to become available to start nginx
|
||||||
bashio::net.wait_for 8080 localhost 900
|
bashio::net.wait_for 8080 localhost 900
|
||||||
bashio::log.info "Starting NGinx..."
|
bashio::log.info "Starting NGinx..."
|
||||||
exec nginx
|
exec nginx
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,10 @@ touch "$ANALYZING_NOW_FILE"
|
|||||||
BIRDSONGS_DIR="$(readlink -f "$HOME/BirdSongs/Extracted/By_Date")"
|
BIRDSONGS_DIR="$(readlink -f "$HOME/BirdSongs/Extracted/By_Date")"
|
||||||
|
|
||||||
# Ensure directories and set permissions
|
# Ensure directories and set permissions
|
||||||
mkdir -p "$INGEST_DIR" || { log_red "Failed to create directory: $INGEST_DIR"; exit 1; }
|
mkdir -p "$INGEST_DIR" || {
|
||||||
|
log_red "Failed to create directory: $INGEST_DIR"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
chown -R pi:pi "$INGEST_DIR" || log_yellow "Could not change ownership for $INGEST_DIR"
|
chown -R pi:pi "$INGEST_DIR" || log_yellow "Could not change ownership for $INGEST_DIR"
|
||||||
chmod -R 755 "$INGEST_DIR" || log_yellow "Could not set permissions for $INGEST_DIR"
|
chmod -R 755 "$INGEST_DIR" || log_yellow "Could not set permissions for $INGEST_DIR"
|
||||||
|
|
||||||
@@ -46,7 +49,7 @@ SERVICES=(birdnet_analysis chart_viewer spectrogram_viewer birdnet_recording bir
|
|||||||
# Notification settings
|
# Notification settings
|
||||||
########################################
|
########################################
|
||||||
NOTIFICATION_INTERVAL=1800 # 30 minutes in seconds
|
NOTIFICATION_INTERVAL=1800 # 30 minutes in seconds
|
||||||
NOTIFICATION_INTERVAL_IN_MINUTES=$(( NOTIFICATION_INTERVAL / 60 ))
|
NOTIFICATION_INTERVAL_IN_MINUTES=$((NOTIFICATION_INTERVAL / 60))
|
||||||
last_notification_time=0
|
last_notification_time=0
|
||||||
issue_reported=0 # 1 = an issue was reported, 0 = system is normal
|
issue_reported=0 # 1 = an issue was reported, 0 = system is normal
|
||||||
declare -A SERVICE_INACTIVE_COUNT=()
|
declare -A SERVICE_INACTIVE_COUNT=()
|
||||||
@@ -72,10 +75,10 @@ apprisealert() {
|
|||||||
current_time=$(date +%s)
|
current_time=$(date +%s)
|
||||||
|
|
||||||
# Calculate time_diff in minutes since last notification
|
# Calculate time_diff in minutes since last notification
|
||||||
local time_diff=$(( (current_time - last_notification_time) / 60 ))
|
local time_diff=$(((current_time - last_notification_time) / 60))
|
||||||
|
|
||||||
# Throttle notifications
|
# Throttle notifications
|
||||||
if (( time_diff < NOTIFICATION_INTERVAL_IN_MINUTES )); then
|
if ((time_diff < NOTIFICATION_INTERVAL_IN_MINUTES)); then
|
||||||
log_yellow "Notification suppressed (last sent ${time_diff} minutes ago)."
|
log_yellow "Notification suppressed (last sent ${time_diff} minutes ago)."
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
@@ -109,7 +112,7 @@ apprisealert() {
|
|||||||
|
|
||||||
apprisealert_recovery() {
|
apprisealert_recovery() {
|
||||||
# Only send a recovery message if we had previously reported an issue
|
# Only send a recovery message if we had previously reported an issue
|
||||||
if (( issue_reported == 1 )); then
|
if ((issue_reported == 1)); then
|
||||||
log_green "$(date) INFO: System is back to normal. Sending recovery notification."
|
log_green "$(date) INFO: System is back to normal. Sending recovery notification."
|
||||||
|
|
||||||
local TITLE="BirdNET-Pi System Recovered"
|
local TITLE="BirdNET-Pi System Recovered"
|
||||||
@@ -133,7 +136,7 @@ check_disk_space() {
|
|||||||
local current_usage
|
local current_usage
|
||||||
current_usage=$(df -h "$BIRDSONGS_DIR" | awk 'NR==2 {print $5}' | sed 's/%//')
|
current_usage=$(df -h "$BIRDSONGS_DIR" | awk 'NR==2 {print $5}' | sed 's/%//')
|
||||||
|
|
||||||
if (( current_usage >= DISK_USAGE_THRESHOLD )); then
|
if ((current_usage >= DISK_USAGE_THRESHOLD)); then
|
||||||
log_red "$(date) INFO: Disk usage is at ${current_usage}% (CRITICAL!)"
|
log_red "$(date) INFO: Disk usage is at ${current_usage}% (CRITICAL!)"
|
||||||
apprisealert "Disk usage critical: ${current_usage}%"
|
apprisealert "Disk usage critical: ${current_usage}%"
|
||||||
return 1
|
return 1
|
||||||
@@ -147,13 +150,13 @@ 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
|
||||||
same_file_counter=0
|
same_file_counter=0
|
||||||
analyzing_now="$current_file"
|
analyzing_now="$current_file"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if (( same_file_counter >= SAME_FILE_THRESHOLD )); then
|
if ((same_file_counter >= SAME_FILE_THRESHOLD)); then
|
||||||
log_red "$(date) INFO: 'analyzing_now' file unchanged for $SAME_FILE_THRESHOLD iterations."
|
log_red "$(date) INFO: 'analyzing_now' file unchanged for $SAME_FILE_THRESHOLD iterations."
|
||||||
apprisealert "No change in analyzing_now for ${SAME_FILE_THRESHOLD} iterations"
|
apprisealert "No change in analyzing_now for ${SAME_FILE_THRESHOLD} iterations"
|
||||||
"$HOME/BirdNET-Pi/scripts/restart_services.sh"
|
"$HOME/BirdNET-Pi/scripts/restart_services.sh"
|
||||||
@@ -161,7 +164,7 @@ check_analyzing_now() {
|
|||||||
return 1
|
return 1
|
||||||
else
|
else
|
||||||
# Only log if it changed this iteration
|
# Only log if it changed this iteration
|
||||||
if (( same_file_counter == 0 )); then
|
if ((same_file_counter == 0)); then
|
||||||
log_green "$(date) INFO: 'analyzing_now' file has been updated."
|
log_green "$(date) INFO: 'analyzing_now' file has been updated."
|
||||||
fi
|
fi
|
||||||
return 0
|
return 0
|
||||||
@@ -174,13 +177,13 @@ check_queue() {
|
|||||||
|
|
||||||
log_green "$(date) INFO: Queue is at a manageable level (${wav_count} wav files)."
|
log_green "$(date) INFO: Queue is at a manageable level (${wav_count} wav files)."
|
||||||
|
|
||||||
if (( wav_count > 50 )); then
|
if ((wav_count > 50)); then
|
||||||
log_red "$(date) INFO: Queue >50. Stopping recorder + restarting analyzer."
|
log_red "$(date) INFO: Queue >50. Stopping recorder + restarting analyzer."
|
||||||
apprisealert "Queue exceeded 50: stopping recorder, restarting analyzer."
|
apprisealert "Queue exceeded 50: stopping recorder, restarting analyzer."
|
||||||
sudo systemctl stop birdnet_recording
|
sudo systemctl stop birdnet_recording
|
||||||
sudo systemctl restart birdnet_analysis
|
sudo systemctl restart birdnet_analysis
|
||||||
return 1
|
return 1
|
||||||
elif (( wav_count > 30 )); then
|
elif ((wav_count > 30)); then
|
||||||
log_red "$(date) INFO: Queue >30. Restarting analyzer."
|
log_red "$(date) INFO: Queue >30. Restarting analyzer."
|
||||||
apprisealert "Queue exceeded 30: restarting analyzer."
|
apprisealert "Queue exceeded 30: restarting analyzer."
|
||||||
sudo systemctl restart birdnet_analysis
|
sudo systemctl restart birdnet_analysis
|
||||||
@@ -194,14 +197,14 @@ check_services() {
|
|||||||
|
|
||||||
for service in "${SERVICES[@]}"; do
|
for service in "${SERVICES[@]}"; do
|
||||||
if [[ "$(systemctl is-active "$service")" != "active" ]]; then
|
if [[ "$(systemctl is-active "$service")" != "active" ]]; then
|
||||||
SERVICE_INACTIVE_COUNT["$service"]=$(( SERVICE_INACTIVE_COUNT["$service"] + 1 ))
|
SERVICE_INACTIVE_COUNT["$service"]=$((SERVICE_INACTIVE_COUNT["$service"] + 1))
|
||||||
|
|
||||||
if (( SERVICE_INACTIVE_COUNT["$service"] == 1 )); then
|
if ((SERVICE_INACTIVE_COUNT["$service"] == 1)); then
|
||||||
# First time inactive => Try to start
|
# First time inactive => Try to start
|
||||||
log_yellow "$(date) INFO: Service '$service' is inactive. Attempting to start..."
|
log_yellow "$(date) INFO: Service '$service' is inactive. Attempting to start..."
|
||||||
systemctl start "$service"
|
systemctl start "$service"
|
||||||
any_inactive=1
|
any_inactive=1
|
||||||
elif (( SERVICE_INACTIVE_COUNT["$service"] == 2 )); then
|
elif ((SERVICE_INACTIVE_COUNT["$service"] == 2)); then
|
||||||
# Second consecutive time => Send an alert
|
# Second consecutive time => Send an alert
|
||||||
log_red "$(date) INFO: Service '$service' is still inactive after restart attempt."
|
log_red "$(date) INFO: Service '$service' is still inactive after restart attempt."
|
||||||
apprisealert "Service '$service' remains inactive after restart attempt."
|
apprisealert "Service '$service' remains inactive after restart attempt."
|
||||||
@@ -213,14 +216,14 @@ check_services() {
|
|||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
# Service is active => reset counter
|
# Service is active => reset counter
|
||||||
if (( SERVICE_INACTIVE_COUNT["$service"] > 0 )); then
|
if ((SERVICE_INACTIVE_COUNT["$service"] > 0)); then
|
||||||
log_green "$(date) INFO: Service '$service' is back to active. Resetting counter."
|
log_green "$(date) INFO: Service '$service' is back to active. Resetting counter."
|
||||||
fi
|
fi
|
||||||
SERVICE_INACTIVE_COUNT["$service"]=0
|
SERVICE_INACTIVE_COUNT["$service"]=0
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
if (( any_inactive == 0 )); then
|
if ((any_inactive == 0)); then
|
||||||
log_green "$(date) INFO: All services are active"
|
log_green "$(date) INFO: All services are active"
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
@@ -269,7 +272,7 @@ while true; do
|
|||||||
check_for_empty_stream || any_issue=1
|
check_for_empty_stream || any_issue=1
|
||||||
|
|
||||||
# Final summary
|
# Final summary
|
||||||
if (( any_issue == 0 )); then
|
if ((any_issue == 0)); then
|
||||||
log_green "$(date) INFO: All systems are functioning normally"
|
log_green "$(date) INFO: All systems are functioning normally"
|
||||||
apprisealert_recovery
|
apprisealert_recovery
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -121,4 +121,3 @@ echo "... setting up Matplotlabdir"
|
|||||||
mkdir -p "$HOME"/.cache/matplotlib
|
mkdir -p "$HOME"/.cache/matplotlib
|
||||||
chown -R "pi:pi" "$HOME"/.cache/matplotlib
|
chown -R "pi:pi" "$HOME"/.cache/matplotlib
|
||||||
chmod 777 "$HOME"/.cache/matplotlib
|
chmod 777 "$HOME"/.cache/matplotlib
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -18,10 +18,10 @@ fi
|
|||||||
############
|
############
|
||||||
|
|
||||||
# Function to perform common setup steps
|
# Function to perform common setup steps
|
||||||
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
|
||||||
|
|||||||
@@ -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"
|
||||||
|
|||||||
@@ -47,4 +47,3 @@ if bashio::config.true 'ssl'; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ 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"
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ set_timezone() {
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "$new_timezone" > /data/timezone
|
echo "$new_timezone" >/data/timezone
|
||||||
echo "$new_timezone" > /etc/timezone
|
echo "$new_timezone" >/etc/timezone
|
||||||
ln -sf "/usr/share/zoneinfo/$new_timezone" /etc/localtime
|
ln -sf "/usr/share/zoneinfo/$new_timezone" /etc/localtime
|
||||||
|
|
||||||
# Update /etc/environment if it exists
|
# Update /etc/environment if it exists
|
||||||
@@ -32,7 +32,7 @@ set_timezone() {
|
|||||||
|
|
||||||
# Update s6 container environment if it exists
|
# Update s6 container environment if it exists
|
||||||
if [ -d /var/run/s6/container_environment ]; then
|
if [ -d /var/run/s6/container_environment ]; then
|
||||||
echo "$new_timezone" > /var/run/s6/container_environment/TZ
|
echo "$new_timezone" >/var/run/s6/container_environment/TZ
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Timezone set to: $new_timezone"
|
echo "Timezone set to: $new_timezone"
|
||||||
@@ -92,16 +92,16 @@ show_time_details() {
|
|||||||
|
|
||||||
# Main script logic
|
# Main script logic
|
||||||
case "$1" in
|
case "$1" in
|
||||||
"set-ntp")
|
"set-ntp")
|
||||||
set_ntp "$2"
|
set_ntp "$2"
|
||||||
;;
|
;;
|
||||||
"show")
|
"show")
|
||||||
show_timezone
|
show_timezone
|
||||||
;;
|
;;
|
||||||
"set-timezone")
|
"set-timezone")
|
||||||
set_timezone "$2"
|
set_timezone "$2"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
show_time_details
|
show_time_details
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|||||||
@@ -205,12 +205,12 @@ set_ntp() {
|
|||||||
|
|
||||||
# systemd-timesyncd is the typical built-in NTP client for systemd-based systems
|
# systemd-timesyncd is the typical built-in NTP client for systemd-based systems
|
||||||
case "$enable_ntp" in
|
case "$enable_ntp" in
|
||||||
true|True|1|on)
|
true | True | 1 | on)
|
||||||
echo "Enabling and starting systemd-timesyncd..."
|
echo "Enabling and starting systemd-timesyncd..."
|
||||||
systemctl enable systemd-timesyncd || echo "Failed to enable timesyncd."
|
systemctl enable systemd-timesyncd || echo "Failed to enable timesyncd."
|
||||||
systemctl start systemd-timesyncd || echo "Failed to start timesyncd."
|
systemctl start systemd-timesyncd || echo "Failed to start timesyncd."
|
||||||
;;
|
;;
|
||||||
false|False|0|off)
|
false | False | 0 | off)
|
||||||
echo "Disabling and stopping systemd-timesyncd..."
|
echo "Disabling and stopping systemd-timesyncd..."
|
||||||
systemctl disable systemd-timesyncd || echo "Failed to disable timesyncd."
|
systemctl disable systemd-timesyncd || echo "Failed to disable timesyncd."
|
||||||
systemctl stop systemd-timesyncd || echo "Failed to stop timesyncd."
|
systemctl stop systemd-timesyncd || echo "Failed to stop timesyncd."
|
||||||
@@ -248,7 +248,7 @@ main() {
|
|||||||
set-ntp)
|
set-ntp)
|
||||||
set_ntp "$@"
|
set_ntp "$@"
|
||||||
;;
|
;;
|
||||||
""|help|--help|-h)
|
"" | help | --help | -h)
|
||||||
print_usage
|
print_usage
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
|||||||
@@ -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"
|
||||||
|
|||||||
@@ -13,4 +13,3 @@ if [ -d /homeassistant/addons_config/calibre-web ] && [ ! -L /homeassistant/addo
|
|||||||
fi
|
fi
|
||||||
rm -r /homeassistant/addons_config/calibre-web
|
rm -r /homeassistant/addons_config/calibre-web
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
|
|
||||||
|
|||||||
@@ -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}"
|
||||||
|
|||||||
@@ -60,7 +60,8 @@ bashio::log.warning "Default password admin:admin..."
|
|||||||
bashio::log.info "Starting..."
|
bashio::log.info "Starting..."
|
||||||
|
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
/./usr/local/bin/codex & true
|
/./usr/local/bin/codex &
|
||||||
|
true
|
||||||
|
|
||||||
bashio::net.wait_for 9810 localhost 900 || true
|
bashio::net.wait_for 9810 localhost 900 || true
|
||||||
bashio::log.info "Started !"
|
bashio::log.info "Started !"
|
||||||
|
|||||||
@@ -102,7 +102,8 @@ fi
|
|||||||
# Launch App #
|
# Launch App #
|
||||||
##############
|
##############
|
||||||
echo " "
|
echo " "
|
||||||
nginx & bashio::log.info "Starting nginx"
|
nginx &
|
||||||
|
bashio::log.info "Starting nginx"
|
||||||
echo " "
|
echo " "
|
||||||
bashio::log.info "Starting the app"
|
bashio::log.info "Starting the app"
|
||||||
echo " "
|
echo " "
|
||||||
|
|||||||
@@ -102,7 +102,8 @@ fi
|
|||||||
# Launch App #
|
# Launch App #
|
||||||
##############
|
##############
|
||||||
echo " "
|
echo " "
|
||||||
nginx & bashio::log.info "Starting nginx"
|
nginx &
|
||||||
|
bashio::log.info "Starting nginx"
|
||||||
echo " "
|
echo " "
|
||||||
bashio::log.info "Starting the app"
|
bashio::log.info "Starting the app"
|
||||||
echo " "
|
echo " "
|
||||||
|
|||||||
@@ -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 @@ case $(bashio::config 'DB_CONNECTION') in
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
# 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 @@ case $(bashio::config 'DB_CONNECTION') in
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
# 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
|
||||||
@@ -148,7 +148,10 @@ chmod -R 775 /config/addons_config/fireflyiii
|
|||||||
|
|
||||||
# Test
|
# Test
|
||||||
f=/config/addons_config/fireflyiii
|
f=/config/addons_config/fireflyiii
|
||||||
while [[ $f != / ]]; do chmod 777 "$f"; f=$(dirname "$f"); done;
|
while [[ $f != / ]]; do
|
||||||
|
chmod 777 "$f"
|
||||||
|
f=$(dirname "$f")
|
||||||
|
done
|
||||||
|
|
||||||
################
|
################
|
||||||
# CRON OPTIONS #
|
# CRON OPTIONS #
|
||||||
|
|||||||
@@ -28,11 +28,10 @@ if bashio::config.has_value 'Updates'; then
|
|||||||
bashio::log.info "$FREQUENCY updates"
|
bashio::log.info "$FREQUENCY updates"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
for i in $(seq 4 2 12)
|
for i in $(seq 4 2 12); do
|
||||||
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
|
||||||
|
|
||||||
@@ -47,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"
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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() {
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ if bashio::config.true 'ssl'; then
|
|||||||
[ ! -f /ssl/"$certfile" ] && bashio::log.fatal "... use_own_certs is true but certificate /ssl/$certfile not found" && bashio::exit.nok
|
[ ! -f /ssl/"$certfile" ] && bashio::log.fatal "... use_own_certs is true but certificate /ssl/$certfile not found" && bashio::exit.nok
|
||||||
[ ! -f /ssl/"$keyfile" ] && bashio::log.fatal "... use_own_certs is true but certificate /ssl/$keyfile not found" && bashio::exit.nok
|
[ ! -f /ssl/"$keyfile" ] && bashio::log.fatal "... use_own_certs is true but certificate /ssl/$keyfile not found" && bashio::exit.nok
|
||||||
|
|
||||||
|
|
||||||
sed -i "s|default_server|ssl|g" /etc/nginx/servers/ssl.conf
|
sed -i "s|default_server|ssl|g" /etc/nginx/servers/ssl.conf
|
||||||
sed -i "/proxy_params.conf/a ssl_certificate /ssl/$certfile;" /etc/nginx/servers/ssl.conf
|
sed -i "/proxy_params.conf/a ssl_certificate /ssl/$certfile;" /etc/nginx/servers/ssl.conf
|
||||||
sed -i "/proxy_params.conf/a ssl_certificate_key /ssl/$keyfile;" /etc/nginx/servers/ssl.conf
|
sed -i "/proxy_params.conf/a ssl_certificate_key /ssl/$keyfile;" /etc/nginx/servers/ssl.conf
|
||||||
|
|||||||
@@ -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."
|
||||||
@@ -73,7 +73,8 @@ CELERY_PID=$!
|
|||||||
# Staring nginx #
|
# Staring nginx #
|
||||||
#################
|
#################
|
||||||
echo "Starting nginx..."
|
echo "Starting nginx..."
|
||||||
exec nginx & bashio::log.info "Starting nginx"
|
exec nginx &
|
||||||
|
bashio::log.info "Starting nginx"
|
||||||
NGINX_PID=$!
|
NGINX_PID=$!
|
||||||
|
|
||||||
# Wait for all background processes
|
# Wait for all background processes
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -93,7 +93,7 @@ setup_root_user() {
|
|||||||
|
|
||||||
# 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
|
||||||
|
|
||||||
|
|||||||
@@ -92,4 +92,3 @@ echo "Enable legacy mode"
|
|||||||
mkdir -p /config/addons_config
|
mkdir -p /config/addons_config
|
||||||
ln -sf "$LOCATION" /config/addons_config/jellyfin
|
ln -sf "$LOCATION" /config/addons_config/jellyfin
|
||||||
chown -R "$PUID:$PGID" "$LOCATION"
|
chown -R "$PUID:$PGID" "$LOCATION"
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
|
|
||||||
|
|||||||
@@ -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 @@ case "$database" in
|
|||||||
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 @@ case "$database" in
|
|||||||
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
# 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
|
||||||
@@ -101,10 +101,13 @@ APP_KEY=$(bashio::config "APP_KEY")
|
|||||||
|
|
||||||
# Check if APP_KEY is not 32 characters long
|
# Check if APP_KEY is not 32 characters long
|
||||||
if [ -z "$APP_KEY" ] || [ ${#APP_KEY} -lt 32 ]; then
|
if [ -z "$APP_KEY" ] || [ ${#APP_KEY} -lt 32 ]; then
|
||||||
APP_KEY="$(echo -n 'base64:'; openssl rand -base64 32)"
|
APP_KEY="$(
|
||||||
|
echo -n 'base64:'
|
||||||
|
openssl rand -base64 32
|
||||||
|
)"
|
||||||
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")"
|
||||||
|
|||||||
@@ -65,7 +65,6 @@ if bashio::config.has_value 'welcome_message'; then
|
|||||||
export ND_UIWELCOMEMESSAGE
|
export ND_UIWELCOMEMESSAGE
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
##############
|
##############
|
||||||
# LAUNCH APP #
|
# LAUNCH APP #
|
||||||
##############
|
##############
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -96,5 +96,6 @@ wait_for_config_file() {
|
|||||||
if [ -f "$config_file" ]; then
|
if [ -f "$config_file" ]; then
|
||||||
execute_main_logic
|
execute_main_logic
|
||||||
else
|
else
|
||||||
wait_for_config_file & true
|
wait_for_config_file &
|
||||||
|
true
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -23,10 +23,9 @@ 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[@]}"
|
for element in "${array[@]}"; do
|
||||||
do
|
|
||||||
if [[ $element =~ $re ]]; then
|
if [[ $element =~ $re ]]; then
|
||||||
# shellcheck disable=SC2295
|
# shellcheck disable=SC2295
|
||||||
APP="${element#${BASH_REMATCH[1]}}"
|
APP="${element#${BASH_REMATCH[1]}}"
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ fi
|
|||||||
sed -i "s|OCRLANG|OCR_LANGUAGES|g" "$CONFIGLOCATION"/papermerge.conf.py
|
sed -i "s|OCRLANG|OCR_LANGUAGES|g" "$CONFIGLOCATION"/papermerge.conf.py
|
||||||
|
|
||||||
languageCount=$(echo "$OCRLANG" | tr -cd ',' | wc -c)
|
languageCount=$(echo "$OCRLANG" | tr -cd ',' | wc -c)
|
||||||
languageCount=$((languageCount+1))
|
languageCount=$((languageCount + 1))
|
||||||
bashio::log.info "Configuring ${languageCount} languages"
|
bashio::log.info "Configuring ${languageCount} languages"
|
||||||
|
|
||||||
if [ -n "$OCRLANG" ]; then
|
if [ -n "$OCRLANG" ]; then
|
||||||
@@ -26,7 +26,7 @@ if [ -n "$OCRLANG" ]; then
|
|||||||
sed -i "${lineStart},${lineEnd}d" "$CONFIGLOCATION"/papermerge.conf.py || true
|
sed -i "${lineStart},${lineEnd}d" "$CONFIGLOCATION"/papermerge.conf.py || true
|
||||||
|
|
||||||
bashio::log.info "Writing new configuration"
|
bashio::log.info "Writing new configuration"
|
||||||
echo "OCR_LANGUAGES = {" >> "$CONFIGLOCATION"/papermerge.conf.py
|
echo "OCR_LANGUAGES = {" >>"$CONFIGLOCATION"/papermerge.conf.py
|
||||||
|
|
||||||
languages=$(echo "$OCRLANG" | tr "," "\n")
|
languages=$(echo "$OCRLANG" | tr "," "\n")
|
||||||
|
|
||||||
@@ -40,20 +40,20 @@ if [ -n "$OCRLANG" ]; then
|
|||||||
apt-get install -yqq tesseract-ocr-"${language}" >/dev/null
|
apt-get install -yqq tesseract-ocr-"${language}" >/dev/null
|
||||||
languageFullName=$(apt-cache show tesseract-ocr-"${language}" | grep -E '^(Description|Description-en):' | grep -oE '[^ ]+$')
|
languageFullName=$(apt-cache show tesseract-ocr-"${language}" | grep -E '^(Description|Description-en):' | grep -oE '[^ ]+$')
|
||||||
bashio::log.info "${language} identified as ${languageFullName}"
|
bashio::log.info "${language} identified as ${languageFullName}"
|
||||||
i=$((i+1))
|
i=$((i + 1))
|
||||||
if [[ $i -eq $languageCount ]]; then
|
if [[ $i -eq $languageCount ]]; then
|
||||||
echo " \"$language\" : \"$languageFullName\"" >> "$CONFIGLOCATION"/papermerge.conf.py
|
echo " \"$language\" : \"$languageFullName\"" >>"$CONFIGLOCATION"/papermerge.conf.py
|
||||||
elif [[ $i -eq 1 ]]; then
|
elif [[ $i -eq 1 ]]; then
|
||||||
echo " \"$language\" : \"$languageFullName\"," >> "$CONFIGLOCATION"/papermerge.conf.py
|
echo " \"$language\" : \"$languageFullName\"," >>"$CONFIGLOCATION"/papermerge.conf.py
|
||||||
bashio::log.info "Setting default language to ${language}"
|
bashio::log.info "Setting default language to ${language}"
|
||||||
sed -i "s/^OCR_DEFAULT_LANGUAGE = \"eng\"/OCR_DEFAULT_LANGUAGE = \"${language}\"/g" "$CONFIGLOCATION"/papermerge.conf.py
|
sed -i "s/^OCR_DEFAULT_LANGUAGE = \"eng\"/OCR_DEFAULT_LANGUAGE = \"${language}\"/g" "$CONFIGLOCATION"/papermerge.conf.py
|
||||||
else
|
else
|
||||||
echo " \"$language\" : \"$languageFullName\"," >> "$CONFIGLOCATION"/papermerge.conf.py
|
echo " \"$language\" : \"$languageFullName\"," >>"$CONFIGLOCATION"/papermerge.conf.py
|
||||||
fi
|
fi
|
||||||
bashio::log.info "... ${language} installed"
|
bashio::log.info "... ${language} installed"
|
||||||
else
|
else
|
||||||
bashio::log.info "Package tesseract-ocr-${language} not found in the repository, skipping"
|
bashio::log.info "Package tesseract-ocr-${language} not found in the repository, skipping"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
echo "}" >> "$CONFIGLOCATION"/papermerge.conf.py
|
echo "}" >>"$CONFIGLOCATION"/papermerge.conf.py
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -53,18 +53,18 @@ IMAPUSERNAME=$(bashio::config 'imapusername')
|
|||||||
IMAPPASSWORD=$(bashio::config 'imappassword')
|
IMAPPASSWORD=$(bashio::config 'imappassword')
|
||||||
|
|
||||||
if [ "$IMAPHOST" != "null" ]; then
|
if [ "$IMAPHOST" != "null" ]; then
|
||||||
printf "\nIMPORT_MAIL_HOST = \"%s\"" "$IMAPHOST" >> /data/config/papermerge.conf.py
|
printf "\nIMPORT_MAIL_HOST = \"%s\"" "$IMAPHOST" >>/data/config/papermerge.conf.py
|
||||||
bashio::log.info "IMPORT_MAIL_HOST set to $IMAPHOST"
|
bashio::log.info "IMPORT_MAIL_HOST set to $IMAPHOST"
|
||||||
|
|
||||||
if [ "$IMAPUSERNAME" != "null" ]; then
|
if [ "$IMAPUSERNAME" != "null" ]; then
|
||||||
printf "\nIMPORT_MAIL_USER = \"%s\"" "$IMAPUSERNAME" >> /data/config/papermerge.conf.py
|
printf "\nIMPORT_MAIL_USER = \"%s\"" "$IMAPUSERNAME" >>/data/config/papermerge.conf.py
|
||||||
bashio::log.info "IMPORT_MAIL_USER set to $IMAPUSERNAME"
|
bashio::log.info "IMPORT_MAIL_USER set to $IMAPUSERNAME"
|
||||||
else
|
else
|
||||||
bashio::log.info "! IMAPHOST has been set, but no IMAPUSERNAME. Please check your configuration!"
|
bashio::log.info "! IMAPHOST has been set, but no IMAPUSERNAME. Please check your configuration!"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$IMAPPASSWORD" != "null" ]; then
|
if [ "$IMAPPASSWORD" != "null" ]; then
|
||||||
printf "\nIMPORT_MAIL_PASS = \"%s\"" "$IMAPPASSWORD" >> /data/config/papermerge.conf.py
|
printf "\nIMPORT_MAIL_PASS = \"%s\"" "$IMAPPASSWORD" >>/data/config/papermerge.conf.py
|
||||||
IMAPPASSWORDMASKED=$(echo "$IMAPPASSWORD" | sed -r 's/./x/g')
|
IMAPPASSWORDMASKED=$(echo "$IMAPPASSWORD" | sed -r 's/./x/g')
|
||||||
bashio::log.info "IMPORT_MAIL_PASS set to $IMAPPASSWORDMASKED"
|
bashio::log.info "IMPORT_MAIL_PASS set to $IMAPPASSWORDMASKED"
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ if bashio::config.true 'ssl'; then
|
|||||||
[ ! -f /ssl/"$certfile" ] && bashio::log.fatal "... use_own_certs is true but certificate /ssl/$certfile not found" && bashio::exit.nok
|
[ ! -f /ssl/"$certfile" ] && bashio::log.fatal "... use_own_certs is true but certificate /ssl/$certfile not found" && bashio::exit.nok
|
||||||
[ ! -f /ssl/"$keyfile" ] && bashio::log.fatal "... use_own_certs is true but certificate /ssl/$keyfile not found" && bashio::exit.nok
|
[ ! -f /ssl/"$keyfile" ] && bashio::log.fatal "... use_own_certs is true but certificate /ssl/$keyfile not found" && bashio::exit.nok
|
||||||
|
|
||||||
|
|
||||||
sed -i "s|default_server|ssl|g" /etc/nginx/servers/ssl.conf
|
sed -i "s|default_server|ssl|g" /etc/nginx/servers/ssl.conf
|
||||||
sed -i "/proxy_params.conf/a ssl_certificate /ssl/$certfile;" /etc/nginx/servers/ssl.conf
|
sed -i "/proxy_params.conf/a ssl_certificate /ssl/$certfile;" /etc/nginx/servers/ssl.conf
|
||||||
sed -i "/proxy_params.conf/a ssl_certificate_key /ssl/$keyfile;" /etc/nginx/servers/ssl.conf
|
sed -i "/proxy_params.conf/a ssl_certificate_key /ssl/$keyfile;" /etc/nginx/servers/ssl.conf
|
||||||
|
|||||||
@@ -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 \
|
||||||
@@ -34,15 +34,15 @@ case $(bashio::config 'DB_TYPE') in
|
|||||||
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"
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -51,7 +51,7 @@ case $(bashio::config 'DB_TYPE') in
|
|||||||
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
|
||||||
@@ -138,7 +138,8 @@ bashio::log.info "Please wait 1 or 2 minutes to allow the server to load"
|
|||||||
bashio::log.info 'Default username : admin, default password: "please_change_password"'
|
bashio::log.info 'Default username : admin, default password: "please_change_password"'
|
||||||
|
|
||||||
# shellcheck disable=SC1091
|
# shellcheck disable=SC1091
|
||||||
. /scripts/entrypoint.sh photoprism start & bashio::log.info "Starting, please wait for next green text..."
|
. /scripts/entrypoint.sh photoprism start &
|
||||||
|
bashio::log.info "Starting, please wait for next green text..."
|
||||||
|
|
||||||
bashio::net.wait_for 2341 localhost 900
|
bashio::net.wait_for 2341 localhost 900
|
||||||
bashio::log.info "App launched"
|
bashio::log.info "App launched"
|
||||||
|
|||||||
@@ -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')
|
||||||
|
|||||||
@@ -28,6 +28,6 @@ bashio::var.json \
|
|||||||
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
|
||||||
|
|||||||
@@ -94,8 +94,8 @@ drop_vectors_everywhere() {
|
|||||||
\"SELECT datname FROM pg_database WHERE datistemplate = false AND datallowconn\""); do
|
\"SELECT datname FROM pg_database WHERE datistemplate = false AND datallowconn\""); do
|
||||||
if su - postgres -c \
|
if su - postgres -c \
|
||||||
"$BINARIES_DIR/$old_pgver/bin/psql -d $db -Atc \
|
"$BINARIES_DIR/$old_pgver/bin/psql -d $db -Atc \
|
||||||
\"SELECT 1 FROM pg_extension WHERE extname='vectors'\"" \
|
\"SELECT 1 FROM pg_extension WHERE extname='vectors'\"" |
|
||||||
| grep -q 1; then
|
grep -q 1; then
|
||||||
bashio::log.warning "Dropping extension vectors from DB $db"
|
bashio::log.warning "Dropping extension vectors from DB $db"
|
||||||
su - postgres -c \
|
su - postgres -c \
|
||||||
"$BINARIES_DIR/$old_pgver/bin/psql -d $db -c \
|
"$BINARIES_DIR/$old_pgver/bin/psql -d $db -c \
|
||||||
@@ -109,17 +109,19 @@ start_postgres() {
|
|||||||
bashio::log.info "Starting PostgreSQL..."
|
bashio::log.info "Starting PostgreSQL..."
|
||||||
if [ "$(bashio::info.arch)" = "armv7" ]; then
|
if [ "$(bashio::info.arch)" = "armv7" ]; then
|
||||||
bashio::log.warning "ARMv7 detected: Starting without vectors.so"
|
bashio::log.warning "ARMv7 detected: Starting without vectors.so"
|
||||||
/usr/local/bin/immich-docker-entrypoint.sh postgres & true
|
/usr/local/bin/immich-docker-entrypoint.sh postgres &
|
||||||
|
true
|
||||||
exit 0
|
exit 0
|
||||||
else
|
else
|
||||||
/usr/local/bin/immich-docker-entrypoint.sh postgres -c config_file=/etc/postgresql/postgresql.conf & true
|
/usr/local/bin/immich-docker-entrypoint.sh postgres -c config_file=/etc/postgresql/postgresql.conf &
|
||||||
|
true
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
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))
|
||||||
if [ "$tries" -ge 60 ]; then
|
if [ "$tries" -ge 60 ]; then
|
||||||
bashio::log.error "Postgres did not start after 2 minutes, aborting."
|
bashio::log.error "Postgres did not start after 2 minutes, aborting."
|
||||||
exit 1
|
exit 1
|
||||||
@@ -216,7 +218,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
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ if [ -f /homeassistant/addons_config/qBittorrent/qBittorrent.conf ] && [ ! -f /h
|
|||||||
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
|
||||||
@@ -33,7 +33,7 @@ fi
|
|||||||
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
|
||||||
|
|
||||||
|
|||||||
@@ -55,7 +55,6 @@ if bashio::config.has_value 'SavePath'; then
|
|||||||
-e "/\[BitTorrent\]/a Downloads\\\DefaultSavePath=$DOWNLOADS" \
|
-e "/\[BitTorrent\]/a Downloads\\\DefaultSavePath=$DOWNLOADS" \
|
||||||
-e "/\[BitTorrent\]/a Session\\\DefaultSavePath=$DOWNLOADS" qBittorrent.conf
|
-e "/\[BitTorrent\]/a Session\\\DefaultSavePath=$DOWNLOADS" qBittorrent.conf
|
||||||
|
|
||||||
|
|
||||||
# Info
|
# Info
|
||||||
bashio::log.info "Downloads can be found in $DOWNLOADS"
|
bashio::log.info "Downloads can be found in $DOWNLOADS"
|
||||||
fi
|
fi
|
||||||
@@ -217,7 +216,7 @@ if bashio::config.has_value 'customUI' && [ ! "$CUSTOMUI" = default ] && [ ! "$C
|
|||||||
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; }
|
||||||
|
|
||||||
### Install WebUI
|
### Install WebUI
|
||||||
mkdir -p /webui/"$CUSTOMUI"
|
mkdir -p /webui/"$CUSTOMUI"
|
||||||
|
|||||||
@@ -34,7 +34,8 @@ if bashio::config.true "qbit_manage"; then
|
|||||||
sed -i "/directory:/a\ root_dir: \"$(bashio::config 'SavePath')\"" /config/qbit_manage/qbit_manage.yml
|
sed -i "/directory:/a\ root_dir: \"$(bashio::config 'SavePath')\"" /config/qbit_manage/qbit_manage.yml
|
||||||
|
|
||||||
# Startup delay 30s ; config file specific ; log file specific
|
# Startup delay 30s ; config file specific ; log file specific
|
||||||
python /qbit_manage/qbit_manage.py -sd 30 --config-file "/config/qbit_manage/qbit_manage.yml" --log-file "/config/qbit_manage/qbit_manage.log" & true
|
python /qbit_manage/qbit_manage.py -sd 30 --config-file "/config/qbit_manage/qbit_manage.yml" --log-file "/config/qbit_manage/qbit_manage.log" &
|
||||||
|
true
|
||||||
bashio::log.info "qbit_manage started with config in /addon_configs/$HOSTNAME/qbit_manage/qbit_manage.yaml accessible with the Filebrowser addon"
|
bashio::log.info "qbit_manage started with config in /addon_configs/$HOSTNAME/qbit_manage/qbit_manage.yaml accessible with the Filebrowser addon"
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -15,10 +15,10 @@ 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() {
|
||||||
|
|
||||||
# Get variable
|
# Get variable
|
||||||
file="$1"
|
file="$1"
|
||||||
@@ -34,7 +34,7 @@ if bashio::config.true 'openvpn_enabled'; then
|
|||||||
line_number=0
|
line_number=0
|
||||||
while read -r line; do
|
while read -r line; do
|
||||||
# Increment the line number
|
# Increment the line number
|
||||||
((line_number=line_number+1))
|
((line_number = line_number + 1))
|
||||||
|
|
||||||
# Check if lines starting with auth-user-pass have a valid argument
|
# Check if lines starting with auth-user-pass have a valid argument
|
||||||
###################################################################
|
###################################################################
|
||||||
@@ -46,7 +46,7 @@ if bashio::config.true 'openvpn_enabled'; then
|
|||||||
# Insert to explain why a comment is made
|
# Insert to explain why a comment is made
|
||||||
sed -i "${line_number}i # The following line is commented out as does not contain a valid argument" "$file"
|
sed -i "${line_number}i # The following line is commented out as does not contain a valid argument" "$file"
|
||||||
# Increment as new line added
|
# Increment as new line added
|
||||||
((line_number=line_number+1))
|
((line_number = line_number + 1))
|
||||||
# Comment out the line
|
# Comment out the line
|
||||||
sed -i "${line_number}s/^/# /" "$file"
|
sed -i "${line_number}s/^/# /" "$file"
|
||||||
# Go to next line
|
# Go to next line
|
||||||
@@ -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,10 +119,10 @@ 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)
|
||||||
# Choose random config
|
# Choose random config
|
||||||
VPN_CONFIG="${VPN_CONFIGS[$RANDOM % ${#VPN_CONFIGS[@]}]}"
|
VPN_CONFIG="${VPN_CONFIGS[$RANDOM % ${#VPN_CONFIGS[@]}]}"
|
||||||
# Get the VPN_CONFIG name without the path and extension
|
# Get the VPN_CONFIG name without the path and extension
|
||||||
@@ -155,7 +155,7 @@ if bashio::config.true 'openvpn_enabled'; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Add credentials file
|
# Add credentials file
|
||||||
if grep -q ^auth-user-pass /config/openvpn/"$openvpn_config" ; then
|
if grep -q ^auth-user-pass /config/openvpn/"$openvpn_config"; then
|
||||||
# Credentials specified are they custom ?
|
# Credentials specified are they custom ?
|
||||||
file_name="$(sed -n "/^auth-user-pass/p" /config/openvpn/"$openvpn_config" | awk -F' ' '{print $2}')"
|
file_name="$(sed -n "/^auth-user-pass/p" /config/openvpn/"$openvpn_config" | awk -F' ' '{print $2}')"
|
||||||
file_name="${file_name:-null}"
|
file_name="${file_name:-null}"
|
||||||
@@ -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
|
||||||
|
|||||||
@@ -5,28 +5,28 @@
|
|||||||
# Contributed by Roy Marples (uberlord@gentoo.org)
|
# Contributed by Roy Marples (uberlord@gentoo.org)
|
||||||
|
|
||||||
# If we have a service specific script, run this now
|
# If we have a service specific script, run this now
|
||||||
if [ -x /etc/openvpn/"${RC_SVCNAME}"-down.sh ] ; then
|
if [ -x /etc/openvpn/"${RC_SVCNAME}"-down.sh ]; then
|
||||||
/etc/openvpn/"${RC_SVCNAME}"-down.sh "$@"
|
/etc/openvpn/"${RC_SVCNAME}"-down.sh "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Restore resolv.conf to how it was
|
# Restore resolv.conf to how it was
|
||||||
if [ "${PEER_DNS}" != "no" ]; then
|
if [ "${PEER_DNS}" != "no" ]; then
|
||||||
if [ -x /sbin/resolvconf ] ; then
|
if [ -x /sbin/resolvconf ]; then
|
||||||
/sbin/resolvconf -d "${dev}"
|
/sbin/resolvconf -d "${dev}"
|
||||||
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
|
||||||
|
|
||||||
if [ -n "${RC_SVCNAME}" ]; then
|
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
|
||||||
|
|||||||
@@ -29,37 +29,37 @@ if [ "${PEER_DNS}" != "no" ]; then
|
|||||||
DOMAIN=
|
DOMAIN=
|
||||||
SEARCH=
|
SEARCH=
|
||||||
i=1
|
i=1
|
||||||
while true ; do
|
while true; do
|
||||||
eval opt=\$foreign_option_${i}
|
eval opt=\$foreign_option_${i}
|
||||||
[ -z "${opt}" ] && break
|
[ -z "${opt}" ] && break
|
||||||
if [ "${opt}" != "${opt#dhcp-option DOMAIN *}" ] ; then
|
if [ "${opt}" != "${opt#dhcp-option DOMAIN *}" ]; then
|
||||||
if [ -z "${DOMAIN}" ] ; then
|
if [ -z "${DOMAIN}" ]; then
|
||||||
DOMAIN="${opt#dhcp-option DOMAIN *}"
|
DOMAIN="${opt#dhcp-option DOMAIN *}"
|
||||||
else
|
else
|
||||||
SEARCH="${SEARCH}${SEARCH:+ }${opt#dhcp-option DOMAIN *}"
|
SEARCH="${SEARCH}${SEARCH:+ }${opt#dhcp-option DOMAIN *}"
|
||||||
fi
|
fi
|
||||||
elif [ "${opt}" != "${opt#dhcp-option DNS *}" ] ; then
|
elif [ "${opt}" != "${opt#dhcp-option DNS *}" ]; then
|
||||||
NS="${NS}nameserver ${opt#dhcp-option DNS *}\n"
|
NS="${NS}nameserver ${opt#dhcp-option DNS *}\n"
|
||||||
fi
|
fi
|
||||||
i=$((${i} + 1))
|
i=$((${i} + 1))
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ -n "${NS}" ] ; then
|
if [ -n "${NS}" ]; then
|
||||||
DNS="# Generated by openvpn for interface ${dev}\n"
|
DNS="# Generated by openvpn for interface ${dev}\n"
|
||||||
if [ -n "${SEARCH}" ] ; then
|
if [ -n "${SEARCH}" ]; then
|
||||||
DNS="${DNS}search ${DOMAIN} ${SEARCH}\n"
|
DNS="${DNS}search ${DOMAIN} ${SEARCH}\n"
|
||||||
elif [ -n "${DOMAIN}" ]; then
|
elif [ -n "${DOMAIN}" ]; then
|
||||||
DNS="${DNS}domain ${DOMAIN}\n"
|
DNS="${DNS}domain ${DOMAIN}\n"
|
||||||
fi
|
fi
|
||||||
DNS="${DNS}${NS}"
|
DNS="${DNS}${NS}"
|
||||||
if [ -x /sbin/resolvconf ] ; then
|
if [ -x /sbin/resolvconf ]; then
|
||||||
printf "${DNS}" | /sbin/resolvconf -a "${dev}"
|
printf "${DNS}" | /sbin/resolvconf -a "${dev}"
|
||||||
else
|
else
|
||||||
# Preserve the existing resolv.conf
|
# Preserve the existing resolv.conf
|
||||||
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
|
||||||
@@ -71,15 +71,15 @@ fi
|
|||||||
|
|
||||||
if [ -n "${RC_SVCNAME}" ]; then
|
if [ -n "${RC_SVCNAME}" ]; then
|
||||||
# If we have a service specific script, run this now
|
# If we have a service specific script, run this now
|
||||||
if [ -x /etc/openvpn/"${RC_SVCNAME}"-up.sh ] ; then
|
if [ -x /etc/openvpn/"${RC_SVCNAME}"-up.sh ]; then
|
||||||
/etc/openvpn/"${RC_SVCNAME}"-up.sh "$@"
|
/etc/openvpn/"${RC_SVCNAME}"-up.sh "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# 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
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ PGID=$(bashio::config "PGID")
|
|||||||
# Create function #
|
# Create function #
|
||||||
###################
|
###################
|
||||||
|
|
||||||
change_folders () {
|
change_folders() {
|
||||||
CONFIGLOCATION=$1
|
CONFIGLOCATION=$1
|
||||||
ORIGINALLOCATION=$2
|
ORIGINALLOCATION=$2
|
||||||
TYPE=$3
|
TYPE=$3
|
||||||
|
|||||||
@@ -45,23 +45,23 @@ FREQUENCY="$(bashio::config 'Updates')"
|
|||||||
bashio::log.info "$FREQUENCY updates as defined in the 'Updates' option"
|
bashio::log.info "$FREQUENCY updates as defined in the 'Updates' option"
|
||||||
|
|
||||||
case "$FREQUENCY" in
|
case "$FREQUENCY" in
|
||||||
"Quarterly")
|
"Quarterly")
|
||||||
sed -i "/customize the cron schedule/a export COLLECTOR_CRON_SCHEDULE=\"*/15 * * * *\"" /etc/cont-init.d/50-cron-config
|
sed -i "/customize the cron schedule/a export COLLECTOR_CRON_SCHEDULE=\"*/15 * * * *\"" /etc/cont-init.d/50-cron-config
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"Hourly")
|
"Hourly")
|
||||||
sed -i "/customize the cron schedule/a export COLLECTOR_CRON_SCHEDULE=\"0 * * * *\"" /etc/cont-init.d/50-cron-config
|
sed -i "/customize the cron schedule/a export COLLECTOR_CRON_SCHEDULE=\"0 * * * *\"" /etc/cont-init.d/50-cron-config
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"Daily")
|
"Daily")
|
||||||
sed -i "/customize the cron schedule/a export COLLECTOR_CRON_SCHEDULE=\"0 0 * * *\"" /etc/cont-init.d/50-cron-config
|
sed -i "/customize the cron schedule/a export COLLECTOR_CRON_SCHEDULE=\"0 0 * * *\"" /etc/cont-init.d/50-cron-config
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"Weekly")
|
"Weekly")
|
||||||
sed -i "/customize the cron schedule/a export COLLECTOR_CRON_SCHEDULE=\"0 0 * * 0\"" /etc/cont-init.d/50-cron-config
|
sed -i "/customize the cron schedule/a export COLLECTOR_CRON_SCHEDULE=\"0 0 * * 0\"" /etc/cont-init.d/50-cron-config
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"Custom")
|
"Custom")
|
||||||
interval="$(bashio::config 'Updates_custom_time')"
|
interval="$(bashio::config 'Updates_custom_time')"
|
||||||
bashio::log.info "... frequency is defined manually as $interval"
|
bashio::log.info "... frequency is defined manually as $interval"
|
||||||
|
|
||||||
|
|||||||
@@ -9,11 +9,11 @@ set -e
|
|||||||
if bashio::config.true "expose_collector"; then
|
if bashio::config.true "expose_collector"; then
|
||||||
bashio::log.info "collector.yaml exposed in /share/scrutiny"
|
bashio::log.info "collector.yaml exposed in /share/scrutiny"
|
||||||
mkdir -p /share/scrutiny
|
mkdir -p /share/scrutiny
|
||||||
if [ -f /data/config/collector.yaml ] ; then
|
if [ -f /data/config/collector.yaml ]; then
|
||||||
cp -rnf /data/config/collector.yaml /share/scrutiny || true
|
cp -rnf /data/config/collector.yaml /share/scrutiny || true
|
||||||
rm -R /data/config/collector.yaml
|
rm -R /data/config/collector.yaml
|
||||||
fi
|
fi
|
||||||
if [ -f /opt/scrutiny/config/collector.yaml ] ; then
|
if [ -f /opt/scrutiny/config/collector.yaml ]; then
|
||||||
cp -rnf /opt/scrutiny/config/collector.yaml /share/scrutiny || true
|
cp -rnf /opt/scrutiny/config/collector.yaml /share/scrutiny || true
|
||||||
rm /opt/scrutiny/config/collector.yaml
|
rm /opt/scrutiny/config/collector.yaml
|
||||||
fi
|
fi
|
||||||
@@ -39,10 +39,10 @@ if [[ "$(bashio::config "Mode")" == Collector ]]; then
|
|||||||
|
|
||||||
# Check collector
|
# Check collector
|
||||||
if bashio::config.has_value "COLLECTOR_API_ENDPOINT"; then
|
if bashio::config.has_value "COLLECTOR_API_ENDPOINT"; then
|
||||||
echo "export COLLECTOR_API_ENDPOINT=$(bashio::config "COLLECTOR_API_ENDPOINT")" >> /env.sh
|
echo "export COLLECTOR_API_ENDPOINT=$(bashio::config "COLLECTOR_API_ENDPOINT")" >>/env.sh
|
||||||
sed -i "1a export COLLECTOR_API_ENDPOINT=$(bashio::config "COLLECTOR_API_ENDPOINT")" /etc/services.d/collector-once/run
|
sed -i "1a export COLLECTOR_API_ENDPOINT=$(bashio::config "COLLECTOR_API_ENDPOINT")" /etc/services.d/collector-once/run
|
||||||
if [ -d /var/run/s6/container_environment ]; then printf "%s" "$COLLECTOR_API_ENDPOINT" > /var/run/s6/container_environment/COLLECTOR_API_ENDPOINT; fi
|
if [ -d /var/run/s6/container_environment ]; then printf "%s" "$COLLECTOR_API_ENDPOINT" >/var/run/s6/container_environment/COLLECTOR_API_ENDPOINT; fi
|
||||||
printf "%s\n" "IN_BACKGROUND=\"$COLLECTOR_API_ENDPOINT\"" >> ~/.bashrc
|
printf "%s\n" "IN_BACKGROUND=\"$COLLECTOR_API_ENDPOINT\"" >>~/.bashrc
|
||||||
bashio::log.info "Using 'COLLECTOR_API_ENDPOINT' $(bashio::config "COLLECTOR_API_ENDPOINT")"
|
bashio::log.info "Using 'COLLECTOR_API_ENDPOINT' $(bashio::config "COLLECTOR_API_ENDPOINT")"
|
||||||
else
|
else
|
||||||
bashio::exit.nok "Mode is set to 'Collector', but 'COLLECTOR_API_ENDPOINT' is not defined"
|
bashio::exit.nok "Mode is set to 'Collector', but 'COLLECTOR_API_ENDPOINT' is not defined"
|
||||||
|
|||||||
@@ -73,13 +73,13 @@ bashio::log.info "Defining database"
|
|||||||
|
|
||||||
case $(bashio::config 'database') in
|
case $(bashio::config 'database') in
|
||||||
|
|
||||||
# Use sqlite
|
# Use sqlite
|
||||||
sqlite)
|
sqlite)
|
||||||
export "SQLITE=1" && sed -i "1a export SQLITE=1" /home/seafile/*.sh
|
export "SQLITE=1" && sed -i "1a export SQLITE=1" /home/seafile/*.sh
|
||||||
;;
|
;;
|
||||||
|
|
||||||
# Use mariadb
|
# Use mariadb
|
||||||
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 \
|
||||||
|
|||||||
@@ -34,8 +34,8 @@ bashio::log.info "Defining database"
|
|||||||
export DB_TYPE=$(bashio::config 'DB_TYPE')
|
export DB_TYPE=$(bashio::config 'DB_TYPE')
|
||||||
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"
|
||||||
export DB_ENGINE="django.db.backends.sqlite3"
|
export DB_ENGINE="django.db.backends.sqlite3"
|
||||||
export POSTGRES_DB="/config/addons_config/tandoor_recipes/recipes.db"
|
export POSTGRES_DB="/config/addons_config/tandoor_recipes/recipes.db"
|
||||||
@@ -85,7 +85,7 @@ case $(bashio::config 'DB_TYPE') in
|
|||||||
# ;;
|
# ;;
|
||||||
|
|
||||||
# use postgresql
|
# use postgresql
|
||||||
postgresql_external)
|
postgresql_external)
|
||||||
bashio::log.info "Using an external database, please populate all required fields in the addons config"
|
bashio::log.info "Using an external database, please populate all required fields in the addons config"
|
||||||
export DB_ENGINE=django.db.backends.postgresql
|
export DB_ENGINE=django.db.backends.postgresql
|
||||||
export POSTGRES_HOST=$(bashio::config "POSTGRES_HOST") && bashio::log.blue "POSTGRES_HOST=$POSTGRES_HOST"
|
export POSTGRES_HOST=$(bashio::config "POSTGRES_HOST") && bashio::log.blue "POSTGRES_HOST=$POSTGRES_HOST"
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ if bashio::config.has_value 'watch_dir'; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echo "${CONFIG}" >"$CONFIGDIR"/settings.json &&
|
echo "${CONFIG}" >"$CONFIGDIR"/settings.json &&
|
||||||
jq . -S "$CONFIGDIR"/settings.json | cat >temp.json && mv temp.json $CONFIGDIR/settings.json
|
jq . -S "$CONFIGDIR"/settings.json | cat >temp.json && mv temp.json $CONFIGDIR/settings.json
|
||||||
|
|
||||||
# USER and PASS
|
# USER and PASS
|
||||||
###############
|
###############
|
||||||
@@ -105,7 +105,7 @@ CONFIG=$(bashio::jq "${CONFIG}" ".\"rpc-authentication-required\"=${BOOLEAN}")
|
|||||||
CONFIG=$(bashio::jq "${CONFIG}" ".\"rpc-username\"=\"${USER}\"")
|
CONFIG=$(bashio::jq "${CONFIG}" ".\"rpc-username\"=\"${USER}\"")
|
||||||
CONFIG=$(bashio::jq "${CONFIG}" ".\"rpc-password\"=\"${PASS}\"")
|
CONFIG=$(bashio::jq "${CONFIG}" ".\"rpc-password\"=\"${PASS}\"")
|
||||||
echo "${CONFIG}" >"$CONFIGDIR"/settings.json &&
|
echo "${CONFIG}" >"$CONFIGDIR"/settings.json &&
|
||||||
jq . -S "$CONFIGDIR"/settings.json | cat >temp.json && mv temp.json "$CONFIGDIR"/settings.json
|
jq . -S "$CONFIGDIR"/settings.json | cat >temp.json && mv temp.json "$CONFIGDIR"/settings.json
|
||||||
|
|
||||||
# WHITELIST
|
# WHITELIST
|
||||||
###########
|
###########
|
||||||
@@ -122,4 +122,4 @@ fi
|
|||||||
CONFIG=$(bashio::jq "${CONFIG}" ".\"rpc-whitelist-enabled\"=${BOOLEAN}")
|
CONFIG=$(bashio::jq "${CONFIG}" ".\"rpc-whitelist-enabled\"=${BOOLEAN}")
|
||||||
CONFIG=$(bashio::jq "${CONFIG}" ".\"rpc-whitelist\"=\"$WHITELIST\"")
|
CONFIG=$(bashio::jq "${CONFIG}" ".\"rpc-whitelist\"=\"$WHITELIST\"")
|
||||||
echo "${CONFIG}" >"$CONFIGDIR"/settings.json &&
|
echo "${CONFIG}" >"$CONFIGDIR"/settings.json &&
|
||||||
jq . -S "$CONFIGDIR"/settings.json | cat >temp.json && mv temp.json "$CONFIGDIR"/settings.json
|
jq . -S "$CONFIGDIR"/settings.json | cat >temp.json && mv temp.json "$CONFIGDIR"/settings.json
|
||||||
|
|||||||
@@ -27,14 +27,14 @@ if bashio::config.has_value 'customUI' && [ ! "$CUSTOMUI" = default ] && [ ! "$C
|
|||||||
"transmission-web-control")
|
"transmission-web-control")
|
||||||
### Install WebUI
|
### Install WebUI
|
||||||
mkdir -p /transmission-web-control
|
mkdir -p /transmission-web-control
|
||||||
curl -sL "$(curl -s https://api.github.com/repos/ronggang/transmission-web-control/releases/latest | jq --raw-output '.tarball_url')" | tar -C /transmission-web-control/ --strip-components=2 -xz \
|
curl -sL "$(curl -s https://api.github.com/repos/ronggang/transmission-web-control/releases/latest | jq --raw-output '.tarball_url')" | tar -C /transmission-web-control/ --strip-components=2 -xz
|
||||||
# Enables the original UI button in transmission-web-control
|
# Enables the original UI button in transmission-web-control
|
||||||
ln -s /usr/share/transmission/public_html/* /transmission-web-control/ 2>/dev/null || true
|
ln -s /usr/share/transmission/public_html/* /transmission-web-control/ 2>/dev/null || true
|
||||||
ln -s /usr/share/transmission/public_html/index.html /transmission-web-control/index.original.html
|
ln -s /usr/share/transmission/public_html/index.html /transmission-web-control/index.original.html
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"kettu")
|
"kettu")
|
||||||
mkdir -p /kettu && \
|
mkdir -p /kettu &&
|
||||||
curl -o /tmp/kettu.tar.gz -L "https://github.com/endor/kettu/archive/master.tar.gz"
|
curl -o /tmp/kettu.tar.gz -L "https://github.com/endor/kettu/archive/master.tar.gz"
|
||||||
tar xf /tmp/kettu.tar.gz -C /kettu --strip-components=1
|
tar xf /tmp/kettu.tar.gz -C /kettu --strip-components=1
|
||||||
;;
|
;;
|
||||||
@@ -46,17 +46,17 @@ if bashio::config.has_value 'customUI' && [ ! "$CUSTOMUI" = default ] && [ ! "$C
|
|||||||
|
|
||||||
"transmissionic")
|
"transmissionic")
|
||||||
TRANSMISSIONIC_VERSION=$(curl -s -L "https://api.github.com/repos/6c65726f79/Transmissionic/releases/latest" | jq -r .tag_name)
|
TRANSMISSIONIC_VERSION=$(curl -s -L "https://api.github.com/repos/6c65726f79/Transmissionic/releases/latest" | jq -r .tag_name)
|
||||||
echo "**** grab transmissionic ****" && \
|
echo "**** grab transmissionic ****" &&
|
||||||
if [ -z "${TRANSMISSIONIC_VERSION+x}" ]; then \
|
if [ -z "${TRANSMISSIONIC_VERSION+x}" ]; then
|
||||||
TRANSMISSIONIC_VERSION="$(curl -s "https://api.github.com/repos/6c65726f79/Transmissionic/releases/latest" \
|
TRANSMISSIONIC_VERSION="$(curl -s "https://api.github.com/repos/6c65726f79/Transmissionic/releases/latest" |
|
||||||
| jq -rc ".tag_name")"; \
|
jq -rc ".tag_name")"
|
||||||
fi && \
|
fi &&
|
||||||
curl -o \
|
curl -o \
|
||||||
/tmp/transmissionic.zip -L \
|
/tmp/transmissionic.zip -L \
|
||||||
"https://github.com/6c65726f79/Transmissionic/releases/download/${TRANSMISSIONIC_VERSION}/Transmissionic-webui-${TRANSMISSIONIC_VERSION}.zip" && \
|
"https://github.com/6c65726f79/Transmissionic/releases/download/${TRANSMISSIONIC_VERSION}/Transmissionic-webui-${TRANSMISSIONIC_VERSION}.zip" &&
|
||||||
unzip \
|
unzip \
|
||||||
/tmp/transmissionic.zip -d \
|
/tmp/transmissionic.zip -d \
|
||||||
/themes && \
|
/themes &&
|
||||||
mv /themes/web /transmissionic
|
mv /themes/web /transmissionic
|
||||||
;;
|
;;
|
||||||
|
|
||||||
@@ -70,7 +70,7 @@ if bashio::config.has_value 'customUI' && [ ! "$CUSTOMUI" = default ] && [ ! "$C
|
|||||||
CUSTOMUI="/${CUSTOMUI}"
|
CUSTOMUI="/${CUSTOMUI}"
|
||||||
chown -R abc:abc "$CUSTOMUI"
|
chown -R abc:abc "$CUSTOMUI"
|
||||||
if cat /etc/services.d/*/*run* &>/dev/null; then sed -i "1a export TRANSMISSION_WEB_HOME=$CUSTOMUI" /etc/services.d/*/*run* 2>/dev/null; fi
|
if cat /etc/services.d/*/*run* &>/dev/null; then sed -i "1a export TRANSMISSION_WEB_HOME=$CUSTOMUI" /etc/services.d/*/*run* 2>/dev/null; fi
|
||||||
if [ -d /var/run/s6/container_environment ]; then printf "%s" "$CUSTOMUI" > /var/run/s6/container_environment/TRANSMISSION_WEB_HOME; fi
|
if [ -d /var/run/s6/container_environment ]; then printf "%s" "$CUSTOMUI" >/var/run/s6/container_environment/TRANSMISSION_WEB_HOME; fi
|
||||||
printf "%s\n" "TRANSMISSION_WEB_HOME=\"$CUSTOMUI\"" >> ~/.bashrc
|
printf "%s\n" "TRANSMISSION_WEB_HOME=\"$CUSTOMUI\"" >>~/.bashrc
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ if bashio::config.true 'OPENVPN_CUSTOM_PROVIDER'; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Function to check for files path
|
# Function to check for files path
|
||||||
function check_path () {
|
function check_path() {
|
||||||
|
|
||||||
# Get variable
|
# Get variable
|
||||||
file="$1"
|
file="$1"
|
||||||
@@ -86,8 +86,7 @@ function check_path () {
|
|||||||
cp "$file" /tmpfile
|
cp "$file" /tmpfile
|
||||||
|
|
||||||
# Loop through each line of the input file
|
# Loop through each line of the input file
|
||||||
while read -r line
|
while read -r line; do
|
||||||
do
|
|
||||||
# Check if the line contains a txt file
|
# Check if the line contains a txt file
|
||||||
if [[ "$line" =~ \.txt ]] || [[ "$line" =~ \.crt ]]; then
|
if [[ "$line" =~ \.txt ]] || [[ "$line" =~ \.crt ]]; then
|
||||||
# Extract the txt file name from the line
|
# Extract the txt file name from the line
|
||||||
@@ -107,7 +106,7 @@ function check_path () {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done < /tmpfile
|
done </tmpfile
|
||||||
|
|
||||||
rm /tmpfile
|
rm /tmpfile
|
||||||
|
|
||||||
@@ -171,7 +170,10 @@ ip route add 172.30.0.0/16 via 172.30.32.1
|
|||||||
if bashio::config.true 'auto_restart'; then
|
if bashio::config.true 'auto_restart'; then
|
||||||
|
|
||||||
bashio::log.info "Auto restarting addon if openvpn down"
|
bashio::log.info "Auto restarting addon if openvpn down"
|
||||||
(set -o posix; export -p) > /env.sh
|
(
|
||||||
|
set -o posix
|
||||||
|
export -p
|
||||||
|
) >/env.sh
|
||||||
chmod 777 /env.sh
|
chmod 777 /env.sh
|
||||||
chmod +x /usr/bin/restart_addon
|
chmod +x /usr/bin/restart_addon
|
||||||
sed -i "1a . /env.sh; /usr/bin/restart_addon >/proc/1/fd/1 2>/proc/1/fd/2" /etc/openvpn/tunnelDown.sh
|
sed -i "1a . /env.sh; /usr/bin/restart_addon >/proc/1/fd/1 2>/proc/1/fd/2" /etc/openvpn/tunnelDown.sh
|
||||||
@@ -201,7 +203,8 @@ if [ "$(bashio::config "OPENVPN_PROVIDER")" == "mullvad" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
bashio::log.info "Starting app"
|
bashio::log.info "Starting app"
|
||||||
/./etc/openvpn/start.sh & echo ""
|
/./etc/openvpn/start.sh &
|
||||||
|
echo ""
|
||||||
|
|
||||||
#################
|
#################
|
||||||
# Allow ingress #
|
# Allow ingress #
|
||||||
|
|||||||
@@ -20,6 +20,6 @@ if [ ! -d /config/addons_config/$slug ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Remove empty config file
|
# Remove empty config file
|
||||||
if [ ! -s /config/addons_config/$slug/preferences.json ] ; then
|
if [ ! -s /config/addons_config/$slug/preferences.json ]; then
|
||||||
rm /config/addons_config/$slug/preferences.json || true
|
rm /config/addons_config/$slug/preferences.json || true
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -4,22 +4,22 @@ set +e
|
|||||||
|
|
||||||
VPN_PROVIDER="${VPN_PROVIDER:-null}"
|
VPN_PROVIDER="${VPN_PROVIDER:-null}"
|
||||||
case "$VPN_PROVIDER" in
|
case "$VPN_PROVIDER" in
|
||||||
"generic")
|
"generic")
|
||||||
sed -i "1a sleep infinity" etc/s6*/s6*/service-pia/run
|
sed -i "1a sleep infinity" etc/s6*/s6*/service-pia/run
|
||||||
sed -i "1a sleep infinity" etc/s6*/s6*/service-proton/run
|
sed -i "1a sleep infinity" etc/s6*/s6*/service-proton/run
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"pia")
|
"pia")
|
||||||
sed -i "1a sleep infinity" /etc/s6*/s6*/service-privoxy/run
|
sed -i "1a sleep infinity" /etc/s6*/s6*/service-privoxy/run
|
||||||
sed -i "1a sleep infinity" /etc/s6*/s6*/service-proton/run
|
sed -i "1a sleep infinity" /etc/s6*/s6*/service-proton/run
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"proton")
|
"proton")
|
||||||
sed -i "1a sleep infinity" /etc/s6*/s6*/service-privoxy/run
|
sed -i "1a sleep infinity" /etc/s6*/s6*/service-privoxy/run
|
||||||
sed -i "1a sleep infinity" /etc/s6*/s6*/service-pia/run
|
sed -i "1a sleep infinity" /etc/s6*/s6*/service-pia/run
|
||||||
;;
|
;;
|
||||||
|
|
||||||
**)
|
**)
|
||||||
sed -i "1a sleep infinity" /etc/s6*/s6*/service-privoxy/run
|
sed -i "1a sleep infinity" /etc/s6*/s6*/service-privoxy/run
|
||||||
sed -i "1a sleep infinity" /etc/s6*/s6*/service-proton/run
|
sed -i "1a sleep infinity" /etc/s6*/s6*/service-proton/run
|
||||||
sed -i "1a sleep infinity" /etc/s6*/s6*/service-pia/run
|
sed -i "1a sleep infinity" /etc/s6*/s6*/service-pia/run
|
||||||
|
|||||||
@@ -57,12 +57,12 @@ sed -i "s|^\(abc:[^:]*:[^:]*:[^:]*:[^:]*:\)[^:]*|\1$LOCATION|" /etc/passwd
|
|||||||
#usermod --home "$LOCATION" abc || true
|
#usermod --home "$LOCATION" abc || true
|
||||||
|
|
||||||
# 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" "export HOME=\"$LOCATION\""
|
printf "%s\n" "export HOME=\"$LOCATION\""
|
||||||
printf "%s\n" "export FM_HOME=\"$LOCATION\""
|
printf "%s\n" "export FM_HOME=\"$LOCATION\""
|
||||||
} >> ~/.bashrc
|
} >>~/.bashrc
|
||||||
|
|
||||||
# Create folder
|
# Create folder
|
||||||
echo "Creating $LOCATION"
|
echo "Creating $LOCATION"
|
||||||
|
|||||||
@@ -32,8 +32,8 @@ fi || (bashio::log.fatal "Error : $TIMEZONE not found. Here is a list of valid t
|
|||||||
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
|
||||||
@@ -55,9 +55,9 @@ if bashio::config.true 'install_ms_edge'; then
|
|||||||
apt-get update
|
apt-get update
|
||||||
echo "**** install edge ****"
|
echo "**** install edge ****"
|
||||||
apt-get install --no-install-recommends -y ca-certificates
|
apt-get install --no-install-recommends -y ca-certificates
|
||||||
if [ -z ${EDGE_VERSION+x} ]; then \
|
if [ -z ${EDGE_VERSION+x} ]; then
|
||||||
EDGE_VERSION=$(curl -sL https://packages.microsoft.com/repos/edge/pool/main/m/microsoft-edge-stable/ | \
|
EDGE_VERSION=$(curl -sL https://packages.microsoft.com/repos/edge/pool/main/m/microsoft-edge-stable/ |
|
||||||
awk -F'(<a href="microsoft-edge-stable_|_amd64.deb\")' '/href=/ {print $2}' | sort --version-sort | tail -1); \
|
awk -F'(<a href="microsoft-edge-stable_|_amd64.deb\")' '/href=/ {print $2}' | sort --version-sort | tail -1)
|
||||||
fi
|
fi
|
||||||
curl -o /tmp/edge.deb -L "https://packages.microsoft.com/repos/edge/pool/main/m/microsoft-edge-stable/microsoft-edge-stable_${EDGE_VERSION}_amd64.deb"
|
curl -o /tmp/edge.deb -L "https://packages.microsoft.com/repos/edge/pool/main/m/microsoft-edge-stable/microsoft-edge-stable_${EDGE_VERSION}_amd64.deb"
|
||||||
dpkg -I /tmp/edge.deb
|
dpkg -I /tmp/edge.deb
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -7,4 +7,4 @@ ${BIN} \
|
|||||||
--password-store=basic \
|
--password-store=basic \
|
||||||
--no-sandbox \
|
--no-sandbox \
|
||||||
--test-type \
|
--test-type \
|
||||||
"$@" > /dev/null 2>&1
|
"$@" >/dev/null 2>&1
|
||||||
|
|||||||
@@ -33,13 +33,13 @@ fi
|
|||||||
if [[ "$DATA_LOCATION_CURRENT" != "$DATA_LOCATION" ]] && [[ "$(ls -A "$DATA_LOCATION_CURRENT")" ]]; then
|
if [[ "$DATA_LOCATION_CURRENT" != "$DATA_LOCATION" ]] && [[ "$(ls -A "$DATA_LOCATION_CURRENT")" ]]; then
|
||||||
bashio::log.warning "Data location was changed from $DATA_LOCATION_CURRENT to $DATA_LOCATION, migrating files"
|
bashio::log.warning "Data location was changed from $DATA_LOCATION_CURRENT to $DATA_LOCATION, migrating files"
|
||||||
cp -rnf "$DATA_LOCATION_CURRENT"/* "$DATA_LOCATION"/ &>/dev/null || true
|
cp -rnf "$DATA_LOCATION_CURRENT"/* "$DATA_LOCATION"/ &>/dev/null || true
|
||||||
echo "Files moved to $DATA_LOCATION" > "$DATA_LOCATION_CURRENT"/migrated
|
echo "Files moved to $DATA_LOCATION" >"$DATA_LOCATION_CURRENT"/migrated
|
||||||
mv "$DATA_LOCATION_CURRENT" "${DATA_LOCATION_CURRENT}_migrated"
|
mv "$DATA_LOCATION_CURRENT" "${DATA_LOCATION_CURRENT}_migrated"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Saving data location
|
# Saving data location
|
||||||
echo "... using data folder $DATA_LOCATION"
|
echo "... using data folder $DATA_LOCATION"
|
||||||
echo -n "$DATA_LOCATION" > "$DATA_LOCATION_FILE"
|
echo -n "$DATA_LOCATION" >"$DATA_LOCATION_FILE"
|
||||||
|
|
||||||
# Update entrypoint
|
# Update entrypoint
|
||||||
# Correct data directory
|
# Correct data directory
|
||||||
|
|||||||
@@ -29,10 +29,14 @@ ln -s /data/media /home/wger
|
|||||||
#####################
|
#####################
|
||||||
# Align permissions #
|
# Align permissions #
|
||||||
#####################
|
#####################
|
||||||
(set -o posix; export -p) > /data/env.sh
|
(
|
||||||
|
set -o posix
|
||||||
|
export -p
|
||||||
|
) >/data/env.sh
|
||||||
chown -R 1000:1000 /data
|
chown -R 1000:1000 /data
|
||||||
chown -R 1000:1000 /home/wger
|
chown -R 1000:1000 /home/wger
|
||||||
chmod -R 777 /data
|
chmod -R 777 /data
|
||||||
|
|
||||||
bashio::log.info "Starting nginx"
|
bashio::log.info "Starting nginx"
|
||||||
nginx || true & true
|
nginx || true &
|
||||||
|
true
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
exec misc/tor/start-tor.sh & ./run & echo "Starting NGinx..."
|
exec misc/tor/start-tor.sh &
|
||||||
|
./run &
|
||||||
|
echo "Starting NGinx..."
|
||||||
|
|
||||||
exec nginx
|
exec nginx
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ fi
|
|||||||
bashio::log.info "Defining database"
|
bashio::log.info "Defining database"
|
||||||
case "$(bashio::config "DB_CONNECTION")" in
|
case "$(bashio::config "DB_CONNECTION")" in
|
||||||
|
|
||||||
# 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 \
|
||||||
@@ -58,7 +58,7 @@ case "$(bashio::config "DB_CONNECTION")" in
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
# Use remote
|
# Use remote
|
||||||
external)
|
external)
|
||||||
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 "ZM_DB_HOST" "ZM_DB_PORT" "ZM_DB_NAME" "ZM_DB_USER" "ZM_DB_PASS"; do
|
for conditions in "ZM_DB_HOST" "ZM_DB_PORT" "ZM_DB_NAME" "ZM_DB_USER" "ZM_DB_PASS"; do
|
||||||
if ! bashio::config.has_value "$conditions"; then
|
if ! bashio::config.has_value "$conditions"; then
|
||||||
@@ -67,9 +67,8 @@ case "$(bashio::config "DB_CONNECTION")" in
|
|||||||
done
|
done
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
|
||||||
# Use remote
|
# Use remote
|
||||||
*)
|
*)
|
||||||
bashio::log.info "Using internal database"
|
bashio::log.info "Using internal database"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
|||||||
@@ -42,8 +42,8 @@ bashio::log.info "Defining database"
|
|||||||
|
|
||||||
case "$(bashio::config 'database')" in
|
case "$(bashio::config 'database')" in
|
||||||
|
|
||||||
# Use mariadb
|
# Use mariadb
|
||||||
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 \
|
||||||
@@ -69,9 +69,8 @@ case "$(bashio::config 'database')" in
|
|||||||
bashio::log.warning "Uninstalling the MariaDB addon will remove any data"
|
bashio::log.warning "Uninstalling the MariaDB addon will remove any data"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
|
||||||
# Use sqlite
|
# Use sqlite
|
||||||
*)
|
*)
|
||||||
bashio::log.info "Using sqlite as database driver"
|
bashio::log.info "Using sqlite as database driver"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
@@ -97,25 +96,27 @@ for variable in PAPERLESS_DATA_DIR PAPERLESS_MEDIA_ROOT PAPERLESS_CONSUMPTION_DI
|
|||||||
# Export
|
# Export
|
||||||
export "$variable"="$variablecontent"
|
export "$variable"="$variablecontent"
|
||||||
# Add to bashrc
|
# Add to bashrc
|
||||||
eval echo "$variable=\"$variablecontent\"" >> ~/.bashrc
|
eval echo "$variable=\"$variablecontent\"" >>~/.bashrc
|
||||||
# set .env
|
# set .env
|
||||||
echo "$variable=\"$variablecontent\"" >> /.env || true
|
echo "$variable=\"$variablecontent\"" >>/.env || true
|
||||||
# set /etc/environment
|
# set /etc/environment
|
||||||
mkdir -p /etc
|
mkdir -p /etc
|
||||||
echo "$variable=\"$variablecontent\"" >> /etc/environment
|
echo "$variable=\"$variablecontent\"" >>/etc/environment
|
||||||
# For s6
|
# For s6
|
||||||
if [ -d /var/run/s6/container_environment ]; then printf "%s" "${variablecontent}" > /var/run/s6/container_environment/"${variable}"; fi
|
if [ -d /var/run/s6/container_environment ]; then printf "%s" "${variablecontent}" >/var/run/s6/container_environment/"${variable}"; fi
|
||||||
done
|
done
|
||||||
|
|
||||||
#################
|
#################
|
||||||
# Staring redis #
|
# Staring redis #
|
||||||
#################
|
#################
|
||||||
exec redis-server & bashio::log.info "Starting redis"
|
exec redis-server &
|
||||||
|
bashio::log.info "Starting redis"
|
||||||
|
|
||||||
#################
|
#################
|
||||||
# Staring nginx #
|
# Staring nginx #
|
||||||
#################
|
#################
|
||||||
exec nginx & bashio::log.info "Starting nginx"
|
exec nginx &
|
||||||
|
bashio::log.info "Starting nginx"
|
||||||
|
|
||||||
###############
|
###############
|
||||||
# Starting app #
|
# Starting app #
|
||||||
|
|||||||
Reference in New Issue
Block a user