2023-08-13 12:37:17 +02:00
|
|
|
#!/bin/bash
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
ynh_abort_if_errors
|
|
|
|
|
2024-05-13 17:08:11 +02:00
|
|
|
function get__upload_url() {
|
|
|
|
# Gotta have this to prevent the infamous "Config panel question should be initialized with a value during install or upgrade."
|
|
|
|
# (at least on bookworm which is has tighter consistency etc)
|
|
|
|
echo ""
|
|
|
|
}
|
|
|
|
|
2023-08-13 12:37:17 +02:00
|
|
|
function run__upload_button() {
|
|
|
|
local data_dir=$(ynh_app_setting_get --app=$app --key=data_dir)
|
|
|
|
local filename="$(echo "$upload_url" | awk -F/ '{print $NF}')"
|
|
|
|
ynh_print_info --message="Downloading file…"
|
2023-08-13 13:42:12 +02:00
|
|
|
wget --tries 3 --no-dns-cache --timeout 900 --output-document="$data_dir/$filename" "$upload_url" 2>&1
|
2023-08-13 12:37:17 +02:00
|
|
|
ynh_print_info --message="Adding file to Kiwix library"
|
|
|
|
$install_dir/kiwix-manage $data_dir/library.xml add "$data_dir/$filename"
|
|
|
|
yunohost service restart kiwix
|
|
|
|
}
|
|
|
|
|
|
|
|
ynh_app_config_run $1
|