aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-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
-rwxr-xr-xrootfs/srv/http/cgi-bin/off (renamed from rootfs/srv/http/off)0
-rwxr-xr-xrootfs/srv/http/cgi-bin/on (renamed from rootfs/srv/http/on)0
-rw-r--r--rootfs/srv/http/index.html21
-rw-r--r--software.mk2
-rwxr-xr-xutil/mkrootfs3
23 files changed, 63 insertions, 23 deletions
diff --git a/.gitignore b/.gitignore
index 6088821..85ec7f5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,5 +7,6 @@ uboot.env
rootfs/bin/helloworld
rootfs/lib/libc.so.6
rootfs/lib/ld-linux-armhf.so.3
+rootfs/usr/share/udhcpc/default.script
# END UPDATE FROM `make __software_files`
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
diff --git a/rootfs/srv/http/off b/rootfs/srv/http/cgi-bin/off
index e70be2d..e70be2d 100755
--- a/rootfs/srv/http/off
+++ b/rootfs/srv/http/cgi-bin/off
diff --git a/rootfs/srv/http/on b/rootfs/srv/http/cgi-bin/on
index 0da06b0..0da06b0 100755
--- a/rootfs/srv/http/on
+++ b/rootfs/srv/http/cgi-bin/on
diff --git a/rootfs/srv/http/index.html b/rootfs/srv/http/index.html
index f60b829..0812323 100644
--- a/rootfs/srv/http/index.html
+++ b/rootfs/srv/http/index.html
@@ -1,10 +1,17 @@
<!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>
+ <head>
+ <meta charset='utf-8'>
+ <title>Hello world!</title>
+ <style>form { display: inline; }</style>
+ </head>
+ <body>
+ <!-- invisible iframe hack to request /on and /off in background w/o JS -->
+ <iframe name="dummy" style="display: none;"></iframe>
+ Turn leds
+ <form action="/on" target="dummy"><button type="submit">on</button></form>
+ or
+ <form action="/off" target="dummy"><button type="submit">off</button></form>
+ </body>
</html>
+
diff --git a/software.mk b/software.mk
index 1635f04..2a609c2 100644
--- a/software.mk
+++ b/software.mk
@@ -13,7 +13,9 @@ $(SHARED_LIBS)&: state/container_img
SOFTWARE_FILES += $(SHARED_LIBS)
rootfs/usr/share/udhcpc/default.script: busybox/examples/udhcp/simple.script state/submodules
+ mkdir -p $(dir $@)
cp $< $@
chmod +x $@
SOFTWARE_FILES += rootfs/usr/share/udhcpc/default.script
+FILES_PART_ROOTFS += $(SOFTWARE_FILES)
diff --git a/util/mkrootfs b/util/mkrootfs
index ae1f489..80dfe04 100755
--- a/util/mkrootfs
+++ b/util/mkrootfs
@@ -32,6 +32,9 @@ CPFLAGS='--no-dereference --recursive --preserve=mode,timestamps,links --no-pres
cp $CPFLAGS "$BUSYBOX_FS/." .
cp $CPFLAGS "$OVERLAY_FS/." .
+# remove legacy files
+rm linuxrc
+
# setuid busybox
chmod a=xrs,u+w bin/busybox