]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blobdiff - config/extrahd/extrahd.pl
syslog: Listen to network and block access from anywhere but localhost
[people/pmueller/ipfire-2.x.git] / config / extrahd / extrahd.pl
index d4782f867e6d7ae3902025e64dd0068e8712bd36..3b57e92303ea13d1c74e92d391ce20333b9cb18e 100644 (file)
@@ -1,11 +1,23 @@
 #!/usr/bin/perl
-#
-# IPFire Scripts
-#
-# This code is distributed under the terms of the GPL
-#
-# (c) The IPFire Team
-#
+###############################################################################
+#                                                                             #
+# IPFire.org - A linux based firewall                                         #
+# Copyright (C) 2010  IPFire Team  <info@ipfire.org>                          #
+#                                                                             #
+# This program 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 3 of the License, or           #
+# (at your option) any later version.                                         #
+#                                                                             #
+# This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.       #
+#                                                                             #
+###############################################################################
 
 use strict;
 # enable only the following on debugging purpose
@@ -36,8 +48,6 @@ close FILE;
 ############################################################################################################################
 ############################################################################################################################
 
-print "$ARGV[0] $ARGV[1]";
-
 if ( "$ARGV[0]" eq "mount" ) {
        system("/bin/cp -f /etc/fstab $fstab");
 
@@ -45,10 +55,10 @@ if ( "$ARGV[0]" eq "mount" ) {
        {
                @deviceline = split( /\;/, $deviceentry );
                if ( "$ARGV[1]" eq "$deviceline[2]" ) {
-                       print "Insert /dev/$deviceline[0] ($deviceline[1]) --> $deviceline[2] into /etc/fstab!\n";
+                       print "Insert $deviceline[0] ($deviceline[1]) --> $deviceline[2] into /etc/fstab!\n";
                        unless ( -d $deviceline[2] ) { system("/bin/mkdir -p $deviceline[2] && chmod 0777 $deviceline[2]"); }
                        open(FILE, ">>$fstab");
-                       print FILE "/dev/$deviceline[0]\t$deviceline[2]\t$deviceline[1]\tdefaults\t0\t0\n";
+                       print FILE "$deviceline[0]\t$deviceline[2]\t$deviceline[1]\tdefaults\t0\t0\n";
                        close(FILE);
                }
        }
@@ -65,15 +75,18 @@ if ( "$ARGV[0]" eq "mount" ) {
        if ( ! `/bin/mount | /bin/fgrep $ARGV[1]` ) {
                system("/bin/cp -f /etc/fstab $fstab");
                system("/bin/fgrep -v $ARGV[1] <$fstab >/etc/fstab");
-               print "Succesfully umounted $ARGV[1].\n";
+               print "Successfully umounted $ARGV[1].\n";
                exit(0);
        } else {
                print "Can't umount $ARGV[1].\n";
                exit(1);
        }
 
+} elsif ( "$ARGV[0]" eq "scanhd") {
+       system("/usr/local/bin/scanhd $ARGV[1]");
+
 } else {
-       print "Usage: $0 (mount|umount) mountpoint\n";
+       print "Usage: $0 (mount|umount|scanhd) mountpoint\n";
 }
 
 ############################################################################################################################