From 2737911d076388fc78fe4cb731828c294dd2bf8d Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sat, 15 Oct 2022 22:25:49 +0200 Subject: [PATCH] More translations --- demo_lxc_build.sh | 88 +++++++++++++++++++++++-------------------- demo_lxc_destroy.sh | 10 +++-- demo_restore_crash.sh | 26 +++++++------ demo_start.sh | 14 +++++-- demo_stop.sh | 16 +++++--- demo_switch.sh | 7 +++- demo_upgrade.sh | 10 ++--- ynh_lxd | 8 ++-- 8 files changed, 105 insertions(+), 74 deletions(-) diff --git a/demo_lxc_build.sh b/demo_lxc_build.sh index 84a2985..7811351 100755 --- a/demo_lxc_build.sh +++ b/demo_lxc_build.sh @@ -32,23 +32,26 @@ lxc_base="ynh-dev-$DIST-$ARCH-$YNH_BRANCH-base" LOG=Build_lxc.log LOG_BUILD_LXC="$final_path/$LOG" -if $(ynh_lxc_exists --name="$name") -then # Si le conteneur existe déjà - ynh_print_info --message="> Suppression du conteneur existant." | tee -a "$LOG_BUILD_LXC" 2>&1 +date | tee -a "$LOG_BUILD_LXC" 2>&1 +ynh_print_info --message=">> Starting demo build." | tee -a "$LOG_BUILD_LXC" 2>&1 + +if ynh_lxc_exists --name="$name" +then + ynh_print_info --message="> Deleting existing LXC containers." | tee -a "$LOG_BUILD_LXC" 2>&1 /bin/bash "$final_path/demo_lxc_destroy.sh" quiet | tee -a "$LOG_BUILD_LXC" 2>&1 fi -ynh_print_info --message="> Création d'une machine debian $DIST minimaliste" | tee -a "$LOG_BUILD_LXC" 2>&1 +ynh_print_info --message="> Creating a YunoHost $DIST $ARCH $YNH_BRANCH" | tee -a "$LOG_BUILD_LXC" 2>&1 ynh_lxc_create --image="$lxc_base" --name="$lxc_name1" | tee -a "$LOG_BUILD_LXC" 2>&1 -ynh_print_info --message= "> Active le bridge réseau" | tee -a "$LOG_BUILD_LXC" 2>&1 +ynh_print_info --message= "> Creating the $lxdbr_demo_name bridge" | tee -a "$LOG_BUILD_LXC" 2>&1 lxc network attach $lxdbr_demo_name $lxc_name1 eth1 eth1 | tee -a "$LOG_BUILD_LXC" 2>&1 -ynh_print_info --message="> Configuration réseau de la machine virtualisée" | tee -a "$LOG_BUILD_LXC" 2>&1 +ynh_print_info --message="> Configuring network of the LXC container" | tee -a "$LOG_BUILD_LXC" 2>&1 ynh_lxc_run_inside --name="$lxc_name1" --command="cp /etc/systemd/network/eth0.network /etc/systemd/network/eth1.network" ynh_lxc_run_inside --name="$lxc_name1" --command="sed -i s/eth0/eth1/g /etc/systemd/network/eth1.network" -ynh_print_info --message="> Update de la machine virtualisée" | tee -a "$LOG_BUILD_LXC" 2>&1 +ynh_print_info --message="> Update of the LXC container" | tee -a "$LOG_BUILD_LXC" 2>&1 ynh_lxc_run_inside --name="$lxc_name1" --command="apt-get -y update" ynh_lxc_run_inside --name="$lxc_name1" --command="apt-get -y full-upgrade" ynh_lxc_run_inside --name="$lxc_name1" --command="apt-get -y autoremove" @@ -60,65 +63,64 @@ ynh_lxc_run_inside --name="$lxc_name1" --command="yunohost tools postinstall --d ynh_print_info --message="> Disable password strength" | tee -a "$LOG_BUILD_LXC" 2>&1 ynh_lxc_run_inside --name="$lxc_name1" --command="yunohost settings set security.password.user.strength -v -1" | tee -a "$LOG_BUILD_LXC" 2>&1 -ynh_print_info --message="> Ajout de l'utilisateur de demo" | tee -a "$LOG_BUILD_LXC" 2>&1 +ynh_print_info --message="> Add demo user" | tee -a "$LOG_BUILD_LXC" 2>&1 ynh_lxc_run_inside --name="$lxc_name1" --command="yunohost user create $demo_user --firstname $demo_user --lastname $demo_user --domain $domain --password $demo_password" | tee -a "$LOG_BUILD_LXC" 2>&1 -ynh_print_info --message="> Vérification de l'état de Yunohost" | tee -a "$LOG_BUILD_LXC" 2>&1 +ynh_print_info --message="> Check YunoHost state" | tee -a "$LOG_BUILD_LXC" 2>&1 ynh_lxc_run_inside --name="$lxc_name1" --command="yunohost -v" | tee -a "$LOG_BUILD_LXC" 2>&1 # ******** -ynh_print_info --message="> Modification de Yunohost pour la demo" | tee -a "$LOG_BUILD_LXC" 2>&1 + +ynh_print_info --message="> Installing demo apps" | tee -a "$LOG_BUILD_LXC" 2>&1 if [ ${DONT_INSTALL_FOR_NOW:-0} -eq 1 ]; then -# App officielles -ynh_print_info --message="> Installation des applications officielles" | tee -a "$LOG_BUILD_LXC" 2>&1 # Ampache -ynh_print_info --message="Installation de Ampache" | tee -a "$LOG_BUILD_LXC" 2>&1 +ynh_print_info --message="installing Ampache" | tee -a "$LOG_BUILD_LXC" 2>&1 ynh_lxc_run_inside --name="$lxc_name1" --command="yunohost app install ampache --force --args \"domain=$domain&path=/ampache&admin=$demo_user&is_public=1&\"" | tee -a "$LOG_BUILD_LXC" 2>&1 # Baikal -ynh_print_info --message="Installation de baikal" | tee -a "$LOG_BUILD_LXC" 2>&1 +ynh_print_info --message="installing baikal" | tee -a "$LOG_BUILD_LXC" 2>&1 ynh_lxc_run_inside --name="$lxc_name1" --command="yunohost app install baikal --force --args \"domain=$domain&path=/baikal&password=$demo_password&\"" | tee -a "$LOG_BUILD_LXC" 2>&1 # Agendav ynh_print_info --message="Installation d'agendav" | tee -a "$LOG_BUILD_LXC" 2>&1 ynh_lxc_run_inside --name="$lxc_name1" --command="yunohost app install agendav --force --args \"domain=$domain&path=/agendav&language=en&\"" | tee -a "$LOG_BUILD_LXC" 2>&1 # Dokuwiki -ynh_print_info --message="Installation de dokuwiki" | tee -a "$LOG_BUILD_LXC" 2>&1 +ynh_print_info --message="installing dokuwiki" | tee -a "$LOG_BUILD_LXC" 2>&1 ynh_lxc_run_inside --name="$lxc_name1" --command="yunohost app install dokuwiki --force --args \"domain=$domain&path=/dokuwiki&admin=$demo_user&is_public=1&language=en&\"" | tee -a "$LOG_BUILD_LXC" 2>&1 # Etherpad -ynh_print_info --message="Installation de etherpad" | tee -a "$LOG_BUILD_LXC" 2>&1 +ynh_print_info --message="installing etherpad" | tee -a "$LOG_BUILD_LXC" 2>&1 ynh_lxc_run_inside --name="$lxc_name1" --command="yunohost app install etherpad_mypads --force --args \"domain=$domain&path=/etherpad&admin=$demo_user&password=administration&language=en&is_public=1&export=none&mypads=1&useldap=0&\"" | tee -a "$LOG_BUILD_LXC" 2>&1 # Hextris -ynh_print_info --message="Installation de hextris" | tee -a "$LOG_BUILD_LXC" 2>&1 +ynh_print_info --message="installing hextris" | tee -a "$LOG_BUILD_LXC" 2>&1 ynh_lxc_run_inside --name="$lxc_name1" --command="yunohost app install hextris --force --args \"domain=$domain&path=/hextris&is_public=1&\"" | tee -a "$LOG_BUILD_LXC" 2>&1 # Jirafeau -ynh_print_info --message="Installation de jirafeau" | tee -a "$LOG_BUILD_LXC" 2>&1 +ynh_print_info --message="installing jirafeau" | tee -a "$LOG_BUILD_LXC" 2>&1 ynh_lxc_run_inside --name="$lxc_name1" --command="yunohost app install jirafeau --force --args \"domain=$domain&path=/jirafeau&admin_user=$demo_user&upload_password=$demo_password&is_public=1&\"" | tee -a "$LOG_BUILD_LXC" 2>&1 # Kanboard -ynh_print_info --message="Installation de kanboard" | tee -a "$LOG_BUILD_LXC" 2>&1 +ynh_print_info --message="installing kanboard" | tee -a "$LOG_BUILD_LXC" 2>&1 ynh_lxc_run_inside --name="$lxc_name1" --command="yunohost app install kanboard --force --args \"domain=$domain&path=/kanboard&admin=$demo_user&is_public=1&\"" | tee -a "$LOG_BUILD_LXC" 2>&1 # Nextcloud -ynh_print_info --message="Installation de nextcloud" | tee -a "$LOG_BUILD_LXC" 2>&1 +ynh_print_info --message="installing nextcloud" | tee -a "$LOG_BUILD_LXC" 2>&1 ynh_lxc_run_inside --name="$lxc_name1" --command="yunohost app install nextcloud --force --args \"domain=$domain&path=/nextcloud&admin=$demo_user&user_home=0&is_public=1&\"" | tee -a "$LOG_BUILD_LXC" 2>&1 # Opensondage -ynh_print_info --message="Installation de opensondage" | tee -a "$LOG_BUILD_LXC" 2>&1 +ynh_print_info --message="installing opensondage" | tee -a "$LOG_BUILD_LXC" 2>&1 ynh_lxc_run_inside --name="$lxc_name1" --command="yunohost app install opensondage --force --args \"domain=$domain&path=/date&admin=$demo_user&language=en&is_public=1&\"" | tee -a "$LOG_BUILD_LXC" 2>&1 # Phpmyadmin -ynh_print_info --message="Installation de phpmyadmin" | tee -a "$LOG_BUILD_LXC" 2>&1 +ynh_print_info --message="installing phpmyadmin" | tee -a "$LOG_BUILD_LXC" 2>&1 ynh_lxc_run_inside --name="$lxc_name1" --command="yunohost app install phpmyadmin --force --args \"domain=$domain&path=/phpmyadmin&admin=$demo_user&\"" | tee -a "$LOG_BUILD_LXC" 2>&1 # Piwigo -ynh_print_info --message="Installation de piwigo" | tee -a "$LOG_BUILD_LXC" 2>&1 +ynh_print_info --message="installing piwigo" | tee -a "$LOG_BUILD_LXC" 2>&1 ynh_lxc_run_inside --name="$lxc_name1" --command="yunohost app install piwigo --force --args \"domain=$domain&path=/piwigo&admin=$demo_user&is_public=1&language=en&\"" | tee -a "$LOG_BUILD_LXC" 2>&1 # Rainloop -ynh_print_info --message="Installation de rainloop" | tee -a "$LOG_BUILD_LXC" 2>&1 +ynh_print_info --message="installing rainloop" | tee -a "$LOG_BUILD_LXC" 2>&1 ynh_lxc_run_inside --name="$lxc_name1" --command="yunohost app install rainloop --force --args \"domain=$domain&path=/rainloop&is_public=No&password=$demo_password&ldap=Yes&language=en&\"" | tee -a "$LOG_BUILD_LXC" 2>&1 # Roundcube -ynh_print_info --message="Installation de roundcube" | tee -a "$LOG_BUILD_LXC" 2>&1 +ynh_print_info --message="installing roundcube" | tee -a "$LOG_BUILD_LXC" 2>&1 ynh_lxc_run_inside --name="$lxc_name1" --command="yunohost app install roundcube --force --args \"domain=$domain&path=/webmail&with_carddav=0&with_enigma=0&language=en_GB&\"" | tee -a "$LOG_BUILD_LXC" 2>&1 # Searx -ynh_print_info --message="Installation de searx" | tee -a "$LOG_BUILD_LXC" 2>&1 +ynh_print_info --message="installing searx" | tee -a "$LOG_BUILD_LXC" 2>&1 ynh_lxc_run_inside --name="$lxc_name1" --command="yunohost app install searx --force --args \"domain=$domain&path=/searx&is_public=1&\"" | tee -a "$LOG_BUILD_LXC" 2>&1 # Shellinabox -ynh_print_info --message="Installation de shellinabox" | tee -a "$LOG_BUILD_LXC" 2>&1 +ynh_print_info --message="installing shellinabox" | tee -a "$LOG_BUILD_LXC" 2>&1 ynh_lxc_run_inside --name="$lxc_name1" --command="yunohost app install shellinabox --force --args \"domain=$domain&path=/ssh&\"" | tee -a "$LOG_BUILD_LXC" 2>&1 # Désactive l'accès à shellinabox ynh_lxc_run_inside --name="$lxc_name1" --command="rm /etc/nginx/conf.d/$domain.d/shellinabox.conf" @@ -126,46 +128,47 @@ ynh_lxc_run_inside --name="$lxc_name1" --command="yunohost app setting shellinab ynh_lxc_run_inside --name="$lxc_name1" --command="yunohost app setting shellinabox domain -d" ynh_lxc_run_inside --name="$lxc_name1" --command="yunohost app ssowatconf" # Strut -ynh_print_info --message="Installation de strut" | tee -a "$LOG_BUILD_LXC" 2>&1 +ynh_print_info --message="installing strut" | tee -a "$LOG_BUILD_LXC" 2>&1 ynh_lxc_run_inside --name="$lxc_name1" --command="yunohost app install strut --force --args \"domain=$domain&path=/strut&is_public=1&\"" | tee -a "$LOG_BUILD_LXC" 2>&1 # Transmission -ynh_print_info --message="Installation de transmission" | tee -a "$LOG_BUILD_LXC" 2>&1 +ynh_print_info --message="installing transmission" | tee -a "$LOG_BUILD_LXC" 2>&1 ynh_lxc_run_inside --name="$lxc_name1" --command="yunohost app install transmission --force --args \"domain=$domain&path=/torrent&\"" | tee -a "$LOG_BUILD_LXC" 2>&1 # Ttrss -ynh_print_info --message="Installation de ttrss" | tee -a "$LOG_BUILD_LXC" 2>&1 +ynh_print_info --message="installing ttrss" | tee -a "$LOG_BUILD_LXC" 2>&1 ynh_lxc_run_inside --name="$lxc_name1" --command="yunohost app install ttrss --force --args \"domain=$domain&path=/ttrss&is_public=1&\"" | tee -a "$LOG_BUILD_LXC" 2>&1 # Wallabag -ynh_print_info --message="Installation de wallabag" | tee -a "$LOG_BUILD_LXC" 2>&1 +ynh_print_info --message="installing wallabag" | tee -a "$LOG_BUILD_LXC" 2>&1 ynh_lxc_run_inside --name="$lxc_name1" --command="yunohost app install wallabag2 --force --args \"domain=$domain&path=/wallabag&admin=$demo_user&\"" | tee -a "$LOG_BUILD_LXC" 2>&1 # Wordpress -ynh_print_info --message="Installation de wordpress" | tee -a "$LOG_BUILD_LXC" 2>&1 +ynh_print_info --message="installing wordpress" | tee -a "$LOG_BUILD_LXC" 2>&1 ynh_lxc_run_inside --name="$lxc_name1" --command="yunohost app install wordpress --force --args \"domain=$domain&path=/blog&admin=$demo_user&language=en_US&multisite=0&is_public=1&\"" | tee -a "$LOG_BUILD_LXC" 2>&1 # Zerobin -ynh_print_info --message="Installation de zerobin" | tee -a "$LOG_BUILD_LXC" 2>&1 +ynh_print_info --message="installing zerobin" | tee -a "$LOG_BUILD_LXC" 2>&1 ynh_lxc_run_inside --name="$lxc_name1" --command="yunohost app install zerobin --force --args \"domain=$domain&path=/zerobin&is_public=1&\"" | tee -a "$LOG_BUILD_LXC" 2>&1 fi + # ******** -ynh_print_info --message="> Création d'un snapshot" | tee -a "$LOG_BUILD_LXC" 2>&1 +ynh_print_info --message="> Creating a snapshot for $lxc_name1" | tee -a "$LOG_BUILD_LXC" 2>&1 ynh_lxc_create_snapshot --name="$lxc_name1" --snapname="snap0" -ynh_print_info --message="> Mise à jour de la machine virtualisée" | tee -a "$LOG_BUILD_LXC" 2>&1 +ynh_print_info --message="> Upgrading the $lxc_name1" | tee -a "$LOG_BUILD_LXC" 2>&1 ynh_lxc_stop --name="$lxc_name1" | tee -a "$LOG_BUILD_LXC" 2>&1 ynh_lxc_upgrade_demo --name=$lxc_name1 --time_to_switch=$time_to_switch -ynh_print_info --message="> Clone la machine" | tee -a "$LOG_BUILD_LXC" 2>&1 -lxc copy "$lxc_name1" "$lxc_name2" | tee -a "$LOG_BUILD_LXC" 2>&1 +ynh_print_info --message="> Cloning $lxc_name1 to $lxc_name2" | tee -a "$LOG_BUILD_LXC" 2>&1 +ynh_lxc_clone --source="$lxc_name1" --destination="$lxc_name2" | tee -a "$LOG_BUILD_LXC" 2>&1 -ynh_print_info --message="> Création d'un snapshot" | tee -a "$LOG_BUILD_LXC" 2>&1 +ynh_print_info --message="> Creating a snapshot for $lxc_name2" | tee -a "$LOG_BUILD_LXC" 2>&1 ynh_lxc_create_snapshot --name="$lxc_name2" --snapname="snap0" -ynh_print_info --message="> Mise en place du cron de switch" | tee -a "$LOG_BUILD_LXC" 2>&1 +ynh_print_info --message="> Setuping the switch cron" | tee -a "$LOG_BUILD_LXC" 2>&1 ynh_add_config --template="$final_path/conf/cron_demo_switch" --destination="/etc/cron.d/demo_switch" -ynh_print_info --message="> Et du cron d'upgrade" | tee -a "$LOG_BUILD_LXC" 2>&1 +ynh_print_info --message="> and the upgrade cron" | tee -a "$LOG_BUILD_LXC" 2>&1 ynh_add_config --template="$final_path/conf/cron_demo_upgrade" --destination="/etc/cron.d/demo_upgrade" -ynh_print_info --message="> Mise en place du service" | tee -a "$LOG_BUILD_LXC" 2>&1 +ynh_print_info --message="> Setuping the service" | tee -a "$LOG_BUILD_LXC" 2>&1 #ynh_add_systemd_config --template="$final_path/conf/systemd.service" ynh_add_systemd_config @@ -174,3 +177,6 @@ yunohost service add $app --log="/var/log/$app/$app.log" ynh_print_info --message="> Starting a systemd service..." | tee -a "$LOG_BUILD_LXC" 2>&1 ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" + +date | tee -a "$LOG_BUILD_LXC" 2>&1 +ynh_print_info --message=">> Demo build finished." | tee -a "$LOG_BUILD_LXC" 2>&1 diff --git a/demo_lxc_destroy.sh b/demo_lxc_destroy.sh index 575b34b..d78e83e 100755 --- a/demo_lxc_destroy.sh +++ b/demo_lxc_destroy.sh @@ -17,19 +17,21 @@ lxdbr_demo_network=$(ynh_app_setting_get --app=$app --key=lxdbr_demo_network) lxc_ip1=$(ynh_app_setting_get --app=$app --key=lxc_ip1) lxc_ip2=$(ynh_app_setting_get --app=$app --key=lxc_ip2) +ynh_print_info --message=">> Starting demo destroy." + /bin/bash "$final_path/demo_stop.sh" -f -ynh_print_info --message="> Suppression des conteneurs et de leur snapshots" +ynh_print_info --message="> Deleting containers and snapshots" ynh_secure_remove --file="/var/lib/lxd/snapshots/$lxc_name1/snap0.tar.gz" ynh_lxc_delete --name=$lxc_name1 ynh_secure_remove --file="/var/lib/lxd/snapshots/$lxc_name2/snap0.tar.gz" ynh_lxc_delete --name=$lxc_name2 -ynh_print_info --message="> Suppression des crons" +ynh_print_info --message="> Deleting crons" ynh_secure_remove --file=/etc/cron.d/demo_switch ynh_secure_remove --file=/etc/cron.d/demo_upgrade -ynh_print_info --message="> Suppression du service" +ynh_print_info --message="> Deleting service" if ynh_exec_warn_less yunohost service status $app >/dev/null then ynh_print_info --message="Removing $app service integration..." @@ -37,3 +39,5 @@ then fi ynh_print_info --message="Stopping and removing the systemd service..." ynh_remove_systemd_config + +ynh_print_info --message=">> Finished demo destroy." diff --git a/demo_restore_crash.sh b/demo_restore_crash.sh index 76d8478..a9236fe 100755 --- a/demo_restore_crash.sh +++ b/demo_restore_crash.sh @@ -17,10 +17,12 @@ lxc_ip2=$(ynh_app_setting_get --app=$app --key=lxc_ip2) lxc_name1=$(ynh_app_setting_get --app=$app --key=lxc_name1) lxc_name2=$(ynh_app_setting_get --app=$app --key=lxc_name2) -ynh_print_info --message="Désactive le cron switch." +ynh_print_info --message=">> Starting demo restore from crash." + +ynh_print_info --message="> Disabling switch cron." sed -i "s/.*demo_switch.sh/#&/" /etc/cron.d/demo_switch # Le cron est commenté durant l'opération de maintenance. -ynh_print_info --message="Suppression des lock et arrêt forcé des conteneurs." +ynh_print_info --message="> Deleting locks and stoping LXC containers." ynh_secure_remove --file="/var/lib/lxd/$lxc_name1.lock_fileS" ynh_secure_remove --file="/var/lib/lxd/$lxc_name2.lock_fileS" ynh_secure_remove --file="/var/lib/lxd/$lxc_name1.lock_fileU" @@ -36,14 +38,14 @@ ynh_lxc_check_container_start --name=$lxc_name2 LXC2_STATUS=$? if [ $LXC1_STATUS -eq 1 ]; then - ynh_print_info --message="> Conteneur $lxc_name1 en défaut." + ynh_print_info --message="> LXC container $lxc_name1 is broken." else - ynh_print_info --message="> Conteneur $lxc_name1 en état de marche." + ynh_print_info --message="> LXC container $lxc_name1 is working." fi if [ $LXC2_STATUS -eq 1 ]; then - ynh_print_info --message="> Conteneur $lxc_name2 en défaut." + ynh_print_info --message="> LXC container $lxc_name2 is broken." else - ynh_print_info --message="> Conteneur $lxc_name2 en état de marche." + ynh_print_info --message="> LXC container $lxc_name2 is working." fi # Restauration des snapshots @@ -79,16 +81,18 @@ fi # Résultats finaux if [ $LXC1_STATUS -eq 1 ] || [ $LXC2_STATUS -eq 1 ]; then if [ $LXC1_STATUS -eq 1 ]; then - ynh_print_info --message="> Le conteneur $lxc_name1 n'a pas pu être réparé..." + ynh_print_info --message="> $lxc_name1 LXC container can't be repaired..." fi if [ $LXC2_STATUS -eq 1 ]; then - ynh_print_info --message="> Le conteneur $lxc_name2 n'a pas pu être réparé..." + ynh_print_info --message="> $lxc_name2 LXC container can't be repaired..." fi else - ynh_print_info --message="> Les 2 conteneurs sont sains et fonctionnels." + ynh_print_info --message="> The 2 LXC containers are working." fi -ynh_print_info --message="Réactive le cron switch." +ynh_print_info --message="> Enabling switch cron." sed -i "s/#*\*/\*/" /etc/cron.d/demo_switch # Le cron est décommenté -ynh_print_info --message="Restart la demo." +ynh_print_info --message="> Restart the demo." $final_path/demo_start.sh + +ynh_print_info --message=">> Finished demo restore from crash." diff --git a/demo_start.sh b/demo_start.sh index a2be13a..6aff977 100755 --- a/demo_start.sh +++ b/demo_start.sh @@ -15,11 +15,17 @@ 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) +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 + /bin/bash "$final_path/demo_stop.sh" > /dev/null 2>&1 # Démarrage de la machine -ynh_print_info --message="> Démarrage de la machine" | tee -a "$final_path/demo_boot.log" -date | tee -a "$final_path/demo_boot.log" -ynh_print_info --message="Starting $lxc_name1" | tee -a "$final_path/demo_boot.log" -ynh_lxc_start_as_demo --name=$lxc_name1 --ip="$lxdbr_demo_network$lxc_ip1" | tee -a "$final_path/demo_boot.log" +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 sleep 3 + +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 diff --git a/demo_stop.sh b/demo_stop.sh index d4dd1e5..8e3cd63 100755 --- a/demo_stop.sh +++ b/demo_stop.sh @@ -14,26 +14,29 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) lxc_name1=$(ynh_app_setting_get --app=$app --key=lxc_name1) lxc_name2=$(ynh_app_setting_get --app=$app --key=lxc_name2) +date | tee -a "$final_path/demo_boot.log" 2>&1 +ynh_print_info --message=">> Stopping demo." | tee -a "$final_path/demo_boot.log" 2>&1 + if [ "$#" -eq 1 ] && [ "$1" == "-f" ] then - ynh_print_info --message="> Suppression des lock et arrêt forcé des conteneurs." + ynh_print_info --message="> Deleting locks and force stopping LXC containers." | tee -a "$final_path/demo_boot.log" 2>&1 ynh_secure_remove --file="/var/lib/lxd/$lxc_name1.lock_fileS" ynh_secure_remove --file="/var/lib/lxd/$lxc_name2.lock_fileS" ynh_secure_remove --file="/var/lib/lxd/$lxc_name1.lock_fileU" ynh_secure_remove --file="/var/lib/lxd/$lxc_name2.lock_fileU" else - ynh_print_info --message="> Attend la libération des lock sur les conteneurs." + ynh_print_info --message="> Waiting locks." | tee -a "$final_path/demo_boot.log" 2>&1 while test -e /var/lib/lxd/$lxc_name1.lock_file* || test -e /var/lib/lxd/$lxc_name2.lock_file*; do sleep 5 # Attend que les conteneur soit libérés par les script upgrade ou switch, le cas échéant. done fi -ynh_print_info --message="> Arrêt des conteneurs" +ynh_print_info --message="> Stopping LXC containers" | tee -a "$final_path/demo_boot.log" 2>&1 if ynh_lxc_exists --name=$lxc_name1 then if ! ynh_lxc_is_stopped --name=$lxc_name1 then - ynh_print_info --message="Arrêt du conteneur $lxc_name1" + ynh_print_info --message="Stopping $lxc_name1 LXC container" | tee -a "$final_path/demo_boot.log" 2>&1 ynh_lxc_stop_as_demo --name=$lxc_name1 fi fi @@ -41,7 +44,10 @@ if ynh_lxc_exists --name=$lxc_name2 then if ! ynh_lxc_is_stopped --name=$lxc_name2 then - ynh_print_info --message="Arrêt du conteneur $lxc_name2" + ynh_print_info --message="Stopping $lxc_name2 LXC container" ynh_lxc_stop_as_demo --name=$lxc_name2 fi fi + +date | tee -a "$final_path/demo_boot.log" 2>&1 +ynh_print_info --message=">> Finished stopping demo." | tee -a "$final_path/demo_boot.log" 2>&1 diff --git a/demo_switch.sh b/demo_switch.sh index 9ad9f3c..2786269 100755 --- a/demo_switch.sh +++ b/demo_switch.sh @@ -22,7 +22,9 @@ path_url=$(ynh_app_setting_get --app=$app --key=path) log_line=$(wc -l "$final_path/demo_switch.log" | cut -d ' ' -f 1) # Repère la fin du log actuel. Pour récupérer les lignes ajoutées sur cette exécution. log_line=$(( $log_line + 1 )) # Ignore la première ligne, reprise de l'ancien log. -date >> "$final_path/demo_switch.log" + +date | tee -a "$final_path/demo_switch.log" 2>&1 +ynh_print_info --message=">> Switching demo." | tee -a "$final_path/demo_switch.log" 2>&1 while test -e /var/lib/lxd/$lxc_name1.lock_file* || test -e /var/lib/lxd/$lxc_name2.lock_file*; do sleep 5 # Attend que le conteneur soit libéré par les script upgrade ou switch, le cas échéant. @@ -72,3 +74,6 @@ else ynh_secure_remove --file="/var/lib/lxd/$LXC_A.lock_fileS" # Libère le lock ynh_print_info --message="Finish restoring $LXC_A" fi + +date | tee -a "$final_path/demo_switch.log" 2>&1 +ynh_print_info --message=">> Finished switching demo." | tee -a "$final_path/demo_switch.log" 2>&1 diff --git a/demo_upgrade.sh b/demo_upgrade.sh index 87b3e4b..7150ca5 100755 --- a/demo_upgrade.sh +++ b/demo_upgrade.sh @@ -17,16 +17,16 @@ lxc_name1=$(ynh_app_setting_get --app=$app --key=lxc_name1) lxc_name2=$(ynh_app_setting_get --app=$app --key=lxc_name2) time_to_switch=$(ynh_app_setting_get --app=$app --key=time_to_switch) -IP_UPGRADE=$lxdbr_demo_network.150 LOOP=0 log_line=$(wc -l "$final_path/demo_upgrade.log" | cut -d ' ' -f 1) # Repère la fin du log actuel. Pour récupérer les lignes ajoutées sur cette exécution. log_line=$(( $log_line + 1 )) # Ignore la première ligne, reprise de l'ancien log. -date >> "$final_path/demo_upgrade.log" +date | tee -a "$final_path/demo_upgrade.log" 2>&1 +ynh_print_info --message=">> Upgrading demo." | tee -a "$final_path/demo_upgrade.log" 2>&1 -ynh_print_info --message="Starting upgrade..." -date ynh_lxc_upgrade_demo --name=$lxc_name1 --time_to_switch=$time_to_switch ynh_lxc_upgrade_demo --name=$lxc_name2 --time_to_switch=$time_to_switch -ynh_print_info --message="Upgrade finished..." + +date | tee -a "$final_path/demo_upgrade.log" 2>&1 +ynh_print_info --message=">> Finished upgrading demo." | tee -a "$final_path/demo_upgrade.log" 2>&1 diff --git a/ynh_lxd b/ynh_lxd index 7c1b65a..846e6cc 100644 --- a/ynh_lxd +++ b/ynh_lxd @@ -547,10 +547,10 @@ ynh_lxc_restore_from_snapshot () { ynh_lxc_load_snapshot --name=$name --snapname=snap0 if ynh_lxc_check_container_start --name=$name then - ynh_print_info --message="\e[92m> Conteneur $name en état de marche.\e[0m" + ynh_print_info --message="\e[92m> LXC container $name is working.\e[0m" return 0 else - ynh_print_info --message="\e[91m> Conteneur $name en défaut.\e[0m" + ynh_print_info --message="\e[91m> LXC container $name is broken.\e[0m" return 1 fi } @@ -608,9 +608,9 @@ ynh_lxc_clone() { ynh_lxc_check_container_start --name=$destination STATUS=$? if [ $STATUS -eq 1 ]; then - ynh_print_info --message="\e[91m> Conteneur $destination en défaut.\e[0m" + ynh_print_info --message="\e[91m> LXC container $destination is broken.\e[0m" else - ynh_print_info --message="\e[92m> Conteneur $destination en état de marche.\e[0m" + ynh_print_info --message="\e[92m> LXC container $destination is working.\e[0m" ynh_print_info --message= "Création d'un nouveau snapshot pour le conteneur $destination" ynh_lxc_create_snapshot --name="$destination" --snapname="snap0" fi