Skip to content

Commit

Permalink
Merge two commits from PR #12
Browse files Browse the repository at this point in the history
  • Loading branch information
amluto committed Nov 22, 2017
2 parents fea83ee + 6d478c3 commit 8343eeb
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion virtme/guest/virtme-init
Expand Up @@ -19,7 +19,10 @@ mount -t sysfs -o nosuid,noexec,nodev sys /sys/

declare -A mount_tags
for i in /sys/bus/virtio/drivers/9pnet_virtio/virtio*/mount_tag; do
mount_tags["`cat "$i"`"]=1
# mount_tag is terminated with a NUL byte, which leads to a
# "command substitution: ignored null byte in input" warning from
# bash; use sed instead of a bare 'cat' here to strip it off.
mount_tags["`sed '$s/\x00$//;' "$i"`"]=1
done

kver="`uname -r`"
Expand Down Expand Up @@ -122,6 +125,16 @@ mkdir -p -m 0755 /dev/shm /dev/pts
mount -t devpts -o gid=tty,mode=620,noexec,nosuid devpts /dev/pts
mount -t tmpfs -o mode=1777,nosuid,nodev tmpfs /dev/shm

# Install /proc/self/fd symlinks into /dev if not already present
declare -r -A fdlinks=(["/dev/fd"]="/proc/self/fd"
["/dev/stdin"]="/proc/self/fd/0"
["/dev/stdout"]="/proc/self/fd/1"
["/dev/stderr"]="/proc/self/fd/2")

for p in "${!fdlinks[@]}"; do
[[ -e "$p" ]] || ln -s "${fdlinks[$p]}" "$p"
done

# Bring up networking
ip link set dev lo up

Expand Down

0 comments on commit 8343eeb

Please sign in to comment.