From d9912aeabb49a4052bdbcd210bb9a1d3399cc5ff Mon Sep 17 00:00:00 2001 From: Mark Korondi Date: Wed, 21 Sep 2016 16:19:01 +0200 Subject: [PATCH] swap creation and removal --- files/etc/rc.local | 17 +++++++++++++++++ files/etc/rc6.d/K99remove-swap | 4 ++++ install-base.sh | 3 ++- 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100755 files/etc/rc.local create mode 100755 files/etc/rc6.d/K99remove-swap diff --git a/files/etc/rc.local b/files/etc/rc.local new file mode 100755 index 0000000..1eb870e --- /dev/null +++ b/files/etc/rc.local @@ -0,0 +1,17 @@ +#!/bin/sh -e +# +# rc.local +# +# This script is executed at the end of each multiuser runlevel. +# Make sure that the script will "exit 0" on success or any other +# value on error. +# +# In order to enable or disable this script just change the execution +# bits. +# +# By default this script does nothing. + +dd if=/dev/zero of=/home/vagrant/swap.img bs=1M count=2048 +mkswap /home/vagrant/swap.img +swapon /home/vagrant/swap.img +exit 0 diff --git a/files/etc/rc6.d/K99remove-swap b/files/etc/rc6.d/K99remove-swap new file mode 100755 index 0000000..1833322 --- /dev/null +++ b/files/etc/rc6.d/K99remove-swap @@ -0,0 +1,4 @@ +#!/bin/sh + +swapoff -a +rm -rf /home/vagrant/swap.img diff --git a/install-base.sh b/install-base.sh index d8af3e6..7a0ee73 100644 --- a/install-base.sh +++ b/install-base.sh @@ -31,5 +31,6 @@ sudo apt-get clean # Enable shared folder access sudo adduser vagrant vboxsf -# Enable autologin +# Copy global configs (/etc) +# (autologin, swap creation and deletion, etc.) sudo cp -ar /vagrant/files/etc /