Make mktemp invocations portable.

This commit is contained in:
Grégoire Sutre 2010-10-18 22:50:01 +02:00
parent 30385e717e
commit b65ea15514
9 changed files with 46 additions and 38 deletions

View file

@ -27,7 +27,7 @@ cmd='test_blockarg { true }'
v=`echo "$cmd" | @builddir@/grub-shell`
error_if_not "$v" '{ true }'
tmp=`mktemp`
tmp=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
cmd='test_blockarg { test_blockarg { true } }'
echo "$cmd" | @builddir@/grub-shell >$tmp
error_if_not "`head -n1 $tmp|tail -n1`" '{ test_blockarg { true } }'

View file

@ -51,8 +51,8 @@ list_parts () {
echo
}
imgfile=`mktemp`
outfile=`mktemp`
imgfile=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
outfile=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
#
# MSDOS partition types

View file

@ -83,17 +83,17 @@ for option in "$@"; do
done
if [ "x${source}" = x ] ; then
tmpfile=`mktemp`
tmpfile=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
while read REPLY; do
echo $REPLY >> ${tmpfile}
done
source=${tmpfile}
fi
outfile1=`mktemp`
outfile1=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
@builddir@/grub-shell --qemu-opts="${qemuopts}" --modules=${modules} ${source} >${outfile1}
outfile2=`mktemp`
outfile2=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
bash ${source} >${outfile2}
if ! diff -q ${outfile1} ${outfile2} >/dev/null

View file

@ -107,14 +107,14 @@ for option in "$@"; do
done
if [ "x${source}" = x ] ; then
tmpfile=`mktemp`
tmpfile=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
while read REPLY; do
echo "$REPLY" >> ${tmpfile}
done
source=${tmpfile}
fi
cfgfile=`mktemp`
cfgfile=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
cat <<EOF >${cfgfile}
grubshell=yes
insmod serial
@ -123,7 +123,7 @@ terminal_input serial
terminal_output serial
EOF
rom_directory=`mktemp -d`
rom_directory=`mktemp -d "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
for mod in ${modules}
do
@ -135,7 +135,7 @@ source /boot/grub/testcase.cfg
halt
EOF
isofile=`mktemp`
isofile=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
if [ x$boot != xnet ]; then
sh @builddir@/grub-mkrescue --grub-mkimage=${builddir}/grub-mkimage --output=${isofile} --override-directory=${builddir}/grub-core \
--rom-directory="${rom_directory}" \
@ -161,7 +161,7 @@ if [ x$boot = xqemu ]; then
fi
if [ x$boot = xcoreboot ]; then
imgfile=`mktemp`
imgfile=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
cp "${GRUB_COREBOOT_ROM}" "${imgfile}"
"${GRUB_CBFSTOOL}" "${imgfile}" add-payload "${rom_directory}/coreboot.elf" fallback/payload
bootdev="-bios ${imgfile}"
@ -169,7 +169,7 @@ if [ x$boot = xcoreboot ]; then
fi
if [ x$boot = xnet ]; then
netdir=`mktemp -d`
netdir=`mktemp -d "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
sh @builddir@/grub-mknetdir --grub-mkimage=${builddir}/grub-mkimage --override-directory=${builddir}/grub-core --net-directory=$netdir
cp ${cfgfile} $netdir/boot/grub/grub.cfg
cp ${source} $netdir/boot/grub/testcase.cfg