This way we can treat DESTDIR like a special case just as the build
system does (i.e., if not set, assume DESTDIR="/").
mkdir -p $(ETC) $(USRLIB)
mkdir -p $(ETC)/devmand/scripts
@echo "Making hierarchy.."
- sh mtree.sh mtree/minix.tree ${TOOL_AWK} ${TOOL_STAT} ${DESTDIR} ${MKUNPRIVED}
+ sh mtree.sh mtree/minix.tree ${TOOL_AWK} ${TOOL_STAT} ${MKUNPRIVED} ${DESTDIR}; # DESTDIR must be last; special case!
@for f in $(FILES1); do if [ -f $(ETC)/$$f ]; then :; else cp $$f $(ETC)/$$f; chmod 755 $(ETC)/$$f; fi; done
@for f in $(USRFILES); do cp usr/$$f $(USR)/$$f; chmod 644 $(USR)/$$f; done
@for f in $(FILES3); do if [ -f $(USRETC)/$$f ]; then :; else cp usr/$$f $(USRETC); chmod 755 $(USRETC)/$$f; fi; done
#!/bin/sh
set -e
-if [ $# -ne 5 ]
-then echo "Usage: $0 mtreefile TOOL_AWK TOOL_STAT DEST_DIR UNPRIV"
+if [ $# -ne 4 -a $# -ne 5 ]
+then echo "Usage: $0 mtreefile TOOL_AWK TOOL_STAT UNPRIV DESTDIR"
exit 1
fi
AWK=$2
STAT=$3
-DESTDIR=$4
-UNPRIV=$5
+UNPRIV=$4
+
+if [ $# -eq 5 ]
+then DESTDIR=$5
+else DESTDIR="/" # If not set, default to root (i.e., normal case)
+fi
+
cat "$1" | while read line
do
NF="`echo $line | ${AWK} '{ print NF }'`"