mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-01-11 02:11:01 +01:00
Github bot : script beautyshied
This commit is contained in:
@@ -9,50 +9,50 @@ set -e
|
||||
|
||||
test_mount () {
|
||||
|
||||
# Set initial test
|
||||
MOUNTED=false
|
||||
ERROR_MOUNT=false
|
||||
# Set initial test
|
||||
MOUNTED=false
|
||||
ERROR_MOUNT=false
|
||||
|
||||
# Exit if not mounted
|
||||
if ! mountpoint -q /mnt/"$diskname"; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
# Exit if can't write
|
||||
# shellcheck disable=SC2015
|
||||
mkdir "/mnt/$diskname/testaze" && touch "/mnt/$diskname/testaze/testaze" && rm -r "/mnt/$diskname/testaze" || ERROR_MOUNT=true
|
||||
if [[ "$ERROR_MOUNT" == "true" ]]; then
|
||||
# Test write permissions
|
||||
if [[ "$MOUNTOPTIONS" == *"noserverino"* ]]; then
|
||||
bashio::log.fatal "Disk is mounted, however unable to write in the shared disk. Please check UID/GID for permissions, and if the share is rw"
|
||||
else
|
||||
MOUNTOPTIONS="$MOUNTOPTIONS,noserverino"
|
||||
echo "... testing with noserverino"
|
||||
mount_drive "$MOUNTOPTIONS"
|
||||
fi
|
||||
# Exit if not mounted
|
||||
if ! mountpoint -q /mnt/"$diskname"; then
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
|
||||
# Set correctly mounted bit
|
||||
MOUNTED=true
|
||||
# Exit if can't write
|
||||
# shellcheck disable=SC2015
|
||||
mkdir "/mnt/$diskname/testaze" && touch "/mnt/$diskname/testaze/testaze" && rm -r "/mnt/$diskname/testaze" || ERROR_MOUNT=true
|
||||
if [[ "$ERROR_MOUNT" == "true" ]]; then
|
||||
# Test write permissions
|
||||
if [[ "$MOUNTOPTIONS" == *"noserverino"* ]]; then
|
||||
bashio::log.fatal "Disk is mounted, however unable to write in the shared disk. Please check UID/GID for permissions, and if the share is rw"
|
||||
else
|
||||
MOUNTOPTIONS="$MOUNTOPTIONS,noserverino"
|
||||
echo "... testing with noserverino"
|
||||
mount_drive "$MOUNTOPTIONS"
|
||||
fi
|
||||
return 0
|
||||
fi
|
||||
|
||||
# Set correctly mounted bit
|
||||
MOUNTED=true
|
||||
return 0
|
||||
|
||||
}
|
||||
|
||||
mount_drive () {
|
||||
|
||||
# Define options
|
||||
MOUNTED=true
|
||||
MOUNTOPTIONS="$1"
|
||||
# Define options
|
||||
MOUNTED=true
|
||||
MOUNTOPTIONS="$1"
|
||||
|
||||
# Try mounting
|
||||
mount -t cifs -o "$MOUNTOPTIONS" "$disk" /mnt/"$diskname" 2>ERRORCODE || MOUNTED=false
|
||||
# Try mounting
|
||||
mount -t cifs -o "$MOUNTOPTIONS" "$disk" /mnt/"$diskname" 2>ERRORCODE || MOUNTED=false
|
||||
|
||||
# Test if succesful
|
||||
if [[ "$MOUNTED" == "true" ]]; then
|
||||
# shellcheck disable=SC2015
|
||||
test_mount
|
||||
fi
|
||||
# Test if succesful
|
||||
if [[ "$MOUNTED" == "true" ]]; then
|
||||
# shellcheck disable=SC2015
|
||||
test_mount
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@ if bashio::config.has_value 'networkdisks'; then
|
||||
|
||||
# Quickly try to mount with defaults
|
||||
mount_drive "rw,file_mode=0775,dir_mode=0775,username=${USERNAME},password=${PASSWORD},nobrl${SMBVERS}${SECVERS}${PUID}${PGID}${CHARSET}${DOMAIN}"
|
||||
|
||||
|
||||
# Deeper analysis if failed
|
||||
if [ "$MOUNTED" = false ]; then
|
||||
|
||||
@@ -189,18 +189,18 @@ if bashio::config.has_value 'networkdisks'; then
|
||||
# Manage output
|
||||
if [ -n "$SMBVERS" ]; then
|
||||
case $SMBVERS in
|
||||
202)
|
||||
SMBVERS="2.0"
|
||||
;;
|
||||
21)
|
||||
SMBVERS="2.1"
|
||||
;;
|
||||
302)
|
||||
SMBVERS="3.02"
|
||||
;;
|
||||
311)
|
||||
SMBVERS="3.1.1"
|
||||
;;
|
||||
202)
|
||||
SMBVERS="2.0"
|
||||
;;
|
||||
21)
|
||||
SMBVERS="2.1"
|
||||
;;
|
||||
302)
|
||||
SMBVERS="3.02"
|
||||
;;
|
||||
311)
|
||||
SMBVERS="3.1.1"
|
||||
;;
|
||||
esac
|
||||
echo "...... SMB version detected : $SMBVERS"
|
||||
SMBVERS=",vers=$SMBVERS"
|
||||
@@ -217,7 +217,7 @@ if bashio::config.has_value 'networkdisks'; then
|
||||
#######################################
|
||||
for SECVERS in "$SECVERS" ",sec=ntlmv2" ",sec=ntlmssp" ",sec=ntlmsspi" ",sec=krb5i" ",sec=krb5" ",sec=ntlm" ",sec=ntlmv2i"; do
|
||||
if [ "$MOUNTED" = false ]; then
|
||||
mount_drive "rw,file_mode=0775,dir_mode=0775,username=${USERNAME},password=${PASSWORD},nobrl${SMBVERS}${SECVERS}${PUID}${PGID}${CHARSET}${DOMAIN}"
|
||||
mount_drive "rw,file_mode=0775,dir_mode=0775,username=${USERNAME},password=${PASSWORD},nobrl${SMBVERS}${SECVERS}${PUID}${PGID}${CHARSET}${DOMAIN}"
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
@@ -83,9 +83,9 @@ fi
|
||||
echo ""
|
||||
bashio::log.green "Load environment variables from $CONFIGSOURCE if existing"
|
||||
if [[ "$CONFIGSOURCE" == "/config"* ]]; then
|
||||
bashio::log.green "If accessing the file with filebrowser it should be mapped to $CONFIGFILEBROWSER"
|
||||
bashio::log.green "If accessing the file with filebrowser it should be mapped to $CONFIGFILEBROWSER"
|
||||
else
|
||||
bashio::log.green "If accessing the file with filebrowser it should be mapped to $CONFIGSOURCE"
|
||||
bashio::log.green "If accessing the file with filebrowser it should be mapped to $CONFIGSOURCE"
|
||||
fi
|
||||
bashio::log.green "---------------------------------------------------------"
|
||||
bashio::log.green "Wiki here on how to use : github.com/alexbelgium/hassio-addons/wiki/Add‐ons-feature-:-add-env-variables"
|
||||
|
||||
@@ -22,12 +22,12 @@ find /homeassistant/addons_config -maxdepth 1 -type l -delete
|
||||
|
||||
# Remove erroneous folders
|
||||
if [ -d /homeassistant ]; then
|
||||
if [ -d /config/addons_config ]; then
|
||||
rm -r /config/addons_config
|
||||
fi
|
||||
if [ -d /config/addons_autoscripts ]; then
|
||||
rm -r /config/addons_autoscripts
|
||||
fi
|
||||
if [ -d /config/addons_config ]; then
|
||||
rm -r /config/addons_config
|
||||
fi
|
||||
if [ -d /config/addons_autoscripts ]; then
|
||||
rm -r /config/addons_autoscripts
|
||||
fi
|
||||
fi
|
||||
|
||||
# Create symlinks
|
||||
|
||||
@@ -22,12 +22,12 @@ find /homeassistant/addons_config -maxdepth 1 -type l -delete
|
||||
|
||||
# Remove erroneous folders
|
||||
if [ -d /homeassistant ]; then
|
||||
if [ -d /config/addons_config ]; then
|
||||
rm -r /config/addons_config
|
||||
fi
|
||||
if [ -d /config/addons_autoscripts ]; then
|
||||
rm -r /config/addons_autoscripts
|
||||
fi
|
||||
if [ -d /config/addons_config ]; then
|
||||
rm -r /config/addons_config
|
||||
fi
|
||||
if [ -d /config/addons_autoscripts ]; then
|
||||
rm -r /config/addons_autoscripts
|
||||
fi
|
||||
fi
|
||||
|
||||
# Create symlinks
|
||||
|
||||
@@ -31,7 +31,7 @@ ln -sf "$DATA_LOCATION" /photos
|
||||
chown -R "$PUID":"$PGID" /photos
|
||||
|
||||
mkdir -p "$MACHINE_LEARNING_CACHE_FOLDER"
|
||||
mkdir -p "$TYPESENSE_DATA_DIR"
|
||||
mkdir -p "$TYPESENSE_DATA_DIR"
|
||||
mkdir -p "$REVERSE_GEOCODING_DUMP_DIRECTORY"
|
||||
chown -R "$PUID":"$PGID" "$MACHINE_LEARNING_CACHE_FOLDER"
|
||||
chown -R "$PUID":"$PGID" "$TYPESENSE_DATA_DIR"
|
||||
|
||||
@@ -39,7 +39,7 @@ for item in "$CONFIGSOURCE"/*; do
|
||||
# Get the base name of the file or folder
|
||||
base_name=$(basename "$item")
|
||||
# Create a symbolic link in the current working directory
|
||||
ln -s "$item" /opt/tplink/EAPController/data/"$base_name"
|
||||
ln -s "$item" /opt/tplink/EAPController/data/"$base_name"
|
||||
echo "Created symlink for '$base_name'"
|
||||
done
|
||||
|
||||
|
||||
@@ -225,8 +225,8 @@ if bashio::config.has_value 'customUI' && [ ! "$CUSTOMUI" = default ] && [ ! "$C
|
||||
sed -i "$LINE i\WebUI\\\RootFolder=$CUSTOMUIDIR" "$CONFIG_LOCATION"/qBittorrent.conf
|
||||
# Set ingress ui
|
||||
if [[ "$CUSTOMUI" != qbit-matUI ]]; then
|
||||
sed -i "s=/vuetorrent/public/=$CUSTOMUIDIR/public/=g" /etc/nginx/servers/ingress.conf || true
|
||||
sed -i "s=vue.torrent=$CUSTOMUI.torrent=g" /etc/nginx/servers/ingress.conf || true
|
||||
sed -i "s=/vuetorrent/public/=$CUSTOMUIDIR/public/=g" /etc/nginx/servers/ingress.conf || true
|
||||
sed -i "s=vue.torrent=$CUSTOMUI.torrent=g" /etc/nginx/servers/ingress.conf || true
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
@@ -4,28 +4,28 @@ set -e
|
||||
|
||||
if bashio::config.true "qbit_manage"; then
|
||||
|
||||
bashio::log.info "qbit_manage activated, setting system"
|
||||
bashio::log.info "qbit_manage activated, setting system"
|
||||
|
||||
# Set folder
|
||||
echo "... setting folder"
|
||||
mkdir -p /config/qbit_manage
|
||||
chmod -R 777 /config/qbit_manage
|
||||
# Set folder
|
||||
echo "... setting folder"
|
||||
mkdir -p /config/qbit_manage
|
||||
chmod -R 777 /config/qbit_manage
|
||||
|
||||
# Create default file
|
||||
if [ ! -f /config/qbit_manage/qbit_manage.yml ]; then
|
||||
echo "... create default file"
|
||||
cp /qbit_manage/config/config.yml.sample /config/qbit_manage/qbit_manage.yml
|
||||
fi
|
||||
# Create default file
|
||||
if [ ! -f /config/qbit_manage/qbit_manage.yml ]; then
|
||||
echo "... create default file"
|
||||
cp /qbit_manage/config/config.yml.sample /config/qbit_manage/qbit_manage.yml
|
||||
fi
|
||||
|
||||
# Set qBittorrent options
|
||||
echo "... align QBT username and password"
|
||||
sed -i "/host:/c\ host: \"localhost:8080\"" /config/qbit_manage/qbit_manage.yml
|
||||
sed -i "/user:/c\ user: \"$(bashio::config "QBT_USERNAME")\"" /config/qbit_manage/qbit_manage.yml
|
||||
sed -i "s=root_dir: \"/data/torrents/\"=$(bashio::config.has_value "SavePath")=g" /config/qbit_manage/qbit_manage.yml
|
||||
sed -i "s=remote_dir: \"/mnt/user/data/torrents/\"=$(bashio::config.has_value "SavePath")=g" /config/qbit_manage/qbit_manage.yml
|
||||
# Set qBittorrent options
|
||||
echo "... align QBT username and password"
|
||||
sed -i "/host:/c\ host: \"localhost:8080\"" /config/qbit_manage/qbit_manage.yml
|
||||
sed -i "/user:/c\ user: \"$(bashio::config "QBT_USERNAME")\"" /config/qbit_manage/qbit_manage.yml
|
||||
sed -i "s=root_dir: \"/data/torrents/\"=$(bashio::config.has_value "SavePath")=g" /config/qbit_manage/qbit_manage.yml
|
||||
sed -i "s=remote_dir: \"/mnt/user/data/torrents/\"=$(bashio::config.has_value "SavePath")=g" /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" --run & true
|
||||
bashio::log.info "qbit_manage started with config in /addon_configs/$HOSTNAME/qbit_manage/qbit_manage.yaml accessible with the Filebrowser addon"
|
||||
# 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" --run & true
|
||||
bashio::log.info "qbit_manage started with config in /addon_configs/$HOSTNAME/qbit_manage/qbit_manage.yaml accessible with the Filebrowser addon"
|
||||
|
||||
fi
|
||||
|
||||
@@ -25,41 +25,41 @@ if bashio::config.true 'openvpn_enabled'; then
|
||||
# Function to check for files path
|
||||
function check_path () {
|
||||
|
||||
# Get variable
|
||||
file="$1"
|
||||
# Get variable
|
||||
file="$1"
|
||||
|
||||
# Loop through each line of the input file
|
||||
while read line
|
||||
do
|
||||
# Check if the line contains a txt file
|
||||
if [[ "$line" =~ \.txt ]] || [[ "$line" =~ \.crt ]]; then
|
||||
# Extract the txt file name from the line
|
||||
file_name="$(echo "$line" | awk -F' ' '{print $2}')"
|
||||
# Check if the txt file exists
|
||||
if [ ! -f "$file_name" ]; then
|
||||
# Check if the txt file exists in the /config/openvpn/ directory
|
||||
if [ -f "/config/openvpn/${file_name##*/}" ]; then
|
||||
# Append /config/openvpn/ in front of the original txt file in the ovpn file
|
||||
sed -i "s/$file_name/\/config\/openvpn\/${file_name##*/}/g" "$file"
|
||||
# Print a success message
|
||||
bashio::log.warning "Appended /config/openvpn/ to ${file_name##*/} in $file"
|
||||
else
|
||||
# Print an error message
|
||||
bashio::log.warning "$file_name is referenced in your ovpn file but does not exist, and can't be found either in the /config/openvpn/ directory"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
done < "$file"
|
||||
# Loop through each line of the input file
|
||||
while read line
|
||||
do
|
||||
# Check if the line contains a txt file
|
||||
if [[ "$line" =~ \.txt ]] || [[ "$line" =~ \.crt ]]; then
|
||||
# Extract the txt file name from the line
|
||||
file_name="$(echo "$line" | awk -F' ' '{print $2}')"
|
||||
# Check if the txt file exists
|
||||
if [ ! -f "$file_name" ]; then
|
||||
# Check if the txt file exists in the /config/openvpn/ directory
|
||||
if [ -f "/config/openvpn/${file_name##*/}" ]; then
|
||||
# Append /config/openvpn/ in front of the original txt file in the ovpn file
|
||||
sed -i "s/$file_name/\/config\/openvpn\/${file_name##*/}/g" "$file"
|
||||
# Print a success message
|
||||
bashio::log.warning "Appended /config/openvpn/ to ${file_name##*/} in $file"
|
||||
else
|
||||
# Print an error message
|
||||
bashio::log.warning "$file_name is referenced in your ovpn file but does not exist, and can't be found either in the /config/openvpn/ directory"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
done < "$file"
|
||||
|
||||
# Standardize lf
|
||||
dos2unix "$file"
|
||||
# Standardize lf
|
||||
dos2unix "$file"
|
||||
|
||||
|
||||
# Correct paths
|
||||
sed -i "s=/etc/openvpn=/config/openvpn=g" "$file"
|
||||
# Correct paths
|
||||
sed -i "s=/etc/openvpn=/config/openvpn=g" "$file"
|
||||
|
||||
}
|
||||
|
||||
|
||||
#####################
|
||||
# CONFIGURE OPENVPN #
|
||||
#####################
|
||||
@@ -76,30 +76,30 @@ dos2unix "$file"
|
||||
check_path /config/openvpn/"$openvpn_config"
|
||||
# Copy potential additional files
|
||||
cp /config/openvpn/* /etc/openvpn/
|
||||
# Standardize file
|
||||
# Standardize file
|
||||
cp /config/openvpn/"${openvpn_config}" /etc/openvpn/config.ovpn
|
||||
# Not correct type
|
||||
# Not correct type
|
||||
else
|
||||
bashio::exit.nok "Configured ovpn file : $openvpn_config is set but does not end by .ovpn ; it can't be used!"
|
||||
fi
|
||||
fi
|
||||
|
||||
# If openvpn_config not set, but folder is not empty
|
||||
# If openvpn_config not set, but folder is not empty
|
||||
else
|
||||
# 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 )
|
||||
# Choose random config
|
||||
VPN_CONFIG="${VPN_CONFIGS[$RANDOM % ${#VPN_CONFIGS[@]}]}"
|
||||
# Get the VPN_CONFIG name without the path and extension
|
||||
openvpn_config="${VPN_CONFIG##*/}"
|
||||
echo "... Openvpn enabled, but openvpn_config option empty. Selecting a random ovpn file : ${openvpn_config}"
|
||||
# Check path
|
||||
check_path /config/openvpn/"${openvpn_config}"
|
||||
# Copy potential additional files
|
||||
cp /config/openvpn/* /etc/openvpn/
|
||||
# Standardize file
|
||||
cp /config/openvpn/"${openvpn_config}" /etc/openvpn/config.ovpn
|
||||
# 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 )
|
||||
# Choose random config
|
||||
VPN_CONFIG="${VPN_CONFIGS[$RANDOM % ${#VPN_CONFIGS[@]}]}"
|
||||
# Get the VPN_CONFIG name without the path and extension
|
||||
openvpn_config="${VPN_CONFIG##*/}"
|
||||
echo "... Openvpn enabled, but openvpn_config option empty. Selecting a random ovpn file : ${openvpn_config}"
|
||||
# Check path
|
||||
check_path /config/openvpn/"${openvpn_config}"
|
||||
# Copy potential additional files
|
||||
cp /config/openvpn/* /etc/openvpn/
|
||||
# Standardize file
|
||||
cp /config/openvpn/"${openvpn_config}" /etc/openvpn/config.ovpn
|
||||
fi
|
||||
|
||||
# Set credentials
|
||||
|
||||
@@ -24,25 +24,25 @@ slug=radarr
|
||||
CONFIG_LOCATION=/config/addons_config/"$slug"/config.xml
|
||||
|
||||
if [ -f "$CONFIG_LOCATION" ]; then
|
||||
# Set UrlBase
|
||||
if ! bashio::config.true "ingress_disabled"; then
|
||||
bashio::log.warning "---------------------------"
|
||||
bashio::log.warning "Ingress is enabled, authentification will be disabled and should be managed through HA itself. If you need authentification, please disable ingress in addon options"
|
||||
bashio::log.warning "---------------------------"
|
||||
# Define UrlBase
|
||||
sed -i "/UrlBase/d" "$CONFIG_LOCATION"
|
||||
sed -i "2a <UrlBase>$slug<\/UrlBase>" "$CONFIG_LOCATION"
|
||||
# Disable local auth
|
||||
sed -i "/AuthenticationType/d" "$CONFIG_LOCATION"
|
||||
sed -i "2a <AuthenticationType>DisabledForLocalAddresses</AuthenticationType>" "$CONFIG_LOCATION"
|
||||
# Disable local auth
|
||||
sed -i "/AuthenticationMethod/d" "$CONFIG_LOCATION"
|
||||
sed -i "2a <AuthenticationMethod>external</AuthenticationMethod>" "$CONFIG_LOCATION"
|
||||
else
|
||||
bashio::log.warning "---------------------------"
|
||||
bashio::log.info "Disabling ingress and enabling authentification"
|
||||
bashio::log.warning "---------------------------"
|
||||
sed -i "/UrlBase/d" "$CONFIG_LOCATION"
|
||||
sed -i "/<AuthenticationMethod>external/d" "$CONFIG_LOCATION"
|
||||
fi
|
||||
# Set UrlBase
|
||||
if ! bashio::config.true "ingress_disabled"; then
|
||||
bashio::log.warning "---------------------------"
|
||||
bashio::log.warning "Ingress is enabled, authentification will be disabled and should be managed through HA itself. If you need authentification, please disable ingress in addon options"
|
||||
bashio::log.warning "---------------------------"
|
||||
# Define UrlBase
|
||||
sed -i "/UrlBase/d" "$CONFIG_LOCATION"
|
||||
sed -i "2a <UrlBase>$slug<\/UrlBase>" "$CONFIG_LOCATION"
|
||||
# Disable local auth
|
||||
sed -i "/AuthenticationType/d" "$CONFIG_LOCATION"
|
||||
sed -i "2a <AuthenticationType>DisabledForLocalAddresses</AuthenticationType>" "$CONFIG_LOCATION"
|
||||
# Disable local auth
|
||||
sed -i "/AuthenticationMethod/d" "$CONFIG_LOCATION"
|
||||
sed -i "2a <AuthenticationMethod>external</AuthenticationMethod>" "$CONFIG_LOCATION"
|
||||
else
|
||||
bashio::log.warning "---------------------------"
|
||||
bashio::log.info "Disabling ingress and enabling authentification"
|
||||
bashio::log.warning "---------------------------"
|
||||
sed -i "/UrlBase/d" "$CONFIG_LOCATION"
|
||||
sed -i "/<AuthenticationMethod>external/d" "$CONFIG_LOCATION"
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -24,26 +24,26 @@ slug=readarr
|
||||
CONFIG_LOCATION=/config/addons_config/"$slug"/config.xml
|
||||
|
||||
if [ -f "$CONFIG_LOCATION" ]; then
|
||||
# Set UrlBase
|
||||
if ! bashio::config.true "ingress_disabled"; then
|
||||
bashio::log.warning "---------------------------"
|
||||
bashio::log.warning "Ingress is enabled, authentification will be disabled and should be managed through HA itself. If you need authentification, please disable ingress in addon options"
|
||||
bashio::log.warning "---------------------------"
|
||||
# Define UrlBase
|
||||
sed -i "/UrlBase/d" "$CONFIG_LOCATION"
|
||||
sed -i "2a <UrlBase>$slug<\/UrlBase>" "$CONFIG_LOCATION"
|
||||
# Disable local auth
|
||||
sed -i "/AuthenticationType/d" "$CONFIG_LOCATION"
|
||||
sed -i "2a <AuthenticationType>DisabledForLocalAddresses</AuthenticationType>" "$CONFIG_LOCATION"
|
||||
# Disable local auth
|
||||
# sed -i "/AuthenticationMethod/d" "$CONFIG_LOCATION"
|
||||
# sed -i "2a <AuthenticationMethod>external</AuthenticationMethod>" "$CONFIG_LOCATION"
|
||||
else
|
||||
bashio::log.warning "---------------------------"
|
||||
bashio::log.info "Disabling ingress and enabling authentification"
|
||||
bashio::log.warning "---------------------------"
|
||||
sed -i "/UrlBase/d" "$CONFIG_LOCATION"
|
||||
sed -i "/<AuthenticationMethod>external/d" "$CONFIG_LOCATION"
|
||||
# sed -i "/<AuthenticationMethod>external/d" "$CONFIG_LOCATION"
|
||||
fi
|
||||
# Set UrlBase
|
||||
if ! bashio::config.true "ingress_disabled"; then
|
||||
bashio::log.warning "---------------------------"
|
||||
bashio::log.warning "Ingress is enabled, authentification will be disabled and should be managed through HA itself. If you need authentification, please disable ingress in addon options"
|
||||
bashio::log.warning "---------------------------"
|
||||
# Define UrlBase
|
||||
sed -i "/UrlBase/d" "$CONFIG_LOCATION"
|
||||
sed -i "2a <UrlBase>$slug<\/UrlBase>" "$CONFIG_LOCATION"
|
||||
# Disable local auth
|
||||
sed -i "/AuthenticationType/d" "$CONFIG_LOCATION"
|
||||
sed -i "2a <AuthenticationType>DisabledForLocalAddresses</AuthenticationType>" "$CONFIG_LOCATION"
|
||||
# Disable local auth
|
||||
# sed -i "/AuthenticationMethod/d" "$CONFIG_LOCATION"
|
||||
# sed -i "2a <AuthenticationMethod>external</AuthenticationMethod>" "$CONFIG_LOCATION"
|
||||
else
|
||||
bashio::log.warning "---------------------------"
|
||||
bashio::log.info "Disabling ingress and enabling authentification"
|
||||
bashio::log.warning "---------------------------"
|
||||
sed -i "/UrlBase/d" "$CONFIG_LOCATION"
|
||||
sed -i "/<AuthenticationMethod>external/d" "$CONFIG_LOCATION"
|
||||
# sed -i "/<AuthenticationMethod>external/d" "$CONFIG_LOCATION"
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -5,7 +5,7 @@ set -e
|
||||
|
||||
# Set configuration directory
|
||||
if [ -d /home/node/.signalk ]; then
|
||||
rm -r /home/node/.signalk
|
||||
rm -r /home/node/.signalk
|
||||
fi
|
||||
ln -sf /config /home/node/.signalk
|
||||
chown -R node:node /config
|
||||
|
||||
@@ -24,25 +24,25 @@ slug=sonarr
|
||||
CONFIG_LOCATION=/config/addons_config/"$slug"/config.xml
|
||||
|
||||
if [ -f "$CONFIG_LOCATION" ]; then
|
||||
# Set UrlBase
|
||||
if ! bashio::config.true "ingress_disabled"; then
|
||||
bashio::log.warning "---------------------------"
|
||||
bashio::log.warning "Ingress is enabled, authentification will be disabled and should be managed through HA itself. If you need authentification, please disable ingress in addon options"
|
||||
bashio::log.warning "---------------------------"
|
||||
# Define UrlBase
|
||||
sed -i "/UrlBase/d" "$CONFIG_LOCATION"
|
||||
sed -i "2a <UrlBase>$slug<\/UrlBase>" "$CONFIG_LOCATION"
|
||||
# Disable local auth
|
||||
sed -i "/AuthenticationType/d" "$CONFIG_LOCATION"
|
||||
sed -i "2a <AuthenticationType>DisabledForLocalAddresses</AuthenticationType>" "$CONFIG_LOCATION"
|
||||
# Disable local auth
|
||||
sed -i "/AuthenticationMethod/d" "$CONFIG_LOCATION"
|
||||
sed -i "2a <AuthenticationMethod>external</AuthenticationMethod>" "$CONFIG_LOCATION"
|
||||
else
|
||||
bashio::log.warning "---------------------------"
|
||||
bashio::log.info "Disabling ingress and enabling authentification"
|
||||
bashio::log.warning "---------------------------"
|
||||
sed -i "/UrlBase/d" "$CONFIG_LOCATION"
|
||||
sed -i "/<AuthenticationMethod>external/d" "$CONFIG_LOCATION"
|
||||
fi
|
||||
# Set UrlBase
|
||||
if ! bashio::config.true "ingress_disabled"; then
|
||||
bashio::log.warning "---------------------------"
|
||||
bashio::log.warning "Ingress is enabled, authentification will be disabled and should be managed through HA itself. If you need authentification, please disable ingress in addon options"
|
||||
bashio::log.warning "---------------------------"
|
||||
# Define UrlBase
|
||||
sed -i "/UrlBase/d" "$CONFIG_LOCATION"
|
||||
sed -i "2a <UrlBase>$slug<\/UrlBase>" "$CONFIG_LOCATION"
|
||||
# Disable local auth
|
||||
sed -i "/AuthenticationType/d" "$CONFIG_LOCATION"
|
||||
sed -i "2a <AuthenticationType>DisabledForLocalAddresses</AuthenticationType>" "$CONFIG_LOCATION"
|
||||
# Disable local auth
|
||||
sed -i "/AuthenticationMethod/d" "$CONFIG_LOCATION"
|
||||
sed -i "2a <AuthenticationMethod>external</AuthenticationMethod>" "$CONFIG_LOCATION"
|
||||
else
|
||||
bashio::log.warning "---------------------------"
|
||||
bashio::log.info "Disabling ingress and enabling authentification"
|
||||
bashio::log.warning "---------------------------"
|
||||
sed -i "/UrlBase/d" "$CONFIG_LOCATION"
|
||||
sed -i "/<AuthenticationMethod>external/d" "$CONFIG_LOCATION"
|
||||
fi
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user