mirror of
https://github.com/YunoHost-Apps/bozon_ynh.git
synced 2024-09-03 18:16:09 +02:00
Merge 4584047561
into f16fc1a21c
This commit is contained in:
commit
7ca9e4095e
2 changed files with 21 additions and 3 deletions
|
@ -9,13 +9,24 @@ source /usr/share/yunohost/helpers
|
||||||
# retrieve arguments
|
# retrieve arguments
|
||||||
app=bozon
|
app=bozon
|
||||||
domain=$1
|
domain=$1
|
||||||
path=${2%/}
|
path=$2
|
||||||
is_public=$3
|
is_public=$3
|
||||||
language=$4
|
language=$4
|
||||||
filesize=$5
|
filesize=$5
|
||||||
admin=$6
|
admin=$6
|
||||||
password=$7
|
password=$7
|
||||||
|
|
||||||
|
|
||||||
|
# chech if / is present at start and not at end
|
||||||
|
if [ "${path:0:1}" != "/" ] && [ ${#path} -gt 0 ]; then
|
||||||
|
# first char is not / && path not empty => add / at start
|
||||||
|
path="/$path"
|
||||||
|
fi
|
||||||
|
if [ "${path:${#path}-1}" == "/" ] && [ ${#path} -gt 1 ]; then
|
||||||
|
# last char is / && path is gretter than /
|
||||||
|
path="${path:0:${#path}-1}"
|
||||||
|
fi
|
||||||
|
|
||||||
# definie useful vars
|
# definie useful vars
|
||||||
parent_path=/var/www
|
parent_path=/var/www
|
||||||
final_path="$parent_path"/"$app"
|
final_path="$parent_path"/"$app"
|
||||||
|
@ -93,16 +104,22 @@ sudo service nginx reload || true
|
||||||
ynh_app_setting_set "$app" unprotected_uris "/"
|
ynh_app_setting_set "$app" unprotected_uris "/"
|
||||||
sudo yunohost app ssowatconf
|
sudo yunohost app ssowatconf
|
||||||
|
|
||||||
|
# add alias line in hosts file
|
||||||
|
echo "127.0.0.1 $domain # $app" | sudo tee -a /etc/hosts
|
||||||
|
|
||||||
# fill the superadmin creation form
|
# fill the superadmin creation form
|
||||||
curl_path=$([ "$path" == "/" ] || echo "$path")
|
curl_path=$([ "$path" == "/" ] || echo "$path")
|
||||||
curl https://"$domain""$curl_path"/ > /dev/null 2>&1
|
curl -k https://"$domain""$curl_path"/ > /dev/null 2>&1
|
||||||
curl -X POST \
|
sleep 1 && curl -kX POST \
|
||||||
--data-urlencode creation="1" \
|
--data-urlencode creation="1" \
|
||||||
--data-urlencode login="$admin" \
|
--data-urlencode login="$admin" \
|
||||||
--data-urlencode pass="$password" \
|
--data-urlencode pass="$password" \
|
||||||
--data-urlencode confirm="$password" \
|
--data-urlencode confirm="$password" \
|
||||||
https://"$domain""$curl_path"/index.php?p=login > /dev/null 2>&1
|
https://"$domain""$curl_path"/index.php?p=login > /dev/null 2>&1
|
||||||
|
|
||||||
|
# remove alias line from hosts file
|
||||||
|
sudo sed -i "/# $app/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" ];
|
if [ "$is_public" = "No" ];
|
||||||
then
|
then
|
||||||
|
|
|
@ -9,6 +9,7 @@ source /usr/share/yunohost/helpers
|
||||||
#retrieve arguments
|
#retrieve arguments
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
domain=$(ynh_app_setting_get "$app" domain)
|
domain=$(ynh_app_setting_get "$app" domain)
|
||||||
|
path=$(ynh_app_setting_get "$app" path)
|
||||||
|
|
||||||
# definie useful vars
|
# definie useful vars
|
||||||
parent_path=/var/www
|
parent_path=/var/www
|
||||||
|
|
Loading…
Add table
Reference in a new issue