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