47 lines
1.2 KiB
Bash
47 lines
1.2 KiB
Bash
#!/bin/bash
|
|
#=================================================
|
|
# GENERIC STARTING
|
|
#=================================================
|
|
# IMPORT GENERIC HELPERS
|
|
#=================================================
|
|
|
|
source _common.sh
|
|
source /usr/share/yunohost/helpers
|
|
|
|
ynh_abort_if_errors
|
|
|
|
#=================================================
|
|
# RETRIEVE ARGUMENTS
|
|
#=================================================
|
|
|
|
final_path=$(ynh_app_setting_get $app final_path)
|
|
node_id=$(ynh_app_setting_get $app node_id)
|
|
command="$final_path/garage -c $final_path/garage.toml"
|
|
|
|
get_weight() {
|
|
ynh_app_setting_get --app=$app --key=weight
|
|
}
|
|
|
|
set_weight() {
|
|
$command layout assign $node_id -c $weight
|
|
apply_layout "$command"
|
|
ynh_app_setting_set --app=$app --key=weight --value=$weight
|
|
}
|
|
|
|
|
|
get_peers() {
|
|
ynh_app_setting_get --app=$app --key=bootstrap_peers
|
|
}
|
|
|
|
set_peers() {
|
|
garage_connect "$command" "$bootstrap_peers"
|
|
apply_layout "$command"
|
|
ynh_app_setting_set --app=$app --key=bootstrap_peers --value=$bootstrap_peers
|
|
}
|
|
|
|
|
|
#=================================================
|
|
# GENERIC FINALIZATION
|
|
#=================================================
|
|
ynh_app_config_run $1
|