Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/test/sanity/scripts/qemu-init.sh
5241 views
1
#!/bin/sh
2
set -e
3
4
# Mount kernel filesystems (proc for process info, sysfs for device info)
5
echo "Mounting kernel filesystems"
6
mount -t proc proc /proc
7
mount -t sysfs sys /sys
8
9
# Mount pseudo-terminal and shared memory filesystems
10
echo "Mounting PTY and shared memory"
11
mkdir -p /dev/pts
12
mount -t devpts devpts /dev/pts
13
mkdir -p /dev/shm
14
mount -t tmpfs tmpfs /dev/shm
15
16
# Mount temporary directories with proper permissions
17
echo "Mounting temporary directories"
18
mount -t tmpfs tmpfs /tmp
19
chmod 1777 /tmp
20
mount -t tmpfs tmpfs /var/tmp
21
22
# Mount runtime directory for services (D-Bus, XDG)
23
echo "Mounting runtime directories"
24
mount -t tmpfs tmpfs /run
25
mkdir -p /run/dbus
26
mkdir -p /run/user/0
27
chmod 700 /run/user/0
28
29
echo "Setting up machine-id for D-Bus"
30
cat /proc/sys/kernel/random/uuid | tr -d '-' > /etc/machine-id
31
32
echo "Setting system clock"
33
date -s "$(cat /host-time)"
34
35
echo "Setting up networking"
36
ip link set lo up
37
ip link set eth0 up
38
ip addr add 10.0.2.15/24 dev eth0
39
ip route add default via 10.0.2.2
40
echo "nameserver 10.0.2.3" > /etc/resolv.conf
41
42
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
43
export XDG_RUNTIME_DIR=/run/user/0
44
45
echo "Starting entrypoint"
46
sh /root/containers/entrypoint.sh $(cat /test-args)
47
echo $? > /exit-code
48
sync
49
50
echo "Powering off"
51
echo o > /proc/sysrq-trigger
52
53