--- /dev/null
+#!/usr/bin/perl -w
+############################################################################
+# #
+# This file is part of the IPFire Firewall. #
+# #
+# IPFire is free software; you can redistribute it and/or modify #
+# it under the terms of the GNU General Public License as published by #
+# the Free Software Foundation; either version 2 of the License, or #
+# (at your option) any later version. #
+# #
+# IPFire is distributed in the hope that it will be useful, #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
+# GNU General Public License for more details. #
+# #
+# You should have received a copy of the GNU General Public License #
+# along with IPFire; if not, write to the Free Software #
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #
+# #
+# Copyright (C) 2018 IPFire Team <info@ipfire.org>. #
+# #
+############################################################################
+
+package IDS;
+
+require '/var/ipfire/general-functions.pl';
+require "${General::swroot}/lang.pl";
+
+#
+## Function for checking if at least 300MB of free disk space are available
+## on the "/var" partition.
+#
+sub checkdiskspace () {
+ # Call diskfree to gather the free disk space of /var.
+ my @df = `/bin/df -B M /var`;
+
+ # Loop through the output.
+ foreach my $line (@df) {
+ # Ignore header line.
+ next if $line =~ m/^Filesystem/;
+
+ # Search for a line with the device information.
+ if ($line =~ m/dev/ ) {
+ # Split the line into single pieces.
+ my @values = split(' ', $line);
+ my ($filesystem, $blocks, $used, $available, $used_perenctage, $mounted_on) = @values;
+
+ # Check if the available disk space is more than 300MB.
+ if ($available < 300) {
+ # If there is not enough space, print out an error message.
+ my $errormessage = "$Lang::tr{'not enough disk space'} < 300MB, /var $available MB";
+
+ # Exit function and return the error message.
+ return $errormessage;
+ }
+ }
+ }
+
+ # Everything okay, return nothing.
+ return;
+}
+
+
+1;