diff options
author | Sam Whited | 2019-01-18 23:50:09 -0600 |
---|---|---|
committer | Sam Whited | 2019-01-18 23:50:09 -0600 |
commit | fa47f49a3bedcaed3b125cef26828919bdcf462c (patch) | |
tree | 29e086e554df9e93aa1b7f9c2e426c01acdfde33 | |
download | aur-fa47f49a3bedcaed3b125cef26828919bdcf462c.tar.gz |
Initial commit
-rw-r--r-- | .SRCINFO | 29 | ||||
-rw-r--r-- | .gitignore | 6 | ||||
-rw-r--r-- | 64.patch | 64 | ||||
-rw-r--r-- | PKGBUILD | 74 | ||||
-rw-r--r-- | config.ini | 37 | ||||
-rw-r--r-- | writefreely-sysusers.conf | 1 | ||||
-rw-r--r-- | writefreely.install | 5 | ||||
-rw-r--r-- | writefreely.service | 34 |
8 files changed, 250 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..e54df233e492 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,29 @@ +pkgbase = writefreely-git + pkgdesc = Federated blogging from write.as + pkgver = v0.7.1_7_gcb1bd37f64ab + pkgrel = 1 + url = https://writefreely.org/ + install = writefreely.install + arch = x86_64 + license = AGPL3 + makedepends = go>=1.11 + makedepends = go-bindata + makedepends = sqlite + depends = glibc + optdepends = sqlite: For SQLite support, + optdepends = mariadb: For MariaDB support + backup = var/lib/writefreely/config.ini + backup = etc/writefreely/config.ini + source = writefreely-sysusers.conf + source = writefreely.service + source = config.ini + source = 64.patch + source = git+https://github.com/writeas/writefreely.git + sha256sums = 6c74c81e27165851daf20d4bcf958227342f063aa3ec53b1cb86a56dac565f10 + sha256sums = 60d4b49872523a2aed3e0e6a55513dfefe5ae6cbec43f2fcc65db894fb3bd2a3 + sha256sums = e357b687bd0eab95996711276216b6f2dc534ba9214ae094172d6d7a6b1fdae5 + sha256sums = 009c083488511d92b489337f7feb8bd17631a104907959d21b1f9b5df3ce0a70 + sha256sums = SKIP + +pkgname = writefreely-git + diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000000..ddc5df1f47bb --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +writefreely/ +pkg/ +src/ +*.zip +*.tar.xz +*.tar.gz diff --git a/64.patch b/64.patch new file mode 100644 index 000000000000..b66787104d6a --- /dev/null +++ b/64.patch @@ -0,0 +1,64 @@ +From f9335a8fe9378b8013a27875085a5e19f0c0670a Mon Sep 17 00:00:00 2001 +From: Sam Whited <sam@samwhited.com> +Date: Wed, 9 Jan 2019 12:00:10 -0600 +Subject: [PATCH] respect external $LDFLAGS on build + +--- + Makefile | 28 ++++++++++++++++++++-------- + 1 file changed, 20 insertions(+), 8 deletions(-) + +diff --git a/Makefile b/Makefile +index 5950dfd..b05a747 100644 +--- a/Makefile ++++ b/Makefile +@@ -1,10 +1,22 @@ +-GITREV=`git describe --tags | cut -c 2-` +-LDFLAGS=-ldflags="-X 'github.com/writeas/writefreely.softwareVer=$(GITREV)'" ++# make(1) from NetBSD (bmake on many Linux's) uses $(.CURDIR), but GNU Make uses ++# $(CURDIR). Normalize on $(.CURDIR) by setting it to $(CURDIR) if not set, and ++# then $(PWD) if still not set. ++.CURDIR ?= $(CURDIR) ++.CURDIR ?= $(PWD) ++ ++# For reproducible builds, don't store the current build directory by default; ++# instead store only the path from the root of the repo (so there is still ++# enough info in debug messages to find the correct file). ++GCFLAGS = -gcflags="all=-trimpath=$(.CURDIR)" ++ASMFLAGS = -asmflags="all=-trimpath=$(.CURDIR)" ++ ++GITREV!=git describe --tags | cut -c 2- ++GOLDFLAGS=-ldflags="-X 'github.com/writeas/writefreely.softwareVer=$(GITREV)' -extldflags '$(LDFLAGS)'" + + GOCMD=go +-GOINSTALL=$(GOCMD) install $(LDFLAGS) +-GOBUILD=$(GOCMD) build $(LDFLAGS) +-GOTEST=$(GOCMD) test $(LDFLAGS) ++GOINSTALL=$(GOCMD) install $(GOLDFLAGS) $(GCFLAGS) $(ASMFLAGS) ++GOBUILD=$(GOCMD) build $(GOLDFLAGS) $(GCFLAGS) $(ASMFLAGS) ++GOTEST=$(GOCMD) test $(GOLDFLAGS) $(GCFLAGS) $(ASMFLAGS) + GOGET=$(GOCMD) get + BINARY_NAME=writefreely + DOCKERCMD=docker +@@ -19,19 +31,19 @@ build-linux: deps + @hash xgo > /dev/null 2>&1; if [ $$? -ne 0 ]; then \ + $(GOGET) -u github.com/karalabe/xgo; \ + fi +- xgo --targets=linux/amd64, -dest build/ $(LDFLAGS) -tags='sqlite' -out writefreely ./cmd/writefreely ++ xgo --targets=linux/amd64, -dest build/ $(GOLDFLAGS) $(GCFLAGS) $(ASMFLAGS) -tags='sqlite' -out writefreely ./cmd/writefreely + + build-windows: deps + @hash xgo > /dev/null 2>&1; if [ $$? -ne 0 ]; then \ + $(GOGET) -u github.com/karalabe/xgo; \ + fi +- xgo --targets=windows/amd64, -dest build/ $(LDFLAGS) -tags='sqlite' -out writefreely ./cmd/writefreely ++ xgo --targets=windows/amd64, -dest build/ $(GOLDFLAGS) $(GCFLAGS) $(ASMFLAGS) -tags='sqlite' -out writefreely ./cmd/writefreely + + build-darwin: deps + @hash xgo > /dev/null 2>&1; if [ $$? -ne 0 ]; then \ + $(GOGET) -u github.com/karalabe/xgo; \ + fi +- xgo --targets=darwin/amd64, -dest build/ $(LDFLAGS) -tags='sqlite' -out writefreely ./cmd/writefreely ++ xgo --targets=darwin/amd64, -dest build/ $(GOLDFLAGS) $(GCFLAGS) $(ASMFLAGS) -tags='sqlite' -out writefreely ./cmd/writefreely + + build-docker : + $(DOCKERCMD) build -t $(IMAGE_NAME):latest -t $(IMAGE_NAME):$(GITREV) . diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..68fd14f54f58 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,74 @@ +# Maintainer: Sam Whited <sam@samwhited.com> + +_pkgname=writefreely +pkgname=writefreely-git +pkgver=v0.7.1_7_gcb1bd37f64ab +pkgrel=1 +pkgdesc='Federated blogging from write.as' +arch=('x86_64') +url='https://writefreely.org/' +license=('AGPL3') +depends=('glibc') +makedepends=('go>=1.11' + 'go-bindata' + 'sqlite') +optdepends=('sqlite: For SQLite support', + 'mariadb: For MariaDB support') +backup=('var/lib/writefreely/config.ini' + 'etc/writefreely/config.ini') +install=writefreely.install +source=(writefreely-sysusers.conf + writefreely.service + config.ini + 64.patch + git+https://github.com/writeas/writefreely.git) +sha256sums=('6c74c81e27165851daf20d4bcf958227342f063aa3ec53b1cb86a56dac565f10' + '60d4b49872523a2aed3e0e6a55513dfefe5ae6cbec43f2fcc65db894fb3bd2a3' + 'e357b687bd0eab95996711276216b6f2dc534ba9214ae094172d6d7a6b1fdae5' + '009c083488511d92b489337f7feb8bd17631a104907959d21b1f9b5df3ce0a70' + 'SKIP') + +pkgver() { + cd "${_pkgname}" + git describe --tags --long | sed s/-/_/g +} + +prepare() { + export GO111MODULE=on + cd "${srcdir}/${_pkgname}" + + patch -p1 <../64.patch + + rm -rf go.mod + go mod init github.com/writeas/writefreely + + # Temporary manual override: + # Go picks v2 by default, which writefreely doesn't seem to support yet. + go get -u github.com/ikeikeikeike/go-sitemap-generator@v1.0.1 + go get -u github.com/writeas/monday@v0.0.0-20181024143321-54a7dd579219 + go mod tidy +} + +build() { + cd "${_pkgname}" + GO111MODULE=on make build +} + +package() { + install -dm750 "${pkgdir}"/var/lib/${_pkgname}/data + install -dm750 "${pkgdir}"/var/lib/${_pkgname}/keys + install -dm750 "${pkgdir}"/usr/share/${_pkgname}/pages + install -dm750 "${pkgdir}"/usr/share/${_pkgname}/static + install -dm750 "${pkgdir}"/usr/share/${_pkgname}/templates + + install -Dm644 config.ini "${pkgdir}"/etc/writefreely/config.ini + install -Dm644 writefreely.service -t "${pkgdir}"/usr/lib/systemd/system/ + install -Dm644 writefreely-sysusers.conf "${pkgdir}"/usr/lib/sysusers.d/writefreely.conf + install -Dm755 "${_pkgname}"/cmd/writefreely/writefreely "${pkgdir}"/usr/bin/writefreely + + cp -r "${_pkgname}"/pages/* "${pkgdir}"/usr/share/writefreely/pages + cp -r "${_pkgname}"/static/* "${pkgdir}"/usr/share/writefreely/static + cp -r "${_pkgname}"/templates/* "${pkgdir}"/usr/share/writefreely/templates +} + +# vim: ts=2 sw=2 et: diff --git a/config.ini b/config.ini new file mode 100644 index 000000000000..c0177d33196b --- /dev/null +++ b/config.ini @@ -0,0 +1,37 @@ +[server] +hidden_host = +port = 8080 +bind = localhost +tls_cert_path = +tls_key_path = + +keys_parent_dir = "/var/lib/writefreely" +pages_parent_dir = "/usr/share/writefreely" +static_parent_dir = "/usr/share/writefreely" +templates_parent_dir = "/usr/share/writefreely" + +[database] +type = sqlite3 +filename = /var/lib/writefreely/data/data.db +username = +password = +database = +host = +port = + +[app] +site_name = +site_description = +host = http://localhost:8080 +theme = write +disable_js = false +webfonts = true +single_user = true +open_registration = false +min_username_len = 3 +max_blogs = 1 +federation = true +public_stats = true +private = false +local_timeline = false + diff --git a/writefreely-sysusers.conf b/writefreely-sysusers.conf new file mode 100644 index 000000000000..a01f780dca94 --- /dev/null +++ b/writefreely-sysusers.conf @@ -0,0 +1 @@ +u writefreely - "writefreely blogging platform daemon" - - diff --git a/writefreely.install b/writefreely.install new file mode 100644 index 000000000000..d2550c325120 --- /dev/null +++ b/writefreely.install @@ -0,0 +1,5 @@ +post_install() { + cd /var/lib/writefreely + sudo -u writefreely /usr/bin/writefreely -c /etc/writefreely/config.ini -gen-keys + sudo -u writefreely /usr/bin/writefreely -c /etc/writefreely/config.ini -init-db +} diff --git a/writefreely.service b/writefreely.service new file mode 100644 index 000000000000..659a81944b66 --- /dev/null +++ b/writefreely.service @@ -0,0 +1,34 @@ +[Unit] +Description=Write Freely +After=syslog.target +After=network.target +After=mysqld.service +After=mariadb.service + +[Service] +User=writefreely +Group=writefreely +Type=simple +WorkingDirectory=/var/lib/writefreely +ExecStart=/usr/bin/writefreely -c config.ini +Restart=always +RestartSec=2s +CapabilityBoundingSet= +NoNewPrivileges=true +PrivateUsers=true +PrivateDevices=true +PrivateTmp=true +ProtectHome=true +ProtectSystem=strict +ProtectControlGroups=yes +ProtectKernelTunables=true +ProtectKernelModules=yes +ReadWritePaths=/var/lib/writefreely +LockPersonality=true +MemoryDenyWriteExecute=true +RestrictRealtime=true +SystemCallArchitectures=native +SystemCallFilter=@system-service + +[Install] +WantedBy=multi-user.target |