|
|
|
@ -16,10 +16,11 @@ dbuser=$app |
|
|
|
. /usr/share/yunohost/helpers |
|
|
|
|
|
|
|
# Retrieve app settings |
|
|
|
domain=$(ynh_app_setting_get $app domain) |
|
|
|
path=$(ynh_app_setting_get $app path) |
|
|
|
domain=$(ynh_app_setting_get "$app" domain) |
|
|
|
path=$(ynh_app_setting_get "$app" path) |
|
|
|
path=${path%/} |
|
|
|
dbpass=$(ynh_app_setting_get $app mysqlpwd) |
|
|
|
dbpass=$(ynh_app_setting_get "$app" mysqlpwd) |
|
|
|
user_home=$(ynh_app_setting_get "$app" user_home) |
|
|
|
|
|
|
|
# Check destination directory |
|
|
|
DESTDIR="/var/www/$app" |
|
|
|
@ -73,9 +74,6 @@ sed -i "s@#DOMAIN#@${domain}@g" ../conf/config.json |
|
|
|
sed -i "s@#DATADIR#@${DATADIR}@g" ../conf/config.json |
|
|
|
sudo cp ../conf/config.json "${TMPDIR}/config.json" |
|
|
|
|
|
|
|
# Copy configuration for external storage plugin |
|
|
|
sudo cp ../conf/mount.json "$DATADIR" |
|
|
|
|
|
|
|
# Enable maintenance mode |
|
|
|
_exec_occ maintenance:mode --on |
|
|
|
|
|
|
|
@ -104,12 +102,22 @@ _exec_occ app:enable user_ldap |
|
|
|
_exec_occ config:import "$oc_conf" |
|
|
|
sudo rm -f "$oc_conf" |
|
|
|
|
|
|
|
# Enable External Storage and create local mount as needed |
|
|
|
_exec_occ app:enable files_external |
|
|
|
_exec_occ files_external:list --output=json \ |
|
|
|
| grep -q '"storage":"\\\\OC\\\\Files\\\\Storage\\\\Local"' \ |
|
|
|
|| _exec_occ files_external:create \ |
|
|
|
'Home' 'local' 'null::null' -c 'datadir=/home/$user' |
|
|
|
# Guess user_home value if empty |
|
|
|
if [[ -z "${user_home:-}" ]]; then |
|
|
|
sudo cat "${DATADIR}/mount.json" >/dev/null 2>&1 \ |
|
|
|
&& user_home=1 \ |
|
|
|
|| user_home=0 |
|
|
|
ynh_app_setting_set "$app" user_home "$user_home" |
|
|
|
fi |
|
|
|
|
|
|
|
# Enable External Storage and create local mount to home folder as needed |
|
|
|
if [[ ${user_home} -eq 1 ]]; then |
|
|
|
_exec_occ app:enable files_external |
|
|
|
_exec_occ files_external:list --output=json \ |
|
|
|
| grep -q '"storage":"\\\\OC\\\\Files\\\\Storage\\\\Local"' \ |
|
|
|
|| _exec_occ files_external:create \ |
|
|
|
'Home' 'local' 'null::null' -c 'datadir=/home/$user' |
|
|
|
fi |
|
|
|
|
|
|
|
# Add dynamic logout URL to the config |
|
|
|
# TODO: if changes are made to this section, replace it with new one. |
|
|
|
|