6.38. Mktemp-1.5

The Mktemp package contains programs used to create secure temporary files in shell scripts.

6.38.1. Installation of Mktemp

Many scripts still use the deprecated tempfile program, which has functionality similar to mktemp. Patch Mktemp to include a tempfile wrapper:

patch -Np1 -i ../mktemp-1.5-add_tempfile-3.patch

The following sed removes -s from the install command which will try to strip the installed files:

cp Makefile.in{,.orig}
sed -e 's/-s $(PROG)/$(PROG)/' Makefile.in.orig > Makefile.in

Prepare Mktemp for compilation:

./configure --build=${CLFS_HOST} --host=${CLFS_TARGET} \
    --prefix=/usr --with-libc

The meaning of the configure option:


This causes the mktemp program to use the mkstemp and mkdtemp functions from the system C library.

Compile the package:


Install the package:

make prefix=${CLFS}/usr install
make prefix=${CLFS}/usr install-tempfile

6.38.2. Contents of Mktemp

Installed programs: mktemp and tempfile

Short Descriptions


Creates temporary files in a secure manner; it is used in scripts


Creates temporary files in a less secure manner than mktemp; it is installed for backwards-compatibility