1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/pluxml_ynh.git synced 2024-09-03 20:16:02 +02:00

[enh] #20: form install: resolve domain name with '--resolve' curl option.

- instead of modifying '/etc/hosts'.
This commit is contained in:
Moul 2017-04-05 19:09:10 +02:00
parent 29f0f568d3
commit 3c9860d5b4

View file

@ -63,9 +63,6 @@ ynh_app_setting_set "$app" unprotected_uris "/"
sudo service nginx reload sudo service nginx reload
sudo yunohost app ssowatconf sudo yunohost app ssowatconf
# Temporary add domain name to /etc/hosts
sudo sed -i "1 i\127.0.0.1 $domain #pluxml_hosts" /etc/hosts
# Make request to install app # Make request to install app
# Get the html page # Get the html page
curl_path=$([ "$path" == "/" ] || echo $path) curl_path=$([ "$path" == "/" ] || echo $path)
@ -74,7 +71,7 @@ curl -kL -o install_page.html https://$domain$curl_path/install.php >/dev/null 2
# Get the token for form validation # Get the token for form validation
token=$(cat install_page.html | grep "input" | grep "token" | tail -1 | cut -d' ' -f3 | cut -d'"' -f2) token=$(cat install_page.html | grep "input" | grep "token" | tail -1 | cut -d' ' -f3 | cut -d'"' -f2)
# Send http POST values # Send http POST values
curl -k -X POST \ curl -k -X POST --resolve "$domain:443:localhost"\
--data-urlencode "default_lang=$default_lang" \ --data-urlencode "default_lang=$default_lang" \
--data-urlencode "install=Installer" \ --data-urlencode "install=Installer" \
--data-urlencode "name=$admin" \ --data-urlencode "name=$admin" \
@ -86,9 +83,6 @@ curl -k -X POST \
sudo rm -f $src_path/install.php sudo rm -f $src_path/install.php
# Remove domain name from /etc/hosts
sudo sed -i "/#pluxml_hosts/d" /etc/hosts
# If app is private, remove url to SSOWat conf from skipped_uris # If app is private, remove url to SSOWat conf from skipped_uris
if [ "$is_public" == "No" ]; then if [ "$is_public" == "No" ]; then
ynh_app_setting_delete "$app" unprotected_uris ynh_app_setting_delete "$app" unprotected_uris