diff options
author | fuero | 2022-07-29 16:42:34 +0200 |
---|---|---|
committer | fuero | 2022-07-29 16:42:34 +0200 |
commit | 6d5c7ca88e59ab7f0abe7d447b58fa8a8864437b (patch) | |
tree | d58113381109c517c456a9305160845e58710335 | |
download | aur-6d5c7ca88e59ab7f0abe7d447b58fa8a8864437b.tar.gz |
Initial commit
-rw-r--r-- | .SRCINFO | 25 | ||||
-rw-r--r-- | PKGBUILD | 85 | ||||
-rw-r--r-- | bashhub-server.environment | 3 | ||||
-rw-r--r-- | bashhub-server.service | 40 | ||||
-rw-r--r-- | bashhub-server.sysusers | 2 | ||||
-rw-r--r-- | bashhub-server.tmpfiles | 1 |
6 files changed, 156 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..428d0802b492 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,25 @@ +pkgbase = bashhub-server-git + pkgdesc = a private cloud alternative for bashhub-client with some added features like regex search. + pkgver = 0.2.5.r13.c49226d + pkgrel = 1 + url = https://github.com/nicksherron/bashhub-server + arch = x86_64 + license = Apache + makedepends = git + makedepends = go-pie + depends = glibc + provides = bashhub-server + conflicts = bashhub-server + backup = etc/default/bashhub-server + source = bashhub-server::git+https://github.com/nicksherron/bashhub-server + source = bashhub-server.service + source = bashhub-server.sysusers + source = bashhub-server.tmpfiles + source = bashhub-server.environment + sha256sums = SKIP + sha256sums = b27591dddef43b8fa47be5608e1ea8dc87db64adc74c953ee4210d3edbc84310 + sha256sums = 29509b7609074e4702d1c0cdaf2ce7d52a781723554456b35ae1a44a1fb2632f + sha256sums = a55dd07223e10313102367abc613dd2c20805523f58dd3784d88919e468506a8 + sha256sums = 1d3551d70a0971a039e625c8e93757aa312d8536e98db5a9d7154ccac702902b + +pkgname = bashhub-server-git diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..1b76bc9267c3 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,85 @@ +# Maintainer: fuero <fuerob@gmail.com> +_pkgname=bashhub-server +pkgname=${_pkgname}-git +pkgver=0.2.5.r13.c49226d +pkgrel=1 +pkgdesc='a private cloud alternative for bashhub-client with some added features like regex search.' +arch=('x86_64') +_repo_prefix='github.com/nicksherron' +_repo_name="${_pkgname}" +url="https://${_repo_prefix}/${_repo_name}" +source=( + "${_repo_name}::git+https://${_repo_prefix}/${_repo_name}" + ${_pkgname}.service + ${_pkgname}.sysusers + ${_pkgname}.tmpfiles + ${_pkgname}.environment +) +license=('Apache') +depends=('glibc') +makedepends=('git' 'go-pie') +conflicts=(${_pkgname}) +provides=(${_pkgname}) +sha256sums=( + 'SKIP' + 'b27591dddef43b8fa47be5608e1ea8dc87db64adc74c953ee4210d3edbc84310' + '29509b7609074e4702d1c0cdaf2ce7d52a781723554456b35ae1a44a1fb2632f' + 'a55dd07223e10313102367abc613dd2c20805523f58dd3784d88919e468506a8' + '1d3551d70a0971a039e625c8e93757aa312d8536e98db5a9d7154ccac702902b' +) + +backup=("etc/default/${_pkgname}") + +pkgver() { + cd "${srcdir}/${_repo_name}" + ( + set -o pipefail + git describe --long --tags 2> /dev/null | sed "s/^[A-Za-z\.\-]*//;s/\([^-]*-\)g/r\1/;s/-/./g" || + printf "r%s.%s\n" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)" + ) +} + +prepare () { + mkdir -p "${srcdir}/src/${_repo_prefix}" + ln -snf "${srcdir}/${_repo_name}" "${srcdir}/src/${_repo_prefix}/${_repo_name}" +} + +clean() { + # Clean up symlink + rm -f "${srcdir}/src/${_repo_prefix}/${_repo_name}" + rm -f "${_repo_name}.bin" +} + +build () { + cd "${srcdir}/src/${_repo_prefix}/${_repo_name}" + export GOPATH="${srcdir}/go" + export GOBIN="${GOPATH}/bin" + export PATH="${GOBIN}:${PATH}" + go build -x -i -v \ + -buildmode=pie \ + -pkgdir=$(mktemp -d -p $(pwd)) \ + -ldflags "\ + -linkmode=external \ + -extldflags '${LDFLAGS}' \ + -X main.commit=$(git rev-parse --short HEAD) \ + -X main.date=$(date -u +%Y%m%d.%H%M%S) \ + -X main.version=$(git describe --always --tags --abbrev=0).$(git rev-parse --short HEAD)\ + " \ + -o "${_repo_name}.bin" +} + +package () { + cd "${srcdir}/src/${_repo_prefix}/${_repo_name}" + install -Dm 755 "${srcdir}/src/${_repo_prefix}/${_repo_name}/${_repo_name}.bin" "${pkgdir}/usr/bin/${_repo_name}" + install -Dm 644 "${srcdir}/src/${_repo_prefix}/${_repo_name}/LICENSE" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE" + + for _file in *.md + do + install -Dm644 "${_file}" "${pkgdir}/usr/share/doc/${pkgname}/$(basename ${_file})" + done + + install -Dm 644 "${srcdir}/${_pkgname}.service" -t "${pkgdir}/usr/lib/systemd/system" + install -Dm 644 "${srcdir}/${_pkgname}.sysusers" "${pkgdir}/usr/lib/sysusers.d/${_pkgname}.conf" + install -Dm 644 "${srcdir}/${_pkgname}.tmpfiles" "${pkgdir}/usr/lib/tmpfiles.d/${_pkgname}.conf" + install -Dm 644 "${srcdir}/${_pkgname}.environment" "${pkgdir}/etc/default/${_pkgname}" +} diff --git a/bashhub-server.environment b/bashhub-server.environment new file mode 100644 index 000000000000..850e8df269c1 --- /dev/null +++ b/bashhub-server.environment @@ -0,0 +1,3 @@ +ADDR=http://0.0.0.0:8080 +DB=/var/lib/bashhub-server/data.db +REG=-r true diff --git a/bashhub-server.service b/bashhub-server.service new file mode 100644 index 000000000000..fd4787eceb03 --- /dev/null +++ b/bashhub-server.service @@ -0,0 +1,40 @@ +[Unit] +Description=private cloud alternative for bashhub-client +Requires=network.target + +[Service] +Type=simple +EnvironmentFile=/etc/default/%N +User=bashhub-server +ExecStart=/usr/bin/bashhub-server -a $ADDR --db $DB $REG +Restart=on-failure +BindPaths=/var/lib/%N +CapabilityBoundingSet= +RestrictAddressFamilies=AF_INET AF_INET6 +SystemCallArchitectures=native +LockPersonality=yes +MemoryDenyWriteExecute=yes +NoNewPrivileges=yes +PrivateDevices=yes +PrivateTmp=yes +PrivateUsers=yes +ProtectClock=yes +ProtectHostname=yes +ProtectControlGroups=yes +ProtectHome=yes +ProtectKernelModules=yes +ProtectKernelTunables=yes +ProtectKernelLogs=yes +ProtectProc=invisible +ProtectSystem=strict +RestrictNamespaces=yes +RestrictSUIDSGID=true +RestrictRealtime=yes +RemoveIPC=yes +SystemCallErrorNumber=EPERM +#SystemCallFilter=@resources +SystemCallFilter=@system-service +UMask=0077 + +[Install] +WantedBy=multi-user.target diff --git a/bashhub-server.sysusers b/bashhub-server.sysusers new file mode 100644 index 000000000000..41306a0ca6a9 --- /dev/null +++ b/bashhub-server.sysusers @@ -0,0 +1,2 @@ +#Type Name ID GECOS Home directory Shell +u bashhub-server - "bashhub-server user" /var/lib/bashhub-server /usr/bin/false diff --git a/bashhub-server.tmpfiles b/bashhub-server.tmpfiles new file mode 100644 index 000000000000..84e59e4bd080 --- /dev/null +++ b/bashhub-server.tmpfiles @@ -0,0 +1 @@ +d /var/lib/bashhub-server 0700 bashhub-server bashhub-server - - |