#!/bin/sh

eval $(@@PREFIX@@/udevadm info --export --export-prefix=ROOT_ --device-id-of-file=/)

[ "$ROOT_MAJOR" -gt 0 ] || exit 0
mkdir -m 0755 -p /run/udev/rules.d >/dev/null 2>&1
ln -sf /run/udev /dev/.udev 2>/dev/null || :

echo "ACTION==\"add|change\", SUBSYSTEM==\"block\", \
ENV{MAJOR}==\"$ROOT_MAJOR\", ENV{MINOR}==\"$ROOT_MINOR\", \
SYMLINK+=\"root\"" > /run/udev/rules.d/10-root-symlink.rules

exit 0
