]> git.donarmstrong.com Git - dsa-puppet.git/blob - modules/ganeti2/templates/instance-debootstrap/hooks/40-dsa-setup-swapfile.erb
Create swapfiles, 2
[dsa-puppet.git] / modules / ganeti2 / templates / instance-debootstrap / hooks / 40-dsa-setup-swapfile.erb
1 #!/bin/bash
2
3 . common.sh
4
5 if [ -z "$TARGET" -o ! -d "$TARGET" ]; then
6   echo "Missing target directory"
7   exit 1
8 fi
9
10 dd if=/dev/zero of="$TARGET/swapfile" bs=1024k count=512
11 chmod 400 "$TARGET/swapfile"
12 mkswap "$TARGET/swapfile"
13
14 cat >> "$TARGET/etc/fstab" <<EOF
15 # /etc/resolv.conf
16 /swapfile none swap sw 0 0
17 EOF
18
19 exit 0
20
21 # vim:set syn=sh: