mirror of
https://github.com/flatcar/scripts.git
synced 2025-09-22 22:21:10 +02:00
mount /dev and /proc while altering rootfs image
Various members of /dev are used (such as /dev/random) in this script, and <() style redirection is used which requires a mounted /proc in the image. So bind-mount /dev and /proc while running so they work. BUG=chromiumos:15951 TEST=examined output before/after Change-Id: I3e8f0edef0da7e63b2af6736e8becfa1cd6d723d Reviewed-on: http://gerrit.chromium.org/gerrit/1846 Reviewed-by: Richard Barnette <jrbarnette@chromium.org> Tested-by: Scott James Remnant <keybuk@chromium.org>
This commit is contained in:
parent
175422fec6
commit
105eb52ba5
@ -28,6 +28,11 @@ TMP_CERT=$(mktemp -p /tmp "${CERT_NAME}.pem.XXXXX")
|
|||||||
mv -f "${TMP_KEY}" "${ROOT_FS_DIR}/${TMP_KEY}"
|
mv -f "${TMP_KEY}" "${ROOT_FS_DIR}/${TMP_KEY}"
|
||||||
mv -f "${TMP_CERT}" "${ROOT_FS_DIR}/${TMP_CERT}"
|
mv -f "${TMP_CERT}" "${ROOT_FS_DIR}/${TMP_CERT}"
|
||||||
|
|
||||||
|
# We need access to /dev/random and /dev/self/fd (which is /proc/self/fd)
|
||||||
|
# within the chrooted image
|
||||||
|
sudo mount --bind /dev "${ROOT_FS_DIR}"/dev
|
||||||
|
sudo mount --bind /proc "${ROOT_FS_DIR}"/proc
|
||||||
|
|
||||||
# Generate testing root cert on the fly.
|
# Generate testing root cert on the fly.
|
||||||
sudo chroot "${ROOT_FS_DIR}" ${QEMU} /usr/bin/openssl req -x509 -days 21 \
|
sudo chroot "${ROOT_FS_DIR}" ${QEMU} /usr/bin/openssl req -x509 -days 21 \
|
||||||
-subj "/CN=www.google.com" \
|
-subj "/CN=www.google.com" \
|
||||||
@ -53,3 +58,6 @@ if [ -n "${QEMU}" ] ; then
|
|||||||
fi
|
fi
|
||||||
rm -f "${ROOT_FS_DIR}/${TMP_KEY}"
|
rm -f "${ROOT_FS_DIR}/${TMP_KEY}"
|
||||||
rm -f "${ROOT_FS_DIR}/${TMP_CERT}"
|
rm -f "${ROOT_FS_DIR}/${TMP_CERT}"
|
||||||
|
|
||||||
|
sudo umount "${ROOT_FS_DIR}"/dev
|
||||||
|
sudo umount "${ROOT_FS_DIR}"/proc
|
||||||
|
Loading…
x
Reference in New Issue
Block a user