defa1dc38a
I was trying a `--ex-unified-core` compose of FAW, and things fell over on `urw-base35-fonts` which does a dance of setting a stamp file in `%post` and checking it in `%posttrans`. This whole pattern should be considered deprecated by file triggers. But let's support it for now. Note there's a lot of parameter passing as we need a single directory which is held across multiple script invocations. Closes: #1319 Approved by: jlebon
28 lines
952 B
Bash
Executable File
28 lines
952 B
Bash
Executable File
#!/bin/bash
|
|
# Run a shell (or program) like how rpm-ostree would run RPM scriptlets. Useful
|
|
# for quickly testing changes to the script environment.
|
|
rootfs=$1
|
|
shift
|
|
cd ${rootfs}
|
|
# ⚠⚠⚠ If you change this, also update src/libpriv/rpmostree-scripts.c ⚠⚠⚠
|
|
BWRAP_ARGV="--dev /dev --proc /proc --dir /tmp --chdir / \
|
|
--unshare-pid --unshare-uts \
|
|
--unshare-ipc --unshare-cgroup-try \
|
|
"
|
|
if ! test "${container:-}" = "systemd-nspawn"; then
|
|
BWRAP_ARGV="$BWRAP_ARGV --unshare-net"
|
|
fi
|
|
|
|
for src in /sys/{block,bus,class,dev}; do
|
|
BWRAP_ARGV="$BWRAP_ARGV --ro-bind $src $src"
|
|
done
|
|
for src in lib{,32,64} bin sbin; do
|
|
if test -L $src; then
|
|
BWRAP_ARGV="$BWRAP_ARGV --symlink usr/$src $src"
|
|
fi
|
|
done
|
|
BWRAP_ARGV="$BWRAP_ARGV --ro-bind usr /usr --ro-bind ./var /var --bind ./usr/etc /etc \
|
|
--tmpfs /var/tmp --tmpfs /var/lib/rpm-state"
|
|
echo exec bwrap $BWRAP_ARGV "$@"
|
|
exec env PS1='bwrap$ ' bwrap $BWRAP_ARGV "$@"
|