pkgbuilds/vaultwarden/PKGBUILD
2024-02-06 10:05:28 -05:00

88 lines
2.4 KiB
Bash

# Maintainer: Daniel M. Capella <polyzen@archlinux.org>
# Maintainer: George Rawlinson <grawlinson@archlinux.org>
# Contributor: Markus Richter <mqus at disroot dot org>
# Contributor: Timothée Ravier <tim@siosm.fr
pkgname=vaultwarden
pkgver=1.30.3
pkgrel=1
pkgdesc='Unofficial Bitwarden compatible server written in Rust'
arch=('x86_64')
url='https://github.com/dani-garcia/vaultwarden'
license=('GPL3')
depends=(
'glibc'
'gcc-libs'
'mariadb-libs'
'openssl'
'postgresql-libs'
'sqlite'
)
makedepends=('git' 'rust')
optdepends=('vaultwarden-web: for the web app')
provides=('bitwarden_rs')
replaces=('bitwarden_rs')
backup=('etc/vaultwarden.env')
options=('!lto')
install=$pkgname.install
_commit='4438da39f9c9aa9d83d1dddbf06616ad287f70eb'
source=(
"$pkgname::git+$url#commit=$_commit"
'systemd.service'
'sysusers.conf'
'tmpfiles.conf'
)
b2sums=('SKIP'
'ff8e896f820b88f079d3d4f4c2eb394362569c921f53693e25d3badaf9fdca841e4d7665862e09d22421f544802f3a64014696fd92d7f0b923faf41f8d99e472'
'6580cf4031f262638abf11e529e8dfc489197afd6cd616c6a7810741e03c004706a5f9358f825aac6644c0ab6b251627ff988ed68f8264120b3575a655972390'
'9cdcd6c997c884eb3c1ad0c9b8cd91e68ec6762a27f9b80a7eb6c0cb1ffa4e500a654da6f17e9f985cc67add154efe737761f74e4e5f72892fc0e9d457314973')
pkgver() {
cd "$pkgname"
git describe --tags | sed 's/^v//'
}
prepare() {
cd "$pkgname"
# change various defaults
sed -i "s,# DATA_FOLDER=data,DATA_FOLDER=/var/lib/$pkgname,
s,web-vault/,/usr/share/webapps/$pkgname-web,
s,# WEB_VAULT_ENABLED=true,WEB_VAULT_ENABLED=false,
s,/path/to/log,/var/log/$pkgname.log,
/^# ROCKET_TLS/a ROCKET_LIMITS={json=10485760}" .env.template
# download dependencies
cargo fetch --locked --target "$CARCH-unknown-linux-gnu"
}
build() {
cd "$pkgname"
VW_VERSION="$pkgver" cargo build --release --frozen --features sqlite,mysql,postgresql
}
check() {
cd "$pkgname"
cargo test --frozen --features sqlite,mysql,postgresql
}
package() {
# systemd integration
install -vDm644 systemd.service "$pkgdir/usr/lib/systemd/system/$pkgname.service"
install -vDm644 sysusers.conf "$pkgdir/usr/lib/sysusers.d/$pkgname.conf"
install -vDm644 tmpfiles.conf "$pkgdir/usr/lib/tmpfiles.d/$pkgname.conf"
cd "$pkgname"
# configuration
install -Dm644 .env.template "$pkgdir"/etc/$pkgname.env
# binary
install -vDm755 -t "$pkgdir/usr/bin" "target/release/$pkgname"
}
# vim:set ts=2 sw=2 et: