Created
October 2, 2022 20:53
-
-
Save aveexy/0259926f22503f0303586f2110ac5216 to your computer and use it in GitHub Desktop.
Make a simple copy of the /dev directory, usefull for systems that have no devfs and don't support mount --bind of regular directories
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
#!/bin/sh | |
create_nod() { | |
name=$(basename "$1") | |
major=$(ls -la "$1" | sed -r 's/ +/ /g' | cut -d " " -f5 | sed 's/.$//') | |
minor=$(ls -la "$1" | sed -r 's/ +/ /g' | cut -d " " -f6) | |
mknod "$name" $2 $major $minor | |
} | |
for f in /dev/*; do | |
if [ -b "$f" ]; then | |
create_nod "$f" b | |
elif [ -c "$f" ]; then | |
create_nod "$f" c | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment