On Mon, Jun 12, 2006 at 10:52:20PM +0200, Ola Lundqvist wrote:
> On Mon, Jun 12, 2006 at 09:22:15PM +0200, Marc Haber wrote:
> > cron-apt could check for free space on /tmp in the beginning and print
> > a more meaningful error message if, say, less than 10 MB is free. This
> > will still break if /tmp fills up while cron-apt is running though.
> 
> I Agree. Let's see what I can do about it.

See attached, untested patch.

Greetings
Marc

-- 
-----------------------------------------------------------------------------
Marc Haber         | "I don't trust Computers. They | Mailadresse im Header
Mannheim, Germany  |  lose things."    Winona Ryder | Fon: *49 621 72739834
Nordisch by Nature |  How to make an American Quilt | Fax: *49 621 72739835
--- cron-apt.orig       2007-07-28 09:08:16.000000000 +0200
+++ cron-apt    2007-07-28 09:26:10.000000000 +0200
@@ -142,7 +142,11 @@
 CONFIGDIRNAME="$(echo $CONFIG | sed 's|/|_-_|g')"
 TMPDIR=$(mktemp -d -t cron-apt.XXXXXX)
 if [ $? -ne 0 ]; then
-    echo "Error: Can not create a safe temporary directory."
+    echo >&2 "Error: Can not create a safe temporary directory."
+    exit 1
+fi
+if [ "$(( $(stat --file-system --format=%S $TMPDIR) * $(stat --file-system 
--format=%a $TMPDIR) / 1024 ))" -lt "10000" ]; then
+    echo >&2 "Error: Not enough free space in $TMPDIR."
     exit 1
 fi
 

Reply via email to