From 91dd6c7ceb7214338e64502d14770b56a647589f Mon Sep 17 00:00:00 2001 From: Erez Zadok Date: Tue, 18 Dec 2007 21:13:40 -0500 Subject: [PATCH] Support creation/detection of pipes and character/block devices Signed-off-by: Erez Zadok --- scaffold | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/scaffold b/scaffold index eb4b531..d2cfad7 100644 --- a/scaffold +++ b/scaffold @@ -57,13 +57,16 @@ function create_hierarchy { TYPE=`echo $LINE | cut -d' ' -f 1` NAME=`echo $LINE | cut -d' ' -f 2` - unset DIR FILE IMMUTABLE SOURCE SYMLINK + unset DIR FILE IMMUTABLE SOURCE SYMLINK BLOCKDEV CHARDEV PIPE ( echo $TYPE | grep -q d ) && DIR=1 ( echo $TYPE | grep -q f ) && FILE=1 ( echo $TYPE | grep -q i ) && IMMUTABLE=1 ( echo $TYPE | grep -q s ) && SOURCE=1 ( echo $TYPE | grep -q l ) && SYMLINK=1 + ( echo $TYPE | grep -q b ) && BLOCKDEV=1 + ( echo $TYPE | grep -q c ) && CHARDEV=1 + ( echo $TYPE | grep -q p ) && PIPE=1 if [ ! -z "$SOURCE" ] ; then if [ ! -z "$DIR" ] ; then @@ -114,6 +117,19 @@ function create_hierarchy { fi elif [ ! -z "$SYMLINK" ] ; then ln -s "linktext:$NAME" $NAME + elif [ ! -z "$BLOCKDEV" ] ; then + mkdir -p `dirname $NAME` || exit $? + # re-create /dev/loop7 (better be free) + mknod $NAME b 7 7 || exit $? + chmod 644 $NAME || exit $? + elif [ ! -z "$CHARDEV" ] ; then + mkdir -p `dirname $NAME` || exit $? + # re-create a /dev/null + mknod $NAME c 1 3 || exit $? + chmod 644 $NAME || exit $? + elif [ ! -z "$PIPE" ] ; then + mkfifo $NAME || exit $? + chmod 644 $NAME || exit $? else echo "What type am i: $TYPE" 1>&2 exit $? @@ -180,6 +196,8 @@ function check_hierarchy { find $1 -type b -printf 'b %p\n' find $1 -type c -printf 'c %p\n' find $1 -type l -printf 'l %p\n' + find $1 -type p -printf 'p %p\n' + find $1 -type s -printf 's %p\n' ) | sort > /tmp/check-$$ grep -v '^$' | sort | diff -u - /tmp/check-$$ ERR=$? -- 2.43.0