summaryrefslogtreecommitdiff
path: root/addons/run.common
blob: 5c4530858087c69624e39eced32fb38dd859dbee (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
do_mounts()
{
	mount --bind /proc debian/proc/ > /dev/null

	mount --bind /dev debian/dev/ > /dev/null
	mount --bind /dev/pts debian/dev/pts > /dev/null

	mount --bind /sys debian/sys/ > /dev/null
	mount --bind /sys/fs/bpf/ debian/sys/fs/bpf/ > /dev/null
	mount --bind /sys/kernel/debug/ debian/sys/kernel/debug/ > /dev/null
	mount --bind /sys/kernel/debug/tracing/ debian/sys/kernel/debug/tracing/

	# Fix up weirdness with debugfs permission changing because of
	# above mounts.
	chmod 0777       /sys/kernel/debug > /dev/null
	chmod 0777 debian/sys/kernel/debug > /dev/null
	chmod 0777       /sys/kernel/debug/tracing > /dev/null
	chmod 0777 debian/sys/kernel/debug/tracing > /dev/null

	# Mount Android partitions
	if [ -d /d/ ]; then
		if [ ! -d debian/d ]; then ln -s /sys/kernel/debug debian/d; fi
	fi

	if [ -d /data/ ]; then
		mkdir -p debian/data/
		mount --bind /data debian/data/
	fi

	if [ -d /system/ ]; then
		mkdir -p debian/system/
		mount --bind /system debian/system/
	fi

	if [ -d /vendor/ ]; then
		mkdir -p debian/vendor/
		mount --bind /vendor debian/vendor/
	fi
}

mount | grep debian > /dev/null
if [ $? -ne 0 ]; then do_mounts; fi