diff options
author | Markus Richter | 2021-01-15 22:51:55 +0100 |
---|---|---|
committer | Markus Richter | 2021-02-19 11:35:07 +0100 |
commit | 1d925209cfe6b65a4e51eb69ef722ff551543f8c (patch) | |
tree | 14a4d0c76db363f83eb6744313fcf6b6503e1611 | |
download | aur-1d925209cfe6b65a4e51eb69ef722ff551543f8c.tar.gz |
First commit
-rw-r--r-- | .SRCINFO | 33 | ||||
-rw-r--r-- | PKGBUILD | 73 | ||||
-rw-r--r-- | earthwalker.env | 23 | ||||
-rw-r--r-- | earthwalker.install | 31 | ||||
-rw-r--r-- | earthwalker.service | 66 | ||||
-rw-r--r-- | earthwalker.sysusers.conf | 1 | ||||
-rw-r--r-- | earthwalker.tmpfiles.conf | 1 |
7 files changed, 228 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..49359a6a4b5c --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,33 @@ +pkgbase = earthwalker-git + pkgdesc = A selfhosted browsergame in which you find out where you are by navigating StreetView. + pkgver = r272.c4b7337 + pkgrel = 1 + url = https://gitlab.com/glatteis/earthwalker + install = earthwalker.install + arch = i686 + arch = x86_64 + arch = armv7h + arch = aarch64 + license = GPL3 + makedepends = go + makedepends = git + makedepends = npm + provides = earthwalker + conflicts = earthwalker + backup = etc/earthwalker/earthwalker.env + backup = etc/earthwalker/config.toml + source = git+https://gitlab.com/glatteis/earthwalker.git + source = earthwalker.install + source = earthwalker.env + source = earthwalker.service + source = earthwalker.sysusers.conf + source = earthwalker.tmpfiles.conf + sha512sums = SKIP + sha512sums = 484d5b10b83202dcf0bc0b0717c637f806f1a457d54dd78185ad56316cfbef49ab16338d15994cde1923b1f31cfcac6d7b7b66e15051c3f59fa85f3df9c6daab + sha512sums = 7e4c63f7e01898c66532206cdae3f8b0262edc73b066f1d6d3c42a2443876cd03acbb3a7ee9a91b59f736ab81d04a6e796b0269ee88dc04292f698efc795f38d + sha512sums = 4942bf0b14248e6cc144c8dd31ab82182bfee6c927f07e9ff6269de67a95eb6ab2567119ed9af898131706be997f4b71cb3b6050899aff5049e4372e89feb361 + sha512sums = 03823fd28e00034932e6f30912f93f6c58cf5897a99bc4c9b96cda73bb17e0391c9a3937ef587ddd9bac54581f9337f86046b0ce29af3702444f162baca33439 + sha512sums = c2ddeba33f565ffa2a78ffedfaacb5e0ed8030c67c2f45e3286261b7e005739d3c4cd16ce5e59c46c9eba14f514270ccae343c4879d11f57d418cb596a9a8e1e + +pkgname = earthwalker-git + diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..213855e71e50 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,73 @@ +# Maintainer: Markus Richter <mqus at disroot dot org> +# Contributor: Timothée Ravier <tim@siosm.fr + +pkgname=earthwalker-git +_pkgbase=earthwalker +pkgver=r272.c4b7337 +pkgrel=1 +pkgdesc="A selfhosted browsergame in which you find out where you are by navigating StreetView." +arch=('i686' 'x86_64' 'armv7h' 'aarch64') +url="https://gitlab.com/glatteis/earthwalker" +license=('GPL3') +depends=() +makedepends=('go' 'git' 'npm') +provides=("$_pkgbase") +optdepends=() +conflicts=("${_pkgbase}") +backup=("etc/${_pkgbase}/${_pkgbase}.env" "etc/${_pkgbase}/config.toml") +install=earthwalker.install +source=('git+https://gitlab.com/glatteis/earthwalker.git' + "${_pkgbase}.install" + "${_pkgbase}.env" + "${_pkgbase}.service" + "${_pkgbase}.sysusers.conf" + "${_pkgbase}.tmpfiles.conf") +# "0001-Disable-Vault.patch") +sha512sums=('SKIP' + '484d5b10b83202dcf0bc0b0717c637f806f1a457d54dd78185ad56316cfbef49ab16338d15994cde1923b1f31cfcac6d7b7b66e15051c3f59fa85f3df9c6daab' + '7e4c63f7e01898c66532206cdae3f8b0262edc73b066f1d6d3c42a2443876cd03acbb3a7ee9a91b59f736ab81d04a6e796b0269ee88dc04292f698efc795f38d' + '4942bf0b14248e6cc144c8dd31ab82182bfee6c927f07e9ff6269de67a95eb6ab2567119ed9af898131706be997f4b71cb3b6050899aff5049e4372e89feb361' + '03823fd28e00034932e6f30912f93f6c58cf5897a99bc4c9b96cda73bb17e0391c9a3937ef587ddd9bac54581f9337f86046b0ce29af3702444f162baca33439' + 'c2ddeba33f565ffa2a78ffedfaacb5e0ed8030c67c2f45e3286261b7e005739d3c4cd16ce5e59c46c9eba14f514270ccae343c4879d11f57d418cb596a9a8e1e') + + +pkgver() { + cd "$srcdir/$_pkgbase" + ( set -o pipefail + git describe --long --tags 2>/dev/null | sed 's/\([^-]*-g\)/r\1/;s/-/./g' || + printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)" + ) +} + +build() { + cd "$srcdir/$_pkgbase" + #patch -N -p1 -i "$srcdir/0001-Disable-Vault.patch" + make +} + +check() { + cd "$srcdir/$_pkgbase" + go test ./... +} + +package() { + # setup systemd service + install -D -m 0644 "$srcdir/${_pkgbase}.service" "$pkgdir/usr/lib/systemd/system/${_pkgbase}.service" + + # declarative setup of user and directory + install -D -m 0644 "$srcdir/${_pkgbase}.sysusers.conf" "$pkgdir/usr/lib/sysusers.d/${_pkgbase}.conf" + install -D -m 0644 "$srcdir/${_pkgbase}.tmpfiles.conf" "$pkgdir/usr/lib/tmpfiles.d/${_pkgbase}.conf" + + # copy default config files + install -D -m 0644 "$srcdir/${_pkgbase}.env" "$pkgdir/etc/${_pkgbase}/${_pkgbase}.env" + install -D -m 0644 "$srcdir/$_pkgbase/config.toml.sample" "$pkgdir/etc/${_pkgbase}/config.toml" + + # copy application data + install -d "$pkgdir/usr/share/${_pkgbase}" + cp -r "$srcdir/${_pkgbase}/public" "$pkgdir/usr/share/${_pkgbase}" +# cp -r "$srcdir/${_pkgbase}/static" "$pkgdir/usr/share/${_pkgbase}" +# cp -r "$srcdir/${_pkgbase}/templates" "$pkgdir/usr/share/${_pkgbase}" + + # copy binary + install -D -m 0755 "$srcdir/$_pkgbase/${_pkgbase}" "$pkgdir/usr/bin/${_pkgbase}" +} diff --git a/earthwalker.env b/earthwalker.env new file mode 100644 index 000000000000..b2809ad5930b --- /dev/null +++ b/earthwalker.env @@ -0,0 +1,23 @@ +### Paths + +# The path where the static files, like javascript and templates are located.`static` and `templates` are expected to be subdirectories of the specified path. Defaults to the location of the binary. +#EARTHWALKER_STATIC_PATH=<location of binary> +EARTHWALKER_STATIC_PATH=/usr/share/earthwalker/ + + +# The path where the config file is located. Defaults to $PWD/config.toml +#EARTHWALKER_CONFIG_PATH=config.toml +EARTHWALKER_CONFIG_PATH=/etc/earthwalker/config.toml + +# The path where the database is located. Defaults to <the dir where the binary is located>/badger +#EARTHWALKER_DB_PATH=/badger +EARTHWALKER_DB_PATH=/badger +# Defines if the path is relative to the executable(`executable`), relative to the current working dir(`cwd`) or absolute(`absolute`). Defaults to `executable`. +#EARTHWALKER_DB_PATH_REL=executable +EARTHWALKER_DB_PATH_REL=cwd + + +### Web settings + +# The tcp port on which earthwalker listens. +#EARTHWALKER_PORT=8080 diff --git a/earthwalker.install b/earthwalker.install new file mode 100644 index 000000000000..ec36f0e1adba --- /dev/null +++ b/earthwalker.install @@ -0,0 +1,31 @@ +post_install() { + echo "" + echo "##########" + echo "#" + #TODO echo "# Remember to configure the server via its environment-variables under /etc/earthwalker.env" + echo "# After installing, start/enable the server via 'systemctl enable earthwalker.service --now'" + echo "#" + echo "##########" + echo "" + +} + +post_upgrade() { + echo "# Remember to restart the earthwalker unit via 'systemctl restart earthwalker.service', if neccessary." +} + +pre_remove() { + # Stop service + systemctl --quiet --no-reload disable --now earthwalker.service +} + +post_remove() { + echo "" + echo "##########" + echo "#" + echo "# Remember to remove the user/group earthwalker, if neccessary." + echo "# All server data in /var/lib/earthwalker was NOT deleted!" + echo "#" + echo "##########" + echo "" +} diff --git a/earthwalker.service b/earthwalker.service new file mode 100644 index 000000000000..ec4577f40d99 --- /dev/null +++ b/earthwalker.service @@ -0,0 +1,66 @@ +[Unit] +Description=Eartwalker Server +Documentation=https://gitlab.com/glatteis/earthwalker +After=network.target + +[Service] +# The user/group earthwalker is run under. the working directory (see below) should allow write and read access to this user/group +User=earthwalker +Group=earthwalker + +# The location of the .env file for configuration +EnvironmentFile=/etc/earthwalker/earthwalker.env +# The location of the compiled binary +ExecStart=/usr/bin/earthwalker + +# Set reasonable connection and process limits +LimitNOFILE=1048576 +LimitNPROC=64 + +# Only allow writes to the following directory and set it to the working directory (user and password data are stored here) +WorkingDirectory=/var/lib/earthwalker +ReadWritePaths=/var/lib/earthwalker + +# Prevent earthwalker from doing anything stupid and/or unneccessary. +LockPersonality=yes +MemoryDenyWriteExecute=yes +NoNewPrivileges=yes + +PrivateTmp=yes +PrivateDevices=yes + +ProtectHome=yes +ProtectSystem=strict +ProtectKernelTunables=yes +ProtectKernelModules=yes +ProtectKernelLogs=yes +ProtectControlGroups=yes +ProtectHostname=yes +ProtectClock=yes + +RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6 +RestrictNamespaces=yes +RestrictRealtime=yes +RestrictSUIDSGID=yes + +RemoveIPC=yes +UMask=0077 + +SystemCallArchitectures=native +SystemCallFilter=@system-service +SystemCallFilter=~@resources +SystemCallFilter=~@privileged + +# Allow earthwalker to bind ports in the range of 0-1024 +AmbientCapabilities=CAP_NET_BIND_SERVICE +# Restrict earthwalker to only this capability +CapabilityBoundingSet=CAP_NET_BIND_SERVICE + +# If earthwalker is run at ports >1024, you can enable (remove the leading '#' of) +# the following lines: +#PrivateUsers=yes +#CapabilityBoundingSet= +#AmbientCapabilities= + +[Install] +WantedBy=multi-user.target diff --git a/earthwalker.sysusers.conf b/earthwalker.sysusers.conf new file mode 100644 index 000000000000..517bd39f8add --- /dev/null +++ b/earthwalker.sysusers.conf @@ -0,0 +1 @@ +u earthwalker - "User for earthwalker service" diff --git a/earthwalker.tmpfiles.conf b/earthwalker.tmpfiles.conf new file mode 100644 index 000000000000..497f051e868b --- /dev/null +++ b/earthwalker.tmpfiles.conf @@ -0,0 +1 @@ +d /var/lib/earthwalker 0750 earthwalker earthwalker |