elements: zypper-minimal: Mount common pseudo filesystems

Mount all the usual /dev /sys /proc pseudo filesystems during the
root.d phase in order to make sure they are available for the rpm
post-installation phases.

Change-Id: I28221debf1036d9eb5137161757eb30811eafab1
This commit is contained in:
Markos Chandras 2016-11-02 22:05:05 +00:00
parent 290925bd5e
commit 435f52a7d1

View File

@ -27,6 +27,10 @@ set -o pipefail
[ -n "${ZYPPER_REPOS}" ]
function cleanup() {
sudo umount $TARGET_ROOT/proc
sudo umount $TARGET_ROOT/dev/pts
sudo umount $TARGET_ROOT/dev
sudo umount $TARGET_ROOT/sys
sudo umount $TMP_MOUNT_PATH/var/cache/zypp
}
@ -54,6 +58,16 @@ sudo mount --bind $ZYPPER_CACHE_DIR $TMP_MOUNT_PATH/var/cache/zypp
# since last run.
sudo zypper ${ZYPPER_TARGET_OPTS} refresh
# Note this is not usually done for root.d elements (see
# lib/common-functions:mount_proc_dev_sys) but it's important that
# we have things like /dev/urandom around inside the chroot for
# the rpm [pre|post]inst scripts within the packages.
sudo mkdir -p $TARGET_ROOT/proc $TARGET_ROOT/dev $TARGET_ROOT/sys
sudo mount -t proc none $TARGET_ROOT/proc
sudo mount --bind /dev $TARGET_ROOT/dev
sudo mount --bind /dev/pts $TARGET_ROOT/dev/pts
sudo mount -t sysfs none $TARGET_ROOT/sys
# Install filesystem, base and useful tools
sudo zypper ${ZYPPER_TARGET_OPTS} install ${ZYPPER_INSTALL_OPTS} filesystem
# Install basic components in order
@ -84,5 +98,5 @@ for newfile in $(sudo find $TARGET_ROOT -type f -name '*rpmnew') ; do
sudo mv $newfile $(echo $newfile | sed 's/.rpmnew$//')
done
# Unmounting of the /var/cache/zypp is handled by the cleanup EXIT
# Unmounting of all the mount points is handled by the cleanup EXIT
# handler so there is nothing else to do here