From 23c31a9e39e6e8cd60f233a5e1e9e887df8e1bad Mon Sep 17 00:00:00 2001 From: Deposite Pirate Date: Tue, 12 Oct 2021 21:49:00 +0200 Subject: * Ergo build which isn't lamebrained (ruby) new file: ergo/.SRCINFO new file: ergo/.gitignore new file: ergo/PKGBUILD new file: ergo/ergo-paths.patch new file: ergo/ergo.install new file: ergo/ergo.service new file: ergo/ergo.sysusers new file: ergo/ergo.tmpfiles --- ergo/.SRCINFO | 27 ++++++++++++++++++ ergo/.gitignore | 1 + ergo/PKGBUILD | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++ ergo/ergo-paths.patch | 52 ++++++++++++++++++++++++++++++++++ ergo/ergo.install | 24 ++++++++++++++++ ergo/ergo.service | 15 ++++++++++ ergo/ergo.sysusers | 1 + ergo/ergo.tmpfiles | 3 ++ 8 files changed, 201 insertions(+) create mode 100644 ergo/.SRCINFO create mode 100644 ergo/.gitignore create mode 100644 ergo/PKGBUILD create mode 100644 ergo/ergo-paths.patch create mode 100644 ergo/ergo.install create mode 100644 ergo/ergo.service create mode 100644 ergo/ergo.sysusers create mode 100644 ergo/ergo.tmpfiles diff --git a/ergo/.SRCINFO b/ergo/.SRCINFO new file mode 100644 index 0000000..00aacc7 --- /dev/null +++ b/ergo/.SRCINFO @@ -0,0 +1,27 @@ +pkgbase = ergo + pkgdesc = A modern IRC server written in Go + pkgver = 2.7.0 + pkgrel = 3 + url = https://github.com/ergochat/ergo + install = ergo.install + arch = x86_64 + license = MIT + makedepends = go + makedepends = git + depends = glibc + provides = oragono + conflicts = oragono + replaces = oragono + backup = etc/ergo.conf + source = git+https://github.com/ergochat/ergo#tag=v2.7.0 + source = ergo-paths.patch + source = ergo.service + source = ergo.sysusers + source = ergo.tmpfiles + sha256sums = SKIP + sha256sums = 824b6618d0377c50645ff75cf1f3ad903e217476738728bc57102fd26ca766c8 + sha256sums = 366b7b10e44e9c0bbe2ee434b1011a9dc71fceb7836502db9a9e1c4400452d12 + sha256sums = 1930c0e32093b32ff7c05fe8548c20a90846acea08b62aab3194c1be7240a756 + sha256sums = 1bc9acdd7fc1fb8251a0165a19d6f4383069e522827535b9c1f717de5495cb29 + +pkgname = ergo diff --git a/ergo/.gitignore b/ergo/.gitignore new file mode 100644 index 0000000..d63a801 --- /dev/null +++ b/ergo/.gitignore @@ -0,0 +1 @@ +/ergo/ diff --git a/ergo/PKGBUILD b/ergo/PKGBUILD new file mode 100644 index 0000000..642a2e4 --- /dev/null +++ b/ergo/PKGBUILD @@ -0,0 +1,78 @@ +# Maintainer: Deposite Pirate +# +# Upstream: https://git.metalpunks.info/arch-ports + +pkgname=ergo +pkgver=2.7.0 +pkgrel=3 +pkgdesc="A modern IRC server written in Go" +arch=('x86_64') +url="https://github.com/ergochat/ergo" +license=('MIT') +install=ergo.install +depends=('glibc') +makedepends=('go' 'git') +source=("git+$url#tag=v$pkgver" + "ergo-paths.patch" + "ergo.service" + "ergo.sysusers" + "ergo.tmpfiles") +sha256sums=('SKIP' + '824b6618d0377c50645ff75cf1f3ad903e217476738728bc57102fd26ca766c8' + '366b7b10e44e9c0bbe2ee434b1011a9dc71fceb7836502db9a9e1c4400452d12' + '1930c0e32093b32ff7c05fe8548c20a90846acea08b62aab3194c1be7240a756' + '1bc9acdd7fc1fb8251a0165a19d6f4383069e522827535b9c1f717de5495cb29') +backup=('etc/ergo.conf') +replaces=('oragono') +conflicts=('oragono') +provides=('oragono') + +prepare() { + cd "${srcdir}/${pkgname}" + + # Fix paths + patch -p1 -i ../ergo-paths.patch +} + +build() { + export GOPATH=$(pwd)/.. + cd "${srcdir}/${pkgname}" + + GIT_COMMIT="$(git rev-parse HEAD 2> /dev/null)" + + # flags from https://wiki.archlinux.org/index.php/Go_package_guidelines + # to address issues namcap warns about: + # ergo W: ELF file ('usr/bin/ergo') lacks FULL RELRO, check LDFLAGS. + # ergo W: ELF file ('usr/bin/ergo') lacks PIE. + # related: https://bugs.archlinux.org/task/60928 + go build \ + -trimpath \ + -buildmode=pie \ + -ldflags "-X main.commit=${GIT_COMMIT} -linkmode external -extldflags \"${LDFLAGS}\"" \ + -v \ + . + + rm languages/README.md + rm -rf languages/example +} + +check() { + export GOPATH=$(pwd)/.. + cd "${srcdir}/${pkgname}" + + go test ./... +} + +package() { + install -Dm644 ergo.service "${pkgdir}/usr/lib/systemd/system/ergo.service" + install -Dm644 "${srcdir}/ergo.sysusers" "${pkgdir}/usr/lib/sysusers.d/ergo.conf" + install -Dm644 "${srcdir}/ergo.tmpfiles" "${pkgdir}/usr/lib/tmpfiles.d/ergo.conf" + + cd "${srcdir}/${pkgname}" + install -Dm755 -d "${pkgdir}/usr/share/${pkgname}/i18n" + cp languages/* "${pkgdir}/usr/share/${pkgname}/i18n/" + install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE" + install -Dm755 ergo "${pkgdir}/usr/bin/ergo" + install -Dm644 default.yaml "${pkgdir}/etc/ergo.conf" + install -Dm644 ergo.motd "${pkgdir}/usr/share/${pkgname}/default.motd" +} diff --git a/ergo/ergo-paths.patch b/ergo/ergo-paths.patch new file mode 100644 index 0000000..9d48e99 --- /dev/null +++ b/ergo/ergo-paths.patch @@ -0,0 +1,52 @@ +diff '--color=auto' -u -r -N ergo/default.yaml ergo-paths/default.yaml +--- ergo/default.yaml 2021-09-30 19:59:44.761132327 +0200 ++++ ergo-paths/default.yaml 2021-09-30 20:00:40.500799350 +0200 +@@ -52,8 +52,8 @@ + # this is a standard TLS configuration with a single certificate; + # see the manual for instructions on how to configure SNI + tls: +- cert: fullchain.pem +- key: privkey.pem ++ cert: /var/lib/ergo/fullchain.pem ++ key: /var/lib/ergo/privkey.pem + # 'proxy' should typically be false. It's for cloud load balancers that + # always send a PROXY protocol header ahead of the connection. See the + # manual ("Reverse proxies") for more details. +@@ -74,8 +74,8 @@ + # ":8097": + # websocket: true + # tls: +- # cert: fullchain.pem +- # key: privkey.pem ++ # cert: /var/lib/ergo/fullchain.pem ++ # key: /var/lib/ergo/privkey.pem + + # sets the permissions for Unix listen sockets. on a typical Linux system, + # the default is 0775 or 0755, which prevents other users/groups from connecting +@@ -169,7 +169,7 @@ + + # motd filename + # if you change the motd, you should move it to ircd.motd +- motd: ergo.motd ++ motd: /var/lib/ergo/ircd.motd + + # motd formatting codes + # if this is true, the motd is escaped using formatting codes like $c, $b, and $i +@@ -740,7 +740,7 @@ + # datastore configuration + datastore: + # path to the datastore +- path: ircd.db ++ path: /var/lib/ergo/ircd.db + + # if the database schema requires an upgrade, `autoupgrade` will attempt to + # perform it automatically on startup. the database will be backed +@@ -772,7 +772,7 @@ + default: en + + # which directory contains our language files +- path: languages ++ path: /usr/share/ergo/i18n + + # limits - these need to be the same across the network + limits: diff --git a/ergo/ergo.install b/ergo/ergo.install new file mode 100644 index 0000000..26c9ee9 --- /dev/null +++ b/ergo/ergo.install @@ -0,0 +1,24 @@ +# Warning: This file has syntactically significant, mixed whitespace. +# The heredoc bodies are indented with tabs up to the block level. +# The tabs are for block indentation in the source code. +# The spaces following the tabs are for indentation of the printed output. + +post_install() { + if [[ -e /var/lib/oragono/ircd.db ]]; then +cat <<-EOF + ==> Oragono is now Ergo, you may want to move the + files in /var/lib/oragono to /var/lib/ergo. +EOF + else + if [[ ! -e /var/lib/ergo/ircd.db ]]; then +cat <<-EOF + ==> Ergo needs to initialize the database and have + certificates made available prior to use. + + cd /var/lib/ergo + sudo -u ergo /usr/bin/ergo mkcerts --config /etc/ergo.conf + sudo -u ergo /usr/bin/ergo initdb --config /etc/ergo.conf +EOF + fi + fi +} diff --git a/ergo/ergo.service b/ergo/ergo.service new file mode 100644 index 0000000..4a47d48 --- /dev/null +++ b/ergo/ergo.service @@ -0,0 +1,15 @@ +[Unit] +Description=A modern IRC server written in Go +After=network.target + +[Service] +Type=simple +User=ergo +Group=ergo +WorkingDirectory=/var/lib/ergo +ExecStart=/usr/bin/ergo run --conf /etc/ergo.conf +ExecReload=/bin/kill -HUP $MAINPID +Restart=on-failure + +[Install] +WantedBy=multi-user.target diff --git a/ergo/ergo.sysusers b/ergo/ergo.sysusers new file mode 100644 index 0000000..96a6928 --- /dev/null +++ b/ergo/ergo.sysusers @@ -0,0 +1 @@ +u ergo - "Ergo IRC daemon" /var/lib/ergo diff --git a/ergo/ergo.tmpfiles b/ergo/ergo.tmpfiles new file mode 100644 index 0000000..d56af93 --- /dev/null +++ b/ergo/ergo.tmpfiles @@ -0,0 +1,3 @@ +#Type Path Mode User Group Age Argument +d /var/lib/ergo 0755 ergo ergo - - +C /var/lib/ergo/ircd.motd 0644 ergo ergo - /usr/share/ergo/default.motd -- cgit v1.2.3-70-g09d2