From c15f2234474ff8a8266e26856702b3c561050667 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20Bouya?= Date: Fri, 16 Mar 2018 00:22:38 +0100 Subject: Move scripts to separate chunks --- bin/install_script_ovh_cloud_instance.sh | 88 +++----------------- bin/install_script_ovh_vps_ssd.sh | 136 +++---------------------------- 2 files changed, 21 insertions(+), 203 deletions(-) (limited to 'bin') diff --git a/bin/install_script_ovh_cloud_instance.sh b/bin/install_script_ovh_cloud_instance.sh index 26e410e..e1c8a54 100755 --- a/bin/install_script_ovh_cloud_instance.sh +++ b/bin/install_script_ovh_cloud_instance.sh @@ -62,6 +62,7 @@ done DIRECTORY=$(cd `dirname $0` && pwd) PYTHON_DIRECTORY="$DIRECTORY/../python" +SCRIPTS="$DIRECTORY/../scripts" if [ -z "$instance_id" ]; then read -p "Id de l'instanceĀ : " instance_id @@ -82,10 +83,10 @@ if [ -z "$no_reboot" -a -z "$no_reboot_start" ]; then fi ARCH_DIR=`mktemp -d` -ARCH_HOST_SCRIPT="$ARCH_DIR/arch_host_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_HOST_SCRIPT="$SCRIPTS/ovh_cloud_instance/arch_host_script.sh" +ARCH_INSTALL_SCRIPT="$SCRIPTS/arch_install_script.sh" +ARCH_HOST_PUPPET_CONFIGURATION_SCRIPT="$SCRIPTS/ovh_cloud_instance/arch_host_puppet_configuration_script.sh" +ARCH_PUPPET_CONFIGURATION_SCRIPT="$SCRIPTS/arch_puppet_configuration_script.sh" ARCH_PUPPET_INITIAL_CONFIGURATION="$ARCH_DIR/puppet_variables.json" trap "rm -rf $ARCH_DIR" EXIT @@ -94,86 +95,17 @@ trap "rm -rf $ARCH_DIR" EXIT python $PYTHON_DIRECTORY/get_initial_configuration_cloud_instance.py $instance_id > $ARCH_PUPPET_INITIAL_CONFIGURATION host_address=$(python $PYTHON_DIRECTORY/get_initial_configuration_cloud_instance.py $instance_id | jq -r '.ips.v4.ipAddress') -cat > $ARCH_HOST_SCRIPT < $ARCH_INSTALL_SCRIPT < $ARCH_PUPPET_CONFIGURATION_SCRIPT < $ARCH_HOST_PUPPET_CONFIGURATION_SCRIPT < $ARCH_PUPPET_INITIAL_CONFIGURATION -cat > $ARCH_HOST_SCRIPT < /tmp/root.x86_64/etc/pacman.d/mirrorlist - -DEVICE_STR=\$(cat /proc/mounts | grep "/dev/[sv]d.. /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" - -cp /tmp/arch_install_script.sh "\$MOUNTPOINT/root/" -cp /tmp/puppet_variables.json "\$MOUNTPOINT/root/" - -/tmp/root.x86_64/bin/arch-chroot "\$MOUNTPOINT" /root/arch_install_script.sh -EOF - - -cat > $ARCH_CHROOT_SCRIPT < /mnt/etc/fstab - -umount /mnt -EOF - -cat > $ARCH_INSTALL_SCRIPT < $ARCH_PUPPET_CONFIGURATION_SCRIPT < $ARCH_HOST_PUPPET_CONFIGURATION_SCRIPT <