Created
August 22, 2012 06:56
-
-
Save archon810/3423114 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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