#!/bin/bash

# Exit hook on subcommand error or unset variable
set -eu

# Source YNH helpers
source /usr/share/yunohost/helpers

# Backup destination
backup_dir="${1}/data/multimedia"

if [ ! -e "/home/yunohost.multimedia" ] || [ -e "/home/yunohost.multimedia/.nobackup" ]; then
    exit 0
fi

# Backup multimedia directory
ynh_backup --src_path="/home/yunohost.multimedia" --dest_path="${backup_dir}" --is_big --not_mandatory
