mirror of
https://github.com/YunoHost-Apps/flarum_ynh.git
synced 2024-09-03 18:36:24 +02:00
Use of extra helpers
Make sure $path is correct (the {YNH_PATH%/} doesn't work in every cases
This commit is contained in:
parent
12de58d4a2
commit
a3707289af
1 changed files with 22 additions and 6 deletions
|
@ -1,7 +1,10 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Exit on command errors and treat unset variables as an error
|
# Load extra functions
|
||||||
set -eu
|
source .fonctions
|
||||||
|
|
||||||
|
# Activate TRAP to stop the script if an error is detected
|
||||||
|
TRAP_ON
|
||||||
|
|
||||||
# This is a multi-instance app, meaning it can be installed several times independently
|
# This is a multi-instance app, meaning it can be installed several times independently
|
||||||
# The id of the app as stated in the manifest is available as $YNH_APP_ID
|
# The id of the app as stated in the manifest is available as $YNH_APP_ID
|
||||||
|
@ -17,7 +20,7 @@ app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
# Retrieve arguments
|
# Retrieve arguments
|
||||||
domain=$YNH_APP_ARG_DOMAIN
|
domain=$YNH_APP_ARG_DOMAIN
|
||||||
path=${YNH_APP_ARG_PATH%/}
|
path=$YNH_APP_ARG_PATH
|
||||||
admin=$YNH_APP_ARG_ADMIN
|
admin=$YNH_APP_ARG_ADMIN
|
||||||
title=$YNH_APP_ARG_TITLE
|
title=$YNH_APP_ARG_TITLE
|
||||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||||
|
@ -27,14 +30,27 @@ final_path=$www_path/$app
|
||||||
# Source YunoHost helpers$
|
# Source YunoHost helpers$
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
# Check variables are not empty
|
||||||
|
CHECK_VAR "$app" "app name not set"
|
||||||
|
|
||||||
|
# Check validity of admin user
|
||||||
|
CHECK_USER "$admin"
|
||||||
|
|
||||||
|
# Check and correct path syntax
|
||||||
|
CHECK_PATH
|
||||||
|
|
||||||
|
# Check availibility of path and domain
|
||||||
|
CHECK_DOMAINPATH
|
||||||
|
|
||||||
# Save app settings
|
# Save app settings
|
||||||
ynh_app_setting_set "$app" admin "$admin"
|
ynh_app_setting_set "$app" admin "$admin"
|
||||||
ynh_app_setting_set "$app" is_public "$is_public"
|
ynh_app_setting_set "$app" is_public "$is_public"
|
||||||
ynh_app_setting_set "$app" path "$path"
|
ynh_app_setting_set "$app" path "$path"
|
||||||
|
|
||||||
# Check domain/path availability
|
|
||||||
sudo yunohost app checkurl "${domain}${path}" -a "$app" \
|
# Check final_path availibility. Installation stops if it already exists
|
||||||
|| ynh_die "Path not available: ${domain}${path}"
|
CHECK_FINALPATH
|
||||||
|
sudo mkdir "$final_path"
|
||||||
|
|
||||||
tmp=/tmp/flaruminstall
|
tmp=/tmp/flaruminstall
|
||||||
sudo rm -rf $tmp
|
sudo rm -rf $tmp
|
||||||
|
|
Loading…
Reference in a new issue