mirror of
https://github.com/YunoHost-Apps/rainloop_ynh.git
synced 2024-09-03 20:16:18 +02:00
Use of .fonctions for easier maintenance
This commit is contained in:
parent
add5d2f2f0
commit
5d0e31beb3
2 changed files with 16 additions and 20 deletions
|
@ -1,12 +1,16 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Exit on command errors and treat unset variables as an error
|
||||
set -eu
|
||||
# It also activate set -eu
|
||||
source .fonctions
|
||||
TRAP_ON
|
||||
|
||||
# Initial data
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
rainloop_version='1.10.5.192'
|
||||
rainloop_version=$(cat ../sources/rainloop_version)
|
||||
|
||||
# Source app helpers
|
||||
. /usr/share/yunohost/helpers
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
# Retrieve arguments
|
||||
domain=$YNH_APP_ARG_DOMAIN
|
||||
|
@ -16,17 +20,11 @@
|
|||
ldap=$YNH_APP_ARG_LDAP
|
||||
lang=$YNH_APP_ARG_LANG
|
||||
|
||||
# Correct path
|
||||
if [ "${path:0:1}" != "/" ]; then
|
||||
path="/$path"
|
||||
fi
|
||||
if [ "${path:${#path}-1}" == "/" ] && [ ${#path} -gt 1 ]; then
|
||||
path="${path:0:${#path}-1}"
|
||||
fi
|
||||
# Correct path using .fonctions
|
||||
CHECK_PATH
|
||||
|
||||
# Check domain/path availability
|
||||
sudo yunohost app checkurl "${domain}${path}" -a "$app" \
|
||||
|| ynh_die "Path not available: ${domain}${path}"
|
||||
# Check domain/path availability using .fonctions
|
||||
CHECK_DOMAINPATH
|
||||
|
||||
# Use 'rainloop' as database name and user
|
||||
dbuser=$app
|
||||
|
@ -38,7 +36,9 @@
|
|||
ynh_app_setting_set "$app" mysqlpwd "$dbpass"
|
||||
|
||||
# Create the final path and copy sources
|
||||
CHECK_FINALPATH
|
||||
final_path=/var/www/$app
|
||||
|
||||
rainloop_path=${final_path}/app
|
||||
|
||||
sudo rm -rf $final_path
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
# Source app helpers
|
||||
source /usr/share/yunohost/helpers
|
||||
source .fonctions
|
||||
|
||||
# Retrieve arguments
|
||||
domain=$(ynh_app_setting_get "$app" domain)
|
||||
|
@ -34,13 +35,8 @@
|
|||
db_user=$app
|
||||
plugins=$(ynh_app_setting_get "$app" plugins)
|
||||
|
||||
# Correct path
|
||||
if [ "${path:0:1}" != "/" ]; then
|
||||
path="/$path"
|
||||
fi
|
||||
if [ "${path:${#path}-1}" == "/" ] && [ ${#path} -gt 1 ]; then
|
||||
path="${path:0:${#path}-1}"
|
||||
fi
|
||||
# Correct path using .fonctions
|
||||
CHECK_PATH
|
||||
|
||||
# no update for db now...
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue