X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=bin%2Finstall_script.sh;h=3a5900689b6f0b74947656103e3de593d14115d0;hb=248bd83ed797f6e0f385e72a56aa7bafdf23d490;hp=f46ab29618e1421ca8d20f1da11e59caf1ed7fb2;hpb=503e4cf5c54e3fe4b802038e8917341c4ce803e5;p=perso%2FImmae%2FProjets%2FPuppet.git 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 <