diff --git a/scripts/install b/scripts/install index 5684d69..e5ba5dc 100644 --- a/scripts/install +++ b/scripts/install @@ -9,6 +9,8 @@ admin=$3 is_public=$4 password=$5 +domain=${$domain%/} + # Check domain/path availability sudo yunohost app checkurl $domain$path -a $app @@ -49,9 +51,14 @@ sudo yunohost app setting $app unprotected_uris -v "/" #get the html page sudo curl -kL -o /tmp/install_page.html https://$domain/$path/install.php >/dev/null 2>&1 #get the token for form validation -token=$(sudo cat /tmp/install_page.html | grep "input" | grep "token" | tail -1 | cut -d' ' -f3 | cut -d'"' -f2) +page=$(cat /tmp/install_page.html) +input=$(echo $page | grep "input") +token_lines=$(echo $input | grep "token") +last_token_line=$(echo $token_lines | tail -1) +token_line_attribute=$(echo $last_token_line | cut -d' ' -f3) +token_value=$(echo token_line_attribute | cut -d'"' -f2) #send http POST values -sudo curl -k -X POST --data "default_lang=fr&timezone=Greenland&install=Installer&name=$admin&login=$admin&pwd=$password&pwd2=$password&token=$token" https://$domain/$path/install.php >/dev/null 2>&1 +sudo curl -k -X POST --data "default_lang=fr&timezone=Greenland&install=Installer&name=$admin&login=$admin&pwd=$password&pwd2=$password&token=$token_value" https://$domain/$path/install.php >/dev/null 2>&1 sudo chmod 750 -R $final_path # If app is private, remove url to SSOWat conf from skipped_uris