unvendor
This commit is contained in:
Dawid Sobczak 2025-04-18 12:41:04 +01:00
parent 9a4b261179
commit 404aa8ebbb
139 changed files with 8091 additions and 1178 deletions

49
06/helpers/cheat Executable file
View file

@ -0,0 +1,49 @@
#!/bin/sh
set -ue
NIXPKGS=nixpkgs/21f524672f25f8c3e7a0b5775e6505fee8fe43ce
: ${DESTDIR:=stage}
mkdir -p $DESTDIR/cheat
if [ ! -e $DESTDIR/cheat/make ]; then
nix build "$NIXPKGS#pkgsStatic.gnumake"
cp result/bin/make $DESTDIR/cheat/make
rm result
fi
if [ ! -e $DESTDIR/cheat/bash ]; then
nix build "$NIXPKGS#pkgsStatic.bash"
cp result/bin/bash $DESTDIR/cheat/bash
rm result
fi
if [ ! -e $DESTDIR/cheat/strace ]; then
nix build "$NIXPKGS#pkgsStatic.strace"
cp result/bin/strace $DESTDIR/cheat/
rm result
fi
if [ ! -e $DESTDIR/cheat/busybox ]; then
nix build "$NIXPKGS#pkgsStatic.busybox"
cp result/bin/busybox $DESTDIR/cheat/busybox
for f in $(ls result/bin/); do
[ $(basename $f) = busybox ] ||
ln -s /cheat/busybox $DESTDIR/cheat/$(basename $f)
done
rm result
fi
if [ -z "$@" ]; then
_PATH=''
for bindir in $DESTDIR/store/*/bin $DESTDIR/store/*/*/bin; do
_PATH="${bindir##$DESTDIR}:$_PATH"
done
LIBC=$(find $DESTDIR/store/*/lib/libc.so | tail -n1)
if [ -n "$LIBC" ] && [ ! -h $DESTDIR/cheat/ldd ]; then
ln -s "${LIBC##$DESTDIR}" $DESTDIR/cheat/ldd
fi
helpers/chroot /cheat/env "PATH=$_PATH" /cheat/ash
else
helpers/chroot "$@"
fi