Last active
December 20, 2023 23:29
-
-
Save Azkali/f5dd103f1b260370983ac8e83b93f757 to your computer and use it in GitHub Desktop.
wsl-chroot
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| [ $(id -u) != 0 ] && exit | |
| [ ! -d $1 ] && exit | |
| daemonize /usr/bin/unshare -fp --mount-proc /lib/systemd/systemd --system-unit=basic.target | |
| cat /usr/lib/binfmt.d/qemu-aarch64-static.conf | tee /proc/sys/fs/binfmt_misc/register > /dev/null | |
| cp /usr/bin/qemu-aarch64-static $1/usr/bin/ | |
| mount -o bind /proc $1/proc | |
| mount -o bind /dev $1/dev | |
| chroot $1 bash | |
| rm $1/usr/bin/qemu-aarch64-static | |
| umount -lR $1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment