mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-05-31 12:54:04 +02:00
cleaning
This commit is contained in:
@@ -1,30 +0,0 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# ==============================================================================
|
||||
# This files check if all user configuration requirements are met
|
||||
# ==============================================================================
|
||||
|
||||
# Check authentication requirements, if enabled
|
||||
if bashio::config.true 'authentication_required'; then
|
||||
if ! bashio::config.has_value 'username'; then
|
||||
bashio::exit.nok 'Transmission authentication is enabled, but no username was specified'
|
||||
fi
|
||||
|
||||
if ! bashio::config.has_value 'password'; then
|
||||
bashio::exit.nok 'Transmission authentication is enabled, but no password was specified'
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check OpenVPN requirements, if enabled
|
||||
if bashio::config.true 'openvpn_enabled'; then
|
||||
if ! bashio::config.has_value 'openvpn_username'; then
|
||||
bashio::exit.nok 'OpenVPN is enabled, but no username was specified'
|
||||
fi
|
||||
|
||||
if ! bashio::config.has_value 'openvpn_password'; then
|
||||
bashio::exit.nok 'OpenVPN is enabled, but no password was specified'
|
||||
fi
|
||||
|
||||
if ! bashio::fs.file_exists "/config/openvpn/$(bashio::config 'openvpn_config').ovpn"; then
|
||||
bashio::exit.nok "The configured /config/openvpn/$(bashio::config 'openvpn_config').ovpn file is not found"
|
||||
fi
|
||||
fi
|
||||
@@ -2,9 +2,6 @@
|
||||
# ==============================================================================
|
||||
|
||||
declare CONFIG
|
||||
declare authentication_required
|
||||
declare username
|
||||
declare password
|
||||
declare incomplete_bool
|
||||
declare download_dir
|
||||
declare incomplete_dir
|
||||
@@ -21,28 +18,13 @@ CONFIG=$(</share/transmission/settings.json)
|
||||
|
||||
download_dir=$(bashio::config 'download_dir')
|
||||
incomplete_dir=$(bashio::config 'incomplete_dir')
|
||||
if ! bashio::config.is_empty 'incomplete_dir'; then
|
||||
incomplete_bool=false ; else
|
||||
incomplete_bool=true
|
||||
fi
|
||||
|
||||
# Defaults
|
||||
CONFIG=$(bashio::jq "${CONFIG}" ".\"incomplete-dir\"=\"${incomplete_dir}\"")
|
||||
CONFIG=$(bashio::jq "${CONFIG}" ".\"download-dir\"=\"${download_dir}\"")
|
||||
CONFIG=$(bashio::jq "${CONFIG}" ".\"incomplete-dir-enabled\"=${incomplete_bool}")
|
||||
CONFIG=$(bashio::jq "${CONFIG}" ".\"incomplete-dir-enabled\"=true")
|
||||
CONFIG=$(bashio::jq "${CONFIG}" ".\"rpc-whitelist-enabled\"=false")
|
||||
CONFIG=$(bashio::jq "${CONFIG}" ".\"rpc-host-whitelist-enabled\"=false")
|
||||
CONFIG=$(bashio::jq "${CONFIG}" ".\"bind-address-ipv4\"=\"0.0.0.0\"")
|
||||
|
||||
authentication_required=$(bashio::config 'authentication_required')
|
||||
CONFIG=$(bashio::jq "${CONFIG}" ".\"rpc-authentication-required\"=${authentication_required}")
|
||||
|
||||
|
||||
username=$(bashio::config 'username')
|
||||
CONFIG=$(bashio::jq "${CONFIG}" ".\"rpc-username\"=\"${username}\"")
|
||||
|
||||
|
||||
password=$(bashio::config 'password')
|
||||
CONFIG=$(bashio::jq "${CONFIG}" ".\"rpc-password\"=\"${password}\"")
|
||||
|
||||
echo "${CONFIG}" > /share/transmission/settings.json
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# ==============================================================================
|
||||
|
||||
declare openvpn_config
|
||||
declare openvpn_username
|
||||
declare openvpn_password
|
||||
|
||||
if bashio::config.true 'openvpn_enabled'; then
|
||||
|
||||
openvpn_config=$(bashio::config 'openvpn_config')
|
||||
|
||||
cp "/config/openvpn/${openvpn_config}.ovpn" /etc/openvpn/config.ovpn
|
||||
|
||||
openvpn_username=$(bashio::config 'openvpn_username')
|
||||
echo "${openvpn_username}" > /etc/openvpn/credentials
|
||||
openvpn_password=$(bashio::config 'openvpn_password')
|
||||
echo "${openvpn_password}" >> /etc/openvpn/credentials
|
||||
|
||||
sed -i 's/auth-user-pass.*/auth-user-pass \/etc\/openvpn\/credentials/g' /etc/openvpn/config.ovpn
|
||||
|
||||
sed -i "1a\/etc/openvpn/up-transmission.sh \"\${4}\" &\n" /etc/openvpn/up.sh
|
||||
|
||||
fi
|
||||
@@ -1,29 +0,0 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# ==============================================================================
|
||||
declare port
|
||||
declare certfile
|
||||
declare ingress_interface
|
||||
declare ingress_port
|
||||
declare keyfile
|
||||
|
||||
port=$(bashio::addon.port 80)
|
||||
if bashio::var.has_value "${port}"; then
|
||||
bashio::config.require.ssl
|
||||
|
||||
if bashio::config.true 'ssl'; then
|
||||
certfile=$(bashio::config 'certfile')
|
||||
keyfile=$(bashio::config 'keyfile')
|
||||
|
||||
mv /etc/nginx/servers/direct-ssl.disabled /etc/nginx/servers/direct.conf
|
||||
sed -i "s/%%certfile%%/${certfile}/g" /etc/nginx/servers/direct.conf
|
||||
sed -i "s/%%keyfile%%/${keyfile}/g" /etc/nginx/servers/direct.conf
|
||||
|
||||
else
|
||||
mv /etc/nginx/servers/direct.disabled /etc/nginx/servers/direct.conf
|
||||
fi
|
||||
fi
|
||||
|
||||
ingress_port=$(bashio::addon.ingress_port)
|
||||
ingress_interface=$(bashio::addon.ip_address)
|
||||
sed -i "s/%%port%%/${ingress_port}/g" /etc/nginx/servers/ingress.conf
|
||||
sed -i "s/%%interface%%/${ingress_interface}/g" /etc/nginx/servers/ingress.conf
|
||||
Reference in New Issue
Block a user