aboutsummaryrefslogtreecommitdiff
path: root/rootfs/etc
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2024-02-07 16:15:21 +0100
committerlonkaars <loek@pipeframe.xyz>2024-02-07 16:15:21 +0100
commitb9dfdaaa1ae0148dd8a3e78508c636636e7396a6 (patch)
tree49dcef99dbd866108d637cc675853ee49ed8f4d1 /rootfs/etc
parent612a0afa63144aae338a51c9206a589d4b8fdd65 (diff)
web server done
Diffstat (limited to 'rootfs/etc')
-rw-r--r--rootfs/etc/deinit.d/90_network3
-rw-r--r--rootfs/etc/deinit.d/99_mounts3
-rwxr-xr-xrootfs/etc/deinitrc2
-rw-r--r--rootfs/etc/httpd.conf2
-rwxr-xr-xrootfs/etc/ifplugd/ifplugd.action3
-rw-r--r--rootfs/etc/init.d/00_mounts3
-rw-r--r--rootfs/etc/init.d/10_hostname3
-rw-r--r--rootfs/etc/init.d/10_network3
-rwxr-xr-xrootfs/etc/init.d/rcS9
-rwxr-xr-xrootfs/etc/initrc3
-rw-r--r--rootfs/etc/inittab6
-rw-r--r--rootfs/etc/network/interfaces8
-rw-r--r--rootfs/etc/network/interfaces.d/eth02
-rw-r--r--rootfs/etc/network/interfaces.d/lo2
-rwxr-xr-xrootfs/etc/sv/httpd2
-rwxr-xr-xrootfs/etc/sv/ifplugd3
-rwxr-xr-xrootfs/etc/sv/syslog2
17 files changed, 43 insertions, 16 deletions
diff --git a/rootfs/etc/deinit.d/90_network b/rootfs/etc/deinit.d/90_network
new file mode 100644
index 0000000..106e6b7
--- /dev/null
+++ b/rootfs/etc/deinit.d/90_network
@@ -0,0 +1,3 @@
+#!/bin/sh
+# disable all network interfaces
+ifdown -a
diff --git a/rootfs/etc/deinit.d/99_mounts b/rootfs/etc/deinit.d/99_mounts
new file mode 100644
index 0000000..359d592
--- /dev/null
+++ b/rootfs/etc/deinit.d/99_mounts
@@ -0,0 +1,3 @@
+#!/bin/sh
+# unmount all drives
+umount -a -r
diff --git a/rootfs/etc/deinitrc b/rootfs/etc/deinitrc
new file mode 100755
index 0000000..e681930
--- /dev/null
+++ b/rootfs/etc/deinitrc
@@ -0,0 +1,2 @@
+#!/bin/sh
+for f in /etc/deinit.d/* ; do . "$f" ; done
diff --git a/rootfs/etc/httpd.conf b/rootfs/etc/httpd.conf
index 2881728..f04b54c 100644
--- a/rootfs/etc/httpd.conf
+++ b/rootfs/etc/httpd.conf
@@ -1,2 +1,4 @@
H:/srv/http
I:index.html
+P:/on:http://localhost/cgi-bin/on
+P:/off:http://localhost/cgi-bin/off
diff --git a/rootfs/etc/ifplugd/ifplugd.action b/rootfs/etc/ifplugd/ifplugd.action
index e5b35ec..e0e59ef 100755
--- a/rootfs/etc/ifplugd/ifplugd.action
+++ b/rootfs/etc/ifplugd/ifplugd.action
@@ -5,5 +5,6 @@ NEW_STATE="$2"
test -n "$INTERFACE"
test -n "$NEW_STATE"
-exec ip link set "$INTERFACE" "$NEW_STATE"
+[ "$NEW_STATE" = "up" ] && exec ifup "$INTERFACE"
+[ "$NEW_STATE" = "down" ] && exec ifdown "$INTERFACE"
diff --git a/rootfs/etc/init.d/00_mounts b/rootfs/etc/init.d/00_mounts
new file mode 100644
index 0000000..804880c
--- /dev/null
+++ b/rootfs/etc/init.d/00_mounts
@@ -0,0 +1,3 @@
+#!/bin/sh
+# mount all drives in /etc/fstab
+mount -a
diff --git a/rootfs/etc/init.d/10_hostname b/rootfs/etc/init.d/10_hostname
new file mode 100644
index 0000000..064cea2
--- /dev/null
+++ b/rootfs/etc/init.d/10_hostname
@@ -0,0 +1,3 @@
+#!/bin/sh
+# update hostname
+hostname -F /etc/hostname
diff --git a/rootfs/etc/init.d/10_network b/rootfs/etc/init.d/10_network
new file mode 100644
index 0000000..03dc3f8
--- /dev/null
+++ b/rootfs/etc/init.d/10_network
@@ -0,0 +1,3 @@
+#!/bin/sh
+# up all network interfaces
+ifup -a -f
diff --git a/rootfs/etc/init.d/rcS b/rootfs/etc/init.d/rcS
deleted file mode 100755
index b819ce4..0000000
--- a/rootfs/etc/init.d/rcS
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/sh
-# core
-mount -a # mount all drives in /etc/fstab
-hostname -F /etc/hostname # update hostname
-
-# system services
-syslogd # system log
-ifplugd # automatically link hot-plugged ethernet connections
-
diff --git a/rootfs/etc/initrc b/rootfs/etc/initrc
new file mode 100755
index 0000000..a3291fd
--- /dev/null
+++ b/rootfs/etc/initrc
@@ -0,0 +1,3 @@
+#!/bin/sh
+for f in /etc/init.d/* ; do . "$f" ; done
+
diff --git a/rootfs/etc/inittab b/rootfs/etc/inittab
index 3f0c41a..ffc4115 100644
--- a/rootfs/etc/inittab
+++ b/rootfs/etc/inittab
@@ -1,6 +1,8 @@
# /etc/inittab init(8)
-::sysinit:/etc/init.d/rcS
-::shutdown:/bin/umount -a -r
+
+::sysinit:/etc/initrc
+::shutdown:/etc/deinitrc
+
::restart:/sbin/init
# put a shell on ttyS0 (serial header on board)
diff --git a/rootfs/etc/network/interfaces b/rootfs/etc/network/interfaces
index 5307bb0..644f5f0 100644
--- a/rootfs/etc/network/interfaces
+++ b/rootfs/etc/network/interfaces
@@ -1,6 +1,6 @@
# interfaces(5) configuration
-auto eth0
-iface eth0 inet dhcp
+source /etc/network/interfaces.d/lo
+source /etc/network/interfaces.d/eth0
-auto lo
-iface lo inet loopback
+# NOTE: this should work but doesn't:
+# source /etc/network/interfaces.d/*
diff --git a/rootfs/etc/network/interfaces.d/eth0 b/rootfs/etc/network/interfaces.d/eth0
new file mode 100644
index 0000000..81922ce
--- /dev/null
+++ b/rootfs/etc/network/interfaces.d/eth0
@@ -0,0 +1,2 @@
+auto eth0
+iface eth0 inet dhcp
diff --git a/rootfs/etc/network/interfaces.d/lo b/rootfs/etc/network/interfaces.d/lo
new file mode 100644
index 0000000..f1bd92e
--- /dev/null
+++ b/rootfs/etc/network/interfaces.d/lo
@@ -0,0 +1,2 @@
+auto lo
+iface lo inet loopback
diff --git a/rootfs/etc/sv/httpd b/rootfs/etc/sv/httpd
new file mode 100755
index 0000000..477041c
--- /dev/null
+++ b/rootfs/etc/sv/httpd
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec httpd -f
diff --git a/rootfs/etc/sv/ifplugd b/rootfs/etc/sv/ifplugd
new file mode 100755
index 0000000..cef959a
--- /dev/null
+++ b/rootfs/etc/sv/ifplugd
@@ -0,0 +1,3 @@
+#!/bin/sh
+# automatically link hot-plugged ethernet connections
+exec ifplugd -n
diff --git a/rootfs/etc/sv/syslog b/rootfs/etc/sv/syslog
new file mode 100755
index 0000000..cdcfeaf
--- /dev/null
+++ b/rootfs/etc/sv/syslog
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec syslogd -n