build.sh: create static loop + dm device nodes in the container
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
95ec50d0b0
commit
6fb3ff27ef
1 changed files with 11 additions and 0 deletions
11
build.sh
11
build.sh
|
|
@ -36,6 +36,17 @@ if [ "$(id -u)" = 0 ]; then
|
|||
mkdir -p /usr/local/sbin
|
||||
printf '#!/bin/sh\nexit 0\n' > /usr/local/sbin/modprobe
|
||||
chmod +x /usr/local/sbin/modprobe
|
||||
# A privileged container's /dev is a snapshot from container start —
|
||||
# loop/dm nodes the host creates later never appear. Create the static
|
||||
# nodes here; opening them autoloads the drivers host-side (reserved
|
||||
# major/minors: loop = block 7,N; device-mapper control = char 10,236).
|
||||
i=0
|
||||
while [ $i -le 15 ]; do
|
||||
[ -b /dev/loop$i ] || mknod -m 660 /dev/loop$i b 7 $i
|
||||
i=$((i + 1))
|
||||
done
|
||||
mkdir -p /dev/mapper
|
||||
[ -c /dev/mapper/control ] || mknod -m 600 /dev/mapper/control c 10 236
|
||||
id build >/dev/null 2>&1 || adduser -D build
|
||||
echo 'build ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/build
|
||||
rm -rf dist
|
||||
|
|
|
|||
Loading…
Reference in a new issue