2016-08-12 17:35:14 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2022-10-13 05:46:46 +02:00
|
|
|
# Démarre le premier conteneur de demo
|
2016-08-13 01:08:44 +02:00
|
|
|
|
2016-08-12 17:35:14 +02:00
|
|
|
# Récupère le dossier du script
|
2016-09-18 19:23:54 +02:00
|
|
|
if [ "${0:0:1}" == "/" ]; then script_dir="$(dirname "$0")"; else script_dir="$(echo $PWD/$(dirname "$0" | cut -d '.' -f2) | sed 's@/$@@')"; fi
|
2016-08-12 17:35:14 +02:00
|
|
|
|
2022-10-13 05:46:46 +02:00
|
|
|
source $script_dir/ynh_lxd
|
|
|
|
source $script_dir/ynh_lxd_demo
|
|
|
|
source /usr/share/yunohost/helpers
|
2016-08-12 17:35:14 +02:00
|
|
|
|
2022-10-13 05:46:46 +02:00
|
|
|
app=${__APP__:-yunohost_demo}
|
|
|
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
|
|
|
lxc_name1=$(ynh_app_setting_get --app=$app --key=lxc_name1)
|
|
|
|
lxdbr_demo_network=$(ynh_app_setting_get --app=$app --key=lxdbr_demo_network)
|
|
|
|
lxc_ip1=$(ynh_app_setting_get --app=$app --key=lxc_ip1)
|
2016-08-12 17:35:14 +02:00
|
|
|
|
2022-10-15 22:25:49 +02:00
|
|
|
date | tee -a "$final_path/demo_boot.log" 2>&1
|
|
|
|
ynh_print_info --message=">> Starting demo." | tee -a "$final_path/demo_boot.log" 2>&1
|
|
|
|
|
2022-10-13 05:46:46 +02:00
|
|
|
/bin/bash "$final_path/demo_stop.sh" > /dev/null 2>&1
|
2016-08-12 17:35:14 +02:00
|
|
|
|
|
|
|
# Démarrage de la machine
|
2022-10-15 22:25:49 +02:00
|
|
|
ynh_print_info --message="> Démarrage de la machine" | tee -a "$final_path/demo_boot.log" 2>&1
|
|
|
|
date | tee -a "$final_path/demo_boot.log" 2>&1
|
|
|
|
ynh_print_info --message="Starting $lxc_name1" | tee -a "$final_path/demo_boot.log" 2>&1
|
|
|
|
ynh_lxc_start_as_demo --name=$lxc_name1 --ip="$lxdbr_demo_network$lxc_ip1" | tee -a "$final_path/demo_boot.log" 2>&1
|
2016-08-12 17:35:14 +02:00
|
|
|
sleep 3
|
2022-10-15 22:25:49 +02:00
|
|
|
|
|
|
|
date | tee -a "$final_path/demo_boot.log" 2>&1
|
|
|
|
ynh_print_info --message=">> Finished starting demo." | tee -a "$final_path/demo_boot.log" 2>&1
|