xrsh-buildroot/buildroot-v86/board/v86/rootfs_overlay/etc/profile.xrsh

67 lines
1.5 KiB
Plaintext
Raw Normal View History

2024-09-11 14:58:31 +02:00
#!/bin/sh
test -d /dev/browser || {
move_root_to_9pfs(){
mkdir /mnt/run # for javascript<->unix pids
test -d /mnt/root && return 0
mv /root /mnt/.
ln -fs /mnt/root /root
}
2024-11-15 13:29:50 +01:00
setup_clipboard(){
test -d /mnt/clipboard || {
mkdir /mnt/clipboard
echo "files appear here when dragdropping- or copy/pasting a file into the 3D scene (minimize in non-immersive mode)" > /mnt/clipboard/README.md
}
}
2024-09-11 14:58:31 +02:00
setup_links(){
ln -fs /etc/motd ~/.motd
ln -fs /mnt/profile.browser ~/.profile.browser
2024-09-11 14:58:31 +02:00
chmod +x ~/.profile.js
}
setup_browser_dev(){
mkdir -p /mnt/dev/browser
touch /mnt/dev/browser/js
touch /mnt/dev/browser/html
touch /mnt/dev/browser/console
ln -fs /mnt/dev/browser /dev/browser
2024-09-11 14:58:31 +02:00
}
setup_network(){
test -n "$BROWSER" || return 0
#mount -a
udhcpc 1>>/var/log/network.log 2>>/var/log/network.log &
echo 0 > /proc/sys/kernel/printk
}
setup_overlayfs(){
test -f /mnt/overlayfs.zip && unzip /mnt/overlayfs.zip -d /
}
2024-09-15 11:18:36 +02:00
setup_incoming_cmds(){
# listen for shell cmds passed to v86 from browser
# (via isoterminal.exec(...))
stty raw < /dev/ttyS1
mkfifo /var/run/ttyS1
cat /dev/ttyS1 > /var/run/ttyS1 &
/bin/sh < /var/run/ttyS1
2024-09-15 11:18:36 +02:00
}
setup_listen_homedir(){
sleep 4 # wait for inode of /mnt/root to become live (due to move_root_to_9pfs)
2024-10-23 18:51:56 +02:00
/mnt/root/bin/watchfs &
2024-09-15 11:18:36 +02:00
}
move_root_to_9pfs
2024-09-11 14:58:31 +02:00
setup_browser_dev
2024-11-15 13:29:50 +01:00
setup_clipboard
2024-09-11 14:58:31 +02:00
setup_links
setup_network
setup_overlayfs
2024-09-15 11:18:36 +02:00
setup_incoming_cmds &
2024-10-23 18:51:56 +02:00
setup_listen_homedir
2024-09-11 14:58:31 +02:00
}