No known key found for this signature in database
GPG Key ID: AE1DCADB6415A156
3 changed files with 67 additions and 14 deletions
@ -0,0 +1,58 @@ |
|||||
|
#!/bin/bash |
||||
|
|
||||
|
#================================================= |
||||
|
# GENERIC STARTING |
||||
|
#================================================= |
||||
|
# IMPORT GENERIC HELPERS |
||||
|
#================================================= |
||||
|
|
||||
|
source scripts/_common.sh |
||||
|
source /usr/share/yunohost/helpers |
||||
|
|
||||
|
#================================================= |
||||
|
# RETRIEVE ARGUMENTS |
||||
|
#================================================= |
||||
|
|
||||
|
app=$YNH_APP_INSTANCE_NAME |
||||
|
|
||||
|
#================================================= |
||||
|
# CHECK IF ARGUMENTS ARE CORRECT |
||||
|
#================================================= |
||||
|
|
||||
|
#================================================= |
||||
|
# DEFINE FUNCTION |
||||
|
#================================================= |
||||
|
|
||||
|
# 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" || true` |
||||
|
! [[ $mount_id =~ ^[0-9]+$ ]] \ |
||||
|
&& ynh_print_warn --message="Unable to create external storage" \ |
||||
|
|| exec_occ files_external:option "$mount_id" enable_sharing true |
||||
|
} |
||||
|
|
||||
|
#================================================= |
||||
|
# SPECIFIC ACTION |
||||
|
#================================================= |
||||
|
# YUNOHOST MULTIMEDIA INTEGRATION |
||||
|
#================================================= |
||||
|
ynh_script_progression --message="Updating multimedia directories..." --weight=6 |
||||
|
|
||||
|
# Build YunoHost multimedia directories |
||||
|
ynh_multimedia_build_main_dir |
||||
|
# Mount the user directory in Nextcloud |
||||
|
exec_occ app:enable files_external |
||||
|
create_external_storage "/home/yunohost.multimedia/\$user" "Multimedia" |
||||
|
create_external_storage "/home/yunohost.multimedia/share" "Shared multimedia" |
||||
|
# Allow nextcloud to write into these directories |
||||
|
ynh_multimedia_addaccess $app |
||||
|
|
||||
|
#================================================= |
||||
|
# END OF SCRIPT |
||||
|
#================================================= |
||||
|
|
||||
|
ynh_script_progression --message="Execution completed" --last |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue