mirror of
https://github.com/YunoHost-Apps/galene_ynh.git
synced 2024-09-03 18:36:31 +02:00
Fix
This commit is contained in:
parent
8f3fff2aeb
commit
0b2f7dd1a7
5 changed files with 32 additions and 38 deletions
|
@ -188,14 +188,9 @@ ynh_print_ON
|
||||||
public_ip4="$(curl ip.yunohost.org)" || true
|
public_ip4="$(curl ip.yunohost.org)" || true
|
||||||
public_ip6="$(curl ipv6.yunohost.org)" || true
|
public_ip6="$(curl ipv6.yunohost.org)" || true
|
||||||
|
|
||||||
if [ -n "$public_ip4" ] && ynh_validate_ip4 --ip_address="$public_ip4"
|
if ( [[ -n "$public_ip4" ]] && ynh_validate_ip4 --ip_address="$public_ip4" || [[ -n "$public_ip6" ]] && ynh_validate_ip6 --ip_address="$public_ip6" )
|
||||||
then
|
then
|
||||||
echo "external-ip=$public_ip4" >> "$coturn_config_path"
|
echo "external-ip=${public_ip4}/${public_ip6}" >> "$coturn_config_path"
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -n "$public_ip6" ] && ynh_validate_ip6 --ip_address="$public_ip6"
|
|
||||||
then
|
|
||||||
echo "external-ip=$public_ip6" >> "$coturn_config_path"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ynh_store_file_checksum --file="$coturn_config_path"
|
ynh_store_file_checksum --file="$coturn_config_path"
|
||||||
|
@ -245,6 +240,8 @@ ynh_use_logrotate --logfile "/var/log/$app"
|
||||||
# For any update do it in all files
|
# For any update do it in all files
|
||||||
|
|
||||||
cp ../sources/Coturn_config_rotate.sh $final_path/Coturn_config_rotate.sh
|
cp ../sources/Coturn_config_rotate.sh $final_path/Coturn_config_rotate.sh
|
||||||
|
ynh_replace_string --match_string=__APP__ --replace_string=$app --target_file="$final_path/Coturn_config_rotate.sh"
|
||||||
|
chmod +x $final_path/Coturn_config_rotate.sh
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
|
|
|
@ -87,18 +87,17 @@ ynh_remove_logrotate
|
||||||
# CLOSE A PORT
|
# CLOSE A PORT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
closeport() {
|
if yunohost firewall list | grep -q "\- $turnserver_tls_port$"
|
||||||
local port=$1
|
then
|
||||||
if yunohost firewall list | grep -q "\- $turnserver_tls_port$"
|
ynh_script_progression --message="Closing port $turnserver_tls_port..." --weight=1
|
||||||
then
|
ynh_exec_warn_less yunohost firewall disallow Both $turnserver_tls_port
|
||||||
ynh_script_progression --message="Closing port $turnserver_tls_port port"
|
fi
|
||||||
ynh_exec_warn_less yunohost firewall disallow Both $turnserver_tls_port
|
|
||||||
elif yunohost firewall list | grep -q "\- $turnserver_alt_tls_port$"
|
if yunohost firewall list | grep -q "\- $turnserver_alt_tls_port$"
|
||||||
then
|
then
|
||||||
ynh_script_progression --message="Closing port $turnserver_alt_tls_port port"
|
ynh_script_progression --message="Closing port $turnserver_alt_tls_port..." --weight=1
|
||||||
ynh_exec_warn_less yunohost firewall disallow Both $turnserver_alt_tls_port
|
ynh_exec_warn_less yunohost firewall disallow Both $turnserver_alt_tls_port
|
||||||
fi
|
fi
|
||||||
}
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
|
|
|
@ -103,7 +103,7 @@ yunohost service add coturn-$app --needs_exposed_ports $turnserver_tls_port
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Starting a systemd service..." --weight=3
|
ynh_script_progression --message="Starting a systemd service..." --weight=3
|
||||||
|
|
||||||
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
|
ynh_systemd_action --service_name=$app --action=start --log_path="/var/log/$app/$app.log"
|
||||||
yunohost service add coturn-$app --needs_exposed_ports $turnserver_tls_port
|
yunohost service add coturn-$app --needs_exposed_ports $turnserver_tls_port
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -158,14 +158,9 @@ ynh_print_ON
|
||||||
public_ip4="$(curl ip.yunohost.org)" || true
|
public_ip4="$(curl ip.yunohost.org)" || true
|
||||||
public_ip6="$(curl ipv6.yunohost.org)" || true
|
public_ip6="$(curl ipv6.yunohost.org)" || true
|
||||||
|
|
||||||
if [ -n "$public_ip4" ] && ynh_validate_ip4 --ip_address="$public_ip4"
|
if ( [[ -n "$public_ip4" ]] && ynh_validate_ip4 --ip_address="$public_ip4" || [[ -n "$public_ip6" ]] && ynh_validate_ip6 --ip_address="$public_ip6" )
|
||||||
then
|
then
|
||||||
echo "external-ip=$public_ip4" >> "$coturn_config_path"
|
echo "external-ip=${public_ip4}/${public_ip6}" >> "$coturn_config_path"
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -n "$public_ip6" ] && ynh_validate_ip6 --ip_address="$public_ip6"
|
|
||||||
then
|
|
||||||
echo "external-ip=$public_ip6" >> "$coturn_config_path"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ynh_store_file_checksum --file="$coturn_config_path"
|
ynh_store_file_checksum --file="$coturn_config_path"
|
||||||
|
@ -189,6 +184,7 @@ chown -R $app:root $final_path
|
||||||
chmod -R 755 $final_path
|
chmod -R 755 $final_path
|
||||||
chown -R $app:root /var/log/$app
|
chown -R $app:root /var/log/$app
|
||||||
chown -R $app:root /etc/$app
|
chown -R $app:root /etc/$app
|
||||||
|
chown turnserver:root $coturn_config_path
|
||||||
chmod -R u=rwX,g=rX,o= /etc/$app
|
chmod -R u=rwX,g=rX,o= /etc/$app
|
||||||
chmod 770 $final_path/Coturn_config_rotate.sh
|
chmod 770 $final_path/Coturn_config_rotate.sh
|
||||||
setfacl -R -m user:turnserver:rX /etc/$app
|
setfacl -R -m user:turnserver:rX /etc/$app
|
||||||
|
|
|
@ -181,14 +181,9 @@ ynh_print_ON
|
||||||
public_ip4="$(curl ip.yunohost.org)" || true
|
public_ip4="$(curl ip.yunohost.org)" || true
|
||||||
public_ip6="$(curl ipv6.yunohost.org)" || true
|
public_ip6="$(curl ipv6.yunohost.org)" || true
|
||||||
|
|
||||||
if [ -n "$public_ip4" ] && ynh_validate_ip4 --ip_address="$public_ip4"
|
if ( [[ -n "$public_ip4" ]] && ynh_validate_ip4 --ip_address="$public_ip4" || [[ -n "$public_ip6" ]] && ynh_validate_ip6 --ip_address="$public_ip6" )
|
||||||
then
|
then
|
||||||
echo "external-ip=$public_ip4" >> "$coturn_config_path"
|
echo "external-ip=${public_ip4}/${public_ip6}" >> "$coturn_config_path"
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -n "$public_ip6" ] && ynh_validate_ip6 --ip_address="$public_ip6"
|
|
||||||
then
|
|
||||||
echo "external-ip=$public_ip6" >> "$coturn_config_path"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ynh_store_file_checksum --file="$coturn_config_path"
|
ynh_store_file_checksum --file="$coturn_config_path"
|
||||||
|
@ -201,6 +196,8 @@ ynh_store_file_checksum --file="$coturn_config_path"
|
||||||
# For any update do it in all files
|
# For any update do it in all files
|
||||||
|
|
||||||
cp ../sources/Coturn_config_rotate.sh $final_path/Coturn_config_rotate.sh
|
cp ../sources/Coturn_config_rotate.sh $final_path/Coturn_config_rotate.sh
|
||||||
|
ynh_replace_string --match_string=__APP__ --replace_string=$app --target_file="$final_path/Coturn_config_rotate.sh"
|
||||||
|
chmod +x $final_path/Coturn_config_rotate.sh
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# MODIFY A CONFIG FILE
|
# MODIFY A CONFIG FILE
|
||||||
|
@ -262,6 +259,7 @@ chown -R $app:root $final_path
|
||||||
chmod -R 755 $final_path
|
chmod -R 755 $final_path
|
||||||
chown -R $app:root /var/log/$app
|
chown -R $app:root /var/log/$app
|
||||||
chown -R $app:root /etc/$app
|
chown -R $app:root /etc/$app
|
||||||
|
chown turnserver:root $coturn_config_path
|
||||||
chmod -R u=rwX,g=rX,o= /etc/$app
|
chmod -R u=rwX,g=rX,o= /etc/$app
|
||||||
chmod 770 $final_path/Coturn_config_rotate.sh
|
chmod 770 $final_path/Coturn_config_rotate.sh
|
||||||
setfacl -R -m user:turnserver:rX /etc/$app
|
setfacl -R -m user:turnserver:rX /etc/$app
|
||||||
|
|
|
@ -3,19 +3,23 @@
|
||||||
|
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
external_IP_line="external-ip=__IPV4__,__IPV6__"
|
external_IP_line="external-ip=__IPV4__/__IPV6__"
|
||||||
|
|
||||||
public_ip4="$(curl ip.yunohost.org)" || true
|
public_ip4="$(curl ip.yunohost.org)" || true
|
||||||
public_ip6="$(curl ipv6.yunohost.org)" || true
|
public_ip6="$(curl ipv6.yunohost.org)" || true
|
||||||
|
|
||||||
if [ -n "$public_ip4" ] && ynh_validate_ip4 --ip_address="$public_ip4"
|
if [ -n "$public_ip4" ] && ynh_validate_ip4 --ip_address="$public_ip4"
|
||||||
then
|
then
|
||||||
echo "external-ip=$public_ip4" >> "$coturn_config_path"
|
external_IP_line="${external_IP_line/'__IPV4__'/$public_ip4}"
|
||||||
|
else
|
||||||
|
external_IP_line="${external_IP_line/'__IPV4__,'/}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$public_ip6" ] && ynh_validate_ip6 --ip_address="$public_ip6"
|
if [ -n "$public_ip6" ] && ynh_validate_ip6 --ip_address="$public_ip6"
|
||||||
then
|
then
|
||||||
echo "external-ip=$public_ip6" >> "$coturn_config_path"
|
external_IP_line="${external_IP_line/'__IPV6__'/$public_ip6}"
|
||||||
|
else
|
||||||
|
external_IP_line="${external_IP_line/',__IPV6__'/}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
old_config_line=$(egrep "^external-ip=.*\$" "/etc/$app/coturn.conf")
|
old_config_line=$(egrep "^external-ip=.*\$" "/etc/$app/coturn.conf")
|
||||||
|
@ -26,7 +30,7 @@ setfacl -R -m user:turnserver:rX /etc/$app
|
||||||
|
|
||||||
if [ "$old_config_line" != "$new_config_line" ]
|
if [ "$old_config_line" != "$new_config_line" ]
|
||||||
then
|
then
|
||||||
systemctl restart coturn-$app.service
|
systemctl restart coturn-__APP__.service
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
Loading…
Add table
Reference in a new issue