commit 413e5ce219527fe56c9976571a1ffc35743d35fc parent 8c77dd7485c360f240027a33be98ff8f90a4d78b Author: Hayden Hamilton <hayden@hhvn.uk> Date: Sun, 31 May 2026 11:02:54 +0100 Add scripts for populating /var/www with git backend Diffstat:
| A | www/chroot/git-wrapper | | | 3 | +++ |
| A | www/chroot/mkchroot | | | 31 | +++++++++++++++++++++++++++++++ |
2 files changed, 34 insertions(+), 0 deletions(-)
diff --git a/www/chroot/git-wrapper b/www/chroot/git-wrapper @@ -0,0 +1,3 @@ +#!/bin/ksh + +git -c safe.directory='*' http-backend "$@" diff --git a/www/chroot/mkchroot 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