Skip to content

Instantly share code, notes, and snippets.

@bjo81
Created August 9, 2020 09:19
Show Gist options
  • Save bjo81/918e8e42b083eec8d298d7bffb3c0c3c to your computer and use it in GitHub Desktop.
Save bjo81/918e8e42b083eec8d298d7bffb3c0c3c to your computer and use it in GitHub Desktop.
bitwarden_rs split draft
# Co-Maintainer: Bjoern Franke <bjo+aur at schafweide.org>
# Maintainer: D. Can Celasun <can[at]dcc[dot]im>
# Contributor: Markus Richter <mqus at disroot dot org>
_pkgbase=bitwarden_rs
pkgname=("${_pkgbase}-postgresql" "${_pkgbase}-mysql")
pkgver=1.16.2
pkgrel=1
arch=('i686' 'x86_64' 'armv7h' 'aarch64')
url="https://github.com/dani-garcia/bitwarden_rs"
license=('GPL3')
depends=('openssl')
makedepends=('rust-nightly' 'cargo-nightly')
optdepends=("bitwarden_rs-vault: Web Interface 'Vault'")
conflicts=("${_pkgbase}-git" "${_pkgbase}" "${_pkgbase}-postgresql")
provides=("${_pkgbase}")
backup=('etc/bitwarden_rs.env')
install=bitwarden_rs.install
source=("https://github.com/dani-garcia/bitwarden_rs/archive/$pkgver.tar.gz"
"${_pkgbase}.install"
"${_pkgbase}.service"
"${_pkgbase}.sysusers.conf"
"${_pkgbase}.tmpfiles.conf"
"0001-Disable-Vault.patch")
sha512sums=('5fa2c7a430a85013f49d25a15400ef7b723a18cd4dcf85aef479788ebe08213be814c68217ae7cffa78e5928cdb89dd2541813fc3983b41ba06ce510191bde7c'
'6bb58fc3d7e1869aafb985aa5fd26683e730ca6b93ddfba6a907aa2b1ca31b1b4280dbfff8c875668d6890e7198f4f0ac39c6f9be283fbfba347f85b987a11f9'
'60a406c8fea4bb651974b3fd386f66a0fcf73bfcc29bffe171b92134e2e81b6374ac6be879eb420208ecd77911b7d157db587510347e56ecb72aec34ac90fbe6'
'15b00b0dc9122f98ce8d7b55668fdfbb2e0387563e7d9ad6c0ebc73b75e46e1ccdb3a2186a453795a1b3e2d45358ff5a8076d5cf30319ab2c21539d20cff81c6'
'6fd0ea962f077f92ad7f55a1bab479e68e3463b41eb171d501847554b676b7ecf05e016544f6331bdb53bf71038fcf2ce67ad213d0a7c2f93acbafd72e8441a6'
'a6f2361c7aa83e63b9a557500406b0cd660e0d7f8b16345f859faa3f96e22bdcecd7589711960486fa0401896291f7d46f66882744c69117fc146056f4a49028')
_src="$_pkgbase-$pkgver"
if (("${pkgname}"=="${_pkgbase}-postgresql"));then
_features="postgresql"
makedepends+=('postgresql')
fi
if (("${pkgname}"=="${_pkgbase}-mysql"));then
_features="mysql"
makedepends+=('mysql')
fi
build() {
echo "building ${pkgname} for ${_features}"
#build bitwarden_rs
cd "$srcdir/$_src"
patch -N -p1 -i "$srcdir/0001-Disable-Vault.patch"
cargo build --release --locked --no-default-features --features ${_features}
}
check() {
cd "$srcdir/$_src"
cargo test --release --locked --no-default-features --features ${_features}
}
package_bitwarden_rs-postgresql() {
conflicts=("${_pkgbase}-git" "${_pkgbase}" "${_pkgbase}-postgresql")
pkgdesc="An unofficial lightweight implementation of the bitwarden-server using rust and postgresql. Does NOT include the web-interface."
package_common
}
package_bitwarden_rs-mysql() {
conflicts=("${_pkgbase}-git" "${_pkgbase}" "${_pkgbase}-mysql")
pkgdesc="An unofficial lightweight implementation of the bitwarden-server using rust and mysql. Does NOT include the web-interface."
package_common
}
package_common() {
# setup systemd service
install -D -m 0644 "$srcdir/bitwarden_rs.service" "$pkgdir/usr/lib/systemd/system/bitwarden_rs.service"
# declarative setup of user and directory
install -D -m 0644 "$srcdir/bitwarden_rs.sysusers.conf" "$pkgdir/usr/lib/sysusers.d/bitwarden_rs.conf"
install -D -m 0644 "$srcdir/bitwarden_rs.tmpfiles.conf" "$pkgdir/usr/lib/tmpfiles.d/bitwarden_rs.conf"
# copy default config file
install -D -m 0644 "$srcdir/$_src/.env.template" "$pkgdir/etc/bitwarden_rs.env"
# copy binary
install -D -m0755 "$srcdir/$_src/target/release/bitwarden_rs" "$pkgdir/usr/bin/bitwarden_rs"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment