From 248bd83ed797f6e0f385e72a56aa7bafdf23d490 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20Bouya?= Date: Sun, 17 Sep 2017 19:05:41 +0200 Subject: Enhance install script, and add ip6 address --- bin/install_script.sh | 82 +++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 67 insertions(+), 15 deletions(-) (limited to 'bin/install_script.sh') diff --git a/bin/install_script.sh b/bin/install_script.sh index f46ab29..3a59006 100755 --- a/bin/install_script.sh +++ b/bin/install_script.sh @@ -1,20 +1,69 @@ #!/bin/bash +set -e + +host_user=root +git_branch=master + +while [ -n "$1" ]; do + case "$1" in + --vps) + vps_name="$2" + shift + ;; + --reinstall-first) + reinstall_first=1 + ;; + --password) + password="$2" + shift + ;; + --host-user) + host_user="$2" + shift + ;; + --no-reboot) + no_reboot=1 + ;; + --no-reboot-start) + no_reboot_start=1 + ;; + --no-reboot-end) + no_reboot_end=1 + ;; + --git-branch) + git_branch="$2" + shift + ;; + esac + + shift +done + DIRECTORY=$(cd `dirname $0` && pwd) PYTHON_DIRECTORY="$DIRECTORY/../python" -if [ -n "$1" ]; then - vps_name="$1" -else +if [ -z "$vps_name" ]; then read -p "Nom du vps : " vps_name fi -echo "Patienter le temps du reboot" -python $PYTHON_DIRECTORY/reboot_vps_server.py --rescue "$vps_name" +if [ -n "$reinstall_first" ]; then + echo "Réinstallation du système" + python $PYTHON_DIRECTORY/reinstall_vps_server.py --use-current "$vps_name" + + read -p "Appuyer sur une touche quand le serveur est prêt" ready +fi + +if [ -z "$no_reboot" -a -z "$no_reboot_start" ]; then + echo "Patienter le temps du reboot" + python $PYTHON_DIRECTORY/reboot_vps_server.py --rescue "$vps_name" +fi -stty -echo -read -p "Mot de passe reçu par e-mail : " password; echo -stty echo +if [ -z "$password" ]; then + stty -echo + read -p "Mot de passe reçu par e-mail : " password; echo + stty echo +fi ARCH_DIR=`mktemp -d` ARCH_HOST_SCRIPT="$ARCH_DIR/arch_host_script.sh" @@ -22,10 +71,13 @@ ARCH_CHROOT_SCRIPT="$ARCH_DIR/arch_chroot_script.sh" ARCH_INSTALL_SCRIPT="$ARCH_DIR/arch_install_script.sh" ARCH_HOST_PUPPET_CONFIGURATION_SCRIPT="$ARCH_DIR/arch_host_puppet_configuration_script.sh" ARCH_PUPPET_CONFIGURATION_SCRIPT="$ARCH_DIR/arch_puppet_configuration_script.sh" +ARCH_PUPPET_INITIAL_CONFIGURATION="$ARCH_DIR/puppet_variables.json" trap "rm -rf $ARCH_DIR" EXIT #### Base installation stage +python $PYTHON_DIRECTORY/get_initial_configuration.py $vps_name > $ARCH_PUPPET_INITIAL_CONFIGURATION + cat > $ARCH_HOST_SCRIPT < $ARCH_INSTALL_SCRIPT <