aboutsummaryrefslogtreecommitdiffstats
path: root/main/openrc/machine-id.initd
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2020-11-11 15:25:36 +0100
committerNatanael Copa <ncopa@alpinelinux.org>2020-11-11 15:29:35 +0100
commit8c8f379f1069d874bb6481ded7bb671ced7b0128 (patch)
tree773832b5d345f48677c568ffd15c8f6d39058c83 /main/openrc/machine-id.initd
parent07f9872c9d0122771d93b80da2f57ccd87069e02 (diff)
main/openrc: add support for nested network configs
Add support for source and source-directory keywords in network configuration by use ifquery from ifupdown-ng. Use a fallback for busybox ifupdown in case ifquery is not available. Run the `make check` to run unit tests in openrc. Also add some unit tests for the find_ifaces and find_running_ifaces functions in networking.initd. fixes #11562
Diffstat (limited to 'main/openrc/machine-id.initd')
-rw-r--r--main/openrc/machine-id.initd17
1 files changed, 17 insertions, 0 deletions
diff --git a/main/openrc/machine-id.initd b/main/openrc/machine-id.initd
new file mode 100644
index 00000000000..f690a4c588d
--- /dev/null
+++ b/main/openrc/machine-id.initd
@@ -0,0 +1,17 @@
+#!/sbin/openrc-run
+
+description="Generate machine-id if needed"
+
+depend() {
+ need root dev
+}
+
+start() {
+ if [ -s /etc/hostname ] ; then
+ return 0
+ fi
+ ebegin "Generating machine-id"
+ dd if=/dev/urandom status=none bs=16 count=1 \
+ | md5sum | cut -d' ' -f1 > /etc/machine-id
+ eend $?
+}