Skip to content

Instantly share code, notes, and snippets.

@archon810
Created August 22, 2012 06:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save archon810/3423114 to your computer and use it in GitHub Desktop.
Save archon810/3423114 to your computer and use it in GitHub Desktop.
root_symlink_rule() {
eval $(/sbin/udevadm info --export --export-prefix=ROOT_ --device-id-of-file=/)
[ "$ROOT_MAJOR" -gt 0 ] || return
mkdir -m 0755 -p /dev/.udev/rules.d/
echo "\
ACTION==\"add|change\", SUBSYSTEM==\"block\", \
ENV{MAJOR}==\"$ROOT_MAJOR\", ENV{MINOR}==\"$ROOT_MINOR\", \
SYMLINK+=\"root\"" > /dev/.udev/rules.d/10-root-symlink.rules
}
case "$1" in
start)
# create /dev/root symlink with dynamic rule
root_symlink_rule
# start udevd
echo -n "Starting udevd: "
/sbin/udevd --daemon
if [ $? -ne 0 ]; then
rc_status -v
rc_exit
fi
rc_status -v
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment