modprobe.d: use $TMP_MOUNT_PATH

The hook inside extra-data.d runs outside the chroot when
building the image which means that we need to prefix paths
inside the hook to avoid running things on the host.

We also run it with sudo because if we're running DIB not
as root, /etc is uid 0 and we'll get a permission denied.

Change-Id: I1838890fe124c84c879285a471bcc78fe47d6c23
This commit is contained in:
Mohammed Naser 2019-12-18 11:26:17 -05:00
parent 71e1bcbdb8
commit 6f1b51627f
1 changed files with 2 additions and 2 deletions

View File

@ -12,9 +12,9 @@ set -o pipefail
# this to work can allow modules that do other things that *are*
# useful for a container to "just work" without a whole bunch of
# refactoring.
if [ ! -d /etc/modprobe.d ]; then
if [ ! -d $TMP_MOUNT_PATH/etc/modprobe.d ]; then
# ^ so we can see in the logs if we took this path ...
mkdir -p /etc/modprobe.d
sudo mkdir -p $TMP_MOUNT_PATH/etc/modprobe.d
fi
# copy all modprobe.d snippets to /etc/modprobe.d