Browse Source

[enh] Enable sharing of the Home's external storage

pull/6/head
Jérôme Lebleu 10 years ago
parent
commit
fa25e50052
  1. 3
      README.md
  2. 11
      scripts/_common.sh
  3. 3
      scripts/install
  4. 3
      scripts/upgrade

3
README.md

@ -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

11
scripts/_common.sh

@ -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() {

3
scripts/install

@ -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 \
'Home' 'local' 'null::null' -c 'datadir=/home/$user'
create_home_external_storage '_exec_occ'
fi fi
# Add dynamic logout URL to the config # Add dynamic logout URL to the config

3
scripts/upgrade

@ -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 \
'Home' 'local' 'null::null' -c 'datadir=/home/$user'
|| create_home_external_storage '_exec_occ'
fi fi
# Add dynamic logout URL to the config # Add dynamic logout URL to the config

Loading…
Cancel
Save