From a7592a2b386e079f4d56f8ba8515327279a48b3f Mon Sep 17 00:00:00 2001 From: Thomas Legay Date: Mon, 12 Jun 2023 15:30:48 +0200 Subject: [PATCH] Migration gitea => forgejo --- README.MD | 2 +- lib/exec_in_chroot.sh | 4 ++-- lib/function.sh | 4 ++-- ressources/{gitea => forgejo}/README.MD | 8 +++---- ressources/{gitea => forgejo}/debmaker | 18 ++++++++++----- .../rootfs/DEBIAN/changelog | 0 ressources/forgejo/rootfs/DEBIAN/conffiles | 1 + .../{gitea => forgejo}/rootfs/DEBIAN/control | 4 ++-- ressources/forgejo/rootfs/DEBIAN/postinst | 6 +++++ .../system => forgejo/rootfs}/gitea.service | 22 +++++++++---------- ressources/gitea/rootfs/DEBIAN/conffiles | 1 - ressources/gitea/rootfs/DEBIAN/postinst | 6 ----- ressources/gitea/rootfs/etc/gitea/.gitkeep | 0 ressources/gitea/rootfs/usr/bin/.gitkeep | 0 .../gitea/rootfs/var/lib/gitea/.gitkeep | 0 15 files changed, 42 insertions(+), 34 deletions(-) rename ressources/{gitea => forgejo}/README.MD (57%) rename ressources/{gitea => forgejo}/debmaker (58%) rename ressources/{gitea => forgejo}/rootfs/DEBIAN/changelog (100%) create mode 100644 ressources/forgejo/rootfs/DEBIAN/conffiles rename ressources/{gitea => forgejo}/rootfs/DEBIAN/control (76%) create mode 100755 ressources/forgejo/rootfs/DEBIAN/postinst rename ressources/{gitea/rootfs/usr/lib/systemd/system => forgejo/rootfs}/gitea.service (53%) delete mode 100644 ressources/gitea/rootfs/DEBIAN/conffiles delete mode 100755 ressources/gitea/rootfs/DEBIAN/postinst delete mode 100644 ressources/gitea/rootfs/etc/gitea/.gitkeep delete mode 100644 ressources/gitea/rootfs/usr/bin/.gitkeep delete mode 100644 ressources/gitea/rootfs/var/lib/gitea/.gitkeep diff --git a/README.MD b/README.MD index d020ed6..4a3c978 100644 --- a/README.MD +++ b/README.MD @@ -51,7 +51,7 @@ To enter in temporary filesystem - [crfpp](./ressources/crfpp) - [element-web](./ressources/element-web) - [flame](./ressources/flame) - - [gitea](./ressources/gitea) + - [forgejo](./ressources/forgejo) - [glpi](./ressources/glpi) - [gotify](./ressources/gotify) - [grocy](./ressources/grocy) diff --git a/lib/exec_in_chroot.sh b/lib/exec_in_chroot.sh index 011b6f6..fcfd43d 100755 --- a/lib/exec_in_chroot.sh +++ b/lib/exec_in_chroot.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/bash base_package_upgrade(){ apt update @@ -38,7 +38,7 @@ configure_depot_nodejs() { } install_go() { - GO_VERSION=1.20.4 + GO_VERSION=1.20.5 [ ! "$1" == "" ] && GO_VERSION=$1 PATH=$PATH:/usr/local/go/bin if [ ! "$(go version)" == "go version go${GO_VERSION} linux/amd64" ] ; diff --git a/lib/function.sh b/lib/function.sh index 8dc9f42..cb16c0c 100644 --- a/lib/function.sh +++ b/lib/function.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/bash LANGUAGE=C LC_ALL=C LANG=C @@ -47,7 +47,7 @@ zdebmaker_inject(){ zdebmaker_getDep sudo mount cache/${APP} ${MOUNT_PATH}/${APP}/ [ -d ${MOUNT_PATH}/${APP}/tmp/dist ] && sudo rm -fr ${MOUNT_PATH}/${APP}/tmp/dist/ - sudo mkdir ${MOUNT_PATH}/${APP}/tmp/dist/ + sudo mkdir -p ${MOUNT_PATH}/${APP}/tmp/dist/ [ -d ${MOUNT_PATH}/${APP}/tmp/src ] && sudo rm -rf ${MOUNT_PATH}/${APP}/tmp/src/ sudo mkdir -p ${MOUNT_PATH}/${APP}/tmp/src sudo echo . /tmp/src/exec_in_chroot.sh | sudo tee ${MOUNT_PATH}/${APP}/root/.bashrc diff --git a/ressources/gitea/README.MD b/ressources/forgejo/README.MD similarity index 57% rename from ressources/gitea/README.MD rename to ressources/forgejo/README.MD index e229b3c..2ef6b67 100644 --- a/ressources/gitea/README.MD +++ b/ressources/forgejo/README.MD @@ -1,9 +1,9 @@ #### gitea ##### Information -Site : https://gitea.io +Site : https://codeberg.org/forgejo/forgejo -Source : https://github.com/go-gitea/gitea/ +Source : https://codeberg.org/forgejo/forgejo ##### Install @@ -11,9 +11,9 @@ Source : https://github.com/go-gitea/gitea/ apt install -y wget ca-certificates wget -qO - https://deb.lgy.fr/install.sh | bash apt-get update -apt-get install -y gitea +apt-get install -y forgejo -systemctl enable --now gitea +systemctl enable --now forgejo #configuration with http://:3000 ``` diff --git a/ressources/gitea/debmaker b/ressources/forgejo/debmaker similarity index 58% rename from ressources/gitea/debmaker rename to ressources/forgejo/debmaker index 118f773..3f2449c 100755 --- a/ressources/gitea/debmaker +++ b/ressources/forgejo/debmaker @@ -1,11 +1,11 @@ #!/bin/bash -VERSION=1.19.3 -APP=gitea -DEPOT=https://github.com/go-gitea/gitea.git +VERSION=1.19.3-0 +APP=forgejo +DEPOT=https://codeberg.org/forgejo/forgejo GIT_VERSION=v${VERSION} DEB_VERSION=${VERSION}-$(date +%Y%m%d%H%M) -DEBIAN_VERSION_CODENAME=bullseye +DEBIAN_VERSION_CODENAME=bookworm IMAGE_SIZE=6 PACKAGE_DEPENDENCY="build-essential nodejs" @@ -28,8 +28,16 @@ build() { makedeb(){ PATH_DEB=/tmp/src/rootfs + mkdir -p \ + ${PATH_DEB}/etc/${APP}/ \ + ${PATH_DEB}/usr/bin/ \ + ${PATH_DEB}/usr/lib/systemd/system/ \ + ${PATH_DEB}/var/lib/gitea/ + + cp ${PATH_DEB}/gitea.service ${PATH_DEB}/usr/lib/systemd/system/ cp /tmp/${APP}/gitea ${PATH_DEB}/usr/bin/ - cp /tmp/${APP}/custom/conf/app.example.ini ${PATH_DEB}/etc/gitea/app.ini + ln -s /usr/bin/gitea ${PATH_DEB}/usr/bin/forgejo + cp /tmp/${APP}/custom/conf/app.example.ini ${PATH_DEB}/etc/${APP}/app.ini sed -i "s/%VERSION%/$DEB_VERSION/" ${PATH_DEB}/DEBIAN/control fakeroot dpkg-deb -Z gzip --build ${PATH_DEB} /tmp/dist } diff --git a/ressources/gitea/rootfs/DEBIAN/changelog b/ressources/forgejo/rootfs/DEBIAN/changelog similarity index 100% rename from ressources/gitea/rootfs/DEBIAN/changelog rename to ressources/forgejo/rootfs/DEBIAN/changelog diff --git a/ressources/forgejo/rootfs/DEBIAN/conffiles b/ressources/forgejo/rootfs/DEBIAN/conffiles new file mode 100644 index 0000000..42ee8a1 --- /dev/null +++ b/ressources/forgejo/rootfs/DEBIAN/conffiles @@ -0,0 +1 @@ +/etc/forgejo/app.ini diff --git a/ressources/gitea/rootfs/DEBIAN/control b/ressources/forgejo/rootfs/DEBIAN/control similarity index 76% rename from ressources/gitea/rootfs/DEBIAN/control rename to ressources/forgejo/rootfs/DEBIAN/control index d3ea13c..3444033 100644 --- a/ressources/gitea/rootfs/DEBIAN/control +++ b/ressources/forgejo/rootfs/DEBIAN/control @@ -1,8 +1,8 @@ -Package: gitea +Package: forgejo Version: %VERSION% Section: contrib Priority: optional Architecture: all Depends: git Maintainer: Thomas Legay -Description: gitea +Description: forgejo diff --git a/ressources/forgejo/rootfs/DEBIAN/postinst b/ressources/forgejo/rootfs/DEBIAN/postinst new file mode 100755 index 0000000..5e42463 --- /dev/null +++ b/ressources/forgejo/rootfs/DEBIAN/postinst @@ -0,0 +1,6 @@ +#!/bin/bash + +id forgejo &> /dev/null || useradd forgejo -r -s /bin/false -d /var/lib/forgejo/ + +chown -R forgejo:forgejo /var/lib/forgejo/ +chown forgejo:forgejo /etc/forgejo/app.ini diff --git a/ressources/gitea/rootfs/usr/lib/systemd/system/gitea.service b/ressources/forgejo/rootfs/gitea.service similarity index 53% rename from ressources/gitea/rootfs/usr/lib/systemd/system/gitea.service rename to ressources/forgejo/rootfs/gitea.service index 7035ffa..f695e8f 100644 --- a/ressources/gitea/rootfs/usr/lib/systemd/system/gitea.service +++ b/ressources/forgejo/rootfs/gitea.service @@ -1,5 +1,5 @@ [Unit] -Description=Gitea (Git with a cup of tea) +Description=Forgejo After=syslog.target After=network.target @@ -12,22 +12,22 @@ After=network.target #LimitNOFILE=65535 RestartSec=2s Type=simple -User=gitea -Group=gitea -WorkingDirectory=/var/lib/gitea/ -# 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 +User=forgejo +Group=forgejo +WorkingDirectory=/var/lib/forgejo/ +# If using Unix socket: tells systemd to create the /run/forgejo folder, which will contain the forgejo.sock file +# (manually creating /run/forgejo doesn't work, because it would not persist across reboots) +#RuntimeDirectory=forgejo +ExecStart=/usr/bin/forgejo web --config /etc/forgejo/app.ini Restart=always -Environment=USER=gitea HOME=/var/lib/gitea/ GITEA_WORK_DIR=/var/lib/gitea/ +Environment=USER=forgejo HOME=/var/lib/forgejo/ FORGEJO_WORK_DIR=/var/lib/forgejo/ GITEA_WORK_DIR=/var/lib/forgejo/ # 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 +# If you want to bind forgejo to a port below 1024, uncomment +# the two values below, or use socket activation to pass forgejo its ports as above ### #CapabilityBoundingSet=CAP_NET_BIND_SERVICE #AmbientCapabilities=CAP_NET_BIND_SERVICE diff --git a/ressources/gitea/rootfs/DEBIAN/conffiles b/ressources/gitea/rootfs/DEBIAN/conffiles deleted file mode 100644 index cce5639..0000000 --- a/ressources/gitea/rootfs/DEBIAN/conffiles +++ /dev/null @@ -1 +0,0 @@ -/etc/gitea/app.ini diff --git a/ressources/gitea/rootfs/DEBIAN/postinst b/ressources/gitea/rootfs/DEBIAN/postinst deleted file mode 100755 index b12b3bf..0000000 --- a/ressources/gitea/rootfs/DEBIAN/postinst +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - -id gitea &> /dev/null || useradd gitea -r -s /bin/false -d /var/lib/gitea/ - -chown -R gitea:gitea /var/lib/gitea/ -chown gitea:gitea /etc/gitea/app.ini diff --git a/ressources/gitea/rootfs/etc/gitea/.gitkeep b/ressources/gitea/rootfs/etc/gitea/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/ressources/gitea/rootfs/usr/bin/.gitkeep b/ressources/gitea/rootfs/usr/bin/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/ressources/gitea/rootfs/var/lib/gitea/.gitkeep b/ressources/gitea/rootfs/var/lib/gitea/.gitkeep deleted file mode 100644 index e69de29..0000000