diff options
Diffstat (limited to 'repo/openrc/machine-id.initd')
-rw-r--r-- | repo/openrc/machine-id.initd | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/repo/openrc/machine-id.initd b/repo/openrc/machine-id.initd new file mode 100644 index 0000000..bdd0698 --- /dev/null +++ b/repo/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/machine-id ] ; 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 $? +} |