Sha256: f1c01a3097cd40bee6004512634befbbf75f6fadff05887af9bc1c1fa62adf3d

Contents?: true

Size: 595 Bytes

Versions: 2

Compression:

Stored size: 595 Bytes

Contents

# setup swapfile

class Bard::Provision::Swapfile < Bard::Provision
  def call
    print "Swapfile:"

    provision_server.run! <<~BASH
      if [ ! -f /swapfile ]; then
        sudo fallocate -l $(grep MemTotal /proc/meminfo | awk '{print $2}')K /swapfile
      fi
      sudo chmod 600 /swapfile
      sudo swapon --show | grep -q '/swapfile' || sudo mkswap /swapfile
      sudo swapon --show | grep -q '/swapfile' || sudo swapon /swapfile
      grep -q '/swapfile none swap sw 0 0' /etc/fstab || echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
    BASH

    puts " ✓"
  end
end


Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bard-1.3.9 lib/bard/provision/swapfile.rb
bard-1.3.8 lib/bard/provision/swapfile.rb