[PATCH] Use an unique temporary multistrap file and remove it afterwards

Geert Stappers <[email protected]>
Newsgroups gmane.linux.debian.devel.embedded
Message-ID <[email protected]>
With adding the Process ID to the temporary multistrap configuration file
makes it unique. This allows multiple invocations on the same time.
For multi user system as Linux is, is this important.

Also is the temp file deleted after usage.
---
 polystrap.sh |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/polystrap.sh b/polystrap.sh
index 8f2e64d..67e2108 100755
--- a/polystrap.sh
+++ b/polystrap.sh
@@ -92,14 +92,15 @@ echo "--------------------------"
 [ -e "$ROOTDIR.tar" ] && { echo "tarball still exists"; exit; }
 [ -e "$ROOTDIR" ] && { echo "root directory still exists"; exit; }
 
-# create multistrap.conf
-echo -n > /tmp/multistrap.conf
+# create a temporary multistrap.conf, the Process ID, $$, makes it unique
+echo -n > /tmp/multistrap.conf.$$
 while read line; do
-        eval echo $line >> /tmp/multistrap.conf
+        eval echo $line >> /tmp/multistrap.conf.$$
 done < $PLATFORM/multistrap.conf
 
 # download and extract packages
-multistrap -f /tmp/multistrap.conf
+multistrap -f /tmp/multistrap.conf.$$
+rm -f /tmp/multistrap.conf.$$
 
 # backup ldconfig and ldd
 mv $ROOTDIR/sbin/ldconfig $ROOTDIR/sbin/ldconfig.REAL
-- 
1.6.2
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.