summarylogtreecommitdiffstats
path: root/wiliwili.sh
blob: 2add4c81e41184bb6553eef1e4f3293076355d7c (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
#!/bin/bash

function bindNvidia() {
	mod=$(lsmod)
	if [[ ${mod} =~ xe ]] || [[ ${mod} =~ amdgpu ]] || [[ ${mod} =~ i915 ]]; then
		bwExtraPar=""
	else
		echo "[Info] NVIDIA device bound"
		bwExtraPar="--dev-bind /dev /dev"
# 		for device in $(ls /dev/ | grep nvidia); do
# 			bwExtraPar="${bwExtraPar} --dev-bind-try /dev/${device} /dev/${device}"
# 		done
# 		echo "[Debug]: parm ${bwExtraPar}"
	fi
}

function launchV2() {
	mod=$(lsmod)
	if [[ ${mod} =~ xe ]] || [[ ${mod} =~ amdgpu ]] || [[ ${mod} =~ i915 ]]; then
		bwrap \
			--dev-bind / / \
			--dev /dev \
			--dev-bind /dev/dri /dev/dri \
			--dev-bind /dev/shm /dev/shm \
			--dev-bind /dev/input /dev/input \
			${bwExtraPar} \
			-- /usr/bin/env -u DISPLAY wiliwili "$@"
	else
		echo "[Info] NVIDIA device bound"
		/usr/bin/env -u DISPLAY wiliwili "$@"
	fi

}

launchV2 $@