fix: auto-fix linting issues

This commit is contained in:
alexbelgium
2025-06-10 10:06:17 +00:00
committed by github-actions[bot]
parent e5adbd266f
commit f728166b14
197 changed files with 5747 additions and 5714 deletions

View File

@@ -16,8 +16,7 @@ if ! bashio::supervisor.ping 2>/dev/null; then
'-----------------------------------------------------------'
# Use environment variables instead of addon options
echo "... convert scripts to use environment variables instead of addon options"
while IFS= read -r scripts
do
while IFS= read -r scripts; do
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[[:space:]]*["'"'"']\([^"'"'"']*\)["'"'"'])/${\1:-}/g' \
@@ -82,4 +81,4 @@ if bashio::config.has_value "PUID" && bashio::config.has_value "PGID" && id abc
fi
# Clean bashrc file safely
if [ -f ~/.bashrc ]; then : > ~/.bashrc; fi
if [ -f ~/.bashrc ]; then : >~/.bashrc; fi

View File

@@ -50,10 +50,10 @@ for KEYS in "${arr[@]}"; do
continue
fi
# 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"
# Get text
secret=$(sed -n "/$secret:/p" "$SECRETSOURCE" )
secret=$(sed -n "/$secret:/p" "$SECRETSOURCE")
secret=${secret#*: }
line="${line%%=*}='$secret'"
VALUE="$secret"
@@ -71,26 +71,26 @@ for KEYS in "${arr[@]}"; do
# shellcheck disable=SC2163
export "$line"
# export to python
if command -v "python3" &>/dev/null ; then
[ ! -f /env.py ] && echo "import os" > /env.py
if command -v "python3" &>/dev/null; then
[ ! -f /env.py ] && echo "import os" >/env.py
# Escape \
VALUEPY="${VALUE//\\/\\\\}"
# Avoid " and '
VALUEPY="${VALUEPY//[\"\']/}"
echo "os.environ['${KEYS}'] = '$VALUEPY'" >> /env.py
echo "os.environ['${KEYS}'] = '$VALUEPY'" >>/env.py
python3 /env.py
fi
# set .env
echo "$line" >> /.env || true
echo "$line" >>/.env || true
# set /etc/environment
mkdir -p /etc
echo "$line" >> /etc/environment
echo "$line" >>/etc/environment
# For non s6
if cat /etc/services.d/*/*run* &>/dev/null; then sed -i "1a export $line" /etc/services.d/*/*run* 2>/dev/null; fi
if cat /etc/cont-init.d/*run* &>/dev/null; then sed -i "1a export $line" /etc/cont-init.d/*run* 2>/dev/null; fi
# For s6
if [ -d /var/run/s6/container_environment ]; then printf "%s" "${VALUE}" > /var/run/s6/container_environment/"${KEYS}"; fi
echo "export ${KEYS}='${VALUE}'" >> ~/.bashrc
if [ -d /var/run/s6/container_environment ]; then printf "%s" "${VALUE}" >/var/run/s6/container_environment/"${KEYS}"; fi
echo "export ${KEYS}='${VALUE}'" >>~/.bashrc
fi
done

View File

@@ -15,8 +15,8 @@ fi
if bashio::config.has_value 'localdisks'; then
# Available devices
blkid | awk '{print substr($1, 0, length($1) - 1)}' | awk -F'/' '{print $NF}' > availabledisks
echo "NAME" >> availabledisks
blkid | awk '{print substr($1, 0, length($1) - 1)}' | awk -F'/' '{print $NF}' >availabledisks
echo "NAME" >>availabledisks
## List available Disk with Labels and Id
bashio::log.blue "---------------------------------------------------"
@@ -99,10 +99,12 @@ if bashio::config.has_value 'localdisks'; then
if [ -d /share/"$disk" ]; then dirpath="/share"; fi
# shellcheck disable=SC2015
mount -t $type "$devpath"/"$disk" "$dirpath"/"$disk" -o $options && bashio::log.info "Success! $disk mounted to /mnt/$disk" || \
(bashio::log.fatal "Unable to mount local drives! Please check the name."
mount -t $type "$devpath"/"$disk" "$dirpath"/"$disk" -o $options && bashio::log.info "Success! $disk mounted to /mnt/$disk" ||
(
bashio::log.fatal "Unable to mount local drives! Please check the name."
rmdir /mnt/"$disk"
bashio::addon.stop)
bashio::addon.stop
)
done
fi

View File

@@ -12,7 +12,7 @@ fi
# DEFINE FUNCTIONS #
####################
test_mount () {
test_mount() {
# Set initial test
MOUNTED=false
@@ -45,7 +45,7 @@ test_mount () {
}
mount_drive () {
mount_drive() {
# Define options
MOUNTED=true
@@ -197,7 +197,7 @@ if bashio::config.has_value 'networkdisks'; then
# Manage output
if [ -n "$SMBVERS" ]; then
case $SMBVERS in
"202"|"200"|"20")
"202" | "200" | "20")
SMBVERS="2.0"
;;
21)

View File

@@ -186,20 +186,20 @@ while IFS= read -r line; do
export "$line"
# export to python
if command -v "python3" &>/dev/null; then
[ ! -f /env.py ] && echo "import os" > /env.py
echo "os.environ['${KEYS}'] = '${VALUE//[\"\']/}'" >> /env.py
[ ! -f /env.py ] && echo "import os" >/env.py
echo "os.environ['${KEYS}'] = '${VALUE//[\"\']/}'" >>/env.py
python3 /env.py
fi
# set .env
if [ -f /.env ]; then echo "$line" >> /.env; fi
if [ -f /.env ]; then echo "$line" >>/.env; fi
mkdir -p /etc
echo "$line" >> /etc/environment
echo "$line" >>/etc/environment
# Export to scripts
if cat /etc/services.d/*/*run* &>/dev/null; then sed -i "1a export $line" /etc/services.d/*/*run* 2>/dev/null; fi
if cat /etc/cont-init.d/*run* &>/dev/null; then sed -i "1a export $line" /etc/cont-init.d/*run* 2>/dev/null; fi
# For s6
if [ -d /var/run/s6/container_environment ]; then printf "%s" "${VALUE}" > /var/run/s6/container_environment/"${KEYS}"; fi
echo "export $line" >> ~/.bashrc
if [ -d /var/run/s6/container_environment ]; then printf "%s" "${VALUE}" >/var/run/s6/container_environment/"${KEYS}"; fi
echo "export $line" >>~/.bashrc
# Show in log
if ! bashio::config.false "verbose"; then bashio::log.blue "$line"; fi
else

View File

@@ -53,8 +53,7 @@ if [ ! -f "${currentshebang%% *}" ]; then
fi
# Check if there is actual commands
while IFS= read -r line
do
while IFS= read -r line; do
# Remove leading and trailing whitespaces
line="$(echo "$line" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')"
@@ -64,4 +63,4 @@ do
/."$CONFIGSOURCE"
exit 0
fi
done < "$CONFIGSOURCE"
done <"$CONFIGSOURCE"

View File

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

View File

@@ -18,8 +18,7 @@ if bashio::config.has_value 'DNS_server'; then
# shellcheck disable=SC2086
for server in ${DNSSERVER//,/ }; do # Separate comma separated values
# Only add DNS if successful
if ping -c 1 "$server" &> /dev/null
then
if ping -c 1 "$server" &>/dev/null; then
DNS="${DNS}nameserver $server\n"
DNSLIST="$server $DNSLIST"
else

View File

@@ -86,7 +86,10 @@ if [ "$$" -eq 1 ]; then
exit 0
}
trap terminate SIGTERM SIGINT
while :; do sleep infinity & wait $!; done
while :; do
sleep infinity &
wait $!
done
else
echo " "
echo -e "\033[0;32mStarting the upstream container\033[0m"

View File

@@ -43,7 +43,7 @@ else
LOGINFO="... updating ${REPOSITORY}" && if [ "$VERBOSE" = true ]; then bashio::log.info "$LOGINFO"; fi
cd "/data/$BASENAME" || exit
git pull --rebase origin >/dev/null || git reset --hard origin/master >/dev/null
git pull --rebase origin >/dev/null || ( rm -r "/data/$BASENAME" && git clone "https://github.com/${REPOSITORY}" )
git pull --rebase origin >/dev/null || (rm -r "/data/$BASENAME" && git clone "https://github.com/${REPOSITORY}")
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
if [ -f /data/"$BASENAME"/"$f"/updater.json ]; then
SLUG=${f//\/}
SLUG=${f//\//}
# Rebase
LOGINFO="... updating ${REPOSITORY}" && if [ "$VERBOSE" = true ]; then bashio::log.info "$LOGINFO"; fi
@@ -64,7 +64,10 @@ for f in */; do
#Define the folder addon
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
UPSTREAM=$(jq -r .upstream_repo updater.json)
@@ -87,12 +90,18 @@ for f in */; do
fi
#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
LOGINFO="... $SLUG : get current version" && if [ "$VERBOSE" = true ]; then bashio::log.info "$LOGINFO"; fi
CURRENT=$(jq .upstream_version updater.json) || \
{ bashio::log.error "$SLUG addon upstream tag not found in updater.json. Exiting."; continue; }
CURRENT=$(jq .upstream_version updater.json) ||
{
bashio::log.error "$SLUG addon upstream tag not found in updater.json. Exiting."
continue
}
if [[ "$SOURCE" = dockerhub ]]; then
# Use dockerhub as upstream
@@ -126,7 +135,7 @@ for f in */; do
tail -n 1
)
[ "${BETA}" = true ] && \
[ "${BETA}" = true ] &&
LASTVERSION=$(
curl -f -L -s --fail "https://hub.docker.com/v2/repositories/${DOCKERHUB_REPO}/${DOCKERHUB_IMAGE}/tags?page_size=$LISTSIZE$FILTER_TEXT" |
jq '.results | .[] | .name' -r |
@@ -137,8 +146,9 @@ for f in */; do
tail -n 1
)
[ "${BYDATE}" = true ] && \
LASTVERSION=$(curl -f -L -s --fail "https://hub.docker.com/v2/repositories/${DOCKERHUB_REPO}/${DOCKERHUB_IMAGE}/tags?page_size=${LISTSIZE}&ordering=last_updated$FILTER_TEXT" |
[ "${BYDATE}" = true ] &&
LASTVERSION=$(
curl -f -L -s --fail "https://hub.docker.com/v2/repositories/${DOCKERHUB_REPO}/${DOCKERHUB_IMAGE}/tags?page_size=${LISTSIZE}&ordering=last_updated$FILTER_TEXT" |
jq '.results | .[] | .name' -r |
sed -e '/.*latest.*/d' |
sed -e '/.*dev.*/d' |
@@ -146,11 +156,12 @@ for f in */; do
sed -e "/.*$EXCLUDE_TEXT.*/d" |
sort -V |
tail -n 1
) && \
DATE=$(curl -f -L -s --fail "https://hub.docker.com/v2/repositories/${DOCKERHUB_REPO}/${DOCKERHUB_IMAGE}/tags/?page_size=${LISTSIZE}&ordering=last_updated$FILTER_TEXT" |
) &&
DATE=$(
curl -f -L -s --fail "https://hub.docker.com/v2/repositories/${DOCKERHUB_REPO}/${DOCKERHUB_IMAGE}/tags/?page_size=${LISTSIZE}&ordering=last_updated$FILTER_TEXT" |
jq '.results[] | select(.name==$LASTVERSION) | .last_updated' -r --arg LASTVERSION "$LASTVERSION"
) && \
DATE="${DATE%T*}" && \
) &&
DATE="${DATE%T*}" &&
LASTVERSION="$LASTVERSION-$DATE"
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
# If failure, checks if there is packages that could be used
function test_packages () {
function test_packages() {
if [ "$VERBOSE" = true ]; then
# shellcheck disable=SC2086
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
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
sed -i "s/${CURRENT}/${LASTVERSION}/g" /data/"${BASENAME}"/"${SLUG}"/"$files"
fi

View File

@@ -9,7 +9,8 @@ set -e
# Set UrlBase
bashio::log.info "Starting NGinx..."
nginx & true
nginx &
true
#############
# Start app #

View File

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

View File

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

View File

@@ -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/%%interface%%/${ingress_interface}/g" /etc/nginx/servers/ingress.conf
sed -i "s|%%ingress_entry%%|${ingress_entry}|g" /etc/nginx/servers/ingress.conf

View File

@@ -9,24 +9,28 @@ set -e
##################
# Starting redis #
##################
exec redis-server & bashio::log.info "Starting redis"
exec redis-server &
bashio::log.info "Starting redis"
####################
# Starting mongodb #
####################
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 #
################
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 #
#########################
python main.py & bashio::log.info "Starting trading view"
python main.py &
bashio::log.info "Starting trading view"
##################
# Starting nginx #

View File

@@ -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.green "---"
fi

View File

@@ -24,10 +24,10 @@ fi
bashio::log.info "Starting app..."
# 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
bashio::net.wait_for 8080 localhost 900
bashio::log.info "Starting NGinx..."
exec nginx

View File

@@ -35,7 +35,10 @@ touch "$ANALYZING_NOW_FILE"
BIRDSONGS_DIR="$(readlink -f "$HOME/BirdSongs/Extracted/By_Date")"
# 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"
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_INTERVAL=1800 # 30 minutes in seconds
NOTIFICATION_INTERVAL_IN_MINUTES=$(( NOTIFICATION_INTERVAL / 60 ))
NOTIFICATION_INTERVAL_IN_MINUTES=$((NOTIFICATION_INTERVAL / 60))
last_notification_time=0
issue_reported=0 # 1 = an issue was reported, 0 = system is normal
declare -A SERVICE_INACTIVE_COUNT=()
@@ -72,10 +75,10 @@ apprisealert() {
current_time=$(date +%s)
# 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
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)."
return
fi
@@ -109,7 +112,7 @@ apprisealert() {
apprisealert_recovery() {
# 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."
local TITLE="BirdNET-Pi System Recovered"
@@ -133,7 +136,7 @@ check_disk_space() {
local current_usage
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!)"
apprisealert "Disk usage critical: ${current_usage}%"
return 1
@@ -147,13 +150,13 @@ check_analyzing_now() {
local current_file
current_file=$(cat "$ANALYZING_NOW_FILE" 2>/dev/null)
if [[ "$current_file" == "$analyzing_now" ]]; then
(( same_file_counter++ ))
((same_file_counter++))
else
same_file_counter=0
analyzing_now="$current_file"
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."
apprisealert "No change in analyzing_now for ${SAME_FILE_THRESHOLD} iterations"
"$HOME/BirdNET-Pi/scripts/restart_services.sh"
@@ -161,7 +164,7 @@ check_analyzing_now() {
return 1
else
# 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."
fi
return 0
@@ -174,13 +177,13 @@ check_queue() {
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."
apprisealert "Queue exceeded 50: stopping recorder, restarting analyzer."
sudo systemctl stop birdnet_recording
sudo systemctl restart birdnet_analysis
return 1
elif (( wav_count > 30 )); then
elif ((wav_count > 30)); then
log_red "$(date) INFO: Queue >30. Restarting analyzer."
apprisealert "Queue exceeded 30: restarting analyzer."
sudo systemctl restart birdnet_analysis
@@ -194,14 +197,14 @@ check_services() {
for service in "${SERVICES[@]}"; do
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
log_yellow "$(date) INFO: Service '$service' is inactive. Attempting to start..."
systemctl start "$service"
any_inactive=1
elif (( SERVICE_INACTIVE_COUNT["$service"] == 2 )); then
elif ((SERVICE_INACTIVE_COUNT["$service"] == 2)); then
# Second consecutive time => Send an alert
log_red "$(date) INFO: Service '$service' is still inactive after restart attempt."
apprisealert "Service '$service' remains inactive after restart attempt."
@@ -213,14 +216,14 @@ check_services() {
fi
else
# 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."
fi
SERVICE_INACTIVE_COUNT["$service"]=0
fi
done
if (( any_inactive == 0 )); then
if ((any_inactive == 0)); then
log_green "$(date) INFO: All services are active"
return 0
else
@@ -269,7 +272,7 @@ while true; do
check_for_empty_stream || any_issue=1
# Final summary
if (( any_issue == 0 )); then
if ((any_issue == 0)); then
log_green "$(date) INFO: All systems are functioning normally"
apprisealert_recovery
else

View File

@@ -24,7 +24,7 @@ echo "... creating default files"
DEFAULT_FILES=("apprise.txt" "exclude_species_list.txt" "IdentifiedSoFar.txt" "disk_check_exclude.txt" "confirmed_species_list.txt" "blacklisted_images.txt" "whitelist_species_list.txt")
for file in "${DEFAULT_FILES[@]}"; do
if [ ! -f "/config/$file" ]; then
echo "" > "/config/$file"
echo "" >"/config/$file"
fi
done
touch /config/include_species_list.txt # Ensure this is always created
@@ -121,4 +121,3 @@ echo "... setting up Matplotlabdir"
mkdir -p "$HOME"/.cache/matplotlib
chown -R "pi:pi" "$HOME"/.cache/matplotlib
chmod 777 "$HOME"/.cache/matplotlib

View File

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

View File

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

View File

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

View File

@@ -47,4 +47,3 @@ if bashio::config.true 'ssl'; then
exit 1
fi
fi

View File

@@ -66,7 +66,7 @@ fi
# Fix timezone as per installer
CURRENT_TIMEZONE="$(timedatectl show --value --property=Timezone)"
[ -f /etc/timezone ] && echo "$CURRENT_TIMEZONE" | sudo tee /etc/timezone > /dev/null
[ -f /etc/timezone ] && echo "$CURRENT_TIMEZONE" | sudo tee /etc/timezone >/dev/null
bashio::log.info "Starting system services"

View File

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

View File

@@ -21,8 +21,8 @@ set_timezone() {
return 1
fi
echo "$new_timezone" > /data/timezone
echo "$new_timezone" > /etc/timezone
echo "$new_timezone" >/data/timezone
echo "$new_timezone" >/etc/timezone
ln -sf "/usr/share/zoneinfo/$new_timezone" /etc/localtime
# Update /etc/environment if it exists
@@ -32,7 +32,7 @@ set_timezone() {
# Update s6 container environment if it exists
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
echo "Timezone set to: $new_timezone"
@@ -92,16 +92,16 @@ show_time_details() {
# Main script logic
case "$1" in
"set-ntp")
"set-ntp")
set_ntp "$2"
;;
"show")
"show")
show_timezone
;;
"set-timezone")
"set-timezone")
set_timezone "$2"
;;
*)
*)
show_time_details
;;
esac

View File

@@ -205,12 +205,12 @@ set_ntp() {
# systemd-timesyncd is the typical built-in NTP client for systemd-based systems
case "$enable_ntp" in
true|True|1|on)
true | True | 1 | on)
echo "Enabling and starting systemd-timesyncd..."
systemctl enable systemd-timesyncd || echo "Failed to enable timesyncd."
systemctl start systemd-timesyncd || echo "Failed to start timesyncd."
;;
false|False|0|off)
false | False | 0 | off)
echo "Disabling and stopping systemd-timesyncd..."
systemctl disable systemd-timesyncd || echo "Failed to disable timesyncd."
systemctl stop systemd-timesyncd || echo "Failed to stop timesyncd."
@@ -248,7 +248,7 @@ main() {
set-ntp)
set_ntp "$@"
;;
""|help|--help|-h)
"" | help | --help | -h)
print_usage
;;
*)

