From daa965eccc7a740e81eff144614f27c8a7d9190d Mon Sep 17 00:00:00 2001 From: okuji Date: Wed, 2 Jan 2002 18:46:31 +0000 Subject: [PATCH] 2002-01-02 Jeremy Katz * util/grub-install.in: Support using mktemp as well as tempfile for secure temporary file creation. --- ChangeLog | 5 +++++ docs/grub-install.8 | 2 +- util/grub-install.in | 13 +++++++++++-- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index e143f20f0..fe7ef6864 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2002-01-02 Jeremy Katz + + * util/grub-install.in: Support using mktemp as well as tempfile + for secure temporary file creation. + 2002-01-02 Jeremy Katz * stage2/md5.c (md5_password): Ensure the password exists before diff --git a/docs/grub-install.8 b/docs/grub-install.8 index 5dbf2cfaf..eaf0ee46f 100644 --- a/docs/grub-install.8 +++ b/docs/grub-install.8 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.23. -.TH GRUB-INSTALL "8" "December 2001" "grub-install (GNU GRUB 0.90)" FSF +.TH GRUB-INSTALL "8" "January 2002" "grub-install (GNU GRUB 0.90)" FSF .SH NAME grub-install \- install GRUB on your drive .SH SYNOPSIS diff --git a/util/grub-install.in b/util/grub-install.in index fcf0658ad..c95c16efb 100644 --- a/util/grub-install.in +++ b/util/grub-install.in @@ -39,6 +39,15 @@ force_lba= recheck=no debug=no +# look for secure tempfile creation wrappers on this platform +if test -x /bin/tempfile; then + mkstemp="/bin/tempfile --prefix=grub" +elif test -x /bin/mktemp; then + mkstemp="/bin/mktemp /tmp/grub-install.log.XXXXXX" +else + mkstemp="" +fi + # Usage: usage # Print the usage. usage () { @@ -268,7 +277,7 @@ if test -f "$device_map"; then : else # Create a safe temporary file. - test -x /bin/tempfile && log_file=`tempfile --prefix=grub` + test -n "$mkstemp" && log_file=`$mkstemp` $grub_shell --batch --device-map=$device_map <$log_file quit @@ -342,7 +351,7 @@ for file in \ done # Create a safe temporary file. -test -x /bin/tempfile && log_file=`tempfile --prefix=grub` +test -n "$mkstemp" && log_file=`$mkstemp` # Now perform the installation. $grub_shell --batch --device-map=$device_map <$log_file