From c78bf3a206e32bec7d585c33cf87fc1bbfb96e48 Mon Sep 17 00:00:00 2001
From: Luc <luc@bijl.us>
Date: Fri, 22 Nov 2024 22:00:38 +0100
Subject: [PATCH] Added meson.build for installation of zlevis-scripts.

---
 README.md       | 20 ++++++++++++++++++++
 meson.build     | 14 ++++++++++++++
 src/meson.build |  3 +++
 3 files changed, 37 insertions(+)
 create mode 100644 meson.build
 create mode 100644 src/meson.build

diff --git a/README.md b/README.md
index ec23fb5..80dddc0 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,23 @@
 # Zlevis
 
 A minimal fork of [Clevis](https://github.com/latchset/clevis), rewritten in POSIX shell to accommodate automatic decryption of a ZFS root pool with TPM2. 
+
+## Installation
+
+### Alpine Linux
+
+Work in progress.
+
+### Manual
+
+Zlevis can be manually installed with `meson`, after cloning the repository, setup the build directory
+
+```
+$ meson setup builddir
+```
+
+Installation of the zlevis scripts is now performed with
+
+```
+# meson install -C builddir
+```
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..2c824ab
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,14 @@
+# Project definition
+project('zlevis', license: 'GPL3', version: '1')
+
+# Define bindir
+bindir=join_paths(get_option('prefix'), get_option('bindir'))
+
+# Define bins list
+bins=[]
+
+# Define subdir with bins
+subdir('src')
+
+# Install bins in bindir
+install_data(bins, install_dir: bindir)
diff --git a/src/meson.build b/src/meson.build
new file mode 100644
index 0000000..afbba5d
--- /dev/null
+++ b/src/meson.build
@@ -0,0 +1,3 @@
+bins += join_paths(meson.current_source_dir(), 'zlevis-encrypt')
+bins += join_paths(meson.current_source_dir(), 'zlevis-decrypt')
+bins += join_paths(meson.current_source_dir(), 'zlevis-fetch')