From c0cf1c07f448cae42ab913517a3177fea15e6fb0 Mon Sep 17 00:00:00 2001
From: Qiyang Sun <qs2g22@soton.ac.uk>
Date: Sat, 2 Nov 2024 21:32:54 +0000
Subject: [PATCH] Add daemon to monitor GPIO and switch runlevel

---
 recipes-core/fastinit/files/level3d.sh |  6 ++++++
 recipes-core/fastinit/level3d.8        | 18 ++++++++++++++++++
 2 files changed, 24 insertions(+)
 create mode 100755 recipes-core/fastinit/files/level3d.sh
 create mode 100644 recipes-core/fastinit/level3d.8

diff --git a/recipes-core/fastinit/files/level3d.sh b/recipes-core/fastinit/files/level3d.sh
new file mode 100755
index 0000000..393f6e7
--- /dev/null
+++ b/recipes-core/fastinit/files/level3d.sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+/usr/local/gpiomon -c 0 -n 1 -q 24
+# blocked until
+/sbin/chlevel.sh 3
+
diff --git a/recipes-core/fastinit/level3d.8 b/recipes-core/fastinit/level3d.8
new file mode 100644
index 0000000..55eb2b9
--- /dev/null
+++ b/recipes-core/fastinit/level3d.8
@@ -0,0 +1,18 @@
+.TH LEVEL3D 8 "November 2024" "Version 0.1" "System Administration Commands and Daemon Manual"
+.SH NAME
+level3d.sh \- runlevel 3 daemon
+.SH SYNOPSIS
+.B /usr/sbin/level3d.sh &
+
+.SH DESCRIPTION
+
+Level3d.sh is blocked until GPIO 24 is high, and invoke /sbin/chlevel.sh 3.
+
+.SH SEE ALSO
+.BR chlevel (1),
+.BR fastinit (8),
+
+.SH AUTHOR
+The 
+.B level3d
+script was first written by Qiyang Sun <qs2g22@soton.ac.uk>, and is maintained by the MAR24 project maintainers.
-- 
GitLab