aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2024-02-07 14:06:30 +0100
committerlonkaars <loek@pipeframe.xyz>2024-02-07 14:06:30 +0100
commit612a0afa63144aae338a51c9206a589d4b8fdd65 (patch)
tree679e6676d9ce4b56996874bd5782764da221280a
parent70623600744cab314baf1ccc912134456ffe565d (diff)
WIP web server
-rwxr-xr-xrootfs/bin/helloled4
-rwxr-xr-xrootfs/bin/leds5
-rw-r--r--rootfs/etc/httpd.conf2
-rwxr-xr-xrootfs/etc/ifplugd/ifplugd.action4
-rw-r--r--rootfs/etc/network/interfaces2
-rw-r--r--rootfs/srv/http/index.html10
-rwxr-xr-xrootfs/srv/http/off2
-rwxr-xr-xrootfs/srv/http/on2
8 files changed, 26 insertions, 5 deletions
diff --git a/rootfs/bin/helloled b/rootfs/bin/helloled
index 877faab..1426a7c 100755
--- a/rootfs/bin/helloled
+++ b/rootfs/bin/helloled
@@ -2,8 +2,6 @@
BRIGHTNESS=0
while true ; do
BRIGHTNESS=$(( ( $BRIGHTNESS + 1 ) % 2 ))
- for i in $(seq 0 3) ; do
- echo $BRIGHTNESS > "/sys/class/leds/beaglebone:green:usr$i/brightness"
- done
+ leds $BRIGHTNESS
sleep 0.5
done
diff --git a/rootfs/bin/leds b/rootfs/bin/leds
new file mode 100755
index 0000000..5fb425e
--- /dev/null
+++ b/rootfs/bin/leds
@@ -0,0 +1,5 @@
+#!/bin/sh
+for i in $(seq 0 3) ; do
+ echo "$1" > "/sys/class/leds/beaglebone:green:usr$i/brightness"
+done
+
diff --git a/rootfs/etc/httpd.conf b/rootfs/etc/httpd.conf
new file mode 100644
index 0000000..2881728
--- /dev/null
+++ b/rootfs/etc/httpd.conf
@@ -0,0 +1,2 @@
+H:/srv/http
+I:index.html
diff --git a/rootfs/etc/ifplugd/ifplugd.action b/rootfs/etc/ifplugd/ifplugd.action
index 05db65d..e5b35ec 100755
--- a/rootfs/etc/ifplugd/ifplugd.action
+++ b/rootfs/etc/ifplugd/ifplugd.action
@@ -5,5 +5,5 @@ NEW_STATE="$2"
test -n "$INTERFACE"
test -n "$NEW_STATE"
-[ "$NEW_STATE" = "up" ] && exec ifup "$INTERFACE"
-[ "$NEW_STATE" = "down" ] && exec ifdown "$INTERFACE"
+exec ip link set "$INTERFACE" "$NEW_STATE"
+
diff --git a/rootfs/etc/network/interfaces b/rootfs/etc/network/interfaces
index 6da47b0..5307bb0 100644
--- a/rootfs/etc/network/interfaces
+++ b/rootfs/etc/network/interfaces
@@ -2,3 +2,5 @@
auto eth0
iface eth0 inet dhcp
+auto lo
+iface lo inet loopback
diff --git a/rootfs/srv/http/index.html b/rootfs/srv/http/index.html
new file mode 100644
index 0000000..f60b829
--- /dev/null
+++ b/rootfs/srv/http/index.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset='utf-8'>
+ <title>Hello world!</title>
+</head>
+<body>
+ <p>Turn leds <a href="/on">on</a> or <a href="/off">off</a></p>
+</body>
+</html>
diff --git a/rootfs/srv/http/off b/rootfs/srv/http/off
new file mode 100755
index 0000000..e70be2d
--- /dev/null
+++ b/rootfs/srv/http/off
@@ -0,0 +1,2 @@
+#!/bin/sh
+leds 0
diff --git a/rootfs/srv/http/on b/rootfs/srv/http/on
new file mode 100755
index 0000000..0da06b0
--- /dev/null
+++ b/rootfs/srv/http/on
@@ -0,0 +1,2 @@
+#!/bin/sh
+leds 1