aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/install_script.sh36
1 files changed, 36 insertions, 0 deletions
diff --git a/bin/install_script.sh b/bin/install_script.sh
index f250285..f46ab29 100755
--- a/bin/install_script.sh
+++ b/bin/install_script.sh
@@ -20,9 +20,12 @@ ARCH_DIR=`mktemp -d`
20ARCH_HOST_SCRIPT="$ARCH_DIR/arch_host_script.sh" 20ARCH_HOST_SCRIPT="$ARCH_DIR/arch_host_script.sh"
21ARCH_CHROOT_SCRIPT="$ARCH_DIR/arch_chroot_script.sh" 21ARCH_CHROOT_SCRIPT="$ARCH_DIR/arch_chroot_script.sh"
22ARCH_INSTALL_SCRIPT="$ARCH_DIR/arch_install_script.sh" 22ARCH_INSTALL_SCRIPT="$ARCH_DIR/arch_install_script.sh"
23ARCH_HOST_PUPPET_CONFIGURATION_SCRIPT="$ARCH_DIR/arch_host_puppet_configuration_script.sh"
24ARCH_PUPPET_CONFIGURATION_SCRIPT="$ARCH_DIR/arch_puppet_configuration_script.sh"
23 25
24trap "rm -rf $ARCH_DIR" EXIT 26trap "rm -rf $ARCH_DIR" EXIT
25 27
28#### Base installation stage
26cat > $ARCH_HOST_SCRIPT <<EOF 29cat > $ARCH_HOST_SCRIPT <<EOF
27#!/bin/bash 30#!/bin/bash
28 31
@@ -117,6 +120,39 @@ send "$password\r"
117expect eof 120expect eof
118EOF 121EOF
119 122
123### Role specific stage
124read -p "Press key when LDAP is configured" i
125
126cat > $ARCH_PUPPET_CONFIGURATION_SCRIPT <<EOF
127CODE_PATH="/etc/puppetlabs/code"
128puppet apply --test \$CODE_PATH/manifests/site.pp
129EOF
130
131cat > $ARCH_HOST_PUPPET_CONFIGURATION_SCRIPT <<EOF
132DEVICE_STR=\$(cat /proc/mounts | grep "/dev/sd.. /mnt/")
133DEVICE=\$(echo "\$DEVICE_STR" | cut -d' ' -f1)
134MOUNTPOINT=\$(echo "\$DEVICE_STR" | cut -d' ' -f2)
135
136cp /tmp/arch_puppet_configuration_script.sh "\$MOUNTPOINT/root/"
137
138/tmp/root.x86_64/bin/arch-chroot "\$MOUNTPOINT" /root/arch_puppet_configuration_script.sh
139EOF
140
141chmod a+x $ARCH_PUPPET_CONFIGURATION_SCRIPT $ARCH_HOST_PUPPET_CONFIGURATION_SCRIPT
142
143expect -f - <<EOF
144set timeout -1
145spawn scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o CheckHostIP=no $ARCH_PUPPET_CONFIGURATION_SCRIPT $ARCH_HOST_PUPPET_CONFIGURATION_SCRIPT root@$vps_name:/tmp
146expect "assword:"
147send "$password\n"
148expect eof
149spawn ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o CheckHostIP=no root@$vps_name /tmp/arch_host_puppet_configuration_script.sh
150expect "assword:"
151send "$password\r"
152expect eof
153EOF
154
155### Installation finished
120read -p "Reboot to normal? [Y/n]" reboot 156read -p "Reboot to normal? [Y/n]" reboot
121if [ "x$reboot" != "xn" ]; then 157if [ "x$reboot" != "xn" ]; then
122 echo "Rebooting" 158 echo "Rebooting"