aboutsummaryrefslogtreecommitdiffstats
path: root/main/alpine-conf/0001-setup-disk-add-swap-to-etc-fstab.patch
blob: da41a090abc9ca21207ede96c40864ff8ef994e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
From e85487169a542eac82244b448e9bb4882ee7a4da Mon Sep 17 00:00:00 2001
From: Natanael Copa <ncopa@alpinelinux.org>
Date: Thu, 24 Oct 2013 14:21:23 +0200
Subject: [PATCH] setup-disk: add swap to /etc/fstab

---
 setup-disk.in | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/setup-disk.in b/setup-disk.in
index 8d3e14d..9e222fb 100644
--- a/setup-disk.in
+++ b/setup-disk.in
@@ -286,6 +286,10 @@ install_mounted_root() {
 		mv "$mnt"/etc/fstab "$mnt"/etc/fstab.old
 	fi
 	enumerate_fstab "$mnt" >> "$mnt"/etc/fstab
+	if [ -n "$SWAP_DEVICE" ]; then
+		echo -e "${SWAP_DEVICE}\tswap\tswap\tdefaults\t0 0" \
+			>> "$mnt"/etc/fstab
+	fi
 	cat >>"$mnt"/etc/fstab <<EOF
 /dev/cdrom	/media/cdrom	iso9660	noauto,ro 0 0
 /dev/fd0	/media/floppy	vfat	noauto	0 0
@@ -573,6 +577,7 @@ setup_swap_dev() {
 		mkswap $swap_dev >/dev/null
 		echo -e "$swap_dev\tswap\t\tswap\tdefaults 0 0" >> /etc/fstab
 	done
+	SWAP_DEVICE="$(uuid_or_device $swap_dev)"
 	swapon -a
 	rc-update --quiet add swap boot
 }
-- 
1.8.4.1