View File

@@ -53,12 +53,12 @@ done
usermod --home "$LOCATION" abc
# Add environment variables
if [ -d /var/run/s6/container_environment ]; then printf "%s" "$LOCATION" > /var/run/s6/container_environment/HOME; fi
if [ -d /var/run/s6/container_environment ]; then printf "%s" "$LOCATION" > /var/run/s6/container_environment/FM_HOME; fi
if [ -d /var/run/s6/container_environment ]; then printf "%s" "$LOCATION" >/var/run/s6/container_environment/HOME; fi
if [ -d /var/run/s6/container_environment ]; then printf "%s" "$LOCATION" >/var/run/s6/container_environment/FM_HOME; fi
{
printf "%s\n" "HOME=\"$LOCATION\""
printf "%s\n" "FM_HOME=\"$LOCATION\""
} >> ~/.bashrc
} >>~/.bashrc
# Create folder
echo "Creating $LOCATION"

View File

@@ -13,4 +13,3 @@ if [ -d /homeassistant/addons_config/calibre-web ] && [ ! -L /homeassistant/addo
fi
rm -r /homeassistant/addons_config/calibre-web
fi

View File

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

View File

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

View File

@@ -60,7 +60,8 @@ bashio::log.warning "Default password admin:admin..."
bashio::log.info "Starting..."
# shellcheck disable=SC2086
/./usr/local/bin/codex & true
/./usr/local/bin/codex &
true
bashio::net.wait_for 9810 localhost 900 || true
bashio::log.info "Started !"

View File

@@ -102,7 +102,8 @@ fi
# Launch App #
##############
echo " "
nginx & bashio::log.info "Starting nginx"
nginx &
bashio::log.info "Starting nginx"
echo " "
bashio::log.info "Starting the app"
echo " "

View File

@@ -102,7 +102,8 @@ fi
# Launch App #
##############
echo " "
nginx & bashio::log.info "Starting nginx"
nginx &
bashio::log.info "Starting nginx"
echo " "
bashio::log.info "Starting the app"
echo " "

View File

@@ -43,8 +43,8 @@ chmod -R 775 /config/addons_config/fireflyiii
bashio::log.info "Defining database"
case $(bashio::config 'DB_CONNECTION') in
# Use sqlite
sqlite_internal)
# Use sqlite
sqlite_internal)
bashio::log.info "Using built in sqlite"
# Set variable
@@ -77,7 +77,7 @@ case $(bashio::config 'DB_CONNECTION') in
;;
# Use MariaDB
mariadb_addon)
mariadb_addon)
bashio::log.info "Using MariaDB addon. Requirements : running MariaDB addon. Detecting values..."
if ! bashio::services.available 'mysql'; then
bashio::log.fatal \
@@ -112,7 +112,7 @@ case $(bashio::config 'DB_CONNECTION') in
;;
# Use remote
*)
*)
bashio::log.info "Using remote database. Requirement : filling all addon options fields, and making sure the database already exists"
for conditions in "DB_HOST" "DB_PORT" "DB_DATABASE" "DB_USERNAME" "DB_PASSWORD"; do
if ! bashio::config.has_value "$conditions"; then
@@ -148,7 +148,10 @@ chmod -R 775 /config/addons_config/fireflyiii
# Test
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 #

View File

@@ -28,11 +28,10 @@ if bashio::config.has_value 'Updates'; then
bashio::log.info "$FREQUENCY updates"
echo ""
for i in $(seq 4 2 12)
do
for i in $(seq 4 2 12); do
hour=" $i"
freqDir="/etc/periodic/daily$i"
echo "0 ${hour:(-4)} * * * run-parts \"$freqDir\"" >> /etc/crontabs/root
echo "0 ${hour:(-4)} * * * run-parts \"$freqDir\"" >>/etc/crontabs/root
mkdir "$freqDir"
done
@@ -47,7 +46,7 @@ if bashio::config.has_value 'Updates'; then
# Starts cron
echo "Timezone $TZ"
export TZ
crond -l 2 -f > /dev/stdout 2> /dev/stderr &
crond -l 2 -f >/dev/stdout 2>/dev/stderr &
# Export variables
IMPORT_DIR_WHITELIST="${CONFIGSOURCE}/import_files"

View File

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

View File

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

View File

@@ -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/"$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 "/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

View File

@@ -37,7 +37,7 @@ else
if [ ! -s /config/secret/secret ]; then
bashio::log.warning "No secret key found in /config/secret/secret, generating a new one."
mkdir -p /config/secret
python3 -c "import secrets; print(secrets.token_urlsafe(32))" | tr -d "\n" > /config/secret/secret
python3 -c "import secrets; print(secrets.token_urlsafe(32))" | tr -d "\n" >/config/secret/secret
bashio::log.warning "New secret key generated and stored in /config/secret/secret"
fi
bashio::log.warning "Using existing secret key from /config/secret/secret."
@@ -73,7 +73,8 @@ CELERY_PID=$!
# Staring nginx #
#################
echo "Starting nginx..."
exec nginx & bashio::log.info "Starting nginx"
exec nginx &
bashio::log.info "Starting nginx"
NGINX_PID=$!
# Wait for all background processes

View File

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

View File

@@ -75,7 +75,7 @@ export_db_env() {
if [ -d /var/run/s6/container_environment ]; then
for var in DB_USERNAME DB_PASSWORD DB_DATABASE_NAME DB_PORT DB_HOSTNAME JWT_SECRET; do
if [ -n "${!var:-}" ]; then
printf "%s" "${!var}" > "/var/run/s6/container_environment/${var}"
printf "%s" "${!var}" >"/var/run/s6/container_environment/${var}"
fi
done
fi
@@ -93,7 +93,7 @@ setup_root_user() {
# Store generated password in the s6 environment if available
if [ -d /var/run/s6/container_environment ]; then
printf "%s" "${DB_ROOT_PASSWORD}" > "/var/run/s6/container_environment/DB_ROOT_PASSWORD"
printf "%s" "${DB_ROOT_PASSWORD}" >"/var/run/s6/container_environment/DB_ROOT_PASSWORD"
fi
fi

View File

@@ -92,4 +92,3 @@ echo "Enable legacy mode"
mkdir -p /config/addons_config
ln -sf "$LOCATION" /config/addons_config/jellyfin
chown -R "$PUID:$PGID" "$LOCATION"

View File

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

View File

@@ -21,8 +21,8 @@ bashio::log.info "Data selected : $database"
case "$database" in
# Use sqlite
sqlite)
# Use sqlite
sqlite)
DB_DATABASE="/config/database.sqlite"
export DB_DATABASE
DB_CONNECTION=sqlite
@@ -34,8 +34,8 @@ case "$database" in
bashio::log.blue "Using $DB_DATABASE"
;;
# Use Mariadb_addon
MariaDB_addon)
# Use Mariadb_addon
MariaDB_addon)
# Use MariaDB
DB_CONNECTION=mysql
export DB_CONNECTION
@@ -66,8 +66,8 @@ case "$database" in
;;
# Use Mariadb_addon
Mysql_external)
# Use Mariadb_addon
Mysql_external)
DB_CONNECTION=mysql
export DB_CONNECTION
for var in DB_DATABASE DB_HOST DB_PASSWORD DB_PORT DB_USERNAME; do
@@ -101,10 +101,13 @@ APP_KEY=$(bashio::config "APP_KEY")
# Check if APP_KEY is not 32 characters long
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::log.warning "The APP_KEY set was invalid, generated a random one: ${APP_KEY}. Restarting to take it into account"
echo "${APP_KEY}" >> /config/APP_KEY
echo "${APP_KEY}" >>/config/APP_KEY
bashio::addon.restart
fi
APP_KEY="$(bashio::config "APP_KEY")"

View File

@@ -65,7 +65,6 @@ if bashio::config.has_value 'welcome_message'; then
export ND_UIWELCOMEMESSAGE
fi
##############
# LAUNCH APP #
##############

View File

@@ -70,10 +70,10 @@ execute_main_logic() {
NEW_SCAN_SUBNETS="${SCAN_SUBNETS%]}, '${local_ip}/24 --interface=${interface}']"
sed -i "/^SCAN_SUBNETS/c\\$NEW_SCAN_SUBNETS" "$config_file"
# Check availability of hosts
VALUE="$(arp-scan --interface="$interface" "${local_ip}/24" 2>/dev/null \
| grep "responded" \
| awk -F'.' '{print $NF}' \
| awk '{print $1}' || true)"
VALUE="$(arp-scan --interface="$interface" "${local_ip}/24" 2>/dev/null |
grep "responded" |
awk -F'.' '{print $NF}' |
awk '{print $1}' || true)"
echo "... $interface is available in Home Assistant (with $VALUE devices), added to app.conf"
fi
fi
@@ -96,5 +96,6 @@ wait_for_config_file() {
if [ -f "$config_file" ]; then
execute_main_logic
else
wait_for_config_file & true
wait_for_config_file &
true
fi

View File

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

View File

@@ -23,10 +23,9 @@ if bashio::config.has_value 'additional_apps'; then
OIFS=$IFS
IFS=","
re='^( *).*'
read -ra array <<< "$NEWAPPS"
read -ra array <<<"$NEWAPPS"
IFS=$OIFS
for element in "${array[@]}"
do
for element in "${array[@]}"; do
if [[ $element =~ $re ]]; then
# shellcheck disable=SC2295
APP="${element#${BASH_REMATCH[1]}}"

View File

@@ -16,7 +16,7 @@ fi
sed -i "s|OCRLANG|OCR_LANGUAGES|g" "$CONFIGLOCATION"/papermerge.conf.py
languageCount=$(echo "$OCRLANG" | tr -cd ',' | wc -c)
languageCount=$((languageCount+1))
languageCount=$((languageCount + 1))
bashio::log.info "Configuring ${languageCount} languages"
if [ -n "$OCRLANG" ]; then
@@ -26,7 +26,7 @@ if [ -n "$OCRLANG" ]; then
sed -i "${lineStart},${lineEnd}d" "$CONFIGLOCATION"/papermerge.conf.py || true
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")
@@ -40,20 +40,20 @@ if [ -n "$OCRLANG" ]; then
apt-get install -yqq tesseract-ocr-"${language}" >/dev/null
languageFullName=$(apt-cache show tesseract-ocr-"${language}" | grep -E '^(Description|Description-en):' | grep -oE '[^ ]+$')
bashio::log.info "${language} identified as ${languageFullName}"
i=$((i+1))
i=$((i + 1))
if [[ $i -eq $languageCount ]]; then
echo " \"$language\" : \"$languageFullName\"" >> "$CONFIGLOCATION"/papermerge.conf.py
echo " \"$language\" : \"$languageFullName\"" >>"$CONFIGLOCATION"/papermerge.conf.py
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}"
sed -i "s/^OCR_DEFAULT_LANGUAGE = \"eng\"/OCR_DEFAULT_LANGUAGE = \"${language}\"/g" "$CONFIGLOCATION"/papermerge.conf.py
else
echo " \"$language\" : \"$languageFullName\"," >> "$CONFIGLOCATION"/papermerge.conf.py
echo " \"$language\" : \"$languageFullName\"," >>"$CONFIGLOCATION"/papermerge.conf.py
fi
bashio::log.info "... ${language} installed"
else
bashio::log.info "Package tesseract-ocr-${language} not found in the repository, skipping"
fi
done
echo "}" >> "$CONFIGLOCATION"/papermerge.conf.py
echo "}" >>"$CONFIGLOCATION"/papermerge.conf.py
fi

View File

@@ -53,18 +53,18 @@ IMAPUSERNAME=$(bashio::config 'imapusername')
IMAPPASSWORD=$(bashio::config 'imappassword')
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"
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"
else
bashio::log.info "! IMAPHOST has been set, but no IMAPUSERNAME. Please check your configuration!"
fi
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')
bashio::log.info "IMPORT_MAIL_PASS set to $IMAPPASSWORDMASKED"
else

View File

@@ -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/"$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 "/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

View File

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

View File

@@ -34,7 +34,7 @@ export PHOTOPRISM_BACKUP_PATH=$(bashio::config 'BACKUP_PATH')
printf "%s\n" "PHOTOPRISM_ORIGINALS_PATH=\"${PHOTOPRISM_ORIGINALS_PATH}\""
printf "%s\n" "PHOTOPRISM_IMPORT_PATH=\"${PHOTOPRISM_IMPORT_PATH}\""
printf "%s\n" "PHOTOPRISM_BACKUP_PATH=\"${PHOTOPRISM_BACKUP_PATH}\""
} >> ~/.bashrc
} >>~/.bashrc
if bashio::config.has_value 'CUSTOM_OPTIONS'; then
CUSTOMOPTIONS=$(bashio::config 'CUSTOM_OPTIONS')

View File

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

View File

@@ -94,8 +94,8 @@ drop_vectors_everywhere() {
\"SELECT datname FROM pg_database WHERE datistemplate = false AND datallowconn\""); do
if su - postgres -c \
"$BINARIES_DIR/$old_pgver/bin/psql -d $db -Atc \
\"SELECT 1 FROM pg_extension WHERE extname='vectors'\"" \
| grep -q 1; then
\"SELECT 1 FROM pg_extension WHERE extname='vectors'\"" |
grep -q 1; then
bashio::log.warning "Dropping extension vectors from DB $db"
su - postgres -c \
"$BINARIES_DIR/$old_pgver/bin/psql -d $db -c \
@@ -109,17 +109,19 @@ start_postgres() {
bashio::log.info "Starting PostgreSQL..."
if [ "$(bashio::info.arch)" = "armv7" ]; then
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
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
}
wait_for_postgres() {
local tries=0
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
bashio::log.error "Postgres did not start after 2 minutes, aborting."
exit 1
@@ -216,7 +218,7 @@ show_db_extensions() {
if [ -n "$exts" ]; then
while read -r ext; do
[ -n "$ext" ] && bashio::log.info " - $ext"
done <<< "$exts"
done <<<"$exts"
else
bashio::log.info " (no extensions enabled)"
fi

View File

@@ -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
if [ -d /config/qBittorrent/addons_config ]; then rm -r /config/qBittorrent/addons_config; fi
if [ -d /config/qBittorrent/qBittorrent ]; then rm -r /config/qBittorrent/qBittorrent; fi
echo "Files moved to /addon_configs/$HOSTNAME/openvpn" > /homeassistant/addons_config/qBittorrent/migrated
echo "Files moved to /addon_configs/$HOSTNAME/openvpn" >/homeassistant/addons_config/qBittorrent/migrated
bashio::log.yellow "... moved files from /config/addons_config/qBittorrent to /addon_configs/$HOSTNAME/qBitorrent (must be accessed with my Filebrowser addon)"
MIGRATED=true
fi
@@ -33,7 +33,7 @@ fi
if [ -d /homeassistant/openvpn ]; then
if [ ! -f /homeassistant/openvpn/migrated ] && [ "$(ls -A /homeassistant/openvpn)" ]; then
cp -rnf /homeassistant/openvpn/* /config/openvpn &>/dev/null || true
echo "Files moved to /addon_configs/$HOSTNAME/openvpn" > /homeassistant/openvpn/migrated
echo "Files moved to /addon_configs/$HOSTNAME/openvpn" >/homeassistant/openvpn/migrated
fi
fi

View File

@@ -55,7 +55,6 @@ if bashio::config.has_value 'SavePath'; then
-e "/\[BitTorrent\]/a Downloads\\\DefaultSavePath=$DOWNLOADS" \
-e "/\[BitTorrent\]/a Session\\\DefaultSavePath=$DOWNLOADS" qBittorrent.conf
# Info
bashio::log.info "Downloads can be found in $DOWNLOADS"
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
;;
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
mkdir -p /webui/"$CUSTOMUI"

View File

@@ -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
# 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"
fi

View File

@@ -15,10 +15,10 @@ if bashio::config.true 'openvpn_enabled'; then
bashio::log.info "----------------------------"
# Get current ip
curl -s ipecho.net/plain > /currentip
curl -s ipecho.net/plain >/currentip
# Function to check for files path
function check_path () {
function check_path() {
# Get variable
file="$1"
@@ -34,7 +34,7 @@ if bashio::config.true 'openvpn_enabled'; then
line_number=0
while read -r line; do
# 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
###################################################################
@@ -46,7 +46,7 @@ if bashio::config.true 'openvpn_enabled'; then
# 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"
# Increment as new line added
((line_number=line_number+1))
((line_number = line_number + 1))
# Comment out the line
sed -i "${line_number}s/^/# /" "$file"
# Go to next line
@@ -77,7 +77,7 @@ if bashio::config.true 'openvpn_enabled'; then
fi
fi
fi
done < /tmpfile
done </tmpfile
rm /tmpfile
# Standardize lf
@@ -119,10 +119,10 @@ if bashio::config.true 'openvpn_enabled'; then
fi
# If openvpn_config not set, but folder is not empty
elif ls /config/openvpn/*.ovpn > /dev/null 2>&1; then
elif ls /config/openvpn/*.ovpn >/dev/null 2>&1; then
# Look for openvpn files
# Wildcard search for openvpn config files and store results in array
mapfile -t VPN_CONFIGS < <( find /config/openvpn -maxdepth 1 -name "*.ovpn" -print )
mapfile -t VPN_CONFIGS < <(find /config/openvpn -maxdepth 1 -name "*.ovpn" -print)
# Choose random config
VPN_CONFIG="${VPN_CONFIGS[$RANDOM % ${#VPN_CONFIGS[@]}]}"
# Get the VPN_CONFIG name without the path and extension
@@ -155,7 +155,7 @@ if bashio::config.true 'openvpn_enabled'; then
fi
# 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 ?
file_name="$(sed -n "/^auth-user-pass/p" /config/openvpn/"$openvpn_config" | awk -F' ' '{print $2}')"
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/s/^/#/' /config/openvpn/"$openvpn_config"
# No credentials specified, using addons username and password
echo "# Please do not remove the line below, it allows using the addon username and password" >> /config/openvpn/"$openvpn_config"
echo "auth-user-pass /etc/openvpn/credentials" >> /etc/openvpn/"$openvpn_config"
echo "# Please do not remove the line below, it allows using the addon username and password" >>/config/openvpn/"$openvpn_config"
echo "auth-user-pass /etc/openvpn/credentials" >>/etc/openvpn/"$openvpn_config"
fi
else
# Standardize just to be sure
@@ -179,8 +179,8 @@ if bashio::config.true 'openvpn_enabled'; then
fi
else
# No credentials specified, using addons username and password
echo "# Please do not remove the line below, it allows using the addon username and password" >> /config/openvpn/"$openvpn_config"
echo "auth-user-pass /etc/openvpn/credentials" >> /config/openvpn/"$openvpn_config"
echo "# Please do not remove the line below, it allows using the addon username and password" >>/config/openvpn/"$openvpn_config"
echo "auth-user-pass /etc/openvpn/credentials" >>/config/openvpn/"$openvpn_config"
fi
# Permissions

View File

@@ -5,28 +5,28 @@
# Contributed by Roy Marples (uberlord@gentoo.org)
# 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 "$@"
fi
# Restore resolv.conf to how it was
if [ "${PEER_DNS}" != "no" ]; then
if [ -x /sbin/resolvconf ] ; then
if [ -x /sbin/resolvconf ]; then
/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
# a symlink and not an actual file
cat /etc/resolv.conf-"${dev}".sv > /etc/resolv.conf
cat /etc/resolv.conf-"${dev}".sv >/etc/resolv.conf
rm -f /etc/resolv.conf-"${dev}".sv
fi
fi
if [ -n "${RC_SVCNAME}" ]; then
# 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
if [ -d /var/run/s6/container_environment ]; then printf "%s" "true" > /var/run/s6/container_environment/IN_BACKGROUND; fi
printf "%s\n" "IN_BACKGROUND=\"true\"" >> ~/.bashrc
if [ -d /var/run/s6/container_environment ]; then printf "%s" "true" >/var/run/s6/container_environment/IN_BACKGROUND; fi
printf "%s\n" "IN_BACKGROUND=\"true\"" >>~/.bashrc
/etc/init.d/"${RC_SVCNAME}" --quiet stop
fi
fi

View File

@@ -29,37 +29,37 @@ if [ "${PEER_DNS}" != "no" ]; then
DOMAIN=
SEARCH=
i=1
while true ; do
while true; do
eval opt=\$foreign_option_${i}
[ -z "${opt}" ] && break
if [ "${opt}" != "${opt#dhcp-option DOMAIN *}" ] ; then
if [ -z "${DOMAIN}" ] ; then
if [ "${opt}" != "${opt#dhcp-option DOMAIN *}" ]; then
if [ -z "${DOMAIN}" ]; then
DOMAIN="${opt#dhcp-option DOMAIN *}"
else
SEARCH="${SEARCH}${SEARCH:+ }${opt#dhcp-option DOMAIN *}"
fi
elif [ "${opt}" != "${opt#dhcp-option DNS *}" ] ; then
elif [ "${opt}" != "${opt#dhcp-option DNS *}" ]; then
NS="${NS}nameserver ${opt#dhcp-option DNS *}\n"
fi
i=$((${i} + 1))
done
if [ -n "${NS}" ] ; then
if [ -n "${NS}" ]; then
DNS="# Generated by openvpn for interface ${dev}\n"
if [ -n "${SEARCH}" ] ; then
if [ -n "${SEARCH}" ]; then
DNS="${DNS}search ${DOMAIN} ${SEARCH}\n"
elif [ -n "${DOMAIN}" ]; then
DNS="${DNS}domain ${DOMAIN}\n"
fi
DNS="${DNS}${NS}"
if [ -x /sbin/resolvconf ] ; then
if [ -x /sbin/resolvconf ]; then
printf "${DNS}" | /sbin/resolvconf -a "${dev}"
else
# 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
fi
printf "${DNS}" > /etc/resolv.conf
printf "${DNS}" >/etc/resolv.conf
chmod 644 /etc/resolv.conf
fi
fi
@@ -71,15 +71,15 @@ fi
if [ -n "${RC_SVCNAME}" ]; then
# 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 "$@"
fi
# 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
if [ -d /var/run/s6/container_environment ]; then printf "%s" "true" > /var/run/s6/container_environment/IN_BACKGROUND; fi
printf "%s\n" "IN_BACKGROUND=\"true\"" >> ~/.bashrc
if [ -d /var/run/s6/container_environment ]; then printf "%s" "true" >/var/run/s6/container_environment/IN_BACKGROUND; fi
printf "%s\n" "IN_BACKGROUND=\"true\"" >>~/.bashrc
/etc/init.d/${RC_SVCNAME} --quiet start
fi
fi

View File

@@ -13,7 +13,7 @@ PGID=$(bashio::config "PGID")
# Create function #
###################
change_folders () {
change_folders() {
CONFIGLOCATION=$1
ORIGINALLOCATION=$2
TYPE=$3

View File

@@ -45,23 +45,23 @@ FREQUENCY="$(bashio::config 'Updates')"
bashio::log.info "$FREQUENCY updates as defined in the 'Updates' option"
case "$FREQUENCY" in
"Quarterly")
"Quarterly")
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
;;
"Daily")
"Daily")
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
;;
"Custom")
"Custom")
interval="$(bashio::config 'Updates_custom_time')"
bashio::log.info "... frequency is defined manually as $interval"

View File

@@ -9,11 +9,11 @@ set -e
if bashio::config.true "expose_collector"; then
bashio::log.info "collector.yaml exposed in /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
rm -R /data/config/collector.yaml
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
rm /opt/scrutiny/config/collector.yaml
fi
@@ -39,10 +39,10 @@ if [[ "$(bashio::config "Mode")" == Collector ]]; then
# Check collector
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
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
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
bashio::log.info "Using 'COLLECTOR_API_ENDPOINT' $(bashio::config "COLLECTOR_API_ENDPOINT")"
else
bashio::exit.nok "Mode is set to 'Collector', but 'COLLECTOR_API_ENDPOINT' is not defined"

View File

@@ -73,13 +73,13 @@ bashio::log.info "Defining database"
case $(bashio::config 'database') in
# Use sqlite
sqlite)
# Use sqlite
sqlite)
export "SQLITE=1" && sed -i "1a export SQLITE=1" /home/seafile/*.sh
;;
# Use mariadb
mariadb_addon)
mariadb_addon)
bashio::log.info "Using MariaDB addon. Requirements : running MariaDB addon. Discovering values..."
if ! bashio::services.available 'mysql'; then
bashio::log.fatal \

View File

@@ -34,8 +34,8 @@ bashio::log.info "Defining database"
export DB_TYPE=$(bashio::config 'DB_TYPE')
case $(bashio::config 'DB_TYPE') in
# Use sqlite
sqlite)
# Use sqlite
sqlite)
bashio::log.info "Using a local sqlite database"
export DB_ENGINE="django.db.backends.sqlite3"
export POSTGRES_DB="/config/addons_config/tandoor_recipes/recipes.db"
@@ -85,7 +85,7 @@ case $(bashio::config 'DB_TYPE') in
# ;;
# use postgresql
postgresql_external)
postgresql_external)
bashio::log.info "Using an external database, please populate all required fields in the addons config"
export DB_ENGINE=django.db.backends.postgresql
export POSTGRES_HOST=$(bashio::config "POSTGRES_HOST") && bashio::log.blue "POSTGRES_HOST=$POSTGRES_HOST"

View File

@@ -86,7 +86,7 @@ if bashio::config.has_value 'watch_dir'; then
fi
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
###############
@@ -105,7 +105,7 @@ CONFIG=$(bashio::jq "${CONFIG}" ".\"rpc-authentication-required\"=${BOOLEAN}")
CONFIG=$(bashio::jq "${CONFIG}" ".\"rpc-username\"=\"${USER}\"")
CONFIG=$(bashio::jq "${CONFIG}" ".\"rpc-password\"=\"${PASS}\"")
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
###########
@@ -122,4 +122,4 @@ fi
CONFIG=$(bashio::jq "${CONFIG}" ".\"rpc-whitelist-enabled\"=${BOOLEAN}")
CONFIG=$(bashio::jq "${CONFIG}" ".\"rpc-whitelist\"=\"$WHITELIST\"")
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

View File

@@ -27,14 +27,14 @@ if bashio::config.has_value 'customUI' && [ ! "$CUSTOMUI" = default ] && [ ! "$C
"transmission-web-control")
### Install WebUI
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
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
;;
"kettu")
mkdir -p /kettu && \
mkdir -p /kettu &&
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
;;
@@ -46,17 +46,17 @@ if bashio::config.has_value 'customUI' && [ ! "$CUSTOMUI" = default ] && [ ! "$C
"transmissionic")
TRANSMISSIONIC_VERSION=$(curl -s -L "https://api.github.com/repos/6c65726f79/Transmissionic/releases/latest" | jq -r .tag_name)
echo "**** grab transmissionic ****" && \
if [ -z "${TRANSMISSIONIC_VERSION+x}" ]; then \
TRANSMISSIONIC_VERSION="$(curl -s "https://api.github.com/repos/6c65726f79/Transmissionic/releases/latest" \
| jq -rc ".tag_name")"; \
fi && \
echo "**** grab transmissionic ****" &&
if [ -z "${TRANSMISSIONIC_VERSION+x}" ]; then
TRANSMISSIONIC_VERSION="$(curl -s "https://api.github.com/repos/6c65726f79/Transmissionic/releases/latest" |
jq -rc ".tag_name")"
fi &&
curl -o \
/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 \
/tmp/transmissionic.zip -d \
/themes && \
/themes &&
mv /themes/web /transmissionic
;;
@@ -70,7 +70,7 @@ if bashio::config.has_value 'customUI' && [ ! "$CUSTOMUI" = default ] && [ ! "$C
CUSTOMUI="/${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 [ -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
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
fi

View File

@@ -72,7 +72,7 @@ if bashio::config.true 'OPENVPN_CUSTOM_PROVIDER'; then
fi
# Function to check for files path
function check_path () {
function check_path() {
# Get variable
file="$1"
@@ -86,8 +86,7 @@ function check_path () {
cp "$file" /tmpfile
# Loop through each line of the input file
while read -r line
do
while read -r line; do
# Check if the line contains a txt file
if [[ "$line" =~ \.txt ]] || [[ "$line" =~ \.crt ]]; then
# Extract the txt file name from the line
@@ -107,7 +106,7 @@ function check_path () {
fi
fi
fi
done < /tmpfile
done </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
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 +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
@@ -201,7 +203,8 @@ if [ "$(bashio::config "OPENVPN_PROVIDER")" == "mullvad" ]; then
fi
bashio::log.info "Starting app"
/./etc/openvpn/start.sh & echo ""
/./etc/openvpn/start.sh &
echo ""
#################
# Allow ingress #

View File

@@ -20,6 +20,6 @@ if [ ! -d /config/addons_config/$slug ]; then
fi
# 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
fi

View File

@@ -4,22 +4,22 @@ set +e
VPN_PROVIDER="${VPN_PROVIDER:-null}"
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-proton/run
;;
"pia")
"pia")
sed -i "1a sleep infinity" /etc/s6*/s6*/service-privoxy/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-pia/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-pia/run

View File

@@ -57,12 +57,12 @@ sed -i "s|^\(abc:[^:]*:[^:]*:[^:]*:[^:]*:\)[^:]*|\1$LOCATION|" /etc/passwd
#usermod --home "$LOCATION" abc || true
# Add environment variables
if [ -d /var/run/s6/container_environment ]; then printf "%s" "$LOCATION" > /var/run/s6/container_environment/HOME; fi
if [ -d /var/run/s6/container_environment ]; then printf "%s" "$LOCATION" > /var/run/s6/container_environment/FM_HOME; fi
if [ -d /var/run/s6/container_environment ]; then printf "%s" "$LOCATION" >/var/run/s6/container_environment/HOME; fi
if [ -d /var/run/s6/container_environment ]; then printf "%s" "$LOCATION" >/var/run/s6/container_environment/FM_HOME; fi
{
printf "%s\n" "export HOME=\"$LOCATION\""
printf "%s\n" "export FM_HOME=\"$LOCATION\""
} >> ~/.bashrc
} >>~/.bashrc
# Create folder
echo "Creating $LOCATION"

View File

@@ -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
KEYBOARD=$(bashio::config 'KEYBOARD')
bashio::log.info "Setting keyboard to $KEYBOARD"
if [ -d /var/run/s6/container_environment ]; then printf "%s" "$KEYBOARD" > /var/run/s6/container_environment/KEYBOARD; fi
printf "%s\n" "KEYBOARD=\"$KEYBOARD\"" >> ~/.bashrc
if [ -d /var/run/s6/container_environment ]; then printf "%s" "$KEYBOARD" >/var/run/s6/container_environment/KEYBOARD; fi
printf "%s\n" "KEYBOARD=\"$KEYBOARD\"" >>~/.bashrc
fi || true
# Set password
@@ -55,9 +55,9 @@ if bashio::config.true 'install_ms_edge'; then
apt-get update
echo "**** install edge ****"
apt-get install --no-install-recommends -y ca-certificates
if [ -z ${EDGE_VERSION+x} ]; then \
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); \
if [ -z ${EDGE_VERSION+x} ]; then
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)
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"
dpkg -I /tmp/edge.deb

View File

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

View File

@@ -7,4 +7,4 @@ ${BIN} \
--password-store=basic \
--no-sandbox \
--test-type \
"$@" > /dev/null 2>&1
"$@" >/dev/null 2>&1

View File

@@ -33,13 +33,13 @@ fi
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"
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"
fi
# Saving data location
echo "... using data folder $DATA_LOCATION"
echo -n "$DATA_LOCATION" > "$DATA_LOCATION_FILE"
echo -n "$DATA_LOCATION" >"$DATA_LOCATION_FILE"
# Update entrypoint
# Correct data directory

View File

@@ -29,10 +29,14 @@ ln -s /data/media /home/wger
#####################
# 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 /home/wger
chmod -R 777 /data
bashio::log.info "Starting nginx"
nginx || true & true
nginx || true &
true

View File

@@ -1,5 +1,7 @@
#!/bin/sh
exec misc/tor/start-tor.sh & ./run & echo "Starting NGinx..."
exec misc/tor/start-tor.sh &
./run &
echo "Starting NGinx..."
exec nginx

View File

@@ -21,8 +21,8 @@ fi
bashio::log.info "Defining database"
case "$(bashio::config "DB_CONNECTION")" in
# Use MariaDB
mariadb_addon)
# Use MariaDB
mariadb_addon)
bashio::log.info "Using MariaDB addon. Requirements : running MariaDB addon. Detecting values..."
if ! bashio::services.available 'mysql'; then
bashio::log.fatal \
@@ -58,7 +58,7 @@ case "$(bashio::config "DB_CONNECTION")" in
;;
# Use remote
external)
external)
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
if ! bashio::config.has_value "$conditions"; then
@@ -67,9 +67,8 @@ case "$(bashio::config "DB_CONNECTION")" in
done
;;
# Use remote
*)
*)
bashio::log.info "Using internal database"
;;

View File

@@ -42,8 +42,8 @@ bashio::log.info "Defining database"
case "$(bashio::config 'database')" in
# Use mariadb
mariadb_addon)
# Use mariadb
mariadb_addon)
bashio::log.info "Using MariaDB addon. Requirements : running MariaDB addon. Discovering values..."
if ! bashio::services.available 'mysql'; then
bashio::log.fatal \
@@ -69,9 +69,8 @@ case "$(bashio::config 'database')" in
bashio::log.warning "Uninstalling the MariaDB addon will remove any data"
;;
# Use sqlite
*)
*)
bashio::log.info "Using sqlite as database driver"
;;
esac
@@ -97,25 +96,27 @@ for variable in PAPERLESS_DATA_DIR PAPERLESS_MEDIA_ROOT PAPERLESS_CONSUMPTION_DI
# Export
export "$variable"="$variablecontent"
# Add to bashrc
eval echo "$variable=\"$variablecontent\"" >> ~/.bashrc
eval echo "$variable=\"$variablecontent\"" >>~/.bashrc
# set .env
echo "$variable=\"$variablecontent\"" >> /.env || true
echo "$variable=\"$variablecontent\"" >>/.env || true
# set /etc/environment
mkdir -p /etc
echo "$variable=\"$variablecontent\"" >> /etc/environment
echo "$variable=\"$variablecontent\"" >>/etc/environment
# 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
#################
# Staring redis #
#################
exec redis-server & bashio::log.info "Starting redis"
exec redis-server &
bashio::log.info "Starting redis"
#################
# Staring nginx #
#################
exec nginx & bashio::log.info "Starting nginx"
exec nginx &
bashio::log.info "Starting nginx"
###############
# Starting app #