summaryrefslogtreecommitdiff
path: root/repo/system/openrc/machine-id.initd
blob: bdd06986687812795eddf87651508329ce5c3b90 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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 $?
}