diff options
Diffstat (limited to 'www/chroot/mkchroot')
| -rwxr-xr-x | www/chroot/mkchroot | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/www/chroot/mkchroot b/www/chroot/mkchroot new file mode 100755 index 0000000..4662b62 --- /dev/null +++ b/www/chroot/mkchroot @@ -0,0 +1,31 @@ +#!/bin/rc + +dir = /var/www +bins = (/usr/local/bin/git /usr/local/libexec/git/git-http-backend) +user = www +group = www + +# the following is incredibly openbsd-specific +libs = `{ldd $bins | \ + grep -v '^/' | \ + grep -v 'Start' | \ + sed 's/.* \///'} + +for (lib in $libs) { + d = `{dirname $lib} + + doas mkdir -p $dir/$d + doas cp /$lib $dir/$lib +} + +if (!test -e $dir/dev/null) { + doas mkdir -p $dir/dev + doas mknod $dir/dev/null c 2 2 + doas chmod 666 $dir/dev/null +} + +doas cp `{whatis www/chroot/git-wrapper} $dir/bin/git-wrapper +doas cp /bin/ksh $dir/bin/ksh + +doas chown -R www:www $dir/usr $dir/dev +doas chown -R root:bin $dir/bin |