summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephane Peter <megastep@megastep.org>2006-07-26 00:37:02 +0000
committerStephane Peter <megastep@megastep.org>2006-07-26 00:37:02 +0000
commit7d5963552facda96f3531ace984254546ebfb43e (patch)
treed74cc9c3d3dc8b4d0483a01c9b7a1e57e1976fb5
parentc07ef7b48d2517077f94a9edc390f19ff0bfc495 (diff)
downloadmakeself-7d5963552facda96f3531ace984254546ebfb43e.tar.gz
Patch to check the available disk space before extracting, originally submitted by Andreas Schweitzer with some alterations to make it work on Solaris.
-rwxr-xr-xmakeself-header.sh20
-rwxr-xr-xmakeself.sh3
2 files changed, 22 insertions, 1 deletions
diff --git a/makeself-header.sh b/makeself-header.sh
index fab5acc..b32b667 100755
--- a/makeself-header.sh
+++ b/makeself-header.sh
@@ -36,6 +36,16 @@ MS_Progress()
done
}
+MS_diskspace()
+{
+ (
+ if test -d /usr/xpg4/bin; then
+ PATH=/usr/xpg4/bin:\$PATH
+ fi
+ df -kP "\$1" | tail -1 | awk '{print \$4}'
+ )
+}
+
MS_dd()
{
blocks=\`expr \$3 / 1024\`
@@ -342,6 +352,16 @@ if test "\$keep" = n; then
trap 'echo Signal caught, cleaning up >&2; cd \$TMPROOT; /bin/rm -rf \$tmpdir; eval \$finish; exit 15' 1 2 3 15
fi
+leftspace=\`MS_diskspace \$tmpdir\`
+if test \$leftspace -lt $USIZE; then
+ echo
+ echo "Not enough space left in "\`dirname \$tmpdir\`" (\$leftspace KB) to decompress \$0 ($USIZE KB)" >&2
+ if test "\$keep" = n; then
+ echo "Consider setting TMPDIR to a directory with more free space."
+ fi
+ eval \$finish; exit 1
+fi
+
for s in \$filesizes
do
if MS_dd "\$0" \$offset \$s | eval "$GUNZIP_CMD" | ( cd "\$tmpdir"; UnTAR x ) | MS_Progress; then
diff --git a/makeself.sh b/makeself.sh
index 940e1c8..f3ea6fa 100755
--- a/makeself.sh
+++ b/makeself.sh
@@ -3,7 +3,7 @@
# Makeself version 2.1.x
# by Stephane Peter <megastep@megastep.org>
#
-# $Id: makeself.sh,v 1.61 2006-07-07 00:03:45 megastep Exp $
+# $Id: makeself.sh,v 1.62 2006-07-26 00:37:02 megastep Exp $
#
# Utility to create self-extracting tar.gz archives.
# The resulting archive is a file holding the tar.gz archive with
@@ -61,6 +61,7 @@
# Check for the presence of the archive directory
# Added --encrypt for symmetric encryption through gpg (Eric Windisch)
# Added support for the digest command on Solaris 10 for MD5 checksums
+# Check for available disk space before extracting to the target directory (Andreas Schweitzer)
#
# (C) 1998-2006 by Stéphane Peter <megastep@megastep.org>
#