Add an -s option that specifies a path to an alternate etcupdate.sh script
to test. This allows a non-installed version of the script to be tested more easily.
This commit is contained in:
parent
25c58526a3
commit
c387a450ac
@ -33,13 +33,17 @@ WORKDIR=work
|
||||
|
||||
usage()
|
||||
{
|
||||
echo "Usage: always.sh [-w workdir]"
|
||||
echo "Usage: always.sh [-s script] [-w workdir]"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Allow the user to specify an alternate work directory.
|
||||
while getopts "w:" option; do
|
||||
# Allow the user to specify an alternate work directory or script.
|
||||
COMMAND=etcupdate
|
||||
while getopts "s:w:" option; do
|
||||
case $option in
|
||||
s)
|
||||
COMMAND="sh $OPTARG"
|
||||
;;
|
||||
w)
|
||||
WORKDIR=$OPTARG
|
||||
;;
|
||||
@ -372,7 +376,7 @@ fi
|
||||
|
||||
build_trees
|
||||
|
||||
etcupdate -r -d $WORKDIR -D $TEST > $WORKDIR/test.out
|
||||
$COMMAND -r -d $WORKDIR -D $TEST > $WORKDIR/test.out
|
||||
|
||||
cat > $WORKDIR/correct.out <<EOF
|
||||
D /dirchange/fromdir/extradir/file
|
||||
@ -492,7 +496,7 @@ fifo /dirchange/todir/difftype
|
||||
|
||||
build_trees
|
||||
|
||||
etcupdate -r -A '/first*' -A '/second* /*di*' -d $WORKDIR -D $TEST > \
|
||||
$COMMAND -r -A '/first*' -A '/second* /*di*' -d $WORKDIR -D $TEST > \
|
||||
$WORKDIR/test1.out
|
||||
|
||||
cat > $WORKDIR/correct1.out <<EOF
|
||||
|
@ -33,13 +33,17 @@ WORKDIR=work
|
||||
|
||||
usage()
|
||||
{
|
||||
echo "Usage: tests.sh [-w workdir]"
|
||||
echo "Usage: conflicts.sh [-s script] [-w workdir]"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Allow the user to specify an alternate work directory.
|
||||
while getopts "w:" option; do
|
||||
# Allow the user to specify an alternate work directory or script.
|
||||
COMMAND=etcupdate
|
||||
while getopts "s:w:" option; do
|
||||
case $option in
|
||||
s)
|
||||
COMMAND="sh $OPTARG"
|
||||
;;
|
||||
w)
|
||||
WORKDIR=$OPTARG
|
||||
;;
|
||||
@ -84,7 +88,7 @@ default:\\
|
||||
:welcome=/etc/motd:
|
||||
EOF
|
||||
|
||||
etcupdate -r -d $WORKDIR -D $TEST >/dev/null
|
||||
$COMMAND -r -d $WORKDIR -D $TEST >/dev/null
|
||||
}
|
||||
|
||||
# This is used to verify special handling for /etc/mail/aliases and
|
||||
@ -122,7 +126,7 @@ MAILER-DAEMON: postmaster
|
||||
postmaster: foo
|
||||
EOF
|
||||
|
||||
etcupdate -r -d $WORKDIR -D $TEST >/dev/null
|
||||
$COMMAND -r -d $WORKDIR -D $TEST >/dev/null
|
||||
}
|
||||
|
||||
# $1 - relative path to file that should be missing from TEST
|
||||
@ -201,7 +205,7 @@ build_login_conflict
|
||||
|
||||
# Verify that 'p' doesn't do anything.
|
||||
echo "Checking 'p':"
|
||||
echo 'p' | etcupdate resolve -d $WORKDIR -D $TEST >/dev/null
|
||||
echo 'p' | $COMMAND resolve -d $WORKDIR -D $TEST >/dev/null
|
||||
|
||||
file /etc/login.conf "" 95de92ea3f1bb1bf4f612a8b5908cddd
|
||||
missing /etc/login.conf.db
|
||||
@ -209,7 +213,7 @@ conflict /etc/login.conf
|
||||
|
||||
# Verify that 'mf' removes the conflict, but does nothing else.
|
||||
echo "Checking 'mf':"
|
||||
echo 'mf' | etcupdate resolve -d $WORKDIR -D $TEST >/dev/null
|
||||
echo 'mf' | $COMMAND resolve -d $WORKDIR -D $TEST >/dev/null
|
||||
|
||||
file /etc/login.conf "" 95de92ea3f1bb1bf4f612a8b5908cddd
|
||||
missing /etc/login.conf.db
|
||||
@ -219,7 +223,7 @@ build_login_conflict
|
||||
|
||||
# Verify that 'tf' installs the new version of the file.
|
||||
echo "Checking 'tf':"
|
||||
echo 'tf' | etcupdate resolve -d $WORKDIR -D $TEST >/dev/null
|
||||
echo 'tf' | $COMMAND resolve -d $WORKDIR -D $TEST >/dev/null
|
||||
|
||||
file /etc/login.conf "" 7774a0f9a3a372c7c109c32fd31c4b6b
|
||||
file /etc/login.conf.db
|
||||
@ -238,7 +242,7 @@ default:\\
|
||||
:welcome=/etc/motd:
|
||||
EOF
|
||||
|
||||
echo 'r' | etcupdate resolve -d $WORKDIR -D $TEST >/dev/null
|
||||
echo 'r' | $COMMAND resolve -d $WORKDIR -D $TEST >/dev/null
|
||||
|
||||
file /etc/login.conf "" 966e25984b9b63da8eaac8479dcb0d4d
|
||||
file /etc/login.conf.db
|
||||
@ -248,12 +252,12 @@ build_aliases_conflict
|
||||
|
||||
# Verify that 'p' and 'mf' do not generate the newaliases warning.
|
||||
echo "Checking newalias warning for 'p'":
|
||||
echo 'p' | etcupdate resolve -d $WORKDIR -D $TEST | grep -q newalias
|
||||
echo 'p' | $COMMAND resolve -d $WORKDIR -D $TEST | grep -q newalias
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "+ Extra warning"
|
||||
fi
|
||||
echo "Checking newalias warning for 'mf'":
|
||||
echo 'mf' | etcupdate resolve -d $WORKDIR -D $TEST | grep -q newalias
|
||||
echo 'mf' | $COMMAND resolve -d $WORKDIR -D $TEST | grep -q newalias
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "+ Extra warning"
|
||||
fi
|
||||
@ -261,14 +265,14 @@ fi
|
||||
# Verify that 'tf' and 'r' do generate the newaliases warning.
|
||||
build_aliases_conflict
|
||||
echo "Checking newalias warning for 'tf'":
|
||||
echo 'tf' | etcupdate resolve -d $WORKDIR -D $TEST | grep -q newalias
|
||||
echo 'tf' | $COMMAND resolve -d $WORKDIR -D $TEST | grep -q newalias
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "- Missing warning"
|
||||
fi
|
||||
|
||||
build_aliases_conflict
|
||||
cp $TEST/etc/mail/aliases $CONFLICTS/etc/mail/aliases
|
||||
echo 'r' | etcupdate resolve -d $WORKDIR -D $TEST | grep -q newalias
|
||||
echo 'r' | $COMMAND resolve -d $WORKDIR -D $TEST | grep -q newalias
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "- Missing warning"
|
||||
fi
|
||||
|
@ -33,13 +33,17 @@ WORKDIR=work
|
||||
|
||||
usage()
|
||||
{
|
||||
echo "Usage: fbsdid.sh [-w workdir]"
|
||||
echo "Usage: fbsdid.sh [-s script] [-w workdir]"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Allow the user to specify an alternate work directory.
|
||||
while getopts "w:" option; do
|
||||
# Allow the user to specify an alternate work directory or script.
|
||||
COMMAND=etcupdate
|
||||
while getopts "s:w:" option; do
|
||||
case $option in
|
||||
s)
|
||||
COMMAND="sh $OPTARG"
|
||||
;;
|
||||
w)
|
||||
WORKDIR=$OPTARG
|
||||
;;
|
||||
@ -267,7 +271,7 @@ fi
|
||||
|
||||
build_trees
|
||||
|
||||
etcupdate -r -d $WORKDIR -D $TEST > $WORKDIR/test.out
|
||||
$COMMAND -r -d $WORKDIR -D $TEST > $WORKDIR/test.out
|
||||
|
||||
cat > $WORKDIR/correct.out <<EOF
|
||||
C /already
|
||||
@ -300,7 +304,7 @@ file /local-already "" 0298b958a603049f45ae6a109c4f7fea
|
||||
|
||||
build_trees
|
||||
|
||||
etcupdate -rF -d $WORKDIR -D $TEST > $WORKDIR/testF.out
|
||||
$COMMAND -rF -d $WORKDIR -D $TEST > $WORKDIR/testF.out
|
||||
|
||||
cat > $WORKDIR/correctF.out <<EOF
|
||||
D /remove
|
||||
|
@ -33,13 +33,17 @@ WORKDIR=work
|
||||
|
||||
usage()
|
||||
{
|
||||
echo "Usage: ignore.sh [-w workdir]"
|
||||
echo "Usage: ignore.sh [-s script] [-w workdir]"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Allow the user to specify an alternate work directory.
|
||||
while getopts "w:" option; do
|
||||
# Allow the user to specify an alternate work directory or script.
|
||||
COMMAND=etcupdate
|
||||
while getopts "s:w:" option; do
|
||||
case $option in
|
||||
s)
|
||||
COMMAND="sh $OPTARG"
|
||||
;;
|
||||
w)
|
||||
WORKDIR=$OPTARG
|
||||
;;
|
||||
@ -172,7 +176,7 @@ fi
|
||||
|
||||
build_trees
|
||||
|
||||
etcupdate -r -d $WORKDIR -D $TEST > $WORKDIR/test.out
|
||||
$COMMAND -r -d $WORKDIR -D $TEST > $WORKDIR/test.out
|
||||
|
||||
cat > $WORKDIR/correct.out <<EOF
|
||||
D /rmdir/file
|
||||
@ -195,7 +199,7 @@ missing /rmdir
|
||||
|
||||
build_trees
|
||||
|
||||
etcupdate -r -I '/tree/*' -d $WORKDIR -D $TEST > $WORKDIR/test1.out
|
||||
$COMMAND -r -I '/tree/*' -d $WORKDIR -D $TEST > $WORKDIR/test1.out
|
||||
|
||||
cat > $WORKDIR/correct1.out <<EOF
|
||||
D /rmdir/file
|
||||
@ -215,7 +219,7 @@ missing /rmdir
|
||||
|
||||
build_trees
|
||||
|
||||
etcupdate -r -I '/tree/*' -I '/rmdir*' -d $WORKDIR -D $TEST > \
|
||||
$COMMAND -r -I '/tree/*' -I '/rmdir*' -d $WORKDIR -D $TEST > \
|
||||
$WORKDIR/test2.out
|
||||
|
||||
cat > $WORKDIR/correct2.out <<EOF
|
||||
@ -236,7 +240,7 @@ file /rmdir/file "foo"
|
||||
|
||||
build_trees
|
||||
|
||||
etcupdate -r -I '/tree/* /rmdir/*' -d $WORKDIR -D $TEST > \
|
||||
$COMMAND -r -I '/tree/* /rmdir/*' -d $WORKDIR -D $TEST > \
|
||||
$WORKDIR/test3.out
|
||||
|
||||
cat > $WORKDIR/correct3.out <<EOF
|
||||
|
@ -33,13 +33,17 @@ WORKDIR=work
|
||||
|
||||
usage()
|
||||
{
|
||||
echo "Usage: tests.sh [-w workdir]"
|
||||
echo "Usage: tests.sh [-s script] [-w workdir]"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Allow the user to specify an alternate work directory.
|
||||
while getopts "w:" option; do
|
||||
# Allow the user to specify an alternate work directory or script.
|
||||
COMMAND=etcupdate
|
||||
while getopts "s:w:" option; do
|
||||
case $option in
|
||||
s)
|
||||
COMMAND="sh $OPTARG"
|
||||
;;
|
||||
w)
|
||||
WORKDIR=$OPTARG
|
||||
;;
|
||||
@ -904,7 +908,7 @@ fi
|
||||
|
||||
build_trees
|
||||
|
||||
etcupdate -nr -d $WORKDIR -D $TEST > $WORKDIR/testn.out
|
||||
$COMMAND -nr -d $WORKDIR -D $TEST > $WORKDIR/testn.out
|
||||
|
||||
cat > $WORKDIR/correct.out <<EOF
|
||||
D /dirchange/fromdir/extradir/file
|
||||
@ -971,7 +975,7 @@ EOF
|
||||
echo "Differences for -n:"
|
||||
diff -u -L "correct" $WORKDIR/correct.out -L "test" $WORKDIR/testn.out
|
||||
|
||||
etcupdate -r -d $WORKDIR -D $TEST > $WORKDIR/test.out
|
||||
$COMMAND -r -d $WORKDIR -D $TEST > $WORKDIR/test.out
|
||||
|
||||
echo "Differences for real:"
|
||||
diff -u -L "correct" $WORKDIR/correct.out -L "test" $WORKDIR/test.out
|
||||
|
Loading…
Reference in New Issue
Block a user