X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=bin%2Finstall_script.sh;h=322a1edf2297d016427ec181313b724b9b8f1405;hb=367c391a61091817cf34475f91a23ca286eec334;hp=f250285840785abeb0025d4e32778cc5f94f208c;hpb=ec1096d8c0d897ebd1ea445d9c5404a13c33ce2e;p=perso%2FImmae%2FProjets%2FPuppet.git diff --git a/bin/install_script.sh b/bin/install_script.sh index f250285..322a1ed 100755 --- a/bin/install_script.sh +++ b/bin/install_script.sh @@ -1,124 +1,166 @@ #!/bin/bash -DIRECTORY=$(cd `dirname $0` && pwd) -PYTHON_DIRECTORY="$DIRECTORY/../python" +usage() { +cat < $ARCH_HOST_SCRIPT < /tmp/root.x86_64/etc/pacman.d/mirrorlist - -DEVICE_STR=\$(cat /proc/mounts | grep "/dev/sd.. /mnt/") -DEVICE=\$(echo "\$DEVICE_STR" | cut -d' ' -f1) -MOUNTPOINT=\$(echo "\$DEVICE_STR" | cut -d' ' -f2) - -umount "\$DEVICE" -UUID=\$(lsblk -rno UUID "\$DEVICE") - -echo "\$UUID" > /tmp/root.x86_64/device_uuid - -cp /tmp/arch_chroot_script.sh /tmp/root.x86_64/ - -/tmp/root.x86_64/bin/arch-chroot /tmp/root.x86_64/ /arch_chroot_script.sh - -mount "\$DEVICE" +DIRECTORY=$(cd `dirname $0` && pwd) +PYTHON_DIRECTORY="$DIRECTORY/../python" +SCRIPTS="$DIRECTORY/../scripts" -cp /tmp/arch_install_script.sh "\$MOUNTPOINT/root/" +if [ -n "$reinstall_first" ]; then + echo "Réinstallation du système" + python $PYTHON_DIRECTORY/reinstall_$T.py --use-current "$host_id" -/tmp/root.x86_64/bin/arch-chroot "\$MOUNTPOINT" /root/arch_install_script.sh -EOF + 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_$T.py --rescue "$host_id" -cat > $ARCH_CHROOT_SCRIPT < $ARCH_PUPPET_INITIAL_CONFIGURATION +host_address=$(python $PYTHON_DIRECTORY/get_initial_configuration_$T.py $host_id | jq -r '.ips.v4.ipAddress') -pacstrap /mnt base git puppet +dest="$host_user@$host_address" +files="$ARCH_HOST_SCRIPT $ARCH_CHROOT_SCRIPT $ARCH_PUPPET_INITIAL_CONFIGURATION $ARCH_INSTALL_SCRIPT" -echo "\$PART / auto defaults 0 1" > /mnt/etc/fstab +$SCRIPTS/send_and_run.tcl "$dest" "$password" "$git_branch" "$environment" $files -umount /mnt -EOF +### Role specific stage +read -p "Press key when LDAP is configured" i -cat > $ARCH_INSTALL_SCRIPT <