summaryrefslogtreecommitdiff
path: root/roles/cloud/install/templates/hetzner_postinst.sh.j2
diff options
context:
space:
mode:
Diffstat (limited to 'roles/cloud/install/templates/hetzner_postinst.sh.j2')
-rw-r--r--roles/cloud/install/templates/hetzner_postinst.sh.j220
1 files changed, 14 insertions, 6 deletions
diff --git a/roles/cloud/install/templates/hetzner_postinst.sh.j2 b/roles/cloud/install/templates/hetzner_postinst.sh.j2
index 271e51b7..7991ea19 100644
--- a/roles/cloud/install/templates/hetzner_postinst.sh.j2
+++ b/roles/cloud/install/templates/hetzner_postinst.sh.j2
@@ -26,21 +26,29 @@ sed -e '/^\/swapfile/d' -i /etc/fstab
rm -f /swapfile
{% if install_cooked.disks.root_lvm_size != "all" %}
-umount /dummy
sed -e '/\/dummy/d' -i /etc/fstab
-rm -rf /dummy
-raid_devices=$(mdadm -Q -Y --detail /dev/md2 2> /dev/null | awk -F = '/MD_DEVICE_.*_DEV=/ { print($2) }')
-if [ -n "$raid_devices" ]; then
+cat > /post-post-install.sh <<EOF
+#!/bin/bash
+
+raid_devices=\$(mdadm -Q -Y --detail /dev/md2 2> /dev/null | awk -F = '/MD_DEVICE_.*_DEV=/ { print(\$2) }')
+if [ -n "\$raid_devices" ]; then
mdadm --stop /dev/md2 2> /dev/null
- for dev in $raid_devices; do
- wipefs -a "$dev"
+ for dev in \$raid_devices; do
+ wipefs -a "\$dev"
done
sed -e '/^ARRAY \/dev\/md\/2 /d' -i /etc/mdadm/mdadm.conf
update-initramfs -u
fi
+
+rm -rf /dummy
+EOF
+
+chmod +x /post-post-install.sh
{% endif %}
+{% if install_distro == "debian" %}
update-grub
+{% endif %}
echo "postinst.sh finished successfully"