Add gitea

This commit is contained in:
thomas 2022-03-04 21:47:14 +01:00
parent beb7aa882f
commit ca1f99908e
11 changed files with 115 additions and 12 deletions

View File

@ -6,6 +6,7 @@ RELEASE=1
[ -e ./lib/function.sh ] && source ./lib/function.sh
APP=authelia
DEPOT=https://github.com/authelia/authelia.git
GIT_VERSION=v${VERSION}
DEB_VERSION=${VERSION}-${RELEASE}
DEBIAN_VERSION_CODENAME=bullseye
@ -30,13 +31,13 @@ envinit() {
prebuild(){
[ -e /tmp/git ] && rm -fr /tmp/git
[ -e /tmp/element-web ] || mkdir /tmp/element-web
git clone --depth 1 -b ${GIT_VERSION} https://github.com/authelia/authelia.git /tmp/git
cp -r /tmp/git/. /tmp/authelia
[ -e /tmp/element-web ] || mkdir /tmp/${APP}
git clone --depth 1 -b ${GIT_VERSION} ${DEPOT} /tmp/git
cp -r /tmp/git/. /tmp/${APP}
}
build() {
cd /tmp/authelia/
cd /tmp/${APP}/
PATH=$PATH:/usr/local/go/bin:/root/.local/share/pnpm
./cmd/authelia-scripts/authelia-scripts build
}
@ -44,8 +45,8 @@ build() {
makedeb(){
PATH_DEB=/tmp/src/rootfs
cp /tmp/authelia/dist/authelia ${PATH_DEB}/usr/bin/authelia
cp /tmp/authelia/config.template.yml ${PATH_DEB}/etc/authelia/configuration.yml
cp /tmp/${APP}/dist/authelia ${PATH_DEB}/usr/bin/authelia
cp /tmp/${APP}/config.template.yml ${PATH_DEB}/etc/authelia/configuration.yml
sed -i "s/%VERSION%/$DEB_VERSION/" ${PATH_DEB}/DEBIAN/control
fakeroot dpkg-deb -Z gzip --build ${PATH_DEB} /tmp/dist
}

View File

@ -6,6 +6,7 @@ RELEASE=3
[ -e ./lib/function.sh ] && source ./lib/function.sh
APP=element-web
DEPOT=https://github.com/vector-im/element-web.git /tmp/git
GIT_VERSION=v${VERSION}
DEB_VERSION=${VERSION}-${RELEASE}
DEBIAN_VERSION_CODENAME=bullseye
@ -30,13 +31,13 @@ envinit() {
prebuild(){
[ -e /tmp/git ] && rm -fr /tmp/git
[ -e /tmp/element-web ] || mkdir /tmp/element-web
git clone --depth 1 -b ${GIT_VERSION} https://github.com/vector-im/element-web.git /tmp/git
cp -r /tmp/git/. /tmp/element-web
[ -e /tmp/element-web ] || mkdir /tmp/${APP}
git clone --depth 1 -b ${GIT_VERSION} ${DEPOT} /tmp/git
cp -r /tmp/git/. /tmp/${APP}
}
build() {
cd /tmp/element-web
cd /tmp/${APP}
yarn install
yarn dist
}
@ -44,8 +45,8 @@ build() {
makedeb(){
PATH_DEB=/tmp/src/rootfs
tar -zxf /tmp/element-web/dist/element-${GIT_VERSION}-dirty.tar.gz --strip-components=1 -C ${PATH_DEB}/usr/share/element-web/
cp /tmp/element-web/config.sample.json ${PATH_DEB}/etc/element-web/config.json
tar -zxf /tmp/${APP}/dist/element-${GIT_VERSION}-dirty.tar.gz --strip-components=1 -C ${PATH_DEB}/usr/share/element-web/
cp /tmp/${APP}/config.sample.json ${PATH_DEB}/etc/element-web/config.json
sed -i "s/%VERSION%/$DEB_VERSION/" ${PATH_DEB}/DEBIAN/control
fakeroot dpkg-deb -Z gzip --build ${PATH_DEB} /tmp/dist
}

51
ressources/gitea/gitea Executable file
View File

@ -0,0 +1,51 @@
#!/bin/bash
VERSION=1.16.3
RELEASE=1
[ -e ./lib/function.sh ] && source ./lib/function.sh
APP=gitea
DEPOT=https://github.com/go-gitea/gitea.git
GIT_VERSION=v${VERSION}
DEB_VERSION=${VERSION}-${RELEASE}
DEBIAN_VERSION_CODENAME=bullseye
IMAGE_SIZE=4
STEP="envinit prebuild build makedeb"
envinit() {
if [ $(dpkg -l | grep -e 'ii nodejs ' | wc -l) -eq 1 ];
then
apt-get update
apt-get dist-upgrade -y
else
apt install -y --no-install-recommends git wget ca-certificates dpkg fakeroot make gcc
wget -qO - https://deb.nodesource.com/setup_16.x | bash
apt-get update
apt-get install -y nodejs
wget -qO - https://go.dev/dl/go1.17.7.linux-amd64.tar.gz | tar -C /usr/local -xz
fi
}
prebuild(){
[ -e /tmp/git ] && rm -fr /tmp/git
[ -e /tmp/element-web ] || mkdir /tmp/${APP}
git clone --depth 1 -b ${GIT_VERSION} ${DEPOT} /tmp/git
cp -r /tmp/git/. /tmp/${APP}
}
build() {
cd /tmp/${APP}/
PATH=$PATH:/usr/local/go/bin
make
}
makedeb(){
PATH_DEB=/tmp/src/rootfs
cp /tmp/${APP}/gitea ${PATH_DEB}/usr/bin/
cp /tmp/${APP}/custom/conf/app.example.ini ${PATH_DEB}/etc/gitea/app.ini
sed -i "s/%VERSION%/$DEB_VERSION/" ${PATH_DEB}/DEBIAN/control
fakeroot dpkg-deb -Z gzip --build ${PATH_DEB} /tmp/dist
}

View File

View File

@ -0,0 +1 @@
/etc/gitea/app.ini

View File

@ -0,0 +1,7 @@
Package: gitea
Version: %VERSION%
Section: base
Priority: optional
Architecture: all
Maintainer: Thomas Legay <thomas@syngate.fr>
Description: gitea

View File

@ -0,0 +1,5 @@
#!/bin/bash
id gitea &> /dev/null || useradd gitea -r -s /bin/false -d /var/lib/gitea/
chown -R gitea:gitea /var/lib/gitea/

View File

@ -0,0 +1,37 @@
[Unit]
Description=Gitea (Git with a cup of tea)
After=syslog.target
After=network.target
[Service]
# Modify these two values and uncomment them if you have
# repos with lots of files and get an HTTP error 500 because
# of that
###
#LimitMEMLOCK=infinity
#LimitNOFILE=65535
RestartSec=2s
Type=simple
User=git
Group=git
WorkingDirectory=/var/lib/gitea/work_dir
# If using Unix socket: tells systemd to create the /run/gitea folder, which will contain the gitea.sock file
# (manually creating /run/gitea doesn't work, because it would not persist across reboots)
#RuntimeDirectory=gitea
ExecStart=/usr/bin/gitea web --config /etc/gitea/app.ini
Restart=always
Environment=USER=git HOME=/var/lib/gitea/ GITEA_WORK_DIR=/var/lib/gitea/work_dir
# If you install Git to directory prefix other than default PATH (which happens
# for example if you install other versions of Git side-to-side with
# distribution version), uncomment below line and add that prefix to PATH
# Don't forget to place git-lfs binary on the PATH below if you want to enable
# Git LFS support
# If you want to bind Gitea to a port below 1024, uncomment
# the two values below, or use socket activation to pass Gitea its ports as above
###
#CapabilityBoundingSet=CAP_NET_BIND_SERVICE
#AmbientCapabilities=CAP_NET_BIND_SERVICE
###
[Install]
WantedBy=multi-user.target

View File