mtree.sh: reverse last two parameters

This way we can treat DESTDIR like a special case just as the build
system does (i.e., if not set, assume DESTDIR="/").
This commit is contained in:
Thomas Veerman 2012-05-07 14:22:27 +00:00
parent acac1f2fda
commit 5daf8dbb89
2 changed files with 10 additions and 5 deletions

View file

@ -37,7 +37,7 @@ install: installpw # installpw needed to bootstrap pw db
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

View file

@ -1,15 +1,20 @@
#!/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 }'`"