Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
google
GitHub Repository: google/crosvm
Path: blob/main/e2e_tests/guest_under_test/initramfs/init.sh
5394 views
1
#!/bin/bash
2
# Copyright 2023 The ChromiumOS Authors
3
# Use of this source code is governed by a BSD-style license that can be
4
# found in the LICENSE file.
5
6
mount_root () {
7
if [ -f "/dev/sda" ]; then
8
mount /dev/sda /newroot
9
else
10
mount /dev/vda /newroot
11
fi
12
}
13
14
mount -t proc /proc -t proc
15
mount -t sysfs none /sys
16
mount -t devtmpfs none /dev
17
18
mount_root
19
20
if mount_root; then
21
mkdir -p /newroot/proc /newroot/sys /newroot/dev || true
22
23
mount --move /sys /newroot/sys
24
mount --move /proc /newroot/proc
25
mount --move /dev /newroot/dev
26
ln -sf /proc/self/fd /newroot/dev/fd
27
28
cp /bin/delegate /newroot/bin/delegate || true
29
30
cd /newroot && chroot /newroot /bin/delegate
31
else
32
exec /bin/delegate
33
fi
34
35