]> git.donarmstrong.com Git - dsa-puppet.git/commitdiff
Create swapfiles, 2
authorPeter Palfrader <peter@palfrader.org>
Wed, 20 Jun 2012 07:31:39 +0000 (09:31 +0200)
committerPeter Palfrader <peter@palfrader.org>
Wed, 20 Jun 2012 07:31:39 +0000 (09:31 +0200)
modules/ganeti2/templates/instance-debootstrap/hooks/40-dsa-setup-swapfile.erb [new file with mode: 0755]

diff --git a/modules/ganeti2/templates/instance-debootstrap/hooks/40-dsa-setup-swapfile.erb b/modules/ganeti2/templates/instance-debootstrap/hooks/40-dsa-setup-swapfile.erb
new file mode 100755 (executable)
index 0000000..4237ff2
--- /dev/null
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+. common.sh
+
+if [ -z "$TARGET" -o ! -d "$TARGET" ]; then
+  echo "Missing target directory"
+  exit 1
+fi
+
+dd if=/dev/zero of="$TARGET/swapfile" bs=1024k count=512
+chmod 400 "$TARGET/swapfile"
+mkswap "$TARGET/swapfile"
+
+cat >> "$TARGET/etc/fstab" <<EOF
+# /etc/resolv.conf
+/swapfile none swap sw 0 0
+EOF
+
+exit 0
+
+# vim:set syn=sh: