1
0
Fork 0
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:
polytan02 2017-02-24 11:31:09 +00:00
parent add5d2f2f0
commit 5d0e31beb3
2 changed files with 16 additions and 20 deletions

View file

@ -1,12 +1,16 @@
#!/bin/bash #!/bin/bash
# Exit on command errors and treat unset variables as an error # 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 app=$YNH_APP_INSTANCE_NAME
rainloop_version='1.10.5.192' rainloop_version=$(cat ../sources/rainloop_version)
# Source app helpers # Source app helpers
. /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
# Retrieve arguments # Retrieve arguments
domain=$YNH_APP_ARG_DOMAIN domain=$YNH_APP_ARG_DOMAIN
@ -16,17 +20,11 @@
ldap=$YNH_APP_ARG_LDAP ldap=$YNH_APP_ARG_LDAP
lang=$YNH_APP_ARG_LANG lang=$YNH_APP_ARG_LANG
# Correct path # Correct path using .fonctions
if [ "${path:0:1}" != "/" ]; then CHECK_PATH
path="/$path"
fi
if [ "${path:${#path}-1}" == "/" ] && [ ${#path} -gt 1 ]; then
path="${path:0:${#path}-1}"
fi
# Check domain/path availability # Check domain/path availability using .fonctions
sudo yunohost app checkurl "${domain}${path}" -a "$app" \ CHECK_DOMAINPATH
|| ynh_die "Path not available: ${domain}${path}"
# Use 'rainloop' as database name and user # Use 'rainloop' as database name and user
dbuser=$app dbuser=$app
@ -38,7 +36,9 @@
ynh_app_setting_set "$app" mysqlpwd "$dbpass" ynh_app_setting_set "$app" mysqlpwd "$dbpass"
# Create the final path and copy sources # Create the final path and copy sources
CHECK_FINALPATH
final_path=/var/www/$app final_path=/var/www/$app
rainloop_path=${final_path}/app rainloop_path=${final_path}/app
sudo rm -rf $final_path sudo rm -rf $final_path

View file

@ -22,6 +22,7 @@
# Source app helpers # Source app helpers
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
source .fonctions
# Retrieve arguments # Retrieve arguments
domain=$(ynh_app_setting_get "$app" domain) domain=$(ynh_app_setting_get "$app" domain)
@ -34,13 +35,8 @@
db_user=$app db_user=$app
plugins=$(ynh_app_setting_get "$app" plugins) plugins=$(ynh_app_setting_get "$app" plugins)
# Correct path # Correct path using .fonctions
if [ "${path:0:1}" != "/" ]; then CHECK_PATH
path="/$path"
fi
if [ "${path:${#path}-1}" == "/" ] && [ ${#path} -gt 1 ]; then
path="${path:0:${#path}-1}"
fi
# no update for db now... # no update for db now...