From 7207f235b91c118121ed4ea07b21fa01e80f575a Mon Sep 17 00:00:00 2001 From: tjh Date: Sun, 25 May 2025 10:15:57 +0100 Subject: [PATCH] update README --- README.md | 13 ++++++++++++- appview/README.md | 1 + 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 appview/README.md diff --git a/README.md b/README.md index c1f855e..6cb988e 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,15 @@ # pkgs -PKGBUILDs for [@tangled.sh](https://tangled.sh/@tangled.sh/core) on [Arch](https://archlinux.org). +PKGBUILDs for running [@tangled.sh](https://tangled.sh/@tangled.sh/core) on [Arch](https://archlinux.org). + +> [!NOTE] +> I use these packages to deploy tangled to my knot server. These are *not* official tangled packages. + +Packages: + +- [appview](appview) + +- [knotserver](knotserver) + +- [knotserver-git](knotserver-git) diff --git a/appview/README.md b/appview/README.md new file mode 100644 index 0000000..d42ab34 --- /dev/null +++ b/appview/README.md @@ -0,0 +1 @@ +# Appview -- 2.49.0 From d93fcd9117e2e28d929bf39a49cf537a9919e230 Mon Sep 17 00:00:00 2001 From: tjh Date: Sun, 25 May 2025 10:32:49 +0100 Subject: [PATCH] update config and add readme's --- README.md | 18 ++++++--- appview/README.md | 1 - conf.sh | 10 ++--- knotserver-git/.SRCINFO | 8 ++-- knotserver-git/PKGBUILD | 10 ++--- knotserver-git/knotserver-sshd.conf | 2 +- knotserver-git/knotserver-tmpfiles.conf | 1 + knotserver-git/knotserver.install | 6 +-- knotserver-git/knotserver.service | 6 +-- knotserver/.SRCINFO | 6 +-- knotserver/PKGBUILD | 13 +++---- knotserver/README.md | 17 +++++++++ knotserver/knotserver-sshd.conf | 2 +- knotserver/knotserver-tmpfiles.conf | 1 + knotserver/knotserver.install | 6 +-- knotserver/knotserver.service | 6 +-- src/README.md.sh | 26 +++++++++++++ src/common/install.sh | 6 +-- src/common/service.sh | 12 +++--- src/common/sshd.conf.sh | 4 +- src/common/tmpfiles.conf.sh | 3 +- src/knotserver/PKGBUILD.sh | 51 +++++++++++++++++++++++++ src/knotserver/README.md.sh | 20 ++++++++++ update.sh | 6 +++ 24 files changed, 183 insertions(+), 58 deletions(-) delete mode 100644 appview/README.md create mode 100644 knotserver/README.md create mode 100644 src/README.md.sh mode change 100755 => 100644 src/common/sshd.conf.sh create mode 100644 src/knotserver/PKGBUILD.sh create mode 100644 src/knotserver/README.md.sh diff --git a/README.md b/README.md index 6cb988e..cb73e27 100644 --- a/README.md +++ b/README.md @@ -3,13 +3,21 @@ PKGBUILDs for running [@tangled.sh](https://tangled.sh/@tangled.sh/core) on [Arch](https://archlinux.org). > [!NOTE] -> I use these packages to deploy tangled to my knot server. These are *not* official tangled packages. +> I use these packages to deploy to my knot server. +> +> These are **not** official tangled packages. **DO NOT** direct issues using these packages to the core tangled.sh repository. -Packages: +## Packages: -- [appview](appview) +### [appview](appview) -- [knotserver](knotserver) +Builds `appview` from tag [v1.3.0-alpha](https://tangled.sh/@tangled.sh/core/tree/v1.3.0-alpha). -- [knotserver-git](knotserver-git) +### [knotserver](knotserver) + +Builds `knotserver`, `keyfetch`, and `repoguard` from tag [v1.3.0-alpha](https://tangled.sh/@tangled.sh/core/tree/v1.3.0-alpha). + +### [knotserver-git](knotserver-git) + +Builds `knotserver`, `keyfetch`, and `repoguard` from branch [master](https://tangled.sh/@tangled.sh/core/tree/master). diff --git a/appview/README.md b/appview/README.md deleted file mode 100644 index d42ab34..0000000 --- a/appview/README.md +++ /dev/null @@ -1 +0,0 @@ -# Appview diff --git a/conf.sh b/conf.sh index 539c0ee..7267ba1 100644 --- a/conf.sh +++ b/conf.sh @@ -1,10 +1,6 @@ +tag=1.3.0-alpha knotserver_user=git knotserver_group=git - -# Path knotserver database files will be stored. -knotserver_db_path=/var/lib/knotserver - -# Path knotserver hosted git repositories will be stored. -knotserver_repo_path=/var/lib/tangled - +knotserver_path=/var/lib/tangled +knotserver_repo_path=/var/lib/tangled/repositories knotserver_log_directory=/var/log/knotserver diff --git a/knotserver-git/.SRCINFO b/knotserver-git/.SRCINFO index 9c6be10..294c730 100644 --- a/knotserver-git/.SRCINFO +++ b/knotserver-git/.SRCINFO @@ -1,6 +1,6 @@ pkgbase = knotserver-git pkgdesc = git collaboration platform built on ATproto - pkgver = 1.3.0.alpha.r2.gdacad6d + pkgver = 1.3.0.alpha.r48.gd4332d6 pkgrel = 1 url = https://tangled.sh/@tangled.sh/core install = knotserver.install @@ -15,8 +15,8 @@ pkgbase = knotserver-git source = knotserver-sshd.conf source = knotserver-tmpfiles.conf sha256sums = SKIP - sha256sums = 8d243e1bc0d2e51079550929019d18811679127e6af6aabeed60cd907ffaab32 - sha256sums = 7201f3f71b4282a99903b481a5d9ab4a26b2b305de8f0c6980570edd8de7137e - sha256sums = 30d0b9df2419c22f930649273e006faa1bdab740f03c47d740c941db45dc951e + sha256sums = e6683a884d99866d883658d331d0080a428ee7ce38b3fab5f2edd7c478c9f3b6 + sha256sums = 0a449ba545f787cb6bbb45419133fa62d94f3b4479000fbdb3658dc85dcf1b37 + sha256sums = cd09d9faa49f248ce7decfcd712269b8312dd20b6e460b478e8e823489b97171 pkgname = knotserver-git diff --git a/knotserver-git/PKGBUILD b/knotserver-git/PKGBUILD index 24afb4e..6b27f3d 100644 --- a/knotserver-git/PKGBUILD +++ b/knotserver-git/PKGBUILD @@ -1,7 +1,7 @@ _pkgname=knotserver pkgname=${_pkgname}-git pkgdesc='git collaboration platform built on ATproto' -pkgver=1.3.0.alpha.r2.gdacad6d +pkgver=1.3.0.alpha.r48.gd4332d6 pkgrel=1 license=(MIT) arch=(x86_64) @@ -16,9 +16,9 @@ source=("tangled::git+$url" ${_pkgname}-sshd.conf ${_pkgname}-tmpfiles.conf) sha256sums=('SKIP' - '8d243e1bc0d2e51079550929019d18811679127e6af6aabeed60cd907ffaab32' - '7201f3f71b4282a99903b481a5d9ab4a26b2b305de8f0c6980570edd8de7137e' - '30d0b9df2419c22f930649273e006faa1bdab740f03c47d740c941db45dc951e') + 'e6683a884d99866d883658d331d0080a428ee7ce38b3fab5f2edd7c478c9f3b6' + '0a449ba545f787cb6bbb45419133fa62d94f3b4479000fbdb3658dc85dcf1b37' + 'cd09d9faa49f248ce7decfcd712269b8312dd20b6e460b478e8e823489b97171') pkgver() { cd ${srcdir}/tangled @@ -36,7 +36,7 @@ build() { export GOFLAGS="-buildmode=pie -trimpath -ldflags=-linkmode=external -mod=readonly -modcacherw" cd ${srcdir}/tangled - go build -o "${srcdir}/build/knotserver" ./cmd/knotserver + go build -ldflags "-X tangled.sh/tangled.sh/core/knotserver.version=${pkgver}" -o "${srcdir}/build/knotserver" ./cmd/knotserver go build -o "${srcdir}/build/repoguard" ./cmd/repoguard go build -o "${srcdir}/build/keyfetch" ./cmd/keyfetch } diff --git a/knotserver-git/knotserver-sshd.conf b/knotserver-git/knotserver-sshd.conf index e3d751a..43c3765 100644 --- a/knotserver-git/knotserver-sshd.conf +++ b/knotserver-git/knotserver-sshd.conf @@ -1,3 +1,3 @@ Match User git - AuthorizedKeysCommand /usr/bin/keyfetch -git-dir /var/lib/tangled -repoguard-path /usr/bin/repoguard -log-path /var/log/knotserver/keyfetch.log + AuthorizedKeysCommand /usr/bin/keyfetch -git-dir /var/lib/tangled/repositories -repoguard-path /usr/bin/repoguard -log-path /var/log/knotserver/keyfetch.log AuthorizedKeysCommandUser nobody diff --git a/knotserver-git/knotserver-tmpfiles.conf b/knotserver-git/knotserver-tmpfiles.conf index 7cc23d3..29166e1 100644 --- a/knotserver-git/knotserver-tmpfiles.conf +++ b/knotserver-git/knotserver-tmpfiles.conf @@ -1,2 +1,3 @@ d /etc/tangled 700 root root d /var/lib/tangled 755 git git - +d /var/lib/tangled/repositories 755 git git - diff --git a/knotserver-git/knotserver.install b/knotserver-git/knotserver.install index ff979f7..2e8105c 100644 --- a/knotserver-git/knotserver.install +++ b/knotserver-git/knotserver.install @@ -1,14 +1,14 @@ post_install() { echo - echo knotserver installed, with repositories stored in: /var/lib/tangled + echo knotserver installed, with repositories stored in: /var/lib/tangled/repositories echo - echo Remember to set 'KNOT_SERVER_SECRET="..."' in /etc/tangled/knotserver + echo Set 'KNOT_SERVER_SECRET="..."' in /etc/tangled/knotserver echo and 'KNOT_SERVER_HOSTNAME' if 'hostname' does not return the FQDN echo of your knot. echo echo To enable git push over ssh for tangled repositories, run: echo " ln -s /usr/lib/systemd/sshd_config.d/knotserver.conf /etc/ssh/sshd_config.d/30-knotserver.conf" - echo " usermod -s /usr/bin/bash -d /var/lib/tangled git" + echo " usermod -s /usr/bin/bash -d /var/lib/tangled/repositories git" echo echo and reload sshd echo diff --git a/knotserver-git/knotserver.service b/knotserver-git/knotserver.service index 81b6c71..c20284c 100644 --- a/knotserver-git/knotserver.service +++ b/knotserver-git/knotserver.service @@ -2,16 +2,16 @@ Description=tangled knot server After=network.target network-online.target Wants=network-online.target -AssertPathExists=/var/lib/knotserver AssertPathExists=/var/lib/tangled +AssertPathExists=/var/lib/tangled/repositories [Service] Environment="KNOT_SERVER_HOSTNAME=%H" Environment="KNOT_SERVER_LISTEN_ADDR=127.0.0.1:5555" -Environment="KNOT_REPO_SCAN_PATH=/var/lib/tangled" +Environment="KNOT_REPO_SCAN_PATH=/var/lib/tangled/repositories" EnvironmentFile=-/etc/tangled/knotserver -WorkingDirectory=/var/lib/knotserver +WorkingDirectory=/var/lib/tangled ExecStart=/usr/bin/knotserver Restart=always User=git diff --git a/knotserver/.SRCINFO b/knotserver/.SRCINFO index 45d4663..3ba3352 100644 --- a/knotserver/.SRCINFO +++ b/knotserver/.SRCINFO @@ -16,8 +16,8 @@ pkgbase = knotserver source = knotserver-sshd.conf source = knotserver-tmpfiles.conf sha256sums = 790dfc1fb65dfc6db973f411a65088f865325f548f24ac1358fd65a52eaa0eee - sha256sums = 8d243e1bc0d2e51079550929019d18811679127e6af6aabeed60cd907ffaab32 - sha256sums = 7201f3f71b4282a99903b481a5d9ab4a26b2b305de8f0c6980570edd8de7137e - sha256sums = 30d0b9df2419c22f930649273e006faa1bdab740f03c47d740c941db45dc951e + sha256sums = e6683a884d99866d883658d331d0080a428ee7ce38b3fab5f2edd7c478c9f3b6 + sha256sums = 0a449ba545f787cb6bbb45419133fa62d94f3b4479000fbdb3658dc85dcf1b37 + sha256sums = cd09d9faa49f248ce7decfcd712269b8312dd20b6e460b478e8e823489b97171 pkgname = knotserver diff --git a/knotserver/PKGBUILD b/knotserver/PKGBUILD index 4e2e284..0c5bcdf 100644 --- a/knotserver/PKGBUILD +++ b/knotserver/PKGBUILD @@ -12,14 +12,14 @@ conflicts=(knotserver-git) makedepends=(go) options=(strip !debug) install=${_pkgname}.install -source=("tangled::git+$url#tag=v$_pkgver" +source=("tangled::git+$url#tag=v${_pkgver}" ${_pkgname}.service ${_pkgname}-sshd.conf ${_pkgname}-tmpfiles.conf) sha256sums=('790dfc1fb65dfc6db973f411a65088f865325f548f24ac1358fd65a52eaa0eee' - '8d243e1bc0d2e51079550929019d18811679127e6af6aabeed60cd907ffaab32' - '7201f3f71b4282a99903b481a5d9ab4a26b2b305de8f0c6980570edd8de7137e' - '30d0b9df2419c22f930649273e006faa1bdab740f03c47d740c941db45dc951e') + 'e6683a884d99866d883658d331d0080a428ee7ce38b3fab5f2edd7c478c9f3b6' + '0a449ba545f787cb6bbb45419133fa62d94f3b4479000fbdb3658dc85dcf1b37' + 'cd09d9faa49f248ce7decfcd712269b8312dd20b6e460b478e8e823489b97171') build() { mkdir -p ${srcdir}/build @@ -32,15 +32,14 @@ build() { export GOFLAGS="-buildmode=pie -trimpath -ldflags=-linkmode=external -mod=readonly -modcacherw" cd ${srcdir}/tangled - go build -ldflags "-X tangled.sh/tangled.sh/core/knotserver.version=$_pkgver" \ - -o "${srcdir}/build/knotserver" ./cmd/knotserver + go build -ldflags "-X tangled.sh/tangled.sh/core/knotserver.version=${_pkgver}" -o "${srcdir}/build/knotserver" ./cmd/knotserver go build -o "${srcdir}/build/repoguard" ./cmd/repoguard go build -o "${srcdir}/build/keyfetch" ./cmd/keyfetch } package() { install -Dm644 "${srcdir}/${_pkgname}.service" "${pkgdir}/usr/lib/systemd/system/${_pkgname}.service" - install -Dm644 "${srcdir}/${_pkgname}-tmpfiles.conf" "${pkgdir}/usr/lib/tmpfiles.d/${_pkgname}.conf" + install -Dm644 "${srcdir}/${_pkgname}-tmpfiles.conf" "$\{pkgdir}/usr/lib/tmpfiles.d/${_pkgname}.conf" install -Dm644 "${srcdir}/${_pkgname}-sshd.conf" "${pkgdir}/usr/lib/systemd/sshd_config.d/${_pkgname}.conf" install -Dm755 "${srcdir}/build/knotserver" "${pkgdir}/usr/bin/knotserver" install -Dm755 "${srcdir}/build/repoguard" "${pkgdir}/usr/bin/repoguard" diff --git a/knotserver/README.md b/knotserver/README.md new file mode 100644 index 0000000..306d73d --- /dev/null +++ b/knotserver/README.md @@ -0,0 +1,17 @@ +# knotserver + +Builds and packages `knotserver`, `keyfetch`, and `repoguard`. + +When installed, knotserver's database files will be stored in `/var/lib/tangled`. Repositories will +be stored in `/var/lib/tangled/repositories`. + +## SSH + +SSH access is required to push to repositories. To enable, use the sshd_config.d drop-in, and give the +`git` user a shell and a home directory: + +```bash +ln -s /usr/lib/systemd/sshd_config.d/knotserver.conf /etc/ssh/sshd_config.d/30-knotserver.conf +usermod -s /usr/bin/bash -d /var/lib/tangled/repositories git +``` + diff --git a/knotserver/knotserver-sshd.conf b/knotserver/knotserver-sshd.conf index e3d751a..43c3765 100644 --- a/knotserver/knotserver-sshd.conf +++ b/knotserver/knotserver-sshd.conf @@ -1,3 +1,3 @@ Match User git - AuthorizedKeysCommand /usr/bin/keyfetch -git-dir /var/lib/tangled -repoguard-path /usr/bin/repoguard -log-path /var/log/knotserver/keyfetch.log + AuthorizedKeysCommand /usr/bin/keyfetch -git-dir /var/lib/tangled/repositories -repoguard-path /usr/bin/repoguard -log-path /var/log/knotserver/keyfetch.log AuthorizedKeysCommandUser nobody diff --git a/knotserver/knotserver-tmpfiles.conf b/knotserver/knotserver-tmpfiles.conf index 7cc23d3..29166e1 100644 --- a/knotserver/knotserver-tmpfiles.conf +++ b/knotserver/knotserver-tmpfiles.conf @@ -1,2 +1,3 @@ d /etc/tangled 700 root root d /var/lib/tangled 755 git git - +d /var/lib/tangled/repositories 755 git git - diff --git a/knotserver/knotserver.install b/knotserver/knotserver.install index ff979f7..2e8105c 100644 --- a/knotserver/knotserver.install +++ b/knotserver/knotserver.install @@ -1,14 +1,14 @@ post_install() { echo - echo knotserver installed, with repositories stored in: /var/lib/tangled + echo knotserver installed, with repositories stored in: /var/lib/tangled/repositories echo - echo Remember to set 'KNOT_SERVER_SECRET="..."' in /etc/tangled/knotserver + echo Set 'KNOT_SERVER_SECRET="..."' in /etc/tangled/knotserver echo and 'KNOT_SERVER_HOSTNAME' if 'hostname' does not return the FQDN echo of your knot. echo echo To enable git push over ssh for tangled repositories, run: echo " ln -s /usr/lib/systemd/sshd_config.d/knotserver.conf /etc/ssh/sshd_config.d/30-knotserver.conf" - echo " usermod -s /usr/bin/bash -d /var/lib/tangled git" + echo " usermod -s /usr/bin/bash -d /var/lib/tangled/repositories git" echo echo and reload sshd echo diff --git a/knotserver/knotserver.service b/knotserver/knotserver.service index 81b6c71..c20284c 100644 --- a/knotserver/knotserver.service +++ b/knotserver/knotserver.service @@ -2,16 +2,16 @@ Description=tangled knot server After=network.target network-online.target Wants=network-online.target -AssertPathExists=/var/lib/knotserver AssertPathExists=/var/lib/tangled +AssertPathExists=/var/lib/tangled/repositories [Service] Environment="KNOT_SERVER_HOSTNAME=%H" Environment="KNOT_SERVER_LISTEN_ADDR=127.0.0.1:5555" -Environment="KNOT_REPO_SCAN_PATH=/var/lib/tangled" +Environment="KNOT_REPO_SCAN_PATH=/var/lib/tangled/repositories" EnvironmentFile=-/etc/tangled/knotserver -WorkingDirectory=/var/lib/knotserver +WorkingDirectory=/var/lib/tangled ExecStart=/usr/bin/knotserver Restart=always User=git diff --git a/src/README.md.sh b/src/README.md.sh new file mode 100644 index 0000000..c90a774 --- /dev/null +++ b/src/README.md.sh @@ -0,0 +1,26 @@ +#!/usr/bin/bash +cat << EOF > ${pkgbuild_path}/README.md +# pkgs + +PKGBUILDs for running [@tangled.sh](https://tangled.sh/@tangled.sh/core) on [Arch](https://archlinux.org). + +> [!NOTE] +> I use these packages to deploy to my knot server. +> +> These are **not** official tangled packages. **DO NOT** direct issues using these packages to the core tangled.sh repository. + +## Packages: + +### [appview](appview) + +Builds \`appview\` from tag [v${tag}](https://tangled.sh/@tangled.sh/core/tree/v${tag}). + +### [knotserver](knotserver) + +Builds \`knotserver\`, \`keyfetch\`, and \`repoguard\` from tag [v${tag}](https://tangled.sh/@tangled.sh/core/tree/v${tag}). + +### [knotserver-git](knotserver-git) + +Builds \`knotserver\`, \`keyfetch\`, and \`repoguard\` from branch [master](https://tangled.sh/@tangled.sh/core/tree/master). + +EOF diff --git a/src/common/install.sh b/src/common/install.sh index 65607db..fd3cdd5 100644 --- a/src/common/install.sh +++ b/src/common/install.sh @@ -2,15 +2,15 @@ cat << EOF > ${pkgbuild_path}/knotserver.install post_install() { echo - echo knotserver installed, with repositories stored in: $knotserver_repo_path + echo knotserver installed, with repositories stored in: ${knotserver_repo_path:-/var/lib/tangled/repositories} echo - echo Remember to set 'KNOT_SERVER_SECRET="..."' in /etc/tangled/knotserver + echo Set 'KNOT_SERVER_SECRET="..."' in /etc/tangled/knotserver echo and 'KNOT_SERVER_HOSTNAME' if 'hostname' does not return the FQDN echo of your knot. echo echo To enable git push over ssh for tangled repositories, run: echo " ln -s /usr/lib/systemd/sshd_config.d/knotserver.conf /etc/ssh/sshd_config.d/30-knotserver.conf" - echo " usermod -s /usr/bin/bash -d $knotserver_repo_path $knotserver_user" + echo " usermod -s /usr/bin/bash -d ${knotserver_repo_path:-/var/lib/tangled/repositories} ${knotserver_user:-git}" echo echo and reload sshd echo diff --git a/src/common/service.sh b/src/common/service.sh index 7a6587d..da4bd6e 100644 --- a/src/common/service.sh +++ b/src/common/service.sh @@ -4,20 +4,20 @@ cat << EOF > ${pkgbuild_path}/knotserver.service Description=tangled knot server After=network.target network-online.target Wants=network-online.target -AssertPathExists=$knotserver_db_path -AssertPathExists=$knotserver_repo_path +AssertPathExists=${knotserver_path:-/var/lib/tangled} +AssertPathExists=${knotserver_repo_path:-/var/lib/tangled/repositories} [Service] Environment="KNOT_SERVER_HOSTNAME=%H" Environment="KNOT_SERVER_LISTEN_ADDR=127.0.0.1:5555" -Environment="KNOT_REPO_SCAN_PATH=${knotserver_repo_path}" +Environment="KNOT_REPO_SCAN_PATH=${knotserver_repo_path:-/var/lib/tangled/repositories}" EnvironmentFile=-/etc/tangled/knotserver -WorkingDirectory=$knotserver_db_path +WorkingDirectory=${knotserver_path:-/var/lib/tangled} ExecStart=/usr/bin/knotserver Restart=always -User=$knotserver_user -Group=$knotserver_group +User=${knotserver_user:-git} +Group=${knotserver_group:-git} StandardOutput=journal StandardError=journal diff --git a/src/common/sshd.conf.sh b/src/common/sshd.conf.sh old mode 100755 new mode 100644 index 6743aef..bc25e4b --- a/src/common/sshd.conf.sh +++ b/src/common/sshd.conf.sh @@ -1,6 +1,6 @@ #!/usr/bin/bash cat << EOF > ${pkgbuild_path}/knotserver-sshd.conf -Match User $knotserver_user - AuthorizedKeysCommand /usr/bin/keyfetch -git-dir $knotserver_repo_path -repoguard-path /usr/bin/repoguard -log-path ${knotserver_log_directory}/keyfetch.log +Match User ${knotserver_user:-git} + AuthorizedKeysCommand /usr/bin/keyfetch -git-dir ${knotserver_repo_path:-/var/lib/tangled/repositories} -repoguard-path /usr/bin/repoguard -log-path ${knotserver_log_directory:-/var/log/knotserver}/keyfetch.log AuthorizedKeysCommandUser nobody EOF diff --git a/src/common/tmpfiles.conf.sh b/src/common/tmpfiles.conf.sh index 039404b..742fd50 100644 --- a/src/common/tmpfiles.conf.sh +++ b/src/common/tmpfiles.conf.sh @@ -1,5 +1,6 @@ #!/usr/bin/bash cat << EOF > ${pkgbuild_path}/knotserver-tmpfiles.conf d /etc/tangled 700 root root -d $knotserver_repo_path 755 $knotserver_user $knotserver_group - +d ${knotserver_path:-/var/lib/tangled} 755 ${knotserver_user:-git} ${knotserver_group:-git} - +d ${knotserver_repo_path:-/var/lib/tangled/repositories} 755 ${knotserver_user:-git} ${knotserver_group:-git} - EOF diff --git a/src/knotserver/PKGBUILD.sh b/src/knotserver/PKGBUILD.sh new file mode 100644 index 0000000..e5d2a68 --- /dev/null +++ b/src/knotserver/PKGBUILD.sh @@ -0,0 +1,51 @@ +#!/usr/bin/bash +cat << EOF > ${pkgbuild_path}/PKGBUILD +_pkgname=knotserver +_pkgver=${tag} +pkgname=\${_pkgname/\-/\.} +pkgdesc='git collaboration platform built on ATproto' +pkgver=\${_pkgver/\-/\.} +pkgrel=1 +license=(MIT) +arch=(x86_64) +url=https://tangled.sh/@tangled.sh/core +depends=(git) +conflicts=(knotserver-git) +makedepends=(go) +options=(strip !debug) +install=\${_pkgname}.install +source=("tangled::git+\$url#tag=v\${_pkgver}" + \${_pkgname}.service + \${_pkgname}-sshd.conf + \${_pkgname}-tmpfiles.conf) +sha256sums=('set by updpkgsums' + 'set by updpkgsums' + 'set by updpkgsums' + 'set by updpkgsums') + +build() { + mkdir -p \${srcdir}/build + + export CGO_ENABLED=1 + export CGO_CPPFLAGS="\${CPPFLAGS}" + export CGO_CFLAGS="\${CFLAGS}" + export CGO_CXXFLAGS="\${CXXFLAGS}" + export CGO_LDFLAGS="\${LDFLAGS}" + export GOFLAGS="-buildmode=pie -trimpath -ldflags=-linkmode=external -mod=readonly -modcacherw" + + cd \${srcdir}/tangled + go build -ldflags "-X tangled.sh/tangled.sh/core/knotserver.version=\${_pkgver}" -o "\${srcdir}/build/knotserver" ./cmd/knotserver + go build -o "\${srcdir}/build/repoguard" ./cmd/repoguard + go build -o "\${srcdir}/build/keyfetch" ./cmd/keyfetch +} + +package() { + install -Dm644 "\${srcdir}/\${_pkgname}.service" "\${pkgdir}/usr/lib/systemd/system/\${_pkgname}.service" + install -Dm644 "\${srcdir}/\${_pkgname}-tmpfiles.conf" "$\{pkgdir}/usr/lib/tmpfiles.d/\${_pkgname}.conf" + install -Dm644 "\${srcdir}/\${_pkgname}-sshd.conf" "\${pkgdir}/usr/lib/systemd/sshd_config.d/\${_pkgname}.conf" + install -Dm755 "\${srcdir}/build/knotserver" "\${pkgdir}/usr/bin/knotserver" + install -Dm755 "\${srcdir}/build/repoguard" "\${pkgdir}/usr/bin/repoguard" + install -Dm755 "\${srcdir}/build/keyfetch" "\${pkgdir}/usr/bin/keyfetch" + install -Dm644 "\${srcdir}/tangled/license" "\${pkgdir}/usr/share/licenses/tangled/LICENSE" +} +EOF diff --git a/src/knotserver/README.md.sh b/src/knotserver/README.md.sh new file mode 100644 index 0000000..93ea2e8 --- /dev/null +++ b/src/knotserver/README.md.sh @@ -0,0 +1,20 @@ +#!/usr/bin/bash +cat << EOF > ${pkgbuild_path}/README.md +# knotserver + +Builds and packages \`knotserver\`, \`keyfetch\`, and \`repoguard\`. + +When installed, knotserver's database files will be stored in \`${knotserver_path}\`. Repositories will +be stored in \`${knotserver_repo_path}\`. + +## SSH + +SSH access is required to push to repositories. To enable, use the sshd_config.d drop-in, and give the +\`${knotserver_user:-git}\` user a shell and a home directory: + +\`\`\`bash +ln -s /usr/lib/systemd/sshd_config.d/knotserver.conf /etc/ssh/sshd_config.d/30-knotserver.conf +usermod -s /usr/bin/bash -d ${knotserver_repo_path} ${knotserver_user:-git} +\`\`\` + +EOF diff --git a/update.sh b/update.sh index 64e39ef..23916f7 100755 --- a/update.sh +++ b/update.sh @@ -2,11 +2,17 @@ source ./conf.sh +pkgbuild_path="." +source src/README.md.sh + for pkgbuild_path in knotserver knotserver-git; do source src/common/sshd.conf.sh source src/common/tmpfiles.conf.sh source src/common/service.sh source src/common/install.sh + for src in src/${pkgbuild_path}/*.sh; do + source ${src} + done cd $pkgbuild_path updpkgsums -- 2.49.0