[cgit] Add build and partial / non-working config

This commit is contained in:
Vladan Popovic 2019-08-02 14:50:09 +02:00
parent d8eefcea1e
commit 6ea2c0c7c2
3 changed files with 61 additions and 0 deletions

39
alpine/cgit/build.sh Normal file
View file

@ -0,0 +1,39 @@
#!/bin/sh
set -e
NAME=cgit
IMAGE=/tmp/$NAME.raw
[ -z $ROOTFS ] && ROOTFS=$(mktemp -d $NAME.XXX -t)
[ -z $ALPINE_VERSION ] && ALPINE_VERSION=3.10
[ -z $ALPINE_RELEASE ] && ALPINE_RELEASE=0
ALPINE_TARBALL=alpine-minirootfs-$ALPINE_VERSION.$ALPINE_RELEASE-x86_64.tar.gz
[ -f $NAME.raw ] && rm $NAME.raw
[ -f $ALPINE_TARBALL ] || wget http://dl-cdn.alpinelinux.org/alpine/v$ALPINE_VERSION/releases/x86_64/$ALPINE_TARBALL
(sudo systemctl stop $NAME.service && sudo portablectl detach $NAME) || echo "Image not attached."
tar xf $ALPINE_TARBALL -C $ROOTFS/
chmod 755 $ROOTFS
mkdir -p \
$ROOTFS/etc/systemd/system \
$ROOTFS/etc/$NAME \
$ROOTFS/var/lib/$NAME \
$ROOTFS/run/$NAME \
$ROOTFS/root/.ssh
touch $ROOTFS/etc/machine-id $ROOTFS/etc/resolv.conf
cp systemd/* $ROOTFS/etc/systemd/system/
sudo systemd-nspawn --directory $ROOTFS/ /sbin/apk update
sudo systemd-nspawn --directory $ROOTFS/ /sbin/apk add cgit uwsgi-cgi
sudo systemd-nspawn --directory $ROOTFS/ /bin/rm -rf /etc/apk/* /var/cache/*
mksquashfs $ROOTFS/ $IMAGE -all-root -noappend
sudo portablectl attach $IMAGE
sudo systemctl restart $NAME.service

View file

@ -0,0 +1,12 @@
[Unit]
Description=cgit uwsgi service
After=network.target
Before=nginx.service
Requires=cgit.socket
[Service]
User=cgit
Group=cgit
ConfigurationDirectory=cgit
StateDirectory=cgit

View file

@ -0,0 +1,10 @@
[Unit]
Description=cgit socket
[Socket]
ListenStream=/run/git/cgit.sock
SocketMode=0660
SocketGroup=http
[Install]
WantedBy=sockets.target