diff --git a/testing/lldap/APKBUILD b/testing/lldap/APKBUILD new file mode 100644 index 00000000000..7433ba7192b --- /dev/null +++ b/testing/lldap/APKBUILD @@ -0,0 +1,60 @@ +# Maintainer: Eloy Degen +pkgname=lldap +pkgver=0.6.1 +pkgrel=0 +pkgdesc="Light LDAP implementation for authentication" +url="https://github.com/lldap/lldap" +arch="x86_64 aarch64" # due to different issues (missing packages, upstream bugs), only 2 archs build +license="GPL-3.0-only" +makedepends="cargo cargo-auditable wasm-pack wasm-bindgen rust-wasm" +source=" + $pkgname-$pkgver.tar.gz::$url/archive/refs/tags/v$pkgver.tar.gz + config-template.patch + " +options="net" # fetch dependencies + +prepare() { + default_prepare + + cargo fetch --target="$CTARGET" --locked +} + +build() { + cargo auditable build --frozen --release -p lldap -p lldap_migration_tool -p lldap_set_password + + # frontend + # RUSTFLAGS needs to be unset as a temporary workaround to make sure wasm-ld is able to link + ( + cd app + unset RUSTFLAGS + wasm-pack build --target web --release + gzip -9 -k -f pkg/lldap_app_bg.wasm + ) +} + +check() { + cargo test --frozen +} + +package() { + install -D -m755 target/release/lldap* -t "$pkgdir"/usr/bin/ + + # frontend, path needs to be specified as lldap command arg + install -D -m755 app/index.html -t "$pkgdir"/usr/lib/"$pkgname"/app/ + install -D -m755 app/static/fonts.css -t "$pkgdir"/usr/lib/"$pkgname"/app/static/ + install -D -m755 app/static/libraries.txt -t "$pkgdir"/usr/lib/"$pkgname"/app/static/ + install -D -m755 app/static/main.js -t "$pkgdir"/usr/lib/"$pkgname"/app/static/ + install -D -m755 app/static/spinner.gif -t "$pkgdir"/usr/lib/"$pkgname"/app/static/ + install -D -m755 app/static/style.css -t "$pkgdir"/usr/lib/"$pkgname"/app/static/ + install -D -m755 app/pkg/* -t "$pkgdir"/usr/lib/"$pkgname"/app/pkg/ + + # install default config file with correct filepath to SQLite db and other things + install -D -m755 lldap_config.docker_template.toml "$pkgdir"/etc/"$pkgname".toml + + # TODO fonts, could be an Alpine package too, but app works fine without them +} + +sha512sums=" +35a7abd18167453e79cf8abe62dc4440afe1ef7ccb6d7880380d4fca0f3d6f314ec090d82ad36941c466a154e9921be8be0da8fc728f90720391e2c421bc41e7 lldap-0.6.1.tar.gz +cddaa73949cccc0ac238863ddaf3ab946b883fcb34f4129937a995c04410460c4a2ef331f2ecfa930c57cbd0a28349baf0a35f72733ce5d53c58211be813197f config-template.patch +" diff --git a/testing/lldap/config-template.patch b/testing/lldap/config-template.patch new file mode 100644 index 00000000000..447ef6645d7 --- /dev/null +++ b/testing/lldap/config-template.patch @@ -0,0 +1,27 @@ +--- a/lldap_config.docker_template.toml ++++ b/lldap_config.docker_template.toml +@@ -96,7 +96,7 @@ + ## - "mysql://mysql-user:password@mysql-server/my-database" + ## + ## This can be overridden with the LLDAP_DATABASE_URL env variable. +-database_url = "sqlite:///data/users.db?mode=rwc" ++database_url = "sqlite:///var/lib/lldap/data/users.db?mode=rwc" + + ## Private key file. + ## Not recommended, use key_seed instead. +@@ -106,13 +106,13 @@ + ## each password. + ## Randomly generated on first run if it doesn't exist. + ## Env variable: LLDAP_KEY_FILE +-#key_file = "/data/private_key" ++key_file = /var/lib/lldap/data/private_key + + ## Seed to generate the server private key, see key_file above. + ## This can be any random string, the recommendation is that it's at least 12 + ## characters long. + ## Env variable: LLDAP_KEY_SEED +-key_seed = "RanD0m STR1ng" ++#key_seed = "RanD0m STR1ng" + + ## Ignored attributes. + ## Some services will request attributes that are not present in LLDAP. When it