From 413e5ce219527fe56c9976571a1ffc35743d35fc Mon Sep 17 00:00:00 2001 From: Hayden Hamilton Date: Sun, 31 May 2026 11:02:54 +0100 Subject: Add scripts for populating /var/www with git backend --- www/chroot/mkchroot | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100755 www/chroot/mkchroot (limited to 'www/chroot/mkchroot') 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 -- cgit v1.2.3