mirror of
https://github.com/YunoHost/yunohost_demo.git
synced 2024-09-03 19:56:44 +02:00
Corrections upgrade
This commit is contained in:
parent
2100c34202
commit
1385046253
2 changed files with 23 additions and 11 deletions
|
@ -124,8 +124,6 @@ echo -e "Installation de searx" | tee -a "$LOG_BUILD_LXC"
|
||||||
ssh $ARG_SSH $LXC_NAME1 "sudo yunohost app install searx -a \"domain=$DOMAIN&path=/searx&is_public=Yes\"" | tee -a "$LOG_BUILD_LXC"
|
ssh $ARG_SSH $LXC_NAME1 "sudo yunohost app install searx -a \"domain=$DOMAIN&path=/searx&is_public=Yes\"" | tee -a "$LOG_BUILD_LXC"
|
||||||
echo -e "Installation de shellinabox" | tee -a "$LOG_BUILD_LXC"
|
echo -e "Installation de shellinabox" | tee -a "$LOG_BUILD_LXC"
|
||||||
ssh $ARG_SSH $LXC_NAME1 "sudo yunohost app install shellinabox -a \"domain=$DOMAIN&path=/ssh\"" | tee -a "$LOG_BUILD_LXC"
|
ssh $ARG_SSH $LXC_NAME1 "sudo yunohost app install shellinabox -a \"domain=$DOMAIN&path=/ssh\"" | tee -a "$LOG_BUILD_LXC"
|
||||||
sudo rm "/var/lib/lxc/$LXC_NAME1/rootfs/etc/nginx/conf.d/$DOMAIN.d/shellinabox.conf" # Supprime le fichier de conf nginx de shellinabox pour empêcher d'y accéder.
|
|
||||||
ssh $ARG_SSH $LXC_NAME1 "sudo yunohost app setting shellinabox path -d && sudo yunohost app ssowatconf" | tee -a "$LOG_BUILD_LXC"
|
|
||||||
echo -e "Installation de strut" | tee -a "$LOG_BUILD_LXC"
|
echo -e "Installation de strut" | tee -a "$LOG_BUILD_LXC"
|
||||||
ssh $ARG_SSH $LXC_NAME1 "sudo yunohost app install strut -a \"domain=$DOMAIN&path=/strut&public_site=Yes\"" | tee -a "$LOG_BUILD_LXC"
|
ssh $ARG_SSH $LXC_NAME1 "sudo yunohost app install strut -a \"domain=$DOMAIN&path=/strut&public_site=Yes\"" | tee -a "$LOG_BUILD_LXC"
|
||||||
echo -e "Installation de transmission" | tee -a "$LOG_BUILD_LXC"
|
echo -e "Installation de transmission" | tee -a "$LOG_BUILD_LXC"
|
||||||
|
@ -139,6 +137,14 @@ ssh $ARG_SSH $LXC_NAME1 "sudo yunohost app install wordpress -a \"domain=$DOMAIN
|
||||||
echo -e "Installation de zerobin" | tee -a "$LOG_BUILD_LXC"
|
echo -e "Installation de zerobin" | tee -a "$LOG_BUILD_LXC"
|
||||||
ssh $ARG_SSH $LXC_NAME1 "sudo yunohost app install zerobin -a \"domain=$DOMAIN&path=/zerobin&is_public=Yes\"" | tee -a "$LOG_BUILD_LXC"
|
ssh $ARG_SSH $LXC_NAME1 "sudo yunohost app install zerobin -a \"domain=$DOMAIN&path=/zerobin&is_public=Yes\"" | tee -a "$LOG_BUILD_LXC"
|
||||||
|
|
||||||
|
# Désactive l'accès à shellinabox
|
||||||
|
sudo rm "/var/lib/lxc/$LXC_NAME1/rootfs/etc/nginx/conf.d/$DOMAIN.d/shellinabox.conf" # Supprime le fichier de conf nginx de shellinabox pour empêcher d'y accéder.
|
||||||
|
ssh $ARG_SSH $LXC_NAME1 "sudo yunohost app setting shellinabox path -d && sudo yunohost app setting shellinabox domain -d && sudo yunohost app ssowatconf" | tee -a "$LOG_BUILD_LXC"
|
||||||
|
|
||||||
|
# Indique le couple login/mot de passe demo/demo
|
||||||
|
sed -i "3i\<center>Login: demo / Password: demo</center>" /var/lib/lxc/yunohost_demo1/rootfs/usr/share/ssowat/portal/login.html # Sur le login du portail
|
||||||
|
sed -i "17i\   Password: demo" /var/lib/lxc/yunohost_demo1/rootfs/usr/share/yunohost/admin/views/login.ms # Et sur le login admin
|
||||||
|
|
||||||
# ********
|
# ********
|
||||||
|
|
||||||
echo "> Arrêt de la machine virtualisée" | tee -a "$LOG_BUILD_LXC"
|
echo "> Arrêt de la machine virtualisée" | tee -a "$LOG_BUILD_LXC"
|
||||||
|
|
|
@ -48,32 +48,38 @@ UPGRADE_DEMO_CONTAINER () { # Démarrage, upgrade et snapshot
|
||||||
# Update
|
# Update
|
||||||
update_apt=0
|
update_apt=0
|
||||||
sudo lxc-attach -n $MACHINE -- apt-get update
|
sudo lxc-attach -n $MACHINE -- apt-get update
|
||||||
sudo lxc-attach -n $MACHINE -- apt-get dist-upgrade --dry-run | grep -q "^Inst " # Vérifie si il y aura des mises à jour.
|
sudo lxc-attach -n $MACHINE -- apt-get dist-upgrade --dry-run | grep -q "^Inst " > /dev/null # Vérifie si il y aura des mises à jour.
|
||||||
if [ "$?" -eq 0 ]; then
|
if [ "$?" -eq 0 ]; then
|
||||||
|
date
|
||||||
update_apt=1
|
update_apt=1
|
||||||
fi
|
|
||||||
# Upgrade
|
# Upgrade
|
||||||
sudo lxc-attach -n $MACHINE -- apt-get dist-upgrade -y
|
sudo lxc-attach -n $MACHINE -- apt-get dist-upgrade -y
|
||||||
# Clean
|
# Clean
|
||||||
sudo lxc-attach -n $MACHINE -- apt-get autoremove -y
|
sudo lxc-attach -n $MACHINE -- apt-get autoremove -y
|
||||||
sudo lxc-attach -n $MACHINE -- apt-get autoclean
|
sudo lxc-attach -n $MACHINE -- apt-get autoclean
|
||||||
|
fi
|
||||||
|
|
||||||
# Exécution des scripts de upgrade.d
|
# Exécution des scripts de upgrade.d
|
||||||
LOOP=$((LOOP + 1))
|
LOOP=$((LOOP + 1))
|
||||||
ls -1 "$script_dir/upgrade.d" | while read LIGNE
|
while read LIGNE
|
||||||
do
|
do
|
||||||
if [ ! "$LIGNE" == "exemple" ] && [ ! "$LIGNE" == "old_scripts" ] && ! echo "$LIGNE" | grep -q ".fail$" # Le fichier exemple, le dossier old_scripts et les scripts fail sont ignorés
|
if [ ! "$LIGNE" == "exemple" ] && [ ! "$LIGNE" == "old_scripts" ] && ! echo "$LIGNE" | grep -q ".fail$" # Le fichier exemple, le dossier old_scripts et les scripts fail sont ignorés
|
||||||
then
|
then
|
||||||
|
date
|
||||||
# Exécute chaque script trouvé dans upgrade.d
|
# Exécute chaque script trouvé dans upgrade.d
|
||||||
|
echo "Exécution du script $LIGNE sur le conteneur $MACHINE"
|
||||||
/bin/bash "$script_dir/upgrade.d/$LIGNE" $MACHINE
|
/bin/bash "$script_dir/upgrade.d/$LIGNE" $MACHINE
|
||||||
if [ "$?" -ne 0 ]; then # Si le script a échoué, le snapshot est annulé.
|
if [ "$?" -ne 0 ]; then # Si le script a échoué, le snapshot est annulé.
|
||||||
echo "Échec du script $LIGNE"
|
echo "Échec du script $LIGNE"
|
||||||
mv -f "$script_dir/upgrade.d/$LIGNE" "$script_dir/upgrade.d/$LIGNE.fail"
|
mv -f "$script_dir/upgrade.d/$LIGNE" "$script_dir/upgrade.d/$LIGNE.fail"
|
||||||
echo -e "Échec d'exécution du script d'upgrade $LIGNE sur le conteneur $MACHINE sur le serveur de demo $DOMAIN!\nLe script a été renommé en .fail, il ne sera plus exécuté tant que le préfixe ne sera pas retiré.\n\nExtrait du log:\n$(tail -n +$log_line "$script_dir/demo_upgrade.log")" | mail -a "Content-Type: text/plain; charset=UTF-8" -s "Demo Yunohost" $MAIL_ADDR
|
echo -e "Échec d'exécution du script d'upgrade $LIGNE sur le conteneur $MACHINE sur le serveur de demo $DOMAIN!\nLe script a été renommé en .fail, il ne sera plus exécuté tant que le préfixe ne sera pas retiré.\n\nExtrait du log:\n$(tail -n +$log_line "$script_dir/demo_upgrade.log")" | mail -a "Content-Type: text/plain; charset=UTF-8" -s "Demo Yunohost" $MAIL_ADDR
|
||||||
update_apt=0
|
update_apt=0
|
||||||
|
else
|
||||||
|
echo "Le script $LIGNE a été exécuté sans erreur"
|
||||||
|
update_apt=1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done <<< "$(ls -1 "$script_dir/upgrade.d")"
|
||||||
|
|
||||||
# Arrêt de la machine virtualisée
|
# Arrêt de la machine virtualisée
|
||||||
sudo lxc-stop -n $MACHINE
|
sudo lxc-stop -n $MACHINE
|
||||||
|
|
Loading…
Add table
Reference in a new issue