The Mktemp package contains programs used to create secure temporary files in shell scripts.
User Notes: http://wiki.linuxfromscratch.org/hlfs/wiki/mktemp
Many scripts still use the deprecated tempfile program, which has functionality similar to mktemp. Patch Mktemp to include an tempfile shell script wrapper:
patch -Np1 -i ../mktemp-1.5-add_tempfile-3.patch
Mktemp can be built with compiler warnings:
sed 's/^CFLAGS =.*/& -Wall -Wformat-security \\\
-Werror -Wfatal-errors/' -i.orig Makefile.in
Prepare Mktemp for compilation:
./configure --prefix=/usr --bindir=/bin \
--with-libc --with-random=/dev/urandom
The meaning of the configure options:
--bindir=/bin
This causes the mktemp program to be
installed to /bin, so it is
available to other programs if /usr is missing or not mounted.
--with-random=/dev/urandom
This causes the mktemp program to use
/dev/urandom as an entropy
source when creating temporary files.
Compile the package:
make
This package does not come with a test suite.
Install the package:
make install
The tempfile script
does not need to be installed to /bin. Instead it can be installed to /usr/bin:
install -m 0555 ./tempfile /usr/bin/tempfile