View Single Post
Posts: 163 | Thanked: 279 times | Joined on Feb 2017 @ Tbilisi, Georgia (caucasus)
#172
Originally Posted by preflex View Post
It's not emulated. It's just a chroot. The kernel (and some other resources, hence the bind mounts) are shared.

See: https://en.wikipedia.org/wiki/Chroot
You can use this script, it needs only one argument and it's either 'terminal' or 'startlxde'

You do not need two separate scripts.

HTML Code:
#!/bin/bash

if [[ "$1" != "terminal" ]] && [[ "$1" != "startlxde" ]]; then
	echo "No known args, please pass correct argument."
	echo "for terminal only 'terminal'"
	echo "for GUI 'startlxde'"
	exit
fi

mount --bind /dev /opt/easychroot/Arch/dev
mount --bind /dev/pts /opt/easychroot/Arch/dev/pts
mount --bind /proc /opt/easychroot/Arch/proc
mount --bind /run /opt/easychroot/Arch/run
mount --bind /sys /opt/easychroot/Arch/sys
mount --bind /var/lib/dbus /opt/easychroot/Arch/var/lib/dbus
mount --bind /var/run/dbus /opt/easychroot/Arch/var/run/dbus
mount --bind /tmp /opt/easychroot/Arch/tmp
mount --bind /dev/shm /opt/easychroot/Arch/dev/shm
#mount --bind /etc/ssl/certs /opt/easychroot/Arch/etc/ssl/certs
mount --bind /home/nemo/.config/pulse /opt/easychroot/Arch/home/nemo/.config/pulse
mount --bind /home/nemo /opt/easychroot/Arch/home/nemo/real_home
mount --bind /home/nemo/Downloads /opt/easychroot/Arch/home/nemo/Downloads
mount --bind /home/nemo/android_storage /opt/easychroot/Arch/home/nemo/android_storage
mount --bind /home/nemo/Music /opt/easychroot/Arch/home/nemo/Music
mount --bind /home/nemo/Videos /opt/easychroot/Arch/home/nemo/Videos
mount --bind /home/nemo/Pictures /opt/easychroot/Arch/home/nemo/Pictures
mount --bind /home/nemo/Documents /opt/easychroot/Arch/home/nemo/Documents

if [ $1 == 'terminal' ]; then
	chroot /opt/easychroot/Arch /bin/bash
fi

if [ $1 == 'startlxde' ]; then
	chmod 1777 /dev/shm
	resolution=`cat /sys/class/graphics/fb0/modes | grep -o -P '(?<=U:).*(?=p)'`
	x=${resolution%%x*}
	y=${resolution##*x}
	echo "selected screen resolution"
	echo $y $x
	sleep 3
	chroot /opt/easychroot/Arch bash /usr/share/easychroot/scripts/start_xwayland_user_shell.sh $y $x $1
fi
 

The Following 5 Users Say Thank You to matemana For This Useful Post: