mirror of
https://github.com/YunoHost-Apps/nextcloud_ynh.git
synced 2024-09-03 19:55:57 +02:00
[enh] Enable sharing of the Home's external storage
This commit is contained in:
parent
feb5ac0ebc
commit
fa25e50052
4 changed files with 15 additions and 5 deletions
|
@ -16,7 +16,8 @@ this package:
|
||||||
|
|
||||||
* Integrate with YunoHost users and SSO - i.e. logout button
|
* Integrate with YunoHost users and SSO - i.e. logout button
|
||||||
* Allow one user to be the administrator (set at the installation)
|
* Allow one user to be the administrator (set at the installation)
|
||||||
* Optionally access the user home folder from Nextcloud files (set at the installation)
|
* Optionally access the user home folder from Nextcloud files (set at the
|
||||||
|
installation, the sharing is enabled by default)
|
||||||
* Serve `/.well-known` paths for CalDAV and CardDAV on the domain only if it's
|
* Serve `/.well-known` paths for CalDAV and CardDAV on the domain only if it's
|
||||||
not already served - i.e. by Baïkal
|
not already served - i.e. by Baïkal
|
||||||
|
|
||||||
|
|
|
@ -72,6 +72,17 @@ exec_occ() {
|
||||||
php occ --no-interaction --no-ansi "$@")
|
php occ --no-interaction --no-ansi "$@")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Create the external storage for the home folders and enable sharing
|
||||||
|
# usage: create_home_external_storage OCC_COMMAND
|
||||||
|
create_home_external_storage() {
|
||||||
|
local OCC=$1
|
||||||
|
local mount_id=`$OCC files_external:create --output=json \
|
||||||
|
'Home' 'local' 'null::null' -c 'datadir=/home/$user' || true`
|
||||||
|
! [[ $mount_id =~ ^[0-9]+$ ]] \
|
||||||
|
&& echo "Unable to create external storage" 1>&2 \
|
||||||
|
|| $OCC files_external:option "$mount_id" enable_sharing true
|
||||||
|
}
|
||||||
|
|
||||||
# Check if an URL is already handled
|
# Check if an URL is already handled
|
||||||
# usage: is_url_handled URL
|
# usage: is_url_handled URL
|
||||||
is_url_handled() {
|
is_url_handled() {
|
||||||
|
|
|
@ -122,8 +122,7 @@ _exec_occ ldap:test-config \'\' \
|
||||||
# Enable External Storage and create local mount to home folder
|
# Enable External Storage and create local mount to home folder
|
||||||
if [[ $user_home -eq 1 ]]; then
|
if [[ $user_home -eq 1 ]]; then
|
||||||
_exec_occ app:enable files_external
|
_exec_occ app:enable files_external
|
||||||
_exec_occ files_external:create \
|
create_home_external_storage '_exec_occ'
|
||||||
'Home' 'local' 'null::null' -c 'datadir=/home/$user'
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Add dynamic logout URL to the config
|
# Add dynamic logout URL to the config
|
||||||
|
|
|
@ -196,8 +196,7 @@ if [[ ${user_home} -eq 1 ]]; then
|
||||||
_exec_occ app:enable files_external
|
_exec_occ app:enable files_external
|
||||||
_exec_occ files_external:list --output=json \
|
_exec_occ files_external:list --output=json \
|
||||||
| grep -q '"storage":"\\\\OC\\\\Files\\\\Storage\\\\Local"' \
|
| grep -q '"storage":"\\\\OC\\\\Files\\\\Storage\\\\Local"' \
|
||||||
|| _exec_occ files_external:create \
|
|| create_home_external_storage '_exec_occ'
|
||||||
'Home' 'local' 'null::null' -c 'datadir=/home/$user'
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Add dynamic logout URL to the config
|
# Add dynamic logout URL to the config
|
||||||
|
|
Loading…
Add table
Reference in a new issue