From 6cdfbf5fc5d24bffe3a85caa6502fa47e20b5980 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sun, 11 Jun 2023 11:24:45 +0200 Subject: [PATCH] Update _common.sh --- scripts/_common.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/scripts/_common.sh b/scripts/_common.sh index 19e6a36..8e445c1 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -8,6 +8,19 @@ # EXPERIMENTAL HELPERS #================================================= +# Define a function to add an external storage +# Create the external storage for the given folders and enable sharing +create_external_storage() { +local datadir="$1" +local mount_name="$2" +local mount_id=`exec_occ files_external:create --output=json \ + "$mount_name" 'local' 'null::null' -c "datadir=$datadir/data" || true` +! [[ $mount_id =~ ^[0-9]+$ ]] \ + && ynh_print_warn --message="Unable to create external storage" \ + || exec_occ files_external:option "$mount_id" enable_sharing true +} + + # Check if an URL is already handled # usage: is_url_handled --domain=DOMAIN --path=PATH_URI is_url_handled() {