aboutsummaryrefslogtreecommitdiffstats
path: root/main/mkinitfs/0001-init-mount-devices-as-read-only.patch
blob: e0077dd7f5eb81f9185708dfad0ca2e17ce0a8ee (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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
From 13cfce8f525fcb656044da419e03747892abd174 Mon Sep 17 00:00:00 2001
From: Natanael Copa <ncopa@alpinelinux.org>
Date: Tue, 21 Dec 2010 10:08:39 +0000
Subject: [PATCH] init: mount devices as read-only

---
 initramfs-init.in |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/initramfs-init.in b/initramfs-init.in
index 2fb2626..9acf1c7 100755
--- a/initramfs-init.in
+++ b/initramfs-init.in
@@ -138,7 +138,7 @@ find_ovl_dev() {
 		# wait for usb to settle if needed
 		wait_usb
 		for i in usb floppy cdrom; do
-			mount /media/$i 2>/dev/null || continue
+			mount -o ro /media/$i 2>/dev/null || continue
 			ovl=$(find_ovl /media/$i)
 			[ -f "$ovl" ] && return
 			umount /media/$i 2>/dev/null
@@ -276,7 +276,7 @@ if [ -n "$KOPT_root" ]; then
 			;;
 	esac
 	ebegin "Mounting root"
-	retry_mount $KOPT_root $sysroot 2>/dev/null
+	retry_mount -o ro $KOPT_root $sysroot 2>/dev/null
 	eend $?
 	cat /proc/mounts | while read DEV DIR TYPE OPTS ; do
 		if [ "$DIR" != "/" -a "$DIR" != "$sysroot" -a -d "$DIR" ]; then
@@ -302,7 +302,7 @@ if [ -n "$ALPINE_DEV_FS" ]; then
 	mount_opts="-t $ALPINE_DEV_FS"
 fi
 
-retry_mount $mount_opts $ALPINE_DEV $ALPINE_MNT >/dev/null 2>&1
+retry_mount -o ro $mount_opts $ALPINE_DEV $ALPINE_MNT >/dev/null 2>&1
 eend $?
 
 # generate apk repositories file 
@@ -329,7 +329,8 @@ if [ -n "$OVL_DEV" ]; then
 		mount_opts="-t $OVL_DEV_FS"
 	fi
 	
-	retry_mount $mount_opts /dev/$OVL_DEV /media/$OVL_DEV >/dev/null 2>&1
+	retry_mount -o ro $mount_opts /dev/$OVL_DEV /media/$OVL_DEV \
+		>/dev/null 2>&1
 	ovl=$(find_ovl /media/$OVL_DEV)
 else
 	find_ovl_dev
-- 
1.7.3.4