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
|
||||
|
||||
# Exit on command errors and treat unset variables as an error
|
||||
set -eu
|
||||
# Load extra functions
|
||||
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
|
||||
# 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
|
||||
domain=$YNH_APP_ARG_DOMAIN
|
||||
path=${YNH_APP_ARG_PATH%/}
|
||||
path=$YNH_APP_ARG_PATH
|
||||
admin=$YNH_APP_ARG_ADMIN
|
||||
title=$YNH_APP_ARG_TITLE
|
||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||
|
@ -27,14 +30,27 @@ final_path=$www_path/$app
|
|||
# Source 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
|
||||
ynh_app_setting_set "$app" admin "$admin"
|
||||
ynh_app_setting_set "$app" is_public "$is_public"
|
||||
ynh_app_setting_set "$app" path "$path"
|
||||
|
||||
# Check domain/path availability
|
||||
sudo yunohost app checkurl "${domain}${path}" -a "$app" \
|
||||
|| ynh_die "Path not available: ${domain}${path}"
|
||||
|
||||
# Check final_path availibility. Installation stops if it already exists
|
||||
CHECK_FINALPATH
|
||||
sudo mkdir "$final_path"
|
||||
|
||||
tmp=/tmp/flaruminstall
|
||||
sudo rm -rf $tmp
|
||||
|
|
Loading…
Reference in a new issue