projects
/
rrq
/
subhost.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
f6aa07e
)
all environment CONFIG and use /sbin/init
author
Ralph Ronnquist
<ralph.ronnquist@gmail.com>
Fri, 4 Mar 2022 01:25:41 +0000
(12:25 +1100)
committer
Ralph Ronnquist
<ralph.ronnquist@gmail.com>
Fri, 4 Mar 2022 01:25:41 +0000
(12:25 +1100)
pretend-boot
patch
|
blob
|
history
diff --git
a/pretend-boot
b/pretend-boot
index 1eaf034c0a440549443ddc9ab115b72b830b7202..746f99aad77c7381c8d8fb24a320634eea79fa89 100755
(executable)
--- a/
pretend-boot
+++ b/
pretend-boot
@@
-1,9
+1,8
@@
#!/bin/bash
#
# Boot up subhost as if a vitual machine.
#!/bin/bash
#
# Boot up subhost as if a vitual machine.
+# Allow CONFIG given as environment
#
#
-# There is already an existing network namespace of the right name,
-# and there are one or more disks at /opt/subhost/$NAME/disk$i
#set -x
#set -x
@@
-11,11
+10,16
@@
: ${NSNAME=$NAME}
: ${SUBHOST=/opt/subhost/$NAME}
: ${TARGET=$SUBHOST/live}
: ${NSNAME=$NAME}
: ${SUBHOST=/opt/subhost/$NAME}
: ${TARGET=$SUBHOST/live}
-: ${INITRD=$SUBHOST/initrd.gz}
: ${CONFIG=$SUBHOST/config}
: ${CONFIG=$SUBHOST/config}
+# sets DISKS=( ... ) and BRIDGES=( ... )
[ -r "$CONFIG" ] && . $CONFIG
[ -r "$CONFIG" ] && . $CONFIG
+if [ -z "$DISKS" ] ; then
+ echo "Missing CONFIG" >&2
+ exit 1
+fi
+
# Generate a mac address for given arguments pass through 40-bit b2sum
# and with 02: prefix.
macaddr() {
# Generate a mac address for given arguments pass through 40-bit b2sum
# and with 02: prefix.
macaddr() {
@@
-87,17
+91,17
@@
setup_console() {
ln -s $(tty) $CONSOLE
}
ln -s $(tty) $CONSOLE
}
+####################
+# Pretend boot
+
setup_cables
setup_rootfs
setup_cables
setup_rootfs
-setup_console || exit 1
-
-# Install the current subhost-init startup script
-cp -p $(realpath $(dirname $0))/subhost-init startup $TARGET/
+setup_console
######################################################################
######################################################################
-# Run the subhost
+# Run the subhost
init
ip netns exec $NSNAME unshare --fork --pid --mount-proc --kill-child \
ip netns exec $NSNAME unshare --fork --pid --mount-proc --kill-child \
- --uts --ipc --mount --cgroup chroot $TARGET /s
tartup
+ --uts --ipc --mount --cgroup chroot $TARGET /s
bin/init
######################################################################
# Cleanup on exit
######################################################################
# Cleanup on exit