aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorDaniel Stefan Haischt <dsh@pfsense.org>2007-01-04 12:35:03 +0000
committerDaniel Stefan Haischt <dsh@pfsense.org>2007-01-04 12:35:03 +0000
commita6cb09d6671e4dee123e76bb82f15cc897f919ad (patch)
treecde6ece42e080f01514b32fed97c137f3ea1d947 /packages
parente77957a17655ceb1dfb6648473884576c49f148e (diff)
downloadpfsense-packages-a6cb09d6671e4dee123e76bb82f15cc897f919ad.tar.gz
pfsense-packages-a6cb09d6671e4dee123e76bb82f15cc897f919ad.tar.bz2
pfsense-packages-a6cb09d6671e4dee123e76bb82f15cc897f919ad.zip
* synced freenas package to current FreeNAS trunk
* unison package file needs to be added to pfsense.com * rc script needs to be tested
Diffstat (limited to 'packages')
-rw-r--r--packages/freenas/pkg/freenas.inc55
-rw-r--r--packages/freenas/pkg/freenas.xml143
-rw-r--r--packages/freenas/pkg/freenas_config.inc59
-rw-r--r--packages/freenas/pkg/freenas_disks.inc1990
-rw-r--r--packages/freenas/pkg/freenas_functions.inc59
-rw-r--r--packages/freenas/pkg/freenas_guiconfig.inc35
-rw-r--r--packages/freenas/pkg/freenas_services.inc2331
-rw-r--r--packages/freenas/pkg/freenas_system.inc1038
-rw-r--r--packages/freenas/pkg/freenas_utils.inc1590
-rw-r--r--packages/freenas/pkg/rc.freenas13
-rw-r--r--packages/freenas/www/diag_ad_infos.php142
-rw-r--r--packages/freenas/www/diag_ataidle_infos.php119
-rw-r--r--packages/freenas/www/diag_disk_infos.php93
-rw-r--r--packages/freenas/www/diag_fn_logs_daemon.php121
-rw-r--r--packages/freenas/www/diag_fn_logs_ftp.php124
-rw-r--r--packages/freenas/www/diag_fn_logs_rsyncd.php124
-rw-r--r--packages/freenas/www/diag_fn_logs_samba.php238
-rw-r--r--packages/freenas/www/diag_fn_logs_settings.php377
-rw-r--r--packages/freenas/www/diag_fn_logs_smartd.php124
-rw-r--r--packages/freenas/www/diag_fn_logs_sshd.php124
-rw-r--r--packages/freenas/www/diag_iscsi_infos.php102
-rw-r--r--packages/freenas/www/diag_mounts_infos.php94
-rw-r--r--packages/freenas/www/diag_part_infos.php86
-rw-r--r--packages/freenas/www/diag_raid_infos.php85
-rw-r--r--packages/freenas/www/diag_smart_infos.php97
-rw-r--r--packages/freenas/www/diag_space_infos.php87
-rw-r--r--packages/freenas/www/disks_manage.php292
-rw-r--r--packages/freenas/www/disks_manage_edit.php220
-rw-r--r--packages/freenas/www/disks_manage_init.php459
-rw-r--r--packages/freenas/www/disks_manage_iscsi.php133
-rw-r--r--packages/freenas/www/disks_manage_tools.php275
-rw-r--r--packages/freenas/www/disks_mount.php268
-rw-r--r--packages/freenas/www/disks_mount_edit.php281
-rw-r--r--packages/freenas/www/disks_mount_tools.php211
-rw-r--r--packages/freenas/www/disks_raid_gconcat.php236
-rw-r--r--packages/freenas/www/disks_raid_gconcat_edit.php256
-rw-r--r--packages/freenas/www/disks_raid_gconcat_infos.php143
-rw-r--r--packages/freenas/www/disks_raid_gconcat_tools.php187
-rw-r--r--packages/freenas/www/disks_raid_gmirror.php202
-rw-r--r--packages/freenas/www/disks_raid_gmirror_edit.php267
-rw-r--r--packages/freenas/www/disks_raid_gmirror_infos.php93
-rw-r--r--packages/freenas/www/disks_raid_gmirror_init.php71
-rw-r--r--packages/freenas/www/disks_raid_gmirror_tools.php152
-rw-r--r--packages/freenas/www/disks_raid_graid5.php236
-rw-r--r--packages/freenas/www/disks_raid_graid5_edit.php258
-rw-r--r--packages/freenas/www/disks_raid_graid5_infos.php143
-rw-r--r--packages/freenas/www/disks_raid_graid5_tools.php190
-rw-r--r--packages/freenas/www/disks_raid_gstripe.php236
-rw-r--r--packages/freenas/www/disks_raid_gstripe_edit.php258
-rw-r--r--packages/freenas/www/disks_raid_gstripe_infos.php143
-rw-r--r--packages/freenas/www/disks_raid_gstripe_tools.php187
-rw-r--r--packages/freenas/www/disks_raid_gvinum.php218
-rw-r--r--packages/freenas/www/disks_raid_gvinum_edit.php250
-rw-r--r--packages/freenas/www/disks_raid_gvinum_infos.php99
-rw-r--r--packages/freenas/www/disks_raid_gvinum_init.php71
-rw-r--r--packages/freenas/www/disks_raid_gvinum_tools.php204
-rw-r--r--packages/freenas/www/services_afp.php144
-rw-r--r--packages/freenas/www/services_ftp.php277
-rw-r--r--packages/freenas/www/services_nfs.php154
-rw-r--r--packages/freenas/www/services_rsyncd.php205
-rw-r--r--packages/freenas/www/services_rsyncd_client.php434
-rw-r--r--packages/freenas/www/services_rsyncd_local.php584
-rw-r--r--packages/freenas/www/services_samba.php306
-rw-r--r--packages/freenas/www/services_samba_share.php165
-rw-r--r--packages/freenas/www/services_samba_share_edit.php156
-rw-r--r--packages/freenas/www/services_unison.php245
-rw-r--r--packages/freenas/www/status_disks.php92
67 files changed, 12065 insertions, 6386 deletions
diff --git a/packages/freenas/pkg/freenas.inc b/packages/freenas/pkg/freenas.inc
index d00440a3..b87ebfe6 100644
--- a/packages/freenas/pkg/freenas.inc
+++ b/packages/freenas/pkg/freenas.inc
@@ -1,31 +1,44 @@
<?php
/* $Id$ */
+/* ========================================================================== */
/*
- $RCSfile$
- Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name>
- All rights reserved.
+ freenas.inc
+ part of pfSense (http://www.pfSense.com)
+ Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name>
+ All rights reserved.
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
+ Based on FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
- 1. Redistributions of source code must retain the above copyright notices,
- this list of conditions and the following disclaimer.
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ All rights reserved.
+ */
+/* ========================================================================== */
+/*
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright
- notices, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+/* ========================================================================== */
require_once("freenas_config.inc");
diff --git a/packages/freenas/pkg/freenas.xml b/packages/freenas/pkg/freenas.xml
index b18d10ff..6b1e5711 100644
--- a/packages/freenas/pkg/freenas.xml
+++ b/packages/freenas/pkg/freenas.xml
@@ -1,4 +1,46 @@
<?xml version="1.0" encoding="utf-8" ?>
+<!--
+/* $Id$ */
+/* ========================================================================== */
+/*
+ freenas.xml
+ part of pfSense (http://www.pfSense.com)
+ Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name>
+ All rights reserved.
+
+ Based on FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ All rights reserved.
+ */
+/* ========================================================================== */
+/*
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+/* ========================================================================== */
+-->
<packagegui>
<name>freenas</name>
<version>1.0</version>
@@ -60,10 +102,17 @@
<section>Services</section>
<url>/services_samba.php</url>
</menu>
+ <menu>
+ <name>Unison</name>
+ <section>Services</section>
+ <url>/services_unison.php</url>
+ </menu>
+ <!--
<service>
<name>dspam</name>
<rcfile>/usr/local/etc/rc.d/dspam.sh</rcfile>
</service>
+ -->
<tabs />
<!--
configpath gets expanded out automatically and config items
@@ -91,6 +140,11 @@
<chmod>0755</chmod>
<item>http://www.pfsense.com/packages/config/freenas/www/disks_manage_iscsi.php</item>
</additional_files_needed>
+ <additional_files_needed>
+ <prefix>/usr/local/www/</prefix>
+ <chmod>0755</chmod>
+ <item>http://www.pfsense.com/packages/config/freenas/www/disks_manage_tools.php</item>
+ </additional_files_needed>
<!-- PHP files (RAID management) -->
<additional_files_needed>
<prefix>/usr/local/www/</prefix>
@@ -107,11 +161,13 @@
<chmod>0755</chmod>
<item>http://www.pfsense.com/packages/config/freenas/www/disks_raid_gmirror_infos.php</item>
</additional_files_needed>
+ <!--
<additional_files_needed>
<prefix>/usr/local/www/</prefix>
<chmod>0755</chmod>
<item>http://www.pfsense.com/packages/config/freenas/www/disks_raid_gmirror_init.php</item>
</additional_files_needed>
+ -->
<additional_files_needed>
<prefix>/usr/local/www/</prefix>
<chmod>0755</chmod>
@@ -132,16 +188,78 @@
<chmod>0755</chmod>
<item>http://www.pfsense.com/packages/config/freenas/www/disks_raid_gvinum_infos.php</item>
</additional_files_needed>
+ <!--
<additional_files_needed>
<prefix>/usr/local/www/</prefix>
<chmod>0755</chmod>
<item>http://www.pfsense.com/packages/config/freenas/www/disks_raid_gvinum_init.php</item>
</additional_files_needed>
+ -->
<additional_files_needed>
<prefix>/usr/local/www/</prefix>
<chmod>0755</chmod>
<item>http://www.pfsense.com/packages/config/freenas/www/disks_raid_gvinum_tools.php</item>
</additional_files_needed>
+ <additional_files_needed>
+ <prefix>/usr/local/www/</prefix>
+ <chmod>0755</chmod>
+ <item>http://www.pfsense.com/packages/config/freenas/www/disks_raid_gconcat.php</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/usr/local/www/</prefix>
+ <chmod>0755</chmod>
+ <item>http://www.pfsense.com/packages/config/freenas/www/disks_raid_gconcat_edit.php</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/usr/local/www/</prefix>
+ <chmod>0755</chmod>
+ <item>http://www.pfsense.com/packages/config/freenas/www/disks_raid_gconcat_infos.php</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/usr/local/www/</prefix>
+ <chmod>0755</chmod>
+ <item>http://www.pfsense.com/packages/config/freenas/www/disks_raid_gconcat_tools.php</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/usr/local/www/</prefix>
+ <chmod>0755</chmod>
+ <item>http://www.pfsense.com/packages/config/freenas/www/disks_raid_gstripe.php</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/usr/local/www/</prefix>
+ <chmod>0755</chmod>
+ <item>http://www.pfsense.com/packages/config/freenas/www/disks_raid_gstripe_edit.php</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/usr/local/www/</prefix>
+ <chmod>0755</chmod>
+ <item>http://www.pfsense.com/packages/config/freenas/www/disks_raid_gstripe_infos.php</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/usr/local/www/</prefix>
+ <chmod>0755</chmod>
+ <item>http://www.pfsense.com/packages/config/freenas/www/disks_raid_gstripe_tools.php</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/usr/local/www/</prefix>
+ <chmod>0755</chmod>
+ <item>http://www.pfsense.com/packages/config/freenas/www/disks_raid_graid5.php</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/usr/local/www/</prefix>
+ <chmod>0755</chmod>
+ <item>http://www.pfsense.com/packages/config/freenas/www/disks_raid_graid5_edit.php</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/usr/local/www/</prefix>
+ <chmod>0755</chmod>
+ <item>http://www.pfsense.com/packages/config/freenas/www/disks_raid_graid5_infos.php</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/usr/local/www/</prefix>
+ <chmod>0755</chmod>
+ <item>http://www.pfsense.com/packages/config/freenas/www/disks_raid_graid5_tools.php</item>
+ </additional_files_needed>
<!-- PHP files (mount management) -->
<additional_files_needed>
<prefix>/usr/local/www/</prefix>
@@ -153,6 +271,11 @@
<chmod>0755</chmod>
<item>http://www.pfsense.com/packages/config/freenas/www/disks_mount_edit.php</item>
</additional_files_needed>
+ <additional_files_needed>
+ <prefix>/usr/local/www/</prefix>
+ <chmod>0755</chmod>
+ <item>http://www.pfsense.com/packages/config/freenas/www/disks_mount_tools.php</item>
+ </additional_files_needed>
<!-- PHP files (diagnostics) -->
<additional_files_needed>
<prefix>/usr/local/www/</prefix>
@@ -264,8 +387,28 @@
<additional_files_needed>
<prefix>/usr/local/www/</prefix>
<chmod>0755</chmod>
+ <item>http://www.pfsense.com/packages/config/freenas/www/services_rsyncd_local.php</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/usr/local/www/</prefix>
+ <chmod>0755</chmod>
<item>http://www.pfsense.com/packages/config/freenas/www/services_samba.php</item>
</additional_files_needed>
+ <additional_files_needed>
+ <prefix>/usr/local/www/</prefix>
+ <chmod>0755</chmod>
+ <item>http://www.pfsense.com/packages/config/freenas/www/services_samba_share.php</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/usr/local/www/</prefix>
+ <chmod>0755</chmod>
+ <item>http://www.pfsense.com/packages/config/freenas/www/services_samba_edit.php</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/usr/local/www/</prefix>
+ <chmod>0755</chmod>
+ <item>http://www.pfsense.com/packages/config/freenas/www/services_unison.php</item>
+ </additional_files_needed>
<!-- PHP files (misc) -->
<additional_files_needed>
<prefix>/usr/local/www/</prefix>
diff --git a/packages/freenas/pkg/freenas_config.inc b/packages/freenas/pkg/freenas_config.inc
index e2ee4848..fc139228 100644
--- a/packages/freenas/pkg/freenas_config.inc
+++ b/packages/freenas/pkg/freenas_config.inc
@@ -1,35 +1,44 @@
<?php
-
/* $Id$ */
+/* ========================================================================== */
/*
- functions.inc
- Copyright (C) 2004 Scott Ullrich
- All rights reserved.
+ freenas_config.inc
+ part of pfSense (http://www.pfSense.com)
+ Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name>
+ All rights reserved.
+
+ Based on FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
- Originally part of m0n0wall (http://m0n0.ch/wall)
- Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
- All rights reserved.
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ All rights reserved.
+ */
+/* ========================================================================== */
+/*
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+/* ========================================================================== */
$GLOBALS['custom_listtags'] = array("disk", "mount", "vdisk");
diff --git a/packages/freenas/pkg/freenas_disks.inc b/packages/freenas/pkg/freenas_disks.inc
index 4cc9f5c5..3f0dd694 100644
--- a/packages/freenas/pkg/freenas_disks.inc
+++ b/packages/freenas/pkg/freenas_disks.inc
@@ -1,737 +1,1082 @@
<?php
+/* $Id$ */
+/* ========================================================================== */
/*
- disks.inc
- part of FreeNAS (http://www.freenas.org)
- Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
- All rights reserved.
-
- Based on m0n0wall (http://m0n0.ch/wall)
- Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
- All rights reserved.
-
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
-
+ freenas_disks.inc
+ part of pfSense (http://www.pfSense.com)
+ Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name>
+ All rights reserved.
+
+ Based on FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ All rights reserved.
+ */
+/* ========================================================================== */
+/*
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+/* ========================================================================== */
+
/* include all configuration functions */
require_once("functions.inc");
$freenas_config =& $config['installedpackages']['freenas']['config'][0];
-
-function disks_mount_all()
-{
- global $freenas_config, $g;
-
- if ($g['booting'])
- echo "Mounting Partitions... ";
-
- /* For each device configured:*/
-
- if (is_array($freenas_config['mounts']['mount']))
- {
- foreach ($freenas_config['mounts']['mount'] as $mountent)
- {
- /* Advanced Umount filesystem if not booting mode (mount edition)*/
- if (!$g['booting'])
- disks_umount_adv($mountent);
-
- /* mount filesystem */
- disks_mount($mountent);
-
- }
- }
-
- if ($g['booting'])
- echo "done\n";
-
- return 0;
-
-}
-
-function disks_mount($mount)
-{
- global $config, $g;
-
- /* mount the specified $mount partition */
- /* The $mount variable is the all config table for the mount point*/
-
- /* Create one directory for each device under mnt */
-
- $mountname=escapeshellcmd($mount['sharename']);
-
- @mkdir ("/mnt/$mountname",0777);
-
- /* mount the filesystems */
-
- /* Must use a special dev name for software RAID volume */
-
- if (strcmp($mount['partition'],"gvinum") == 0)
- $devname="/dev/gvinum/{$mount['mdisk']}";
- else if (strcmp($mount['partition'],"gmirror") == 0)
- $devname="/dev/mirror/{$mount['mdisk']}";
- else
- $devname="/dev/{$mount['mdisk']}{$mount['partition']}";
-
- /* check the fileystem only if there is a problem*/
-
- switch ($mount['fstype'])
- {
- case "ufs":
-
- if (mwexec("/sbin/mount -t ufs -o acls {$devname} /mnt/$mountname") == 0)
- {
- /* Change this directory into 777 mode */
- mwexec("/bin/chmod 777 /mnt/$mountname");
- return 0;
- }
- else
- {
- /* If it's NOK, Check filesystem and do a fsck, answer Yes to all question*/
- mwexec("/sbin/fsck -y -t ufs {$devname}");
- /* Re-try to mount the partition */
- if (mwexec("/sbin/mount -t ufs -o acls {$devname} /mnt/$mountname") == 0)
- {
- /* Change this directory into 777 mode */
- mwexec("/bin/chmod 777 /mnt/$mountname");
- return 0;
- }
- else
- {
- /* Not OK, remove the directory, prevent writing on RAM */
- @rmdir ("/mnt/$mountname");
- return 1;
- }
-
- }
- break;
-
- case "msdosfs":
- if (mwexec("/sbin/mount_msdosfs -u ftp -g ftp -m 777 {$devname} /mnt/$mountname") == 0)
- return 0;
- else
- {
- exec("/sbin/fsck_msdosfs -y {$devname}");
- if (mwexec("/sbin/mount_msdosfs -u ftp -g ftp -m 777 {$devname} /mnt/$mountname") == 0)
- return 0;
- else
- {
- /* Not OK, remove the directory, prevent writing on RAM */
- @rmdir ("/mnt/$mountname");
- return 1;
- }
- }
-
- break;
-
- case "ntfs":
- if (mwexec("/sbin/mount_ntfs -u ftp -g ftp -m 777 {$devname} /mnt/$mountname") == 0)
- return 0;
- else
- {
- /* Not OK, remove the directory, prevent writing on RAM */
- @rmdir ("/mnt/$mountname");
- return 1;
- }
- break;
-
- case "ext2fs":
- if (mwexec("/sbin/mount_ext2fs {$devname} /mnt/$mountname") == 0)
- {
- /* Change this directory into 777 mode */
- mwexec("/bin/chmod 777 /mnt/$mountname");
- return 0;
- }
- else
- {
- exec("/usr/local/sbin/e2fsck -f -p -y {$devname}");
- if (mwexec("/sbin/mount_ext2fs {$devname} /mnt/$mountname") == 0)
- {
- /* Change this directory into 777 mode */
- mwexec("/bin/chmod 777 /mnt/$mountname");
- return 0;
- }
- else
- {
- /* Not OK, remove the directory, prevent writing on RAM */
- @rmdir ("/mnt/$mountname");
- return 1;
- }
- }
- break;
- }
-
-}
-
-function disks_umount($mount)
-{
- global $config, $g;
-
- /* Umout the specified mount point */
- /* The $mount variable is the all config table for the mount point*/
-
- $mountname=escapeshellcmd($mount['sharename']);
-
- if (mwexec("/sbin/umount $mountname") == 0)
- {
- if (@rmdir ("/mnt/$mountname"))
- return 0;
- else
- return 1;
-
- }
-
- else
- return 1;
+/* Mount all configured disks */
+function disks_mount_all() {
+ global $freenas_config, $g;
+
+ if ($g['booting'])
+ echo "Mounting Partitions... ";
+
+ /* For each device configured: */
+ if (is_array($freenas_config['mounts']['mount'])) {
+ foreach ($freenas_config['mounts']['mount'] as $mountent) {
+ /* Advanced Umount filesystem if not booting mode (mount edition) */
+ if (!$g['booting'])
+ disks_umount_adv($mountent);
+
+ /* mount filesystem */
+ disks_mount($mountent);
+ } // end foreach
+ } // end if
+
+ if ($g['booting'])
+ echo "done\n";
+
+ return 0;
}
+/* Mount using the configured mount given in parameter
+ * Return 0 if sucessful, 1 if error
+ */
+function disks_mount($mount) {
+ global $freenas_config, $g;
+
+ /* Create one directory for each device under mnt */
+
+ $mountname=escapeshellcmd($mount['sharename']);
+
+ @mkdir ("/mnt/$mountname",0777);
+
+ /* mount the filesystems */
+ $devname=escapeshellcmd($mount['fullname']);
+
+ /* check the fileystem only if there is a problem*/
+ /* This part is too stupid: I must read the FreBSD
+ * start script for use the same intelligent method
+ * for checking hard drive
+ */
+ switch ($mount['fstype']) {
+ case "ufs":
+ if (mwexec("/sbin/mount -t ufs -o acls $devname /mnt/$mountname") == 0) {
+ /* Change this directory into 777 mode */
+ mwexec("/bin/chmod 777 /mnt/$mountname");
+ $result = 0;
+ } else {
+ /* If it's NOK, Check filesystem and do a fsck, answer Yes to all question*/
+ mwexec("/sbin/fsck -y -t ufs $devname");
+
+ /* Re-try to mount the partition */
+ if (mwexec("/sbin/mount -t ufs -o acls $devname /mnt/$mountname") == 0) {
+ /* Change this directory into 777 mode */
+ mwexec("/bin/chmod 777 /mnt/$mountname");
+ $result = 0;
+ } else {
+ /* Not OK, remove the directory, prevent writing on RAM disk*/
+ @rmdir ("/mnt/$mountname");
+ $result = 1;
+ } // end if
+ } // end if
+ break;
+ case "msdosfs":
+ if (mwexec("/sbin/mount_msdosfs -u ftp -g ftp -m 777 $devname /mnt/$mountname") == 0) {
+ $result = 0;
+ } else {
+ exec("/sbin/fsck -y -t msdosfs {$devname}");
+
+ if (mwexec("/sbin/mount_msdosfs -u ftp -g ftp -m 777 $devname /mnt/$mountname") == 0) {
+ $result = 0;
+ } else {
+ /* Not OK, remove the directory, prevent writing on RAM disk*/
+ @rmdir ("/mnt/$mountname");
+ $result = 1;
+ }
+ }
+ break;
+ case "ntfs":
+ if (mwexec("/sbin/mount_ntfs -u ftp -g ftp -m 777 $devname /mnt/$mountname") == 0) {
+ $result = 0;
+ else {
+ /* Not OK, remove the directory, prevent writing on RAM disk */
+ @rmdir ("/mnt/$mountname");
+ $result = 1;
+ }
+ break;
+ case "ext2fs":
+ if (mwexec("/sbin/mount_ext2fs $devname /mnt/$mountname") == 0) {
+ /* Change this directory into 777 mode */
+ mwexec("/bin/chmod 777 /mnt/$mountname");
+ $result = 0;
+ } else {
+ exec("/usr/local/sbin/e2fsck -f -p {$devname}");
+
+ if (mwexec("/sbin/mount_ext2fs $devname /mnt/$mountname") == 0) {
+ /* Change this directory into 777 mode */
+ mwexec("/bin/chmod 777 /mnt/$mountname");
+ $result = 0;
+ } else {
+ /* Not OK, remove the directory, prevent writing on RAM */
+ @rmdir ("/mnt/$mountname");
+ $result= 1;
+ }
+ }
+ break;
+ } // end switch
+
+ return $result;
+}
+
+/* Mount using fullname (/dev/ad0s1) given in parameter*/
+function disks_mount_fullname($fullname) {
+ global $freenas_config;
+
+ if (is_array($freenas_config['mounts']['mount'])) {
+ /* Search the mount list for given disk and partition */
+ foreach($freenas_config['mounts']['mount'] as $mountk => $mountv) {
+ if($mountv['fullname'] == $fullname) {
+ $mount = $mountv;
+ }
+ }
+ }
+
+ if($mount) {
+ $result= disks_mount($mount);
+ } else {
+ $result=0;
+ }
+
+ return $result;
+}
+
+/* Umount the specified configured mount point
+ * Return 0 is successfull, 1 if error
+ */
+function disks_umount($mount) {
+ global $freenas_config, $g;
+
+ /* Umout the specified mount point */
+ /* The $mount variable is the all config table for the mount point*/
+ $mountname=escapeshellcmd($mount['sharename']);
+
+ if (mwexec("/sbin/umount $mountname") == 0) {
+ if (@rmdir ("/mnt/$mountname")) {
+ return 0;
+ } else {
+ return 1;
+ }
+ } else {
+ return 1;
+ }
+}
+
+/* Advanced unmount the specified mount point without using the sharename value
+ * Used when changing the 'sharename': Need to umount the old unknow sharename
+ * Return 0 if successful, 1 if error
+ */
+function disks_umount_fullname($fullname) {
+ global $freenas_config;
+
+ /* Search the mount list for given fullname */
+ foreach($freenas_config['mounts']['mount'] as $mountk => $mountv) {
+ if (strcmp($mountv['fullname'],$fullname) == 0) {
+ $mount = $mountv;
+ }
+ }
+
+ if($mount) {
+ $result = disks_umount($mount);
+ } else {
+ $result= 1;
+ }
+
+ return $result;
+}
+
+/* Advanced unmount the specified mount point without using the sharename value
+ * Used when changing the 'sharename': Need to umount the old unknow sharename
+ * Return 0 if successful, 1 if error
+ */
function disks_umount_adv($mount)
{
- global $config, $g;
-
- /* Advanced unmout the specified mount point without using the sharename (changing it)*/
- /* The $mount variable is the all config table for the mount point*/
-
- $mountpart="{$mount['partition']}";
-
- if ((strcmp($mountpart,"gvinum") == 0) || (strcmp($mountpart,"gmirror") == 0))
- $complete = "{$mount['mdisk']}";
- else
- $complete = "{$mount['mdisk']}{$mount['partition']}";
-
- // get the mount list
- $detmount = get_mounts_list();
-
- foreach ($detmount as $detmountk => $detmountv)
- {
-
- // If we found the mount point on the device
-
- if (strcmp($detmountv['mdisk'],$complete) == 0)
- {
- $mountname="{$detmountv['mp']}";
- }
-
- }
-
- if ($mountname)
- {
- exec("/sbin/umount $mountname");
- @rmdir ("$mountname");
- return 0;
- }
- else
- return 1;
-}
-
-function disks_mount_status($mount)
-{
- // This option check if the mount are mounted
- global $config, $g;
- $detmount = get_mounts_list();
- $status="ERROR";
-
- // Recreate the full system name device+s+partition number
- /* mount the filesystems */
-
- $mountpart="{$mount['partition']}";
-
- if ((strcmp($mountpart,"gvinum") == 0) || (strcmp($mountpart,"gmirror") == 0))
- $complete = "{$mount['mdisk']}";
- else
- $complete = "{$mount['mdisk']}{$mount['partition']}";
-
- //echo "debug, display complete: $complete <br>";
-
- foreach ($detmount as $detmountk => $detmountv)
- {
-
- //echo "debug, display detmountv[mdisk]: {$detmountv['mdisk']} <br>";
-
- if (strcmp($detmountv['mdisk'],$complete) == 0)
- {
- $status="OK";
- return $status;
- }
-
- }
- return $status;
-}
-
-function disks_check_mount($disk)
-{
- // This option check if the partition 1 of the disk is mounted
- // Return 0 if not, 1 if yes
- global $config, $g;
- $detmount = get_mounts_list();
- $status=0;
-
- // Recreate the full system name device+s+partition number
- /* mount the filesystems */
-
- $complete = "{$disk}" . "s1";
-
- foreach ($detmount as $detmountk => $detmountv)
- {
-
- //echo "debug, display detmountv[mdisk]: {$detmountv['mdisk']} <br>";
-
- if (strcmp($detmountv['mdisk'],$complete) == 0)
- {
- $status="1";
- return $status;
- }
-
- }
- return $status;
-}
-
-
-
-function disks_status($diskname)
+ $fulname="{$mount['fullname']}";
+
+ // get the mount list
+ $detmount = get_mounts_list();
+
+ //Look for the mount point in all mounted point
+ foreach ($detmount as $detmountk => $detmountv) {
+ // If we found the mount point on the device
+ if (strcmp($detmountv['fullname'],$fullname) == 0) {
+ $mountname="{$detmountv['mp']}";
+ }
+ }
+
+ if ($mountname) {
+ exec("/sbin/umount $mountname");
+ @rmdir ("$mountname");
+ return 0;
+ } else {
+ $result = 1;
+ }
+
+ return $result;
+}
+
+function disks_mount_status($mount) {
+ // This option check if the mount are mounted
+ global $freenas_config, $g;
+ $detmount = get_mounts_list();
+ $status="ERROR";
+
+ // Recreate the full system name device+s+partition number
+ /* mount the filesystems */
+ $mountpart="{$mount['partition']}";
+
+ if ((strcmp($mountpart,"gvinum") == 0) || (strcmp($mountpart,"gmirror") == 0)) {
+ $complete = "{$mount['mdisk']}";
+ } else {
+ $complete = "{$mount['mdisk']}{$mount['partition']}";
+ }
+
+ //echo "debug, display complete: $complete <br>";
+
+ foreach ($detmount as $detmountk => $detmountv) {
+ //echo "debug, display detmountv[mdisk]: {$detmountv['mdisk']} <br>";
+
+ if (strcmp($detmountv['mdisk'],$complete) == 0) {
+ $status="OK";
+ return $status;
+ }
+ }
+
+ return $status;
+}
+
+/* This option check if this fullname (/dev/ad0s1) is mounted
+ * Return 0 if not, 1 if yes
+ */
+function disks_check_mount_fullname($fullname) {
+ $detmount = get_mounts_list();
+ $status=0;
+ //print_r($detmount);
+
+ foreach ($detmount as $detmountk => $detmountv) {
+ if (strcmp($detmountv['fullname'],$fullname) == 0) {
+ $status=1;
+ break;
+ }
+ }
+
+ return $status;
+}
+
+/* This option check if the configured mount is mounted. */
+function disks_check_mount($mount)
{
- // This option check if the configured disk is online
- global $config, $g;
- $detectedlist = get_physical_disks_list();
- $status="MISSING";
- foreach ($detectedlist as $detecteddisk => $detecteddiskv)
- {
-
- if ($detecteddisk == $diskname['name'])
- {
- $status="ONLINE";
- if (($detecteddiskv['size'] != $diskname['size']) || ($detecteddiskv['desc'] != $diskname['desc']))
- $status="CHANGED";
- break;
- }
- }
- return $status;
+ return disks_check_mount_fullname($mount['fullname']);
}
+/* This function check if the disk is mounted
+ * Return 0 if not, 1 if yes
+ */
+function disks_check_mount_disk($disk) {
+ $detmount = get_mounts_list();
+ $status=0;
+
+ foreach ($detmount as $detmountk => $detmountv) {
+ /* Must found the $disk (ad0) in result $mdisk (ad0s1) */
+ // strpos will return 0 (found at position 0) if found, must check the 'false' value
+ if (strpos($detmountv['mdisk'], $disk) !== false ) {
+ $status=1;
+ break;
+ }
+}
+return $status;
+}
+
+/* This option check if the configured disk is online (detected by the system)
+ * Result: "MISSING", disk don't detected by OS
+ * Result: "ONLINE", disk is online
+ * Result: "CHANGED", disk have changed (be replaced ?)
+ */
+function disks_status($diskname) {
+ // This option check if the configured disk is online
+ global $freenas_config, $g;
+ $detectedlist = get_physical_disks_list();
+ $status="MISSING";
+
+ foreach ($detectedlist as $detecteddisk => $detecteddiskv) {
+ if ($detecteddisk == $diskname['name']) {
+ $status="ONLINE";
+ if (($detecteddiskv['size'] != $diskname['size']) || ($detecteddiskv['desc'] != $diskname['desc'])) {
+ $status="CHANGED";
+ }
+ break;
+ }
+ }
+
+ return $status;
+}
function disks_addfstab($cfgdev,$cfgtype) {
- global $config, $g;
-
- /* Open or create fstab in RW */
- $fd = fopen("{$g['etc_path']}/fstab", "w");
-
- if ( $fd )
- {
- /* check for the precence of dev */
- /* ADD (check if it's ADD line or replace) the line for the dev */
- $fstab = "/dev/$cfgdev /mnt/$cfgdev $cfgtype rw 1 1\n";
-
- /* write out an fstab */
- fwrite($fd, $fstab);
-
- /* close file */
- fclose($fd);
- }
- else
- {
- die( "fopen failed for {$g['etc_path']}/fstab" ) ;
- }
-
+ global $freenas_config, $g;
+
+ /* Open or create fstab in RW */
+ $fd = fopen("{$g['etc_path']}/fstab", "w");
+
+ if ( $fd ) {
+ /* check for the precence of dev */
+ /* ADD (check if it's ADD line or replace) the line for the dev */
+ $fstab = "/dev/$cfgdev /mnt/$cfgdev $cfgtype rw 1 1\n";
+
+ /* write out an fstab */
+ fwrite($fd, $fstab);
+
+ /* close file */
+ fclose($fd);
+ } else {
+ die( "fopen failed for {$g['etc_path']}/fstab" ) ;
+ }
}
function disks_umount_all() {
- global $freenas_config, $g;
-
- /* Sync disks*/
- mwexec("/usr/bin/sync");
-
- if (is_array($freenas_config['mounts']['mount']))
- {
- foreach ($freenas_config['mounts']['mount'] as $mountent)
- {
-
- /* Umount filesystem */
- disks_umount($mountent);
-
- }
- }
-
- return 0;
+ global $freenas_config, $g;
+
+ /* Sync disks*/
+ mwexec("/bin/sync");
+
+ if (is_array($freenas_config['mounts']['mount'])) {
+ foreach ($freenas_config['mounts']['mount'] as $mountent) {
+ /* Umount filesystem */
+ disks_umount($mountent);
+ }
+ }
+
+ return 0;
+}
+
+/* Configure, create and start gvinum volume */
+function disks_raid_gvinum_configure() {
+ global $freenas_config, $g;
+
+ /* Generate the raid.conf file */
+ if ($freenas_config['gvinum']['vdisk']) {
+
+ foreach ($freenas_config['gvinum']['vdisk'] as $a_raid_conf) {
+ if (file_exists($g['varrun_path'] . "/raid.conf.dirty") &&
+ !in_array("{$a_raid_conf['name']}\n", file($g['varrun_path'] . "/raid.conf.dirty"))) { continue; }
+
+ /* generate raid.conf */
+ $fd = fopen("{$g['varetc_path']}/raid-{$a_raid_conf['name']}.conf", "w");
+ if (!$fd) {
+ printf("Error: cannot open raid.conf in services_raid_configure().\n");
+ return 1;
+ }
+
+ $raidconf="";
+ foreach ($a_raid_conf['diskr'] as $diskrk => $diskrv) {
+ $raidconf .= <<<EOD
+drive disk_{$diskrv} device {$diskrv}
+
+EOD;
+ } // end foreach
+
+ $raidconf .= <<<EOD
+volume {$a_raid_conf['name']}
+
+EOD;
+
+ switch ($a_raid_conf['type']) {
+ case "0":
+ $raidconf .= <<<EOD
+plex org striped 256k
+
+EOD;
+
+ foreach ($a_raid_conf['diskr'] as $diskrk => $diskrv) {
+ /* Get the disksize */
+ $disksize=get_disks_size($diskrv);
+ /* Remove the ending 'B' in 'MB' */
+ $disksize=rtrim($disksize, 'B');
+ /*
+ $raidconf .= <<<EOD
+sd length {$disksize} drive disk_{$diskrv}
+
+EOD;
+*/
+
+ $raidconf .= <<<EOD
+sd length 0 drive disk_{$diskrv}
+
+EOD;
+
+ } // end foreach
+ break;
+ case "1":
+ foreach ($a_raid_conf['diskr'] as $diskrk => $diskrv) {
+ $raidconf .= <<<EOD
+plex org concat
+
+EOD;
+
+ /* Get the disksize */
+ $disksize=get_disks_size($diskrv);
+ /* Remove the ending 'B' in 'MB' */
+ $disksize=rtrim($disksize, 'B');
+ /*
+ $raidconf .= <<<EOD
+sd length {$disksize} drive disk_{$diskrv}
+
+EOD;
+*/
+ $raidconf .= <<<EOD
+sd length 0 drive disk_{$diskrv}
+
+EOD;
+
+ } // end foreach
+ break;
+ case "5":
+ $raidconf .= <<<EOD
+plex org raid5 256k
+EOD;
+
+ foreach ($a_raid_conf['diskr'] as $diskrk => $diskrv) {
+ /* Get the disksize */
+ $disksize=get_disks_size($diskrv);
+ /* Remove the ending 'B' in 'MB' */
+ $disksize=rtrim($disksize, 'B');
+ /*
+ $raidconf .= <<<EOD
+sd length {$disksize} drive disk_{$diskrv}
+
+EOD;
+*/
+
+ $raidconf .= <<<EOD
+sd length 0 drive disk_{$diskrv}
+
+EOD;
+
+ } // end foreach
+ break;
+ } // end switch
+
+ fwrite($fd, $raidconf);
+ fclose($fd);
+
+ /* Create each volume */
+ mwexec("/sbin/gvinum create {$g['varetc_path']}/raid-{$a_raid_conf['name']}.conf");
+ } // end foreach
+
+
+ /* start each volume */
+
+ foreach ($freenas_config['gvinum']['vdisk'] as $a_raid_conf) {
+ exec("/sbin/gvinum lv $raidname",$rawdata);
+
+ if (strpos($rawdata[0],"State: up")>=0) { continue; }
+
+ mwexec("/sbin/gvinum start {$a_raid_conf['name']}");
+ }
+ } // end if
+
+ return 0;
}
function disks_raid_configure()
{
- global $freenas_config, $g;
-
- /* Generate the raid.conf file */
-
- if ($freenas_config['raid']['vdisk'])
- {
-
- foreach ($freenas_config['raid']['vdisk'] as $a_raid_conf)
- {
-
- if (file_exists($g['varrun_path'] . "/raid.conf.dirty") &&
- !in_array("{$a_raid_conf['name']}\n",file($g['varrun_path'] . "/raid.conf.dirty"))) continue;
-
- /* generate raid.conf */
- $fd = fopen("{$g['varetc_path']}/raid-{$a_raid_conf['name']}.conf", "w");
- if (!$fd)
- {
- printf("Error: cannot open raid.conf in services_raid_configure().\n");
- return 1;
- }
-
- $raidconf="";
- foreach ($a_raid_conf['diskr'] as $diskrk => $diskrv)
- {
- $raidconf .= <<<EOD
+ global $freenas_config, $g;
+
+ /* Generate the raid.conf file */
+ if ($freenas_config['raid']['vdisk']) {
+ foreach ($freenas_config['raid']['vdisk'] as $a_raid_conf) {
+ if (file_exists($g['varrun_path'] . "/raid.conf.dirty") &&
+ ! in_array("{$a_raid_conf['name']}\n",file($g['varrun_path'] . "/raid.conf.dirty"))) { continue; }
+
+ /* generate raid.conf */
+ $fd = fopen("{$g['varetc_path']}/raid-{$a_raid_conf['name']}.conf", "w");
+
+ if (!$fd) {
+ printf("Error: cannot open raid.conf in services_raid_configure().\n");
+ return 1;
+ }
+
+ $raidconf="";
+ foreach ($a_raid_conf['diskr'] as $diskrk => $diskrv) {
+ $raidconf .= <<<EOD
drive disk_{$diskrv} device /dev/{$diskrv}s1a
EOD;
-
- }
-
- $raidconf .= <<<EOD
+
+ } // end foreach
+
+ $raidconf .= <<<EOD
volume {$a_raid_conf['name']}
EOD;
- switch ($a_raid_conf['type'])
- {
- case "0":
- $raidconf .= <<<EOD
+ switch ($a_raid_conf['type']) {
+ case "0":
+ $raidconf .= <<<EOD
plex org striped 256k
EOD;
- foreach ($a_raid_conf['diskr'] as $diskrk => $diskrv)
- {
- /* Get the disksize */
- $disksize=get_disks_size($diskrv);
- /* Remove the ending 'B' in 'MB' */
- $disksize=rtrim($disksize, 'B');
- /* $raidconf .= <<<EOD
+
+ foreach ($a_raid_conf['diskr'] as $diskrk => $diskrv) {
+ /* Get the disksize */
+ $disksize=get_disks_size($diskrv);
+ /* Remove the ending 'B' in 'MB' */
+ $disksize=rtrim($disksize, 'B');
+ /*
+ $raidconf .= <<<EOD
sd length {$disksize} drive disk_{$diskrv}
-EOD; */
- $raidconf .= <<<EOD
+EOD;
+*/
+
+$raidconf .= <<<EOD
sd length 0 drive disk_{$diskrv}
EOD;
-
- }
- break;
- case "1":
- foreach ($a_raid_conf['diskr'] as $diskrk => $diskrv)
- {
- $raidconf .= <<<EOD
+
+ } // end foreach
+ break;
+ case "1":
+ foreach ($a_raid_conf['diskr'] as $diskrk => $diskrv) {
+ $raidconf .= <<<EOD
plex org concat
EOD;
-
- /* Get the disksize */
- $disksize=get_disks_size($diskrv);
- /* Remove the ending 'B' in 'MB' */
- $disksize=rtrim($disksize, 'B');
- /* $raidconf .= <<<EOD
+
+ /* Get the disksize */
+ $disksize=get_disks_size($diskrv);
+ /* Remove the ending 'B' in 'MB' */
+ $disksize=rtrim($disksize, 'B');
+ /*
+ $raidconf .= <<<EOD
sd length {$disksize} drive disk_{$diskrv}
-EOD; */
+EOD;
+*/
- $raidconf .= <<<EOD
+ $raidconf .= <<<EOD
sd length 0 drive disk_{$diskrv}
EOD;
-
- }
-
- break;
- case "5":
- $raidconf .= <<<EOD
+
+ } // end foreach
+ break;
+ case "5":
+ $raidconf .= <<<EOD
plex org raid5 256k
EOD;
- foreach ($a_raid_conf['diskr'] as $diskrk => $diskrv)
- {
- /* Get the disksize */
- $disksize=get_disks_size($diskrv);
- /* Remove the ending 'B' in 'MB' */
- $disksize=rtrim($disksize, 'B');
- /* $raidconf .= <<<EOD
+
+ foreach ($a_raid_conf['diskr'] as $diskrk => $diskrv) {
+ /* Get the disksize */
+ $disksize=get_disks_size($diskrv);
+ /* Remove the ending 'B' in 'MB' */
+ $disksize=rtrim($disksize, 'B');
+ /*
+ $raidconf .= <<<EOD
sd length {$disksize} drive disk_{$diskrv}
-EOD; */
+EOD;
+*/
- $raidconf .= <<<EOD
+ $raidconf .= <<<EOD
sd length 0 drive disk_{$diskrv}
EOD;
-
- }
- break;
-
- }
- fwrite($fd, $raidconf);
- fclose($fd);
-
- /* Create each volume */
-
- mwexec("/sbin/gvinum create {$g['varetc_path']}/raid-{$a_raid_conf['name']}.conf");
-
- }
-
-
- /* start each volume */
-
- foreach ($freenas_config['raid']['vdisk'] as $a_raid_conf)
- {
- exec("/sbin/gvinum lv $raidname",$rawdata);
- if (strpos($rawdata[0],"State: up")>=0) continue;
-
- mwexec("/sbin/gvinum start {$a_raid_conf['name']}");
- }
-
- }
-
- return 0;
-}
-
-function disks_raid_gmirror_configure()
-{
- global $freenas_config, $g;
-
- /* Create the gmirror device */
-
- if ($freenas_config['gmirror']['vdisk']) {
-
- // Load gmirror
-
- mwexec("/sbin/gmirror load");
-
- foreach ($freenas_config['gmirror']['vdisk'] as $a_raid_conf) {
-
- /* Create each volume */
-
- $cmd = "/sbin/gmirror label -b {$a_raid_conf['balance']} {$a_raid_conf['name']} ";
-
- foreach ($a_raid_conf['diskr'] as $diskrk => $diskrv) {
- $cmd .= "{$diskrv} ";
- }
-
- mwexec($cmd);
-
- }
- }
-
- return 0;
-}
-
-function disks_raid_start()
-{
- global $config, $g;
-
- /* Start software RAID */
- disks_raid_gvinum_start();
- disks_raid_gmirror_start();
-
- return 0;
-
-}
-
-
-function disks_raid_gvinum_start()
-{
- global $freenas_config, $g;
-
- /* Generate the raid.conf file */
-
- if ($freenas_config['raid']['vdisk']) {
-
- if ($g['booting'])
- echo "Start gvinum raid... ";
-
- /* start each volume */
-
- foreach ($freenas_config['raid']['vdisk'] as $a_raid_conf) {
- mwexec("/sbin/gvinum start {$a_raid_conf['name']}");
- }
-
- if ($g['booting'])
- echo "done\n";
-
- }
-
- return 0;
-}
-
-function disks_raid_gmirror_start()
-{
- global $freenas_config, $g;
-
- /* Start Geom mirror */
-
- if ($freenas_config['gmirror']['vdisk']) {
-
- if ($g['booting'])
- echo "Start gmirror raid... ";
-
- // Load geom mirror module
-
- mwexec("/sbin/gmirror load");
-
- if ($g['booting'])
- echo "done\n";
-
- }
-
- return 0;
-}
-
-function disks_raid_stop()
-{
- /* Stop software RAID */
- disks_raid_gvinum_stop();
- disks_raid_gmirror_stop();
-
- return 0;
-
+ } // end foreach
+ break;
+ } // end switch
+
+ fwrite($fd, $raidconf);
+ fclose($fd);
+
+ /* Create each volume */
+ mwexec("/sbin/gvinum create {$g['varetc_path']}/raid-{$a_raid_conf['name']}.conf");
+ } // end foreach
+
+ /* start each volume */
+ foreach ($freenas_config['raid']['vdisk'] as $a_raid_conf) {
+ exec("/sbin/gvinum lv $raidname",$rawdata);
+ if (strpos($rawdata[0],"State: up")>=0) { continue; }
+ mwexec("/sbin/gvinum start {$a_raid_conf['name']}");
+ }
+ } // end if
+
+ return 0;
}
-function disks_raid_gvinum_stop()
-{
- global $freenas_config, $g;
-
- /* Generate the raid.conf file */
+/* Configure, create and start gmirror volume */
+function disks_raid_gmirror_configure() {
+ global $freenas_config, $g;
+
+ /* Create the gmirror device */
+ if ($freenas_config['gmirror']['vdisk']) {
+ // Load gmirror
+ mwexec("/sbin/gmirror load");
+
+ foreach ($freenas_config['gmirror']['vdisk'] as $a_raid_conf) {
+ /* Create each volume */
+ $cmd = "/sbin/gmirror label -b {$a_raid_conf['balance']} {$a_raid_conf['name']} ";
+
+ foreach ($a_raid_conf['diskr'] as $diskrk => $diskrv) {
+ $cmd .= "{$diskrv} ";
+ }
+
+ mwexec($cmd);
+ }
+ }
+
+ return 0;
+}
+
+/* Configure, create and start gconcat volume */
+function disks_raid_gconcat_configure() {
+ global $freenas_config, $g;
+
+ if ($freenas_config['gconcat']['vdisk']) {
+ // Load gconcat
+ mwexec("/sbin/gconcat load");
+
+ foreach ($freenas_config['gconcat']['vdisk'] as $a_raid_conf) {
+ /* Create each volume */
+ $cmd = "/sbin/gconcat label {$a_raid_conf['name']} ";
+
+ foreach ($a_raid_conf['diskr'] as $diskrk => $diskrv) {
+ $cmd .= "{$diskrv} ";
+ }
+
+ mwexec($cmd);
+
+ }
+ }
+
+ return 0;
+}
+
+/* Configure, create and start gstripe volume */
+function disks_raid_gstripe_configure() {
+ global $freenas_config, $g;
+
+ if ($freenas_config['gstripe']['vdisk']) {
+ // Load gstripe
+ mwexec("/sbin/gstripe load");
+
+ foreach ($freenas_config['gstripe']['vdisk'] as $a_raid_conf) {
+ /* Create each volume */
+ $cmd = "/sbin/gstripe label {$a_raid_conf['name']} ";
- if ($freenas_config['raid']['vdisk']) {
-
- /* stop each volume */
-
- foreach ($freenas_config['raid']['vdisk'] as $a_raid_conf) {
- mwexec("/sbin/gvinum stop {$a_raid_conf['name']}");
- }
+ foreach ($a_raid_conf['diskr'] as $diskrk => $diskrv) {
+ $cmd .= "{$diskrv} ";
+ }
- }
-
- return 0;
+ mwexec($cmd);
+ }
+ }
+
+ return 0;
}
-function disks_raid_gmirror_stop()
-{
- global $freenas_config, $g;
-
- /* Generate the raid.conf file */
-
- if ($freenas_config['gmirror']['vdisk']) {
-
- /* start each volume */
-
- foreach ($freenas_config['gmirror']['vdisk'] as $a_raid_conf) {
- mwexec("/sbin/gmirror stop {$a_raid_conf['name']}");
- }
-
-
- }
-
- return 0;
-}
-
-function disks_raid_gvinum_delete($raidname)
-{
- global $freenas_config, $g;
-
- /* Delete a gvinum volume */
-
- //echo "DEBUG: delete {$raidname}";
-
- exec("/sbin/gvinum lv $raidname",$rawdata);
- if (strpos($rawdata[0],"State: up") === false) {
- return 0;
- }
-
- mwexec("/sbin/gvinum rm -r $raidname");
-
- foreach ($freenas_config['raid']['vdisk'] as $a_raid) {
- if ($a_raid['name'] == $raidname) {
- foreach ($a_raid['diskr'] as $disk) {
- mwexec("/sbin/gvinum rm -r disk_{$disk}");
- }
- }
- }
-
- return 0;
-}
-
-function disks_raid_gmirror_delete($raidname)
-{
- global $freenas_config, $g;
-
- /* Delete a gmirror volume */
-
- // Stop the volume
-
- mwexec("/sbin/gmirror stop $raidname");
-
- // Clear the gmirror information on the hard drive
-
- foreach ($freenas_config['gmirror']['vdisk'] as $a_raid) {
- if ($a_raid['name'] == $raidname) {
- foreach ($a_raid['diskr'] as $disk) {
- mwexec("/sbin/gmirror clear {$disk}");
- }
- }
- }
-
- return 0;
-}
-
-function fdisk_hd_install($harddrive)
+/* Configure, create and start graid5 volume */
+
+function disks_raid_graid5_configure()
{
- global $config, $g;
-
- /* Initialise HARD DRIVE for installing FreeNAS (creating 2 partition) */
-
- /* getting disk information */
- $fdisk_info=fdisk_get_info($harddrive);
-
- /* setting FreeNAS partition size to 32Mb*/
-
- $part_freenas_size=32;
-
- /* convert Mb to b */
- $part_freenas_size=$part_freenas_size * 1024 * 1024;
-
- $part1_size=$part_freenas_size / $fdisk_info['sec_size'];
- $part2_size=$fdisk_info['total'] - $part1_size;
-
- /* Create fdisk config file */
-
-
- /* generate fdisk.conf */
- $fd = fopen("{$g['varetc_path']}/fdisk.conf", "w");
- if (!$fd)
- {
- printf("Error: cannot open fdisk.conf in fdisk_hd_install().\n");
- return 1;
- }
-
- $fdiskconf .= <<<EOD
+ global $freenas_config, $g;
+
+ if ($freenas_config['graid5']['vdisk']) {
+ /* Load graid5 */
+ mwexec("/sbin/graid5 load");
+
+ foreach ($freenas_config['graid5']['vdisk'] as $a_raid_conf) {
+ /* Create each volume */
+ $cmd = "/sbin/graid5 label -s 131072 {$a_raid_conf['name']} ";
+
+ foreach ($a_raid_conf['diskr'] as $diskrk => $diskrv) {
+ $cmd .= "{$diskrv} ";
+ }
+
+ mwexec($cmd);
+ }
+ }
+
+ return 0;
+}
+
+function disks_raid_start() {
+ global $freenas_config, $g;
+
+ /* WARNING: Must change this code for advanced RAID configuration ex: RAID1+0
+ * Geom RAID volume must be started in 'intelligent' sort, for RAID1+0, gmirror must
+ * be started before gstripe, etc...
+ */
+ disks_raid_gvinum_start();
+ disks_raid_gmirror_start();
+ disks_raid_gstripe_start();
+ disks_raid_gconcat_start();
+ disks_raid_graid5_start();
+
+ return 0;
+}
+
+
+function disks_raid_gvinum_start() {
+ global $freenas_config, $g;
+
+ /* Generate the raid.conf file */
+ if ($freenas_config['raid']['vdisk']) {
+ if ($g['booting'])
+ echo "Start gvinum raid... ";
+
+ /* start each volume */
+ foreach ($freenas_config['raid']['vdisk'] as $a_raid_conf) {
+ mwexec("/sbin/gvinum start {$a_raid_conf['name']}");
+ }
+
+ if ($g['booting'])
+ echo "done\n";
+ }
+
+ return 0;
+}
+
+function disks_raid_gmirror_start() {
+ global $freenas_config, $g;
+
+ /* Start Geom mirror */
+ if ($freenas_config['gmirror']['vdisk']) {
+ if ($g['booting'])
+ echo "Start gmirror raid... ";
+
+ // Load geom mirror module
+ mwexec("/sbin/gmirror load");
+
+ if ($g['booting'])
+ echo "done\n";
+ }
+
+ return 0;
+}
+
+/* Start geom concat volumes */
+function disks_raid_gconcat_start() {
+ global $freenas_config, $g;
+
+/* Start Geom concat */
+ if ($freenas_config['gconcat']['vdisk']) {
+ if ($g['booting'])
+ echo "Start gconcat raid... ";
+
+ // Load geom concat module
+ mwexec("/sbin/gconcat load");
+
+ if ($g['booting'])
+ echo "done\n";
+ }
+
+ return 0;
+}
+
+/* Start geom stripe volumes */
+function disks_raid_gstripe_start() {
+ global $freenas_config, $g;
+
+ /* Start Geom stripe */
+ if ($freenas_config['gstripe']['vdisk']) {
+ if ($g['booting'])
+ echo "Start gstripe raid... ";
+
+ // Load geom stripe module
+ mwexec("/sbin/gstripe load");
+
+ if ($g['booting'])
+ echo "done\n";
+ }
+
+ return 0;
+}
+
+/* Start geom raid5 volumes */
+function disks_raid_graid5_start() {
+ global $freenas_config, $g;
+
+ /* Start Geom RAID5 */
+ if ($freenas_config['graid5']['vdisk']) {
+ if ($g['booting'])
+ echo "Start graid5 raid... ";
+
+ // Load geom raid5 module
+ mwexec("/sbin/graid5 load");
+
+ if ($g['booting'])
+ echo "done\n";
+ }
+
+ return 0;
+}
+
+function disks_raid_stop() {
+ /* WARNING: Must change this code for advanced RAID configuration ex: RAID1+0
+ * Geom RAID volume must be started in 'intelligent' sort, for RAID1+0, gmirror must
+ * be started before gstripe, etc...
+ */
+ disks_raid_gvinum_stop();
+ disks_raid_graid5_stop();
+ disks_raid_gstripe_stop();
+ disks_raid_gconcat_stop();
+ disks_raid_gmirror_stop();
+
+ return 0;
+}
+
+function disks_raid_gvinum_stop() {
+ global $freenas_config, $g;
+
+ /* Generate the raid.conf file */
+ if ($freenas_config['raid']['vdisk']) {
+ /* stop each volume */
+ foreach ($freenas_config['raid']['vdisk'] as $a_raid_conf) {
+ mwexec("/sbin/gvinum stop {$a_raid_conf['name']}");
+ }
+ }
+
+ return 0;
+}
+
+function disks_raid_gmirror_stop() {
+ global $freenas_config, $g;
+
+ /* Generate the raid.conf file */
+ if ($freenas_config['gmirror']['vdisk']) {
+ /* start each volume */
+ foreach ($freenas_config['gmirror']['vdisk'] as $a_raid_conf) {
+ mwexec("/sbin/gmirror stop {$a_raid_conf['name']}");
+ }
+ }
+
+ return 0;
+}
+
+/* Stop all geom concat volumes */
+function disks_raid_gconcat_stop() {
+ global $freenas_config, $g;
+
+ /* Stop geom concat */
+ if ($freenas_config['gconcat']['vdisk']) {
+ /* start each volume */
+ foreach ($freenas_config['gconcat']['vdisk'] as $a_raid_conf) {
+ mwexec("/sbin/gconcat stop {$a_raid_conf['name']}");
+ }
+ }
+
+ return 0;
+}
+
+/* Stop all geom stripe volumes */
+function disks_raid_gstripe_stop() {
+ global $freenas_config, $g;
+
+ /* Stop geom stripe */
+ if ($freenas_config['gstripe']['vdisk']) {
+ /* start each volume */
+ foreach ($freenas_config['gstripe']['vdisk'] as $a_raid_conf) {
+ mwexec("/sbin/gstripe stop {$a_raid_conf['name']}");
+ }
+ }
+
+ return 0;
+}
+
+/* Stop all geom raid5 volumes */
+function disks_raid_graid5_stop() {
+ global $freenas_config, $g;
+
+ /* Generate the raid.conf file */
+ if ($freenas_config['graid5']['vdisk']) {
+ /* start each volume */
+ foreach ($freenas_config['graid5']['vdisk'] as $a_raid_conf) {
+ mwexec("/sbin/graid5 stop {$a_raid_conf['name']}");
+ }
+ }
+
+ return 0;
+}
+
+
+/* Delete geom gvinum volume given in parameter */
+function disks_raid_gvinum_delete($raidname) {
+ global $freenas_config, $g;
+
+ exec("/sbin/gvinum lv $raidname",$rawdata);
+
+ if (strpos($rawdata[0],"State: up") === false) {
+ return 0;
+ }
+
+ mwexec("/sbin/gvinum rm -r $raidname");
+
+ foreach ($freenas_config['gvinum']['vdisk'] as $a_raid) {
+ if ($a_raid['name'] == $raidname) {
+ foreach ($a_raid['diskr'] as $disk) {
+ mwexec("/sbin/gvinum rm -r disk_{$disk}");
+ }
+ }
+ }
+
+ return 0;
+}
+
+/* Delete geom mirror volume given in parameter */
+function disks_raid_gmirror_delete($raidname) {
+ global $freenas_config, $g;
+
+ // Stop the volume
+ mwexec("/sbin/gmirror stop $raidname");
+
+ // Clear the gmirror information on the hard drive
+ foreach ($freenas_config['gmirror']['vdisk'] as $a_raid) {
+ if ($a_raid['name'] == $raidname) {
+ foreach ($a_raid['diskr'] as $disk) {
+ mwexec("/sbin/gmirror clear {$disk}");
+ }
+ }
+ }
+
+ return 0;
+}
+
+/* Delete geom concat volume given in parameter */
+function disks_raid_gconcat_delete($raidname) {
+ global $freenas_config, $g;
+
+ // Stop the volume
+ mwexec("/sbin/gconcat stop $raidname");
+
+ // Clear the gconcat information on the hard drive
+ foreach ($freenas_config['gconcat']['vdisk'] as $a_raid) {
+ if ($a_raid['name'] == $raidname) {
+ foreach ($a_raid['diskr'] as $disk) {
+ mwexec("/sbin/gconcat clear {$disk}");
+ }
+
+ mwexec("/sbin/gconcat destroy $raidname");
+ }
+ }
+
+ return 0;
+}
+
+/* Delete geom stripe volume given in parameter */
+function disks_raid_gstripe_delete($raidname) {
+ global $freenas_config, $g;
+
+ // Stop the volume
+ mwexec("/sbin/gstripe stop $raidname");
+
+ // Clear the gconcat information on the hard drive
+ foreach ($freenas_config['gstripe']['vdisk'] as $a_raid) {
+ if ($a_raid['name'] == $raidname) {
+ foreach ($a_raid['diskr'] as $disk) {
+ mwexec("/sbin/gstripe clear {$disk}");
+ }
+
+ mwexec("/sbin/gstripe destroy $raidname");
+ }
+ }
+
+ return 0;
+}
+
+/* Delete geom raid5 volume given in parameter */
+function disks_raid_graid5_delete($raidname) {
+ global $freenas_config, $g;
+
+ // Stop the volume
+ mwexec("/sbin/graid5 stop $raidname");
+
+ // Clear the graid5 information on the hard drive
+ foreach ($freenas_config['graid5']['vdisk'] as $a_raid) {
+ if ($a_raid['name'] == $raidname) {
+ foreach ($a_raid['diskr'] as $disk) {
+ mwexec("/sbin/graid5 remove $raidname {$disk}");
+ }
+
+ mwexec("/sbin/graid5 destroy $raidname");
+ }
+ }
+
+ return 0;
+}
+
+/* Initialise HARD DRIVE for installing FreeNAS (creating 2 partition) */
+function fdisk_hd_install($harddrive) {
+ global $freenas_config, $g;
+
+ /* Initialise HARD DRIVE for installing FreeNAS (creating 2 partition) */
+
+ /* getting disk information */
+ $fdisk_info=fdisk_get_info($harddrive);
+
+ /* setting FreeNAS partition size to 32Mb */
+
+ $part_freenas_size=32;
+
+ /* convert Mb to b */
+ $part_freenas_size=$part_freenas_size * 1024 * 1024;
+
+ $part1_size=$part_freenas_size / $fdisk_info['sec_size'];
+ $part2_size=$fdisk_info['total'] - $part1_size;
+
+ /* Create fdisk config file */
+
+ /* generate fdisk.conf */
+ $fd = fopen("{$g['varetc_path']}/fdisk.conf", "w");
+ if (!$fd) {
+ printf("Error: cannot open fdisk.conf in fdisk_hd_install().\n");
+ return 1;
+ }
+
+$fdiskconf .= <<<EOD
g c{$fdisk_info['cyl']} h{$fdisk_info['head']} s{$fdisk_info['sect']}
p 1 165 1 $part1_size
p 2 165 $part1_size $part2_size
@@ -740,160 +1085,167 @@ p 4 0 0 0
a 1
EOD;
-
- fwrite($fd, $fdiskconf);
- fclose($fd);
- /* Fdisk the disk */
-
- /* Warning: Ask two questions to the user */
- mwexec("/sbin/fdisk -f {$g['varetc_path']}/fdisk.conf /dev/$harddrive");
-
- return 0;
+ fwrite($fd, $fdiskconf);
+ fclose($fd);
+
+ /* Fdisk the disk */
+
+ /* Warning: Ask two questions to the user */
+ mwexec("/sbin/fdisk -f {$g['varetc_path']}/fdisk.conf /dev/$harddrive");
+
+ return 0;
}
-function fdisk_get_info($harddrive)
-{
-
- /* Return information about an harddrive
-
- $result['total'] : size
- $result['cyl'] : cylinders
- $result['head'] : heads
- $result['sect'] : sectors/track
- $result['sec_size'] : Media sector size
-
- */
-
- global $config, $g;
-
- exec("/sbin/fdisk /dev/$harddrive",$rawdata);
-
- $result=array();
-
- foreach ($rawdata as $line)
- {
- /* separe the line by space or egal*/
-
- $aline= preg_split("/[\s,]+|=/", $line);
-
- $first_word = chop($aline[0]);
-
- if ($aline[0] == "Media")
- {
- $result['sec_size']=chop($aline[4]);
- continue ;
- }
-
- if ($aline[0] == "cylinders")
- {
-
- $result['cyl']=chop($aline[1]);
- $result['head']=chop($aline[3]);
- $result['sect']=chop($aline[5]);
- continue ;
- }
-
- }
-
- $result['total'] = $result['cyl'] * $result['head'] * $result['sect'] ;
-
- return $result;
-
-}
-
-function disks_bsdlabel($harddrive,$partition,$type)
-{
- global $config, $g;
-
- // Generating BSD Label table
-
- passthru("/sbin/bsdlabel " . escapeshellarg($harddrive) ."$partition > {$g['tmp_path']}/label.tmp");
-
- // put this file on a array
- $tableau = file("{$g['tmp_path']}/label.tmp");
-
- // Open this file in add mode
- $handle = fopen("{$g['tmp_path']}/label.tmp", 'a');
-
- while(list(,$val) = each($tableau))
- {
- // If the line contain the word "unused"
-
- if (ereg ("unused",$val))
- {
- // Replacing c: by a:
- $val = ereg_replace ("c:","a:", $val);
- // Peplacing unused by $type
- $val = ereg_replace ("unused",$type, $val);
- // Adding this line add the end of the file
- fwrite($handle, $val);
- }
- }
- // Closing file
- fclose($handle);
-
- // Injecting this new partition table
- passthru("/sbin/bsdlabel -R -B " . escapeshellarg($harddrive) ."$partition {$g['tmp_path']}/label.tmp");
-}
-
-
-function disks_set_ataidle()
-{
- global $g, $freenas_config;
-
- if (is_array($freenas_config['disks']['disk']))
- {
- foreach ($freenas_config['disks']['disk'] as $disk)
- {
-
- if ($disk['type']=="IDE")
- {
- /* If UDMA mode forced, launch atacontrol */
- if (isset($disk['udma']) && ($disk['udma'] != "auto"))
- mwexec("/sbin/atacontrol mode {$disk['name']} {$disk['udma']}");
-
- /* Don't use ataidle if all is disabled */
- if (($disk['harddiskstandby'] == 0) && ($disk['apm'] == 0) && ($disk['acoustic'] == 0))
- continue;
-
- /* Found the channel and device number from the /dev name */
- /* Divise the number by 2, the interger is the channel number, the rest is the device */
-
- $value=trim($disk['name'],'ad');
-
- $value=intval($value);
- $channel = $value/2;
- $device=$value % 2;
- $channel=intval($channel);
- $time=$disk['harddiskstandby'];
- $apm=$disk['apm'];
- $ac=$disk['acoustic'];
-
- /* mwexec("/usr/local/sbin/ataidle -A $ac -P $apm -S $time $channel $device"); */
-
- $cmd = "/usr/local/sbin/ataidle ";
-
- if ($disk['acoustic'] != 0)
- $cmd .= "-A $ac ";
- if ($disk['apm'] != 0)
- $cmd .= "-P $apm ";
- if ($disk['harddiskstandby'] !=0)
- $cmd .= "-S $time ";
-
- $cmd .= "$channel $device";
-
- mwexec($cmd);
-
-
- }
-
- }
- return 1;
- }
-
- return 0;
+function fdisk_get_info($harddrive) {
+ /* Return information about an harddrive
+
+ $result['total'] : size
+ $result['cyl'] : cylinders
+ $result['head'] : heads
+ $result['sect'] : sectors/track
+ $result['sec_size'] : Media sector size
+
+ */
+
+ global $freenas_config, $g;
+
+ exec("/sbin/fdisk /dev/$harddrive",$rawdata);
+
+ $result=array();
+
+ foreach ($rawdata as $line) {
+ /* separe the line by space or egal*/
+ $aline= preg_split("/[\s,]+|=/", $line);
+ $first_word = chop($aline[0]);
+
+ if ($aline[0] == "Media") {
+ $result['sec_size']=chop($aline[4]);
+ continue ;
+ }
+
+ if ($aline[0] == "cylinders") {
+ $result['cyl']=chop($aline[1]);
+ $result['head']=chop($aline[3]);
+ $result['sect']=chop($aline[5]);
+ continue ;
+ }
+ }
+
+ $result['total'] = $result['cyl'] * $result['head'] * $result['sect'] ;
+
+ return $result;
+}
+
+/* Is this function still used ??? */
+function disks_bsdlabel($harddrive,$partition,$type) {
+ global $freenas_config, $g;
+
+ // Generating BSD Label table
+ passthru("/sbin/bsdlabel " . escapeshellarg($harddrive) ."$partition > {$g['tmp_path']}/label.tmp");
+
+ // put this file on a array
+ $tableau = file("{$g['tmp_path']}/label.tmp");
+
+ // Open this file in add mode
+ $handle = fopen("{$g['tmp_path']}/label.tmp", 'a');
+
+ while(list(,$val) = each($tableau)) {
+ // If the line contain the word "unused"
+ if (ereg ("unused",$val)) {
+ // Replacing c: by a:
+ $val = ereg_replace ("c:","a:", $val);
+ // Peplacing unused by $type
+ $val = ereg_replace ("unused",$type, $val);
+ // Adding this line add the end of the file
+ fwrite($handle, $val);
+ }
+ }
+
+ // Closing file
+ fclose($handle);
+
+ // Injecting this new partition table
+ passthru("/sbin/bsdlabel -R -B " . escapeshellarg($harddrive) ."$partition {$g['tmp_path']}/label.tmp");
+}
+
+
+function disks_set_ataidle() {
+ global $g, $freenas_config;
+
+ if (is_array($freenas_config['disks']['disk'])) {
+ foreach ($freenas_config['disks']['disk'] as $disk) {
+ if ($disk['type']=="IDE") {
+ /* If UDMA mode forced, launch atacontrol */
+ if (isset($disk['udma']) && ($disk['udma'] != "auto")) {
+ mwexec("/sbin/atacontrol mode {$disk['name']} {$disk['udma']}");
+ }
+
+ /* Don't use ataidle if all is disabled */
+ if (($disk['harddiskstandby'] == 0) && ($disk['apm'] == 0) && ($disk['acoustic'] == 0)) { continue; }
+
+ /* Found the channel and device number from the /dev name */
+ /* Divise the number by 2, the interger is the channel number, the rest is the device */
+
+ $value=trim($disk['name'],'ad');
+
+ $value=intval($value);
+ $channel = $value/2;
+ $device=$value % 2;
+ $channel=intval($channel);
+ $time=$disk['harddiskstandby'];
+ $apm=$disk['apm'];
+ $ac=$disk['acoustic'];
+
+ /* mwexec("/usr/local/sbin/ataidle -A $ac -P $apm -S $time $channel $device"); */
+
+ $cmd = "/usr/local/sbin/ataidle ";
+
+ if ($disk['acoustic'] != 0) { $cmd .= "-A $ac "; }
+ if ($disk['apm'] != 0) { $cmd .= "-P $apm "; }
+ if ($disk['harddiskstandby'] !=0) { $cmd .= "-S $time "; }
+
+ $cmd .= "$channel $device";
+ mwexec($cmd);
+ } // end if
+ } // end foreach
+
+ return 1;
+ } // end if
+
+ return 0;
+}
+
+/* Is this function still used ???
+Get list of partition information from disk.
+Result is in the form:
+[1] => Array
+(
+ [start] => 31
+ [size] => 409169
+ [type] => 0xa5
+ [flags] => 0x80
+)
+*/
+function disks_get_partition_info($disk) {
+ exec("/sbin/fdisk -s /dev/{$disk}", $rawdata);
+ array_shift($rawdata);
+ array_shift($rawdata);
+
+ $result = array();
+
+ foreach($rawdata as $partinfo) {
+ $apartinfo = preg_split("/\s+/", $partinfo);
+ $partid = chop($apartinfo[1],":");
+
+ $result[$partid] = array();
+ $result[$partid]['start'] = chop($apartinfo[2]);
+ $result[$partid]['size'] = chop($apartinfo[3]);
+ $result[$partid]['type'] = chop($apartinfo[4]);
+ $result[$partid]['flags'] = chop($apartinfo[5]);
+ }
+ return $result;
}
?>
diff --git a/packages/freenas/pkg/freenas_functions.inc b/packages/freenas/pkg/freenas_functions.inc
index 77980ea9..fcea4478 100644
--- a/packages/freenas/pkg/freenas_functions.inc
+++ b/packages/freenas/pkg/freenas_functions.inc
@@ -1,35 +1,44 @@
<?php
-
/* $Id$ */
+/* ========================================================================== */
/*
- functions.inc
- Copyright (C) 2004 Scott Ullrich
- All rights reserved.
+ freenas_functions.inc
+ part of pfSense (http://www.pfSense.com)
+ Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name>
+ All rights reserved.
+
+ Based on FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
- Originally part of m0n0wall (http://m0n0.ch/wall)
- Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
- All rights reserved.
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ All rights reserved.
+ */
+/* ========================================================================== */
+/*
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+/* ========================================================================== */
/* include all configuration functions */
require_once ("freenas_disks.inc");
diff --git a/packages/freenas/pkg/freenas_guiconfig.inc b/packages/freenas/pkg/freenas_guiconfig.inc
index 8acd5ff4..7dd5ec47 100644
--- a/packages/freenas/pkg/freenas_guiconfig.inc
+++ b/packages/freenas/pkg/freenas_guiconfig.inc
@@ -35,6 +35,8 @@ $d_diskdirty_path = $g['varrun_path'] . "/disk.dirty";
$d_raidconfdirty_path = $g['varrun_path'] . "/raid.conf.dirty";
$d_userconfdirty_path = $g['varrun_path'] . "/user.conf.dirty";
$d_groupconfdirty_path = $g['varrun_path'] . "/group.conf.dirty";
+$d_smbshareconfdirty_path = $g['varrun_path'] . "/smbshare.conf.dirty";
+$d_upnpconfdirty_path = $g['varrun_path'] . "/upnp.conf.dirty";
$freenas_config =& $config['installedpackages']['freenas']['config'][0];
@@ -80,6 +82,39 @@ function gmirror_sort() {
}
+function gconcat_sort() {
+ global $g, $config;
+
+ function gconcatcmp($a, $b) {
+ return strcmp($a['name'], $b['name']);
+ }
+
+ usort($config['gconcat']['vdisk'], "gconcatcmp");
+
+}
+
+function gstripe_sort() {
+ global $g, $config;
+
+ function gstripecmp($a, $b) {
+ return strcmp($a['name'], $b['name']);
+ }
+
+ usort($config['gstripe']['vdisk'], "gstripecmp");
+
+}
+
+function graid5_sort() {
+ global $g, $config;
+
+ function graid5cmp($a, $b) {
+ return strcmp($a['name'], $b['name']);
+ }
+
+ usort($config['graid5']['vdisk'], "graid5cmp");
+
+}
+
/* TODO: This needs to be changed */
function users_sort() {
global $g, $config;
diff --git a/packages/freenas/pkg/freenas_services.inc b/packages/freenas/pkg/freenas_services.inc
index 91f740e7..8d6f1940 100644
--- a/packages/freenas/pkg/freenas_services.inc
+++ b/packages/freenas/pkg/freenas_services.inc
@@ -1,75 +1,90 @@
<?php
/* $Id$ */
+/* ========================================================================== */
/*
- services.inc
- part of m0n0wall (http://m0n0.ch/wall)
-
- Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
- All rights reserved.
-
- Modified for FreeNAS (http://freenas.org) by Olivier Cochard <cochard@gmail.com>
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
+ freenas_services.inc
+ part of pfSense (http://www.pfSense.com)
+ Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name>
+ All rights reserved.
+
+ Based on FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ All rights reserved.
+ */
+/* ========================================================================== */
+/*
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+/* ========================================================================== */
define (FTP_BACKEND_PAM, "pam");
define (FTP_BACKEND_PLAINTEXT, "plaintext");
$freenas_config =& $config['installedpackages']['freenas']['config'][0];
+/* Stop samba, Generate the samba configuration
+ * file and start samba Return 0 if OK, 1 or
+ * error code if error
+ */
function services_samba_configure() {
- global $freenas_config, $g;
+ global $freenas_config, $g;
- /* kill any running samba */
-
- killbyname("smbd");
- killbyname("winbindd");
- killbyname("nmbd");
+ /* kill any running samba */
+ killbyname("smbd");
+ killbyname("winbindd");
+ killbyname("nmbd");
- if (isset($freenas_config['samba']['enable']))
- {
-
- if ($g['booting'])
- echo "Starting Samba... ";
+ if (isset($freenas_config['samba']['enable'])) {
+ if ($g['booting']) { echo "Starting Samba... "; }
/* make sure any of the required dirs exist */
- if (! file_exists("{$g['varetc_path']}/private"))
+ if (! file_exists("{$g['varetc_path']}/private")) {
mkdir("{$g['varetc_path']}/private");
- if (! file_exists("{$g['varlog_path']}/samba"))
+ }
+ if (! file_exists("{$g['varlog_path']}/samba")) {
mkdir("{$g['varlog_path']}/samba");
+ }
- /* generate smb.conf */
- $fd = fopen("{$g['varetc_path']}/smb.conf", "w");
- if (!$fd) {
- printf("Error: cannot open smb.conf in services_samba_configure().\n");
- return 1;
- }
-
- /* If no share configured, exit */
- if (!is_array($freenas_config['mounts']['mount']))
- return 0;
-
-
- $sambaconf = <<<EOD
+ /* generate smb.conf */
+ $fd = fopen("{$g['varetc_path']}/smb.conf", "w");
+
+ if (!$fd) {
+ printf("Error: cannot open smb.conf in services_samba_configure().\n");
+ return 1;
+ }
+
+ /* If no share configured, exit */
+ if (!is_array($freenas_config['mounts']['mount'])) { return 0; }
+
+ $gen_date = date("F j, Y, g:i a");
+ $sambaconf = <<<EOD
+#
+# smb.conf generated by pfSense
+# Generated at: {$gen_date}
+#
[global]
encrypt passwords = yes
netbios name = {$freenas_config['samba']['netbiosname']}
@@ -81,67 +96,70 @@ dns proxy = no
socket options = IPTOS_LOWDELAY TCP_NODELAY
EOD;
- if ($freenas_config['samba']['sndbuf']) {
- $sambaconf .= <<<EOD
+ if ($freenas_config['samba']['sndbuf']) {
+ /* below is a continuation of socket options! */
+ $sambaconf .= <<<EOD
SO_SNDBUF={$freenas_config['samba']['sndbuf']}
EOD;
- }
- else {
- $sambaconf .= <<<EOD
+ } else {
+ /* below is a continuation of socket options! */
+ $sambaconf .= <<<EOD
SO_SNDBUF=16384
EOD;
- }
-
- if ($freenas_config['samba']['rcvbuf']) {
- $sambaconf .= <<<EOD
+ } // end if
+
+ if ($freenas_config['samba']['rcvbuf']) {
+ /* below is a continuation of socket options! */
+ $sambaconf .= <<<EOD
SO_RCVBUF={$freenas_config['samba']['rcvbuf']}
EOD;
- }
- else {
- $sambaconf .= <<<EOD
+ } else {
+ /* below is a continuation of socket options! */
+ $sambaconf .= <<<EOD
SO_RCVBUF=16384
EOD;
- }
-
- if ($freenas_config['samba']['winssrv']) {
- $sambaconf .= <<<EOD
+ } // end if
+
+ if ($freenas_config['samba']['winssrv']) {
+ $sambaconf .= <<<EOD
wins server = {$freenas_config['samba']['winssrv']}
EOD;
- }
-
- if (isset ($freenas_config['samba']['unixcharset'])) {
- $sambaconf .= <<<EOD
+ }
+
+ if (isset ($freenas_config['samba']['unixcharset'])) {
+ $sambaconf .= <<<EOD
unix charset = {$freenas_config['samba']['unixcharset']}
EOD;
- }
- else {
- $sambaconf .= <<<EOD
+ } else {
+ $sambaconf .= <<<EOD
unix charset = UTF-8
EOD;
-
- }
-
-
-
- $sambaconf .= <<<EOD
+
+ } // end if
+
+ $sambaconf .= <<<EOD
local master = {$freenas_config['samba']['localmaster']}
time server = {$freenas_config['samba']['timesrv']}
guest account = ftp
display charset = UTF-8
-max log size = 100
-#syslog only = yes
-syslog = 3
+max log size = 10
+syslog only = yes
+syslog = {$config['samba']['loglevel']}
load printers = no
printing = bsd
printcap name = /dev/null
-disable spoolss = Yes
+disable spoolss = yes
+#Test: Try to improve samba performance under FreeBSD:
+use sendfile = yes
+strict locking = no
+#End of performance section
log level = {$freenas_config['samba']['loglevel']}
dos charset = {$freenas_config['samba']['doscharset']}
smb passwd file = {$g['varetc_path']}/private/smbpasswd
@@ -149,23 +167,23 @@ private dir = {$g['varetc_path']}/private
EOD;
- switch ($freenas_config['samba']['security']) {
- case "share":
- $sambaconf .= <<<EOD
+ switch ($freenas_config['samba']['security']) {
+ case "share":
+ $sambaconf .= <<<EOD
create mask = 0666
directory mask = 0777
passdb backend = smbpasswd
EOD;
-
- $guestmode = <<<EOD
+
+ $guestmode = <<<EOD
guest ok = yes
EOD;
-
- break;
- case "domain":
- $sambaconf .= <<<EOD
+
+ break; // end case "share"
+ case "domain":
+ $sambaconf .= <<<EOD
passdb backend = smbpasswd
allow trusted domains = No
dns proxy = No
@@ -180,30 +198,29 @@ template homedir = /mnt
template shell = /bin/sh
EOD;
-
- $guestmode = <<<EOD
+
+ $guestmode = <<<EOD
guest ok = no
EOD;
- break;
- case "user":
- $sambaconf .= <<<EOD
+ break; // end case "domain":
+ case "user":
+ $sambaconf .= <<<EOD
passdb backend = smbpasswd
EOD;
- $guestmode = <<<EOD
+
+ $guestmode = <<<EOD
guest ok = no
EOD;
- break;
- }
-
-
-
- foreach ($freenas_config['mounts']['mount'] as $mountent) {
- /* Unmount filesystem if not booting mode*/
-
- $sambaconf .= <<<EOD
+
+ break; // end case "user":
+ } // end switch
+
+ foreach ($freenas_config['mounts']['mount'] as $mountent) {
+ /* Unmount filesystem if not booting mode*/
+ $sambaconf .= <<<EOD
[{$mountent['sharename']}]
comment = {$mountent['desc']}
@@ -211,86 +228,84 @@ path = /mnt/{$mountent['sharename']}
public = yes
writeable = yes
printable = no
-veto files = /.snap/
+veto files = /Network Trash Folder/Icon?/:2e*/.AppleDesktop/.AppleDB/.AppleDouble/TheFindByContentFolder/TheVolumeSettingsFolder/Temporary Items/.snap/
+hide dot files = yes
{$guestmode}
EOD;
- if ( (is_array($freenas_config['samba']['hidemount']) && in_array($mountent['sharename'],$freenas_config['samba']['hidemount'])))
-
- $sambaconf .= <<<EOD
+ if ( (is_array($freenas_config['samba']['hidemount']) && in_array($mountent['sharename'],$freenas_config['samba']['hidemount']))) {
+ $sambaconf .= <<<EOD
browseable = no
EOD;
- }
-
- if (isset($freenas_config['samba']['recyclebin'])) {
- $sambaconf .= <<<EOD
+ } // end if
+
+ if (isset($freenas_config['samba']['recyclebin'])) {
+ $sambaconf .= <<<EOD
vfs object = recycle
recycle:repository = Recycle Bin
recycle:keeptree = Yes
recycle:versions = Yes
EOD;
- }
+ } // end if
+ } // end foreach
+
+ fwrite($fd, $sambaconf);
+ fclose($fd);
+
+ /* run nmbd and nmbd */
+ if (isset($freenas_config['ad']['enable'])) {
+ mwexec("/usr/local/bin/net rpc join -S {$freenas_config['ad']['ad_srv_name']} -U {$freenas_config['ad']['admin_name']}%{$freenas_config['ad']['admin_pass']}");
+ }
- fwrite($fd, $sambaconf);
- fclose($fd);
+ $result |= mwexec("/usr/local/sbin/nmbd -D -s {$g['varetc_path']}/smb.conf");
- /* run nmbd and nmbd */
-
- if (isset($freenas_config['ad']['enable'])) {
- mwexec("/usr/local/bin/net rpc join -S {$freenas_config['ad']['ad_srv_name']} -U {$freenas_config['ad']['admin_name']}%{$freenas_config['ad']['admin_pass']}");
- }
+ if (isset($freenas_config['ad']['enable'])) {
+ mwexec("/usr/local/sbin/winbindd -s {$g['varetc_path']}/smb.conf");
+ //mwexec("/usr/local/sbin/wbinfo --set-auth-user {$freenas_config['ad']['admin_name']}%{$freenas_config['ad']['admin_pass']}");
+ }
- mwexec("/usr/local/sbin/nmbd -D -s {$g['varetc_path']}/smb.conf");
-
- if (isset($freenas_config['ad']['enable'])) {
- mwexec("/usr/local/sbin/winbindd -s {$g['varetc_path']}/smb.conf");
- //mwexec("/usr/local/sbin/wbinfo --set-auth-user {$freenas_config['ad']['admin_name']}%{$freenas_config['ad']['admin_pass']}");
- }
-
- mwexec("/usr/local/sbin/smbd -D -s {$g['varetc_path']}/smb.conf");
-
-
- /* TEST: Wait for samba starting */
- sleep(2);
+ $result |= mwexec("/usr/local/sbin/smbd -D -s {$g['varetc_path']}/smb.conf");
- /* Generate the samba password file */
- system_user_samba();
+ /* TEST: Wait for samba starting */
+ sleep(2);
- if ($g['booting'])
- echo "done\n";
- }
+ /* Generate the samba password file */
+ $result |= system_user_samba();
- return 0;
+ if ($g['booting']) { echo "done\n"; }
+ }// end if
+
+ return $result;
}
+/* Stop rsync, Generate the rsync configuration file and start
+ * rsync Return 0 if OK, 1 or error code if error
+ */
function services_rsyncd_configure() {
- global $freenas_config, $g;
+ global $freenas_config, $g;
- /* kill any running rsync daemon */
+ /* kill any running rsync daemon */
+ sigkillbypid("{$g['varrun_path']}/rsyncd.pid", "TERM");
- sigkillbypid("{$g['varrun_path']}/rsyncd.pid", "TERM");
+ if (isset($freenas_config['rsyncd']['enable'])) {
+ if ($g['booting']) { echo "Starting RSYNC daemon... "; }
- if (isset($freenas_config['rsyncd']['enable'])) {
-
- if ($g['booting'])
- echo "Starting RSYNC daemon... ";
-
- /* If no share configured, exit */
- if (!is_array($freenas_config['mounts']['mount']))
- return 1;
-
- /* generate rsyncd.conf */
- $fd = fopen("{$g['varetc_path']}/rsyncd.conf", "w");
- if (!$fd) {
- printf("Error: cannot open rsyncd.conf in services_rsyncd_configure().\n");
- return 1;
- }
-
- $rsyncdconf = <<<EOD
+ /* If no share configured, exit */
+ if (!is_array($freenas_config['mounts']['mount'])) { return 1; }
+
+ /* generate rsyncd.conf */
+ $fd = fopen("{$g['varetc_path']}/rsyncd.conf", "w");
+
+ if (!$fd) {
+ printf("Error: cannot open rsyncd.conf in services_rsyncd_configure().\n");
+ return 1;
+ }
+
+ $rsyncdconf = <<<EOD
read only = {$freenas_config['rsyncd']['readonly']}
syslog facility = local4
list = yes
@@ -299,155 +314,141 @@ pid file = {$g['varrun_path']}/rsyncd.pid
EOD;
- if (!empty($freenas_config['rsyncd']['maxcon'])) {
- $rsyncdconf .= <<<EOD
+ if (!empty($freenas_config['rsyncd']['maxcon'])) {
+ $rsyncdconf .= <<<EOD
max connections = {$freenas_config['rsyncd']['maxcon']}
EOD;
- }
-
- if (!empty($freenas_config['rsyncd']['motd'])) {
- $rsyncdconf .= <<<EOD
+ }
+
+ if (!empty($freenas_config['rsyncd']['motd'])) {
+ $rsyncdconf .= <<<EOD
motd file = {$g['varetc_path']}/rsyncd.motd
EOD;
- }
-
- if (isset($freenas_config['rsyncd']['rsyncd_user'])) {
- $rsyncdconf .= <<<EOD
+ }
+
+ if (isset($freenas_config['rsyncd']['rsyncd_user'])) {
+ $rsyncdconf .= <<<EOD
uid = {$freenas_config['rsyncd']['rsyncd_user']}
EOD;
- }
- else {
- $rsyncdconf .= <<<EOD
+ } else {
+ $rsyncdconf .= <<<EOD
uid = ftp
gid = ftp
EOD;
- }
+ } // end if
+ foreach ($freenas_config['mounts']['mount'] as $mountent) {
+ /* Unmount filesystem if not booting mode*/
+ $rsyncdconf .= <<<EOD
-
- foreach ($freenas_config['mounts']['mount'] as $mountent) {
- /* Unmount filesystem if not booting mode*/
-
- $rsyncdconf .= <<<EOD
-
[{$mountent['sharename']}]
comment = {$mountent['desc']}
path = /mnt/{$mountent['sharename']}
EOD;
- }
-
- fwrite($fd, $rsyncdconf);
- fclose($fd);
-
- // Generate MOTD file if configured
-
- if (!empty($freenas_config['rsyncd']['motd'])) {
- $fd = fopen("{$g['varetc_path']}/rsyncd.motd", "w");
- if (!$fd) {
- printf("Error: cannot open rsyncd.motd in services_rsyncd_configure().\n");
- return 1;
- }
-
- $motd = <<<EOD
+ } // end foreach
+
+ fwrite($fd, $rsyncdconf);
+ fclose($fd);
+
+ // Generate MOTD file if configured
+ if (!empty($freenas_config['rsyncd']['motd'])) {
+ $fd = fopen("{$g['varetc_path']}/rsyncd.motd", "w");
+
+ if (!$fd) {
+ printf("Error: cannot open rsyncd.motd in services_rsyncd_configure().\n");
+ return 1;
+ }
+
+ $motd = <<<EOD
{$freenas_config['rsyncd']['motd']}
EOD;
-
- fwrite($fd, $motd);
- fclose($fd);
- }
- /* run rsync Daemon */
- mwexec("/usr/local/bin/rsync --daemon --config={$g['varetc_path']}/rsyncd.conf");
+ fwrite($fd, $motd);
+ fclose($fd);
+ } // end if
+ /* run rsync Daemon */
+ $result = mwexec("/usr/local/bin/rsync --daemon --config={$g['varetc_path']}/rsyncd.conf");
- if ($g['booting'])
- echo "done\n";
- }
+ if ($g['booting']) { echo "done\n"; }
+ } // end if
- return 0;
+ return $result;
}
+/* Stop nfs processes, Generate the nfs configuration file and
+ * start nfsd processes Return 0 if OK, 1 or error code if error
+ */
function services_nfs_configure() {
- global $freenas_config, $g;
+ global $freenas_config, $g;
- /* kill any running nfsd */
-
- killbyname("rpc.statd");
- killbyname("rpc.lockd");
- killbypid("{$g['varrun_path']}/mountd.pid");
- forcekillbyname("nfsd");
- killbyname("rpcbind");
+ /* kill any running nfsd */
+ killbyname("rpc.statd");
+ killbyname("rpc.lockd");
+ killbypid("{$g['varrun_path']}/mountd.pid");
+ forcekillbyname("nfsd");
+ killbyname("rpcbind");
+
+ if (isset($freenas_config['nfs']['enable'])) {
+ if ($g['booting']) { echo "Starting NFS... "; }
+
+ /* If no share configured, exit */
+ if (!is_array($freenas_config['mounts']['mount'])) { return 1; }
+
+ /* generate exports */
+ $fd = fopen("{$g['varetc_path']}/exports", "w");
+
+ if (!$fd) {
+ printf("Error: cannot open exports in services_nfs_configure().\n");
+ return 1;
+ }
-
- if (isset($freenas_config['nfs']['enable']))
- {
-
- if ($g['booting'])
- echo "Starting NFS... ";
-
- /* If no share configured, exit */
- if (!is_array($freenas_config['mounts']['mount']))
- return 1;
-
- /* generate exports */
- $fd = fopen("{$g['varetc_path']}/exports", "w");
- if (!$fd) {
- printf("Error: cannot open exports in services_nfs_configure().\n");
- return 1;
- }
-
- list($network,$subnet) =
- explode('/', $freenas_config['nfs']['nfsnetwork']);
-
- $subnet = gen_subnet_mask($subnet);
-
- $a_mount = &$freenas_config['mounts']['mount'];
-
- foreach ($a_mount as $mount)
- {
- $nfsconf .= <<<EOD
+ list($network,$subnet) =
+ explode('/', $freenas_config['nfs']['nfsnetwork']);
+
+ $subnet = gen_subnet_mask($subnet);
+ $a_mount = &$freenas_config['mounts']['mount'];
+
+ foreach ($a_mount as $mount) {
+ $nfsconf .= <<<EOD
/mnt/{$mount['sharename']} -alldirs -maproot=root
EOD;
- if ($freenas_config['nfs']['mapall'] == "yes")
- {
-
- $nfsconf .= <<<EOD
+ if ($freenas_config['nfs']['mapall'] == "yes") {
+ $nfsconf .= <<<EOD
-mapall=root
EOD;
-
- }
-
- $nfsconf .= <<<EOD
--network {$network} -mask $subnet
-EOD;
-
- }
- fwrite($fd, $nfsconf);
- fclose($fd);
+ }
- /* run rpcbind, nfsd and mountd */
- mwexec("/usr/sbin/rpcbind");
- mwexec("/usr/sbin/nfsd -u -t -n 4");
- mwexec("/usr/sbin/mountd -r {$g['varetc_path']}/exports");
- mwexec("/usr/sbin/rpc.lockd");
- mwexec("/usr/sbin/rpc.statd");
+ $nfsconf .= <<<EOD
+-network {$network} -mask $subnet
+EOD;
- if ($g['booting'])
- echo "done\n";
- }
+ } // end foreach
+
+ fwrite($fd, $nfsconf);
+ fclose($fd);
+
+ /* run rpcbind, nfsd and mountd */
+ mwexec("/usr/sbin/rpcbind");
+ mwexec("/usr/sbin/nfsd -u -t -n 4");
+ mwexec("/usr/sbin/mountd -r {$g['varetc_path']}/exports");
+ mwexec("/usr/sbin/rpc.lockd");
+ mwexec("/usr/sbin/rpc.statd");
+
+ if ($g['booting']) { echo "done\n"; }
+ } // end if
- return 0;
-
+ return 0;
}
function services_ftpd_configure() {
@@ -458,31 +459,28 @@ function services_ftpd_configure() {
}
function services_wzdftpd_configure() {
- global $freenas_config, $config, $g;
-
- /* kill any WZDFTPD */
- killbyname("wzdftpd");
+ global $freenas_config, $config, $g;
- if (isset($freenas_config['ftp']['enable'])) {
+ /* kill any WZDFTPD */
+ killbyname("wzdftpd");
- if ($g['booting'])
- echo "Starting FTP server... ";
+ if (isset($freenas_config['ftp']['enable'])) {
+ if ($g['booting']) { echo "Starting FTP server... "; }
- if (! file_exists("/var/log/wzdftpd"))
- mkdir("/var/log/wzdftpd");
+ /* create missing dirs if necessary */
+ if (! file_exists("/var/log/wzdftpd")) { mkdir("/var/log/wzdftpd"); }
+ if (! file_exists("/usr/local/etc/wzdftpd")) { mkdir("/usr/local/etc/wzdftpd"); }
- if (! file_exists("/usr/local/etc/wzdftpd"))
- mkdir("/usr/local/etc/wzdftpd");
-
- /* generate wzd.cfg */
+ /* generate wzd.cfg */
chmod("/usr/local/etc/wzdftpd/wzd.cfg", 0600);
- $fd = fopen("/usr/local/etc/wzdftpd/wzd.cfg", "w");
- if (!$fd) {
- printf("Error: cannot open vsftpd.conf in services_vsftpd_configure().\n");
- return 1;
- }
+ $fd = fopen("/usr/local/etc/wzdftpd/wzd.cfg", "w");
+
+ if (!$fd) {
+ printf("Error: cannot open vsftpd.conf in services_vsftpd_configure().\n");
+ return 1;
+ }
- $ftpconf = <<<EOD
+ $ftpconf = <<<EOD
[GLOBAL]
config version = 0.7.2
backup config = true
@@ -490,15 +488,15 @@ port = {$freenas_config['ftp']['port']}
EOD;
- if ($freenas_config['ftp']['pasv_min_port'] && $freenas_config['ftp']['pasv_max_port']) {
- $ftpconf .= <<<EOD
+ if ($freenas_config['ftp']['pasv_min_port'] && $freenas_config['ftp']['pasv_max_port']) {
+ $ftpconf .= <<<EOD
pasv_low_range = {$freenas_config['ftp']['pasv_min_port']}
pasv_high_range = {$freenas_config['ftp']['pasv_max_port']}
EOD;
- }
+ }
- $ftpconf .= <<<EOD
+ $ftpconf .= <<<EOD
pasv_ip = {$freenas_config['ftp']['pasv_address']}
dir_message = .message
@@ -557,13 +555,13 @@ site_help = *
EOD;
-if (! empty($freenas_config['ftp']['timeout'])) {
-$ftpconf .= "site_idle ={$freenas_config['ftp']['timeout']}\n";
-} else {
-$ftpconf .= "site_idle = *\n";
-}
+ if (! empty($freenas_config['ftp']['timeout'])) {
+ $ftpconf .= "site_idle ={$freenas_config['ftp']['timeout']}\n";
+ } else {
+ $ftpconf .= "site_idle = *\n";
+ }
- $ftpconf .= <<<EOD
+ $ftpconf .= <<<EOD
site_invite = !=guest *
site_kick = +O
site_kill = +O
@@ -607,8 +605,8 @@ site_vfsdel = +O
EOD;
- if (empty($config['system']['zeroconf_disable'])) {
- $ftpconf .= <<<EOD
+ if (empty($config['system']['zeroconf_disable'])) {
+ $ftpconf .= <<<EOD
/usr/local/share/wzdftpd/modules/libwzd_zeroconf.so = allow
[ZEROCONF]
@@ -619,9 +617,9 @@ zeroconf_path = /
EOD;
- }
+ }
- $ftpconf .= <<<EOD
+ $ftpconf .= <<<EOD
[sfv]
progressmeter = [WzD] - %3d%% Complete - [WzD]
@@ -655,36 +653,38 @@ site_who = !/usr/local/etc/wzdftpd/file_who.txt
EOD;
- if (isset($freenas_config['ftp']['banner'])) {
- $ftpconf .= "200 = {$freenas_config['ftp']['banner']}";
- }
+ if (isset($freenas_config['ftp']['banner'])) {
+ $ftpconf .= "200 = {$freenas_config['ftp']['banner']}";
+ } else {
+ $ftpconf .= "200 = Welcome to pfSense FTP service";
+ }
- fwrite($fd, $ftpconf);
- fclose($fd);
- chmod("/usr/local/etc/wzdftpd/wzd.cfg", 0400);
+ fwrite($fd, $ftpconf);
+ fclose($fd);
+ chmod("/usr/local/etc/wzdftpd/wzd.cfg", 0400);
- /* now generate the plaintext users file (if applicable) */
- if ($freenas_config['ftp']['authentication_backend'] == FTP_BACKEND_PLAINTEXT) {
- $ftpusers = "[GROUPS]\n";
- $a_group =& $config['system']['group'];
- $a_user =& $config['system']['user'];
+ /* now generate the plaintext users file (if applicable) */
+ if ($freenas_config['ftp']['authentication_backend'] == FTP_BACKEND_PLAINTEXT) {
+ $ftpusers = "[GROUPS]\n";
+ $a_group =& $config['system']['group'];
+ $a_user =& $config['system']['user'];
- for ($i = 0; $i < count($a_group); $i++) {
- $group = $a_group[$i];
- $gid = $i + 1;
+ for ($i = 0; $i < count($a_group); $i++) {
+ $group = $a_group[$i];
+ $gid = $i + 1;
- $ftpusers .= <<<EOD
+ $ftpusers .= <<<EOD
privgroup {$group['name']}
gid={$gid}
default_home=/
EOD;
- } // end foreach
+ } // end foreach
- /* anonymous group */
- if (! empty($freenas_config['ftp']['anonymous'])) {
- $ftpusers .= <<<EOD
+ /* anonymous group */
+ if (! empty($freenas_config['ftp']['anonymous'])) {
+ $ftpusers .= <<<EOD
privgroup anonymous
max_idle_time=10
@@ -694,11 +694,11 @@ default_home=/home
EOD;
}
- /* same for users */
- $ftpusers .= "[USERS]\n";
- for ($i = 0; $i < count($a_user); $i++) {
- $user = $a_user[$i];
- $ftpusers .= <<<EOD
+ /* same for users */
+ $ftpusers .= "[USERS]\n";
+ for ($i = 0; $i < count($a_user); $i++) {
+ $user = $a_user[$i];
+ $ftpusers .= <<<EOD
name={$user['name']}
pass={$user['password']}
@@ -708,11 +708,11 @@ groups={$user['groupname']}
rights=0xffffffff
EOD;
- } // end foreach
+ } // end foreach
- /* anonymous user */
- if (! empty($freenas_config['ftp']['anonymous'])) {
- $ftpusers .= <<<EOD
+ /* anonymous user */
+ if (! empty($freenas_config['ftp']['anonymous'])) {
+ $ftpusers .= <<<EOD
name=guest
pass=%
@@ -728,45 +728,42 @@ bytes_dl_total=1918812
num_logins=2
EOD;
- }
-
- $ftpusers .= "[HOSTS]\nall = *\n";
- chmod("/usr/local/etc/wzdftpd/users", 0600);
- file_put_contents("/usr/local/etc/wzdftpd/users", $ftpusers);
- chmod("/usr/local/etc/wzdftpd/users", 0400);
-
- } // end if
+ } // end if
- /* run vsftpd */
- mwexec("/usr/local/sbin/wzdftpd -f /usr/local/etc/wzdftpd/wzd.cfg");
+ $ftpusers .= "[HOSTS]\nall = *\n";
+ chmod("/usr/local/etc/wzdftpd/users", 0600);
+ file_put_contents("/usr/local/etc/wzdftpd/users", $ftpusers);
+ chmod("/usr/local/etc/wzdftpd/users", 0400);
+ } // end if
+ /* run vsftpd */
+ mwexec("/usr/local/sbin/wzdftpd -f /usr/local/etc/wzdftpd/wzd.cfg");
- if ($g['booting'])
- echo "done\n";
- }
+ if ($g['booting']) { echo "done\n"; }
+ } // end if
- return 0;
+ return 0;
}
+/* this function is currently not used */
function services_vsftpd_configure() {
- global $freenas_config, $g;
+ global $freenas_config, $g;
- /* kill any VSFTPD */
- killbyname("vsftpd");
+ /* kill any VSFTPD */
+ killbyname("vsftpd");
- if (isset($freenas_config['ftp']['enable'])) {
-
- if ($g['booting'])
- echo "Starting FTP server... ";
-
- /* generate vfstpd.conf */
- $fd = fopen("{$g['varetc_path']}/vsftpd.conf", "w");
- if (!$fd) {
- printf("Error: cannot open vsftpd.conf in services_vsftpd_configure().\n");
- return 1;
- }
-
- $ftpconf = <<<EOD
+ if (isset($freenas_config['ftp']['enable'])) {
+ if ($g['booting']) { echo "Starting FTP server... "; }
+
+ /* generate vfstpd.conf */
+ $fd = fopen("{$g['varetc_path']}/vsftpd.conf", "w");
+
+ if (!$fd) {
+ printf("Error: cannot open vsftpd.conf in services_vsftpd_configure().\n");
+ return 1;
+ }
+
+ $ftpconf = <<<EOD
# Standalone mode
listen=YES
background=YES
@@ -795,345 +792,504 @@ ls_recurse_enable=YES
idle_session_timeout={$freenas_config['ftp']['timeout']}
EOD;
- if (isset($freenas_config['ftp']['banner'])) {
- $ftpconf .= <<<EOD
+ if (isset($freenas_config['ftp']['banner'])) {
+ $ftpconf .= <<<EOD
ftpd_banner={$freenas_config['ftp']['banner']}
EOD;
- }
- else {
- $ftpconf .= <<<EOD
-ftpd_banner=Welcome to FreeNAS FTP service
+ } else {
+ $ftpconf .= <<<EOD
+ftpd_banner=Welcome to pfSense FTP service
EOD;
- }
-
- if ($freenas_config['ftp']['pasv_min_port'] && $freenas_config['ftp']['pasv_max_port']) {
- $ftpconf .= <<<EOD
+ }
+
+ if ($freenas_config['ftp']['pasv_min_port'] && $freenas_config['ftp']['pasv_max_port']) {
+ $ftpconf .= <<<EOD
pasv_max_port={$freenas_config['ftp']['pasv_max_port']}
pasv_min_port={$freenas_config['ftp']['pasv_min_port']}
EOD;
- }
-
- if ($freenas_config['ftp']['pasv_address']) {
- $ftpconf .= <<<EOD
+ }
+
+ if ($freenas_config['ftp']['pasv_address']) {
+ $ftpconf .= <<<EOD
pasv_address={$freenas_config['ftp']['pasv_address']}
EOD;
- }
-
- fwrite($fd, $ftpconf);
- fclose($fd);
+ }
- /* run vsftpd */
- mwexec("/usr/local/sbin/vsftpd {$g['varetc_path']}/vsftpd.conf");
+ fwrite($fd, $ftpconf);
+ fclose($fd);
+ /* run vsftpd */
+ mwexec("/usr/local/sbin/vsftpd {$g['varetc_path']}/vsftpd.conf");
- if ($g['booting'])
- echo "done\n";
- }
+ if ($g['booting']) { echo "done\n"; }
+ }
- return 0;
+ return 0;
}
function services_pureftpd_configure() {
+ global $freenas_config, $g;
- // Stop the pure-ftpd process and re-start it
-
- global $freenas_config, $g;
+ /* kill any Pure-FTPD */
+ killbyname("pure-ftpd");
- /* kill any Pure-FTPD */
- killbyname("pure-ftpd");
+ if (isset($freenas_config['ftp']['enable'])) {
+ if ($g['booting']) { echo "Starting FTP server... "; }
- if (isset($freenas_config['ftp']['enable'])) {
-
- if ($g['booting'])
- echo "Starting FTP server... ";
-
- /* Generate the banner file */
-
- $fd = fopen("/mnt/.banner", "w");
- if (!$fd) {
- printf("Error: cannot open .banner in services_pureftpd_configure().\n");
- return 1;
- }
-
- if (empty($freenas_config['ftp']['banner'])) {
- $banner = <<<EOD
-Welcome to FreeNAS FTP service
+ /* Generate the banner file */
+ $fd = fopen("/mnt/.banner", "w");
+
+ if (!$fd) {
+ printf("Error: cannot open .banner in services_pureftpd_configure().\n");
+ return 1;
+ }
+
+ if (empty($freenas_config['ftp']['banner'])) {
+ $banner = <<<EOD
+Welcome to pfSense FTP service
EOD;
- } else {
- $banner = <<<EOD
+ } else {
+ $banner = <<<EOD
{$freenas_config['ftp']['banner']}
-
+
EOD;
- }
-
- fwrite($fd, $banner);
- fclose($fd);
-
-
- /* run pure-ftpd */
-
- $cmd = "/usr/local/sbin/pure-ftpd -S {$freenas_config['ftp']['port']} -c {$freenas_config['ftp']['numberclients']} -C {$freenas_config['ftp']['maxconperip']} -I {$freenas_config['ftp']['timeout']} -M U 077:077 -B -b ";
-
- if ( (isset($freenas_config['ftp']['anonymous'])) && (!isset($freenas_config['ftp']['localuser'])))
- $cmd .= "-e ";
-
- if ( (!isset($freenas_config['ftp']['anonymous'])) && (isset($freenas_config['ftp']['localuser'])))
- $cmd .= "-E ";
-
- if ($freenas_config['ftp']['pasv_min_port'] && $freenas_config['ftp']['pasv_max_port'])
- $cmd .= "-p {$freenas_config['ftp']['pasv_min_port']}:{$freenas_config['ftp']['pasv_max_port']} ";
-
- if ($freenas_config['ftp']['pasv_address'])
- $cmd .= "-P {$freenas_config['ftp']['pasv_address']} ";
-
- if ($freenas_config['ftp']['natmode'])
- $cmd .= "-N ";
-
- if ($freenas_config['ftp']['passiveip'])
- $cmd .= "-P {$freenas_config['ftp']['passiveip']} ";
-
- if ($freenas_config['ftp']['fxp'])
- $cmd .= "-W ";
-
-
- mwexec($cmd);
-
-
- if ($g['booting'])
- echo "done\n";
- }
-
-
- return 0;
+ } // end if
+
+ fwrite($fd, $banner);
+ fclose($fd);
+
+ /* run pure-ftpd */
+ $cmd = "/usr/local/sbin/pure-ftpd -S {$freenas_config['ftp']['port']} -c {$freenas_config['ftp']['numberclients']} -C {$freenas_config['ftp']['maxconperip']} -I {$freenas_config['ftp']['timeout']} -M U 077:077 -B -b ";
+
+ if ( (isset($freenas_config['ftp']['anonymous'])) && (!isset($freenas_config['ftp']['localuser']))) {
+ $cmd .= "-e ";
+ }
+
+ if ( (!isset($freenas_config['ftp']['anonymous'])) && (isset($freenas_config['ftp']['localuser']))) {
+ $cmd .= "-E ";
+ }
+
+ if ($freenas_config['ftp']['pasv_min_port'] && $freenas_config['ftp']['pasv_max_port']) {
+ $cmd .= "-p {$freenas_config['ftp']['pasv_min_port']}:{$freenas_config['ftp']['pasv_max_port']} ";
+ }
+
+ if ($freenas_config['ftp']['pasv_address']) {
+ $cmd .= "-P {$freenas_config['ftp']['pasv_address']} ";
+ }
+
+ if ($freenas_config['ftp']['natmode']) {
+ $cmd .= "-N ";
+ }
+
+ if ($freenas_config['ftp']['passiveip']) {
+ $cmd .= "-P {$freenas_config['ftp']['passiveip']} ";
+ }
+
+ if ($freenas_config['ftp']['fxp']) {
+ $cmd .= "-W ";
+ }
+
+ mwexec($cmd);
+
+ if ($g['booting']) { echo "done\n"; }
+ } // end if
+
+ return 0;
}
+/* Stop smartd, Generate the configuration file and start
+ * smartd Return 0 if OK, 1 or error code if error
+ */
function services_smart_configure() {
- global $config, $g;
-
- /* kill any running smartd */
- killbyname("smartd");
+ global $config, $g;
- if (isset($config['system']['smart'])) {
+ /* kill any running smartd */
+ killbyname("smartd");
- if ($g['booting'])
- echo "Starting smartd... ";
+ if (isset($config['system']['smart'])) {
+ if ($g['booting']) { echo "Starting smartd... "; }
- /* run smartd */
- mwexec("/usr/local/sbin/smartd --logfacility=local5");
+ /* run smartd */
+ mwexec("/usr/local/sbin/smartd --logfacility=local5");
- if ($g['booting'])
- echo "done\n";
- }
+ if ($g['booting']) { echo "done\n"; }
+ }
- return 0;
+ return 0;
+}
+
+/* Generate the unison configuration
+ * Return 0 if OK, 1 or error code if error
+ */
+function services_unison_configure() {
+ global $freenas_config, $g;
+ $result = 0 ;
+
+ if ($g['booting']) { echo "Configuring unison... \n"; }
+
+ if (isset($freenas_config['unison']['enable'])) {
+ /* ensure unison workdir exists */
+ $workdir = "/mnt/{$freenas_config['unison']['share']}/{$config['unison']['workdir']}";
+
+ if (isset($freenas_config['unison']['makedir']) && !file_exists($workdir)) {
+ if (!mkdir($workdir)) {
+ printf("Error: cannot mkdir $workdir in services_unison_configure().\n");
+ }
+
+ exec("/bin/chmod 775 $workdir");
+ }
+
+ if (!file_exists($workdir)) {
+ printf("Error: cannot open $workdir in services_unison_configure().\n");
+ $result = 1 ;
+ }
+
+ /* add workdir to login.conf UNISON environment variable */
+ $logfile = "{$g['etc_path']}/login.conf";
+
+ if (!file_exists("$logfile")) {
+ printf("Error: $logfile doesn't exist, in services_unison_configure().\n");
+ $result = 1 ;
+ }
+
+ $tmp = file_get_contents("$logfile");
+ $search = "/UNISON=.*?(?=[,:])/";
+
+ if (!preg_match($search, $tmp)) {
+ printf("Error: cannot find UNISON in $logfile, in services_unison_configure().\n");
+ $result = 1 ;
+ }
+
+ $tmp = preg_replace($search, "UNISON=$workdir", $tmp);
+
+ if (!file_put_contents($logfile, $tmp)) {
+ printf("Error: couldn't write $logfile, in services_unison_configure().\n");
+ $result = 1 ;
+ }
+ } // end if
+
+ $tmp = "";
+
+ return $result;
+}
+
+/* Stop and start ushare
+ * Return 0 if OK, 1 or error code if error
+ */
+function services_ushare_configure() {
+ global $freenas_config, $g;
+
+ $result = 0 ;
+
+ /* Kill any running uShare */
+ killbyname("ushare");
+
+ /* Delete multicast route. */
+ mwexec("/sbin/route delete -net 239.0.0.0");
+
+ if(isset($freenas_config['upnp']['enable'])) {
+ if($g['booting']) { echo "Starting UPnP server... "; }
+
+ /* Setup a multicast route for UPnP messages. */
+ // TODO: where to get the upnp iface?
+ $result = mwexec("/sbin/route add -net 239.0.0.0 -netmask 255.0.0.0 -interface " . escapeshellarg($freenas_config['upnp']['if']));
+
+ $content = "";
+ foreach($freenas_config['upnp']['content'] as $contentv) {
+ $content .= " --content=$contentv";
+ }
+
+ /* Run uShare as daemon. */
+ // TODO: where to get the upnp iface?
+ $result |= mwexec("/usr/local/bin/ushare --daemon --no-web --name={$freenas_config['upnp']['name']} --interface={$freenas_config['upnp']['if']} {$content}");
+ } // end if
+
+ return $result;
}
function services_cron_configure() {
- global $freenas_config, $g;
-
- /* kill any running cron */
- killbyname("cron");
-
- /* generate crontab */
- $fd = fopen("{$g['varetc_path']}/crontab", "w");
-
- $crontabconf = <<<EOD
-SHELL=/bin/sh
-PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin
-HOME=/var/log
-#
-#minute hour mday month wday who command
-#
+ global $freenas_config, $g;
+
+ /* kill any running cron */
+ killbyname("cron");
+
+ /* ======================================================================= */
+ /* = configure crontab item for rsyncclient = */
+ /* ======================================================================= */
+ if (isset($freenas_config['rsyncclient']['enable'])) {
+ if ($g['booting']) { echo "Configuring cron for rsync client... "; }
+
+ if ($freenas_config['rsyncclient']['all_mins'] == "0") {
+ foreach ($freenas_config['rsyncclient']['minute'] as $minutev) {
+ if (strlen($cron_min) > 0) {
+ $cron_min = $cron_min . "," . $minutev;
+ } else {
+ $cron_min = $minutev;
+ }
+ } // end foreach
+ } else {
+ $cron_min = "*";
+ } // end if
+
+ if ($freenas_config['rsyncclient']['all_hours'] == "0") {
+ foreach ($freenas_config['rsyncclient']['hour'] as $hourv) {
+ if (strlen($cron_hour) > 0) {
+ $cron_hour = $cron_hour . "," . $hourv;
+ } else {
+ $cron_hour = $hourv;
+ }
+ } // end foreach
+ } else {
+ $cron_hour = "*";
+ } // end if
+
+ if ($freenas_config['rsyncclient']['all_days'] == "0") {
+ foreach ($freenas_config['rsyncclient']['day'] as $dayv) {
+ if (strlen($cron_day) > 0) {
+ $cron_day = $cron_day . "," . $dayv;
+ } else {
+ $cron_day = $dayv;
+ }
+ } // end foreach
+ } else {
+ $cron_day = "*";
+ } // end if
+
+ if ($freenas_config['rsyncclient']['all_months'] == "0") {
+ foreach ($freenas_config['rsyncclient']['month'] as $monthv) {
+ if (strlen($cron_month) > 0) {
+ $cron_month = $cron_month . "," . $monthv;
+ } else {
+ $cron_month = $monthv;
+ }
+ } // end foreach
+ } else {
+ $cron_month = "*";
+ } // end if
+
+ if ($freenas_config['rsyncclient']['all_weekday'] == "0") {
+ foreach ($freenas_config['rsyncclient']['weekday'] as $weekdayv) {
+ if (strlen($cron_weekday) > 0) {
+ $cron_weekday = $cron_weekday . "," . $weekdayv;
+ } else {
+ $cron_weekday = $weekdayv;
+ }
+ } // end foreach
+ } else {
+ $cron_weekday = "*";
+ } // end if
+
+ $cron_item = array();
+ $cron_item['minute'] = "{$cron_min}";
+ $cron_item['hour'] = "{$cron_hour}";
+ $cron_item['mday'] = "{$cron_day}";
+ $cron_item['month'] = "{$cron_month}";
+ $cron_item['wday'] = "{$cron_weekday}";
+ $cron_item['who'] = "root";
+ $cron_item['command'] = "{$g['varrun_path']}/sync.sh";
+
+ $config['cron']['item'][] = $cron_item;
+
+ if ($g['booting']) { echo "done\n"; }
+ } // end if
-EOD;
+ /* Erase all variable used previously */
+ unset ($cron_min, $cron_hour, $cron_day, $cron_month, $cron_weekday);
+
+ /* ======================================================================= */
+ /* = configure crontab item for rsync local part = */
+ /* ======================================================================= */
+ if (isset($freenas_config['rsync_local']['enable'])) {
+ if ($g['booting']) { echo "Configuring cron for local rsync... "; }
+
+ if ($freenas_config['rsync_local']['all_mins'] == "0") {
+ foreach ($freenas_config['rsync_local']['minute'] as $minutev) {
+ if (strlen($cron_min) > 0) {
+ $cron_min = $cron_min . "," . $minutev;
+ } else {
+ $cron_min = $minutev;
+ }
+ } // end foreach
+ } else {
+ $cron_min = "*";
+ } // end if
+
+ if ($freenas_config['rsync_local']['all_hours'] == "0") {
+ foreach ($freenas_config['rsync_local']['hour'] as $hourv) {
+ if (strlen($cron_hour) > 0) {
+ $cron_hour = $cron_hour . "," . $hourv;
+ } else {
+ $cron_hour = $hourv;
+ }
+ } // end foreach
+ } else {
+ $cron_hour = "*";
+ } // end if
+
+ if ($freenas_config['rsync_local']['all_days'] == "0") {
+ foreach ($freenas_config['rsync_local']['day'] as $dayv) {
+ if (strlen($cron_day) > 0) {
+ $cron_day = $cron_day . "," . $dayv;
+ } else {
+ $cron_day = $dayv;
+ }
+ } // end foreach
+ } else {
+ $cron_day = "*";
+ } // end if
+
+ if ($freenas_config['rsync_local']['all_months'] == "0") {
+ foreach ($freenas_config['rsync_local']['month'] as $monthv) {
+ if (strlen($cron_month) > 0) {
+ $cron_month = $cron_month . "," . $monthv;
+ } else {
+ $cron_month = $monthv;
+ }
+ } // end foreach
+ } else {
+ $cron_month = "*";
+ } // end if
+
+ if ($freenas_config['rsync_local']['all_weekday'] == "0") {
+ foreach ($freenas_config['rsync_local']['weekday'] as $weekdayv) {
+ if (strlen($cron_weekday) > 0) {
+ $cron_weekday = $cron_weekday . "," . $weekdayv;
+ } else {
+ $cron_weekday = $weekdayv;
+ }
+ } // end foreach
+ } else {
+ $cron_weekday = "*";
+ }
- if (!$fd) {
- printf("Error: cannot open crontab in services_cron_configure().\n");
- return 1;
- }
-
- if (isset($freenas_config['rsyncclient']['enable'])) {
-
- if ($g['booting'])
- echo "Configuring cron for rsync client... ";
-
- if ($freenas_config['rsyncclient']['all_mins'] == "0") {
- foreach ($freenas_config['rsyncclient']['minute'] as $minutev) {
- if (strlen($cron_min) > 0)
- $cron_min = $cron_min . "," . $minutev;
- else
- $cron_min = $minutev;
- }
- }
- else
- $cron_min = "*";
-
-
- if ($freenas_config['rsyncclient']['all_hours'] == "0") {
- foreach ($freenas_config['rsyncclient']['hour'] as $hourv) {
- if (strlen($cron_hour) > 0)
- $cron_hour = $cron_hour . "," . $hourv;
- else
- $cron_hour = $hourv;
- }
- }
- else
- $cron_hour = "*";
-
- if ($freenas_config['rsyncclient']['all_days'] == "0") {
- foreach ($freenas_config['rsyncclient']['day'] as $dayv) {
- if (strlen($cron_day) > 0)
- $cron_day = $cron_day . "," . $dayv;
- else
- $cron_day = $dayv;
- }
- }
- else
- $cron_day = "*";
-
- if ($freenas_config['rsyncclient']['all_months'] == "0") {
- foreach ($freenas_config['rsyncclient']['month'] as $monthv) {
- if (strlen($cron_month) > 0)
- $cron_month = $cron_month . "," . $monthv;
- else
- $cron_month = $monthv;
- }
- }
- else
- $cron_month = "*";
-
-
- if ($freenas_config['rsyncclient']['all_weekday'] == "0") {
- foreach ($freenas_config['rsyncclient']['weekday'] as $weekdayv) {
- if (strlen($cron_weekday) > 0)
- $cron_weekday = $cron_weekday . "," . $weekdayv;
- else
- $cron_weekday = $weekdayv;
- }
- }
- else
- $cron_weekday = "*";
-
- $crontabconf .= <<<EOD
-{$cron_min} {$cron_hour} {$cron_day} {$cron_month} {$cron_weekday} root {$g['varrun_path']}/sync.sh
-
-EOD;
-
- if ($g['booting'])
- echo "done\n";
- }
-
- // Erase all variable used previously
- unset ($cron_min, $cron_hour, $cron_day, $cron_month, $cron_weekday);
-
- if (isset($freenas_config['shutdown']['enable'])) {
-
- if ($g['booting'])
- echo "Configuring cron for shutdown... ";
-
- if ($freenas_config['shutdown']['all_mins'] == "0") {
- foreach ($freenas_config['shutdown']['minute'] as $minutev) {
- if (strlen($cron_min) > 0)
- $cron_min = $cron_min . "," . $minutev;
- else
- $cron_min = $minutev;
- }
- }
- else
- $cron_min = "*";
-
-
- if ($freenas_config['shutdown']['all_hours'] == "0") {
- foreach ($freenas_config['shutdown']['hour'] as $hourv) {
- if (strlen($cron_hour) > 0)
- $cron_hour = $cron_hour . "," . $hourv;
- else
- $cron_hour = $hourv;
- }
- }
- else
- $cron_hour = "*";
-
- if ($freenas_config['shutdown']['all_days'] == "0") {
- foreach ($freenas_config['shutdown']['day'] as $dayv) {
- if (strlen($cron_day) > 0)
- $cron_day = $cron_day . "," . $dayv;
- else
- $cron_day = $dayv;
- }
- }
- else
- $cron_day = "*";
-
- if ($freenas_config['shutdown']['all_months'] == "0") {
- foreach ($freenas_config['shutdown']['month'] as $monthv) {
- if (strlen($cron_month) > 0)
- $cron_month = $cron_month . "," . $monthv;
- else
- $cron_month = $monthv;
- }
- }
- else
- $cron_month = "*";
-
-
- if ($freenas_config['shutdown']['all_weekday'] == "0") {
- foreach ($freenas_config['shutdown']['weekday'] as $weekdayv) {
- if (strlen($cron_weekday) > 0)
- $cron_weekday = $cron_weekday . "," . $weekdayv;
- else
- $cron_weekday = $weekdayv;
- }
- }
- else
- $cron_weekday = "*";
-
- $crontabconf .= <<<EOD
-{$cron_min} {$cron_hour} {$cron_day} {$cron_month} {$cron_weekday} root /etc/rc.shutdown
-
-EOD;
-
- if ($g['booting'])
- echo "done\n";
- }
-
- fwrite($fd, $crontabconf);
- fclose($fd);
-
- /* run cron */
- mwexec("/usr/sbin/cron -s");
-
- return 0;
-
+ $cron_item = array();
+ $cron_item['minute'] = "{$cron_min}";
+ $cron_item['hour'] = "{$cron_hour}";
+ $cron_item['mday'] = "{$cron_day}";
+ $cron_item['month'] = "{$cron_month}";
+ $cron_item['wday'] = "{$cron_weekday}";
+ $cron_item['who'] = "root";
+ $cron_item['command'] = "{$g['varrun_path']}/sync.sh";
+
+ $config['cron']['item'][] = $cron_item;
+
+ if ($g['booting']) { echo "done\n"; }
+ }
+
+ /* Erase all variable used previously */
+ unset ($cron_min, $cron_hour, $cron_day, $cron_month, $cron_weekday);
+
+ /* ======================================================================= */
+ /* = configure crontab item shutdown part = */
+ /* ======================================================================= */
+ if (isset($freenas_config['shutdown']['enable'])) {
+ if ($g['booting']) { echo "Configuring cron for shutdown... "; }
+
+ if ($freenas_config['shutdown']['all_mins'] == "0") {
+ foreach ($freenas_config['shutdown']['minute'] as $minutev) {
+ if (strlen($cron_min) > 0) {
+ $cron_min = $cron_min . "," . $minutev;
+ } else {
+ $cron_min = $minutev;
+ }
+ } // end foreach
+ } else {
+ $cron_min = "*";
+ } // end if
+
+ if ($freenas_config['shutdown']['all_hours'] == "0") {
+ foreach ($freenas_config['shutdown']['hour'] as $hourv) {
+ if (strlen($cron_hour) > 0) {
+ $cron_hour = $cron_hour . "," . $hourv;
+ } else {
+ $cron_hour = $hourv;
+ }
+ } // end foreach
+ } else {
+ $cron_hour = "*";
+ } // end if
+
+ if ($freenas_config['shutdown']['all_days'] == "0") {
+ foreach ($freenas_config['shutdown']['day'] as $dayv) {
+ if (strlen($cron_day) > 0) {
+ $cron_day = $cron_day . "," . $dayv;
+ } else {
+ $cron_day = $dayv;
+ }
+ } // end foreach
+ } else {
+ $cron_day = "*";
+ } // end if
+
+ if ($freenas_config['shutdown']['all_months'] == "0") {
+ foreach ($freenas_config['shutdown']['month'] as $monthv) {
+ if (strlen($cron_month) > 0) {
+ $cron_month = $cron_month . "," . $monthv;
+ } else {
+ $cron_month = $monthv;
+ }
+ } // end foreach
+ } else {
+ $cron_month = "*";
+ } // end if
+
+ if ($freenas_config['shutdown']['all_weekday'] == "0") {
+ foreach ($freenas_config['shutdown']['weekday'] as $weekdayv) {
+ if (strlen($cron_weekday) > 0) {
+ $cron_weekday = $cron_weekday . "," . $weekdayv;
+ } else {
+ $cron_weekday = $weekdayv;
+ }
+ } // end foreach
+ } else {
+ $cron_weekday = "*";
+ } // end if
+
+ $cron_item = array();
+ $cron_item['minute'] = "{$cron_min}";
+ $cron_item['hour'] = "{$cron_hour}";
+ $cron_item['mday'] = "{$cron_day}";
+ $cron_item['month'] = "{$cron_month}";
+ $cron_item['wday'] = "{$cron_weekday}";
+ $cron_item['who'] = "root";
+ $cron_item['command'] = "{$g['varrun_path']}/sync.sh";
+
+ $config['cron']['item'][] = $cron_item;
+
+ if ($g['booting']) { echo "done\n"; }
+ } // end if
+
+ /* call the pfSense configure_cron function */
+ configure_cron();
+
+ /* run cron */
+ mwexec("/usr/sbin/cron -s");
+
+ return 0;
}
-function services_rsyncclient_configure()
-{
- global $freenas_config, $g;
+function services_rsyncclient_configure() {
+ global $freenas_config, $g;
- // Generate a shell script that is used by cron
- // Generate crontab works
-
- if (isset($freenas_config['rsyncclient']['enable']))
- {
-
- if ($g['booting'])
- echo "Generating synchronizing cron script... ";
-
- /* generate /var/run/sync.sh script */
- $fd = fopen("{$g['varrun_path']}/sync.sh", "w");
- if (!$fd)
- {
- printf("Error: cannot open /var/run/sync.sh in services_rsyncclient_configure().\n");
- return 1;
- }
-
- $syncscript = <<<EOD
+ // Generate a shell script that is used by cron
+ // Generate crontab works
+ if (isset($freenas_config['rsyncclient']['enable'])) {
+ if ($g['booting']) { echo "Generating synchronizing cron script... "; }
+
+ /* generate /var/run/sync.sh script */
+ $fd = fopen("{$g['varrun_path']}/sync.sh", "w");
+
+ if (!$fd) {
+ printf("Error: cannot open /var/run/sync.sh in services_rsyncclient_configure().\n");
+ return 1;
+ }
+
+ $syncscript = <<<EOD
#!/bin/sh
if [ -r /var/run/rsync-running ]; then
@@ -1143,167 +1299,243 @@ fi
EOD;
- $opt_delete="";
- if (isset($freenas_config['rsyncclient']['opt_delete']))
- $opt_delete = "--delete --delete-after ";
-
- foreach ($freenas_config['rsyncclient']['sharetosync'] as $sharek => $sharev)
- {
- $syncscript .= <<<EOD
+ $opt_delete="";
+ if (isset($freenas_config['rsyncclient']['opt_delete'])) {
+ $opt_delete = "--delete --delete-after ";
+ }
+
+ foreach ($freenas_config['rsyncclient']['sharetosync'] as $sharek => $sharev) {
+ $syncscript .= <<<EOD
/usr/local/bin/rsync -rtz {$opt_delete}rsync://{$freenas_config['rsyncclient']['rsyncserverip']}/{$sharev} /mnt/{$sharev}
EOD;
- }
-
- $syncscript .= <<<EOD
+ } // end foreach
+
+ $syncscript .= <<<EOD
/bin/rm -f /var/run/rsync-running
EOD;
- fwrite($fd,$syncscript);
- fclose($fd);
-
- /* Add exectutive right to the script */
- exec("/bin/chmod 770 {$g['varrun_path']}/sync.sh");
-
- if ($g['booting'])
- echo "done\n";
- return 0;
- }
-
- return 0;
+ fwrite($fd,$syncscript);
+ fclose($fd);
+
+ /* Add exectutive right to the script */
+ exec("/bin/chmod 770 {$g['varrun_path']}/sync.sh");
+
+ if ($g['booting']) { echo "done\n"; }
+ } // end if
+
+ return 0;
}
-function services_afpd_configure()
-{
- global $freenas_config, $config, $g;
+function services_rsync_local_configure() {
+ global $freenas_config, $g;
+
+ // Generate a shell script that is used by cron
+ // Generate crontab works
+ if (isset($freenas_config['rsync_local']['enable'])) {
+ if ($g['booting']) { echo "Generating local rsync cron script... "; }
+
+ /* generate /var/run/sync_local.sh script */
+ $fd = fopen("{$g['varrun_path']}/sync_local.sh", "w");
+
+ if (!$fd) {
+ printf("Error: cannot open /var/run/sync_local.sh in services_rsync_local_configure().\n");
+ return 1;
+ }
- /* kill any VSFTPD */
- killbyname("afpd");
+ $syncscript = <<<EOD
+#!/bin/sh
- if (isset($freenas_config['afp']['enable'])) {
-
- /* If no share configured, exit */
- if (!is_array($freenas_config['mounts']['mount']))
- return 1;
-
- if ($g['booting'])
- echo "Starting AFP server... ";
-
- if (empty($freenas_config['afp']['afpname']))
- $afpname="-";
- else
- $afpname=$freenas_config['afp']['afpname'];
-
- /* generate afpd.conf */
- $fd = fopen("{$g['varetc_path']}/afpd.conf", "w");
- if (!$fd) {
- printf("Error: cannot open afpd.conf in services_afpd_configure().\n");
- return 1;
- }
-
- $afpconf = <<<EOD
-{$afpname} -transall
-EOD;
-
- if (empty($config['system']['zeroconf_disable'])) {
- $afpconf .= <<<EOD
+if [ -r /var/run/rsync_local-running ]; then
+exit
+fi
+/usr/bin/touch /var/run/rsync_local-running
+
+EOD;
+
+ $opt_delete="";
+ if (isset($freenas_config['rsync_local']['opt_delete'])) {
+ $opt_delete = "--delete --delete-after ";
+ }
+
+ $syncscript .= <<<EOD
+/usr/local/bin/rsync -a {$opt_delete} /mnt/{$freenas_config['rsync_local']['source']} /mnt/{$freenas_config['rsync_local']['destination']}
+
+EOD;
+
+ $syncscript .= <<<EOD
+/bin/rm -f /var/run/rsync_local-running
+
+EOD;
+
+ fwrite($fd,$syncscript);
+ fclose($fd);
+
+ /* Add exectutive right to the script */
+ exec("/bin/chmod 770 {$g['varrun_path']}/sync_local.sh");
+
+ if ($g['booting']) { echo "done\n"; }
+ } // end if
+
+ return 0;
+}
+
+function services_radius_configure() {
+ global $freenas_config, $g;
+
+ if (isset($config['radius']['enable'])) {
+ /* generate radius.conf */
+ $fd = fopen("{$g['varetc_path']}/radius.conf", "w");
+
+ if (!$fd) {
+ printf("Error: cannot open radius.conf in services_radius_configure().\n");
+ return 1;
+ }
+
+ $radiusconf = <<<EOD
+auth {$config['radius']['radiusip']}:{$config['radius']['port']} {$config['radius']['secret']} {$config['radius']['timeout']} {$config['radius']['maxretry']}
+
+EOD;
+
+ fwrite($fd, $radiusconf);
+ fclose($fd);
+ } // end if
+
+ return 0;
+}
+
+/* Stop, Generate the config file and start
+ * AFP Return 0 if OK, 1 or error code if error
+ */
+function services_afpd_configure() {
+ global $freenas_config, $config, $g;
+
+ /* kill any afpd */
+ killbyname("afpd");
+
+ if (isset($freenas_config['afp']['enable'])) {
+ /* If no share configured, exit */
+ if (!is_array($freenas_config['mounts']['mount'])) { return 1; }
+ if ($g['booting']) { echo "Starting AFP server... "; }
+
+ if (empty($freenas_config['afp']['afpname'])) {
+ $afpname="-";
+ } else {
+ $afpname=$freenas_config['afp']['afpname'];
+ }
+
+ /* generate afpd.conf */
+ $fd = fopen("{$g['varetc_path']}/afpd.conf", "w");
+
+ if (!$fd) {
+ printf("Error: cannot open afpd.conf in services_afpd_configure().\n");
+ return 1;
+ }
+
+ $afpconf = <<<EOD
+{$afpname} -transall -uamlist
+EOD;
+
+ if (empty($config['system']['zeroconf_disable'])) {
+ $afpconf .= <<<EOD
-noslp -fqdn {$config['system']['hostname']}.{$config['system']['domain']} -uamlist
EOD;
- } else {
- $afpconf .= <<<EOD
+ } else {
+ $afpconf .= <<<EOD
-noslp -nozeroconf -uamlist
EOD;
- }
+ } // end if
- if (isset($freenas_config['afp']['guest']) && isset($freenas_config['afp']['local']) )
- $afpconf .= <<<EOD
+ if (isset($freenas_config['afp']['guest']) && isset($freenas_config['afp']['local']) ) {
+ $afpconf .= <<<EOD
uams_guest.so,uams_clrtxt.so,uams_dhx.so
EOD;
- else if (isset($freenas_config['afp']['guest']))
- $afpconf .= <<<EOD
+ } else if (isset($freenas_config['afp']['guest'])) {
+ $afpconf .= <<<EOD
uams_guest.so
EOD;
- else if (isset($freenas_config['afp']['local']))
- $afpconf .= <<<EOD
+ } else if (isset($freenas_config['afp']['local'])) {
+ $afpconf .= <<<EOD
uams_clrtxt.so,uams_dhx.so
EOD;
-
- $afpconf .= <<<EOD
+ }
+
+ $afpconf .= <<<EOD
-nosavepassword -defaultvol {$g['varetc_path']}/AppleVolumes.default -systemvol {$g['varetc_path']}/AppleVolumes.system -uampath /etc/uams -guestname ftp
EOD;
- fwrite($fd, $afpconf);
- fclose($fd);
-
- /* generate AppleVolumes.default */
- $fd = fopen("{$g['varetc_path']}/AppleVolumes.default", "w");
- if (!$fd)
- {
- printf("Error: cannot open AppleVolumes.default in services_afpd_configure().\n");
- return 1;
- }
-
- $a_mount = &$freenas_config['mounts']['mount'];
- foreach ($a_mount as $mount)
- {
- $AppleVolumes .= <<<EOD
+
+ fwrite($fd, $afpconf);
+ fclose($fd);
+
+ /* generate AppleVolumes.default */
+ $fd = fopen("{$g['varetc_path']}/AppleVolumes.default", "w");
+
+ if (!$fd) {
+ printf("Error: cannot open AppleVolumes.default in services_afpd_configure().\n");
+ return 1;
+ }
+
+ $a_mount = &$freenas_config['mounts']['mount'];
+
+ foreach ($a_mount as $mount) {
+ $AppleVolumes .= <<<EOD
/mnt/{$mount['sharename']} "{$mount['sharename']}"
EOD;
- }
-
- fwrite($fd, $AppleVolumes);
- fclose($fd);
+ } // end foreach
+
+ fwrite($fd, $AppleVolumes);
+ fclose($fd);
- /* run afpdpd */
- mwexec("/usr/local/sbin/afpd -F {$g['varetc_path']}/afpd.conf");
+ /* run afpdpd */
+ mwexec("/usr/local/sbin/afpd -F {$g['varetc_path']}/afpd.conf");
- if ($g['booting'])
- echo "done\n";
- }
+ if ($g['booting']) { echo "done\n"; }
+ } // end if
- return 0;
+ return 0;
}
-function services_nis_configure()
-{
- global $freenas_config, $g;
+function services_nis_configure() {
+ global $freenas_config, $g;
- return 0;
+ return 0;
}
-function services_iscsi_configure()
-{
- global $freenas_config, $g;
-
- if (isset($freenas_config['iscsi']['enable']))
- {
- if ($g['booting'])
- echo "Starting iSCSI driver... ";
-
- mwexec("/sbin/kldload kdload /boot/kernel/iscsi_initiator.ko");
- mwexec("/sbin/sysctl debug.iscsi=0");
- mwexec("/usr/local/sbin/iscontrol targetaddress={$freenas_config['iscsi']['targetaddress']} TargetName={$freenas_config['iscsi']['targetname']}");
-
- if ($g['booting'])
- echo "done\n";
- }
-
- return 0;
+/* Start iscsi initiator
+ * Return 0 if Ok, 1 or error code if problem
+ */
+/* TODO: NEED TO STOP IT TOO ??? */
+function services_iscsi_configure() {
+ global $freenas_config, $g;
+
+ if (isset($freenas_config['iscsi']['enable'])) {
+ if ($g['booting']) { echo "Starting iSCSI driver... "; }
+
+ $result = mwexec("/sbin/kldload kdload /boot/kernel/iscsi_initiator.ko");
+ $result |= mwexec("/sbin/sysctl debug.iscsi=0");
+ $result |= mwexec("/usr/local/sbin/iscontrol targetaddress={$freenas_config['iscsi']['targetaddress']} TargetName={$freenas_config['iscsi']['targetname']}");
+
+ if ($g['booting']) { echo "done\n"; }
+ }
+
+ if (isset($result)) { return $result; }
+ return 0;
}
function services_zeroconf_configure() {
- //services_mdnsresponder_configure();
- //services_howl_configure();
- services_avahi_configure();
+ //services_mdnsresponder_configure();
+ //services_howl_configure();
+ return services_avahi_configure();
}
function services_avahi_configure() {
- global $freenas_config, $config, $g;
-
- $service_template = <<<EOD
+ global $freenas_config, $config, $g;
+
+ $service_template = <<<EOD
<?xml version="1.0" standalone='no'?>
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
@@ -1320,376 +1552,369 @@ function services_avahi_configure() {
EOD;
- /* kill any running dbus daemon */
+ /* kill any running dbus daemon */
sigkillbypid("{$g['varrun_path']}/dbus/dbus.pid", "TERM");
unlink_if_exists("{$g['varrun_path']}/dbus/dbus.pid");
- /* kill any running avahi daemons */
+ /* kill any running avahi daemons */
mwexec("/usr/local/sbin/avahi-daemon -k");
-
- if (isset($config['system']['zeroconf_disable']))
- return 0;
-
- if (! file_exists("/usr/local/etc/avahi/services"))
- mwexec("mkdir -p /usr/local/etc/avahi/services");
-
- if (isset($config['system']['webgui']['port'])) {
- $webservice = str_replace("@PORT@",
- $config['system']['webgui']['port'],
- $service_template);
- $webservice = str_replace("@TYPE@",
- "_http._tcp",
- $webservice);
- $webservice = str_replace("@SERVICE_DESC@",
- "pfSense webGUI",
- $webservice);
- $webservice = str_replace("@TXT_RECORDS@",
- "",
- $webservice);
-
- file_put_contents("/usr/local/etc/avahi/services/http.service", $webservice);
- } else {
- $webservice = str_replace("@PORT@",
- "80",
- $service_template);
- $webservice = str_replace("@TYPE@",
- "_http._tcp",
- $webservice);
- $webservice = str_replace("@SERVICE_DESC@",
- "pfSense webGUI",
- $webservice);
- $webservice = str_replace("@TXT_RECORDS@",
- "",
+ /* simply return if zeroconf isn't enabled */
+ if (isset($config['system']['zeroconf_disable'])) { return 0; }
+
+ /* configure Avahi and it's dependencies */
+ if (! file_exists("/usr/local/etc/avahi/services")) {
+ mwexec("mkdir -p /usr/local/etc/avahi/services");
+ }
+
+ /* add HTTP service type */
+ $webproto = $config['system']['webgui']['protocol'];
+
+ if (isset($config['system']['webgui']['port'])) {
+ $webservice = str_replace("@PORT@",
+ $config['system']['webgui']['port'],
+ $service_template);
+ $webservice = str_replace("@TYPE@",
+ "_{$webproto}._tcp",
$webservice);
+ $webservice = str_replace("@SERVICE_DESC@",
+ "pfSense webGUI",
+ $webservice);
+ $webservice = str_replace("@TXT_RECORDS@",
+ "",
+ $webservice);
+
+ file_put_contents("/usr/local/etc/avahi/services/http.service", $webservice);
+ } else {
+ $webservice = str_replace("@PORT@",
+ "80",
+ $service_template);
+ $webservice = str_replace("@TYPE@",
+ "_{$webproto}._tcp",
+ $webservice);
+ $webservice = str_replace("@SERVICE_DESC@",
+ "pfSense webGUI",
+ $webservice);
+ $webservice = str_replace("@TXT_RECORDS@",
+ "",
+ $webservice);
+
+ file_put_contents("/usr/local/etc/avahi/services/http.service", $webservice);
+ } // end if
- file_put_contents("/usr/local/etc/avahi/services/http.service", $webservice);
- }
-
+ /* afp is announcing itself */
+ if (isset($freenas_config['afp']['enable'])) {
+ /* NOP */
+ }
+
+ /* add rsync service type */
+ if (isset($freenas_config['rsyncd']['enable'])) {
+ $rsyncservice = str_replace("@PORT@",
+ $freenas_config['rsyncd']['port'],
+ $service_template);
+ $rsyncservice = str_replace("@TYPE@",
+ "_rsync._tcp",
+ $rsyncservice);
+ $rsyncservice = str_replace("@SERVICE_DESC@",
+ "Remote Sync Daemon",
+ $rsyncservice);
+ $rsyncservice = str_replace("@TXT_RECORDS@",
+ "",
+ $rsyncservice);
+
+ file_put_contents("/usr/local/etc/avahi/services/rsync.service", $rsyncservice);
+ } // end if
-
- if (isset($freenas_config['afp']['enable'])) {
- /* NOP */
- }
-
- if (isset($freenas_config['rsyncd']['enable'])) {
- $rsyncservice = str_replace("@PORT@",
- $config['rsyncd']['port'],
- $service_template);
- $rsyncservice = str_replace("@TYPE@",
- "_rsync._tcp",
- $rsyncservice);
- $rsyncservice = str_replace("@SERVICE_DESC@",
- "Remote Sync Daemon",
- $rsyncservice);
- $rsyncservice = str_replace("@TXT_RECORDS@",
- "",
- $rsyncservice);
-
- file_put_contents("/usr/local/etc/avahi/services/rsync.service", $rsyncservice);
- }
-
- if (isset($config['system']['ssh']['enable'])) {
- $sshservice = str_replace("@PORT@",
- "22",
- $service_template);
- $sshservice = str_replace("@TYPE@",
- "_ssh._tcp",
- $sshservice);
- $sshservice = str_replace("@SERVICE_DESC@",
- "Remote Terminal",
- $sshservice);
- $sshservice = str_replace("@TXT_RECORDS@",
- "",
- $sshservice);
-
- file_put_contents("/usr/local/etc/avahi/services/ssh.service", $sshservice);
- }
-
- if (isset($freenas_config['ftp']['enable'])) {
- /* NOP */
- }
-
- if (isset($freenas_config['samba']['enable'])) {
- $cifsservice = str_replace("@PORT@",
- "139",
- $service_template);
- $cifsservice = str_replace("@TYPE@",
- "_smb._tcp",
- $cifsservice);
- $cifsservice = str_replace("@SERVICE_DESC@",
- "Samba Server",
- $cifsservice);
- $cifsservice = str_replace("@TXT_RECORDS@",
- "",
- $cifsservice);
-
- file_put_contents("/usr/local/etc/avahi/services/cifs.service", $cifsservice);
- }
-
- if (isset($freenas_config['nfs']['enable'])) {
-
- /* If no share configured, exit */
- if (!is_array($freenas_config['mounts']['mount']))
- break;
-
- $a_mount = &$freenas_config['mounts']['mount'];
-
- foreach ($a_mount as $mount) {
- $sharename = str_replace(" ", "", $mount['sharename']);
- $sharename = strtolower($sharename);
-
- $nfsservice = str_replace("@PORT@",
- "2049",
- $service_template);
- $nfsservice = str_replace("@TYPE@",
- "_nfs._tcp",
- $nfsservice);
- $nfsservice = str_replace("@SERVICE_DESC@",
- "NFS Mount: {$mount['sharename']}",
- $nfsservice);
- $nfsservice = str_replace("@TXT_RECORDS@",
- "path=/mnt/{$mount['sharename']}",
- $nfsservice);
-
- file_put_contents("/usr/local/etc/avahi/services/{$sharename}_nfs.service", $nfsservice);
- }
- }
+ if (isset($config['system']['ssh']['enable'])) {
+ $sshservice = str_replace("@PORT@",
+ "22",
+ $service_template);
+ $sshservice = str_replace("@TYPE@",
+ "_ssh._tcp",
+ $sshservice);
+ $sshservice = str_replace("@SERVICE_DESC@",
+ "Remote Terminal",
+ $sshservice);
+ $sshservice = str_replace("@TXT_RECORDS@",
+ "",
+ $sshservice);
+
+ file_put_contents("/usr/local/etc/avahi/services/ssh.service", $sshservice);
+
+ /* do the same for sftp, cause we do enable it by dfeault */
+ $sftpservice = str_replace("@PORT@",
+ "22",
+ $service_template);
+ $sftpservice = str_replace("@TYPE@",
+ "_ssh._tcp",
+ $sftpservice);
+ $sftpservice = str_replace("@SERVICE_DESC@",
+ "Remote Terminal",
+ $sftpservice);
+ $sftpservice = str_replace("@TXT_RECORDS@",
+ "",
+ $sftpservice);
+
+ file_put_contents("/usr/local/etc/avahi/services/ssh-sftp.service", $sftpservice);
+ } // end if
+ /* we are using wzdftpd, which has the ability to announce itself */
+ if (isset($freenas_config['ftp']['enable'])) {
+ /* NOP */
+ }
+
+ if (isset($freenas_config['samba']['enable'])) {
+ $cifsservice = str_replace("@PORT@",
+ "139",
+ $service_template);
+ $cifsservice = str_replace("@TYPE@",
+ "_smb._tcp",
+ $cifsservice);
+ $cifsservice = str_replace("@SERVICE_DESC@",
+ "Samba Server",
+ $cifsservice);
+ $cifsservice = str_replace("@TXT_RECORDS@",
+ "",
+ $cifsservice);
+
+ file_put_contents("/usr/local/etc/avahi/services/cifs.service", $cifsservice);
+ }
+
+ if (isset($freenas_config['nfs']['enable'])) {
+ /* If no share configured, exit */
+ if (!is_array($freenas_config['mounts']['mount'])) { break; }
+
+ $a_mount = &$freenas_config['mounts']['mount'];
+
+ foreach ($a_mount as $mount) {
+ $sharename = str_replace(" ", "", $mount['sharename']);
+ $sharename = strtolower($sharename);
+
+ $nfsservice = str_replace("@PORT@",
+ "2049",
+ $service_template);
+ $nfsservice = str_replace("@TYPE@",
+ "_nfs._tcp",
+ $nfsservice);
+ $nfsservice = str_replace("@SERVICE_DESC@",
+ "NFS Mount: {$mount['sharename']}",
+ $nfsservice);
+ $nfsservice = str_replace("@TXT_RECORDS@",
+ "path=/mnt/{$mount['sharename']}",
+ $nfsservice);
+
+ file_put_contents("/usr/local/etc/avahi/services/{$sharename}_nfs.service", $nfsservice);
+ } // end foreach
+ } // end if
/* run dbus */
mwexec("/usr/local/bin/dbus-daemon --system");
-
/* run avahi */
mwexec("/usr/local/sbin/avahi-daemon -D");
- if ($g['booting'])
- echo "done\n";
-
- return 0;
+ if ($g['booting']) { echo "done\n"; }
+
+ return 0;
}
-function services_howl_configure()
-{
- global $freenas_config, $config, $g;
-
-
- /* kill any mDNSResponder */
- killbyname("mDNSResponder");
-
- if (isset($config['system']['zeroconf_disable']))
- return 0;
-
- $fd = fopen("{$g['varetc_path']}/mDNSResponder.conf", "w");
- if (!$fd)
- {
- printf("Error: cannot open mDNSResponder.conf in services_howl_configure().\n");
- return 1;
- }
-
- if ($config['system']['webgui']['port'])
- {
- $mDNSResponder = <<<EOD
+/* this function is currently not used */
+function services_howl_configure() {
+ global $freenas_config, $config, $g;
+
+ /* kill any mDNSResponder */
+ killbyname("mDNSResponder");
+
+ if (isset($config['system']['zeroconf_disable'])) { return 0; }
+
+ $fd = fopen("{$g['varetc_path']}/mDNSResponder.conf", "w");
+
+ if (!$fd) {
+ printf("Error: cannot open mDNSResponder.conf in services_howl_configure().\n");
+ return 1;
+ }
+
+ if ($config['system']['webgui']['port']) {
+ $mDNSResponder = <<<EOD
"{$config['system']['hostname']} Web Admin" _http._tcp local. {$config['system']['webgui']['port']}
EOD;
- }
- else
- {
- $mDNSResponder = <<<EOD
+ } else {
+ $mDNSResponder = <<<EOD
"{$config['system']['hostname']} Web Admin" _http._tcp local. 80
EOD;
- }
-
-
- if (isset($freenas_config['afp']['enable']))
- {
- $mDNSResponder .= <<<EOD
+ } // end if
+
+ if (isset($freenas_config['afp']['enable'])) {
+ $mDNSResponder .= <<<EOD
"{$config['system']['hostname']} AFP Server" _afpovertcp._tcp local. 548
EOD;
- }
-
- if (isset($freenas_config['rsyncd']['enable']))
- {
- $mDNSResponder .= <<<EOD
+ }
+
+ if (isset($freenas_config['rsyncd']['enable'])) {
+ $mDNSResponder .= <<<EOD
"{$config['system']['hostname']} RSYNC Server" _rsync._tcp. local. {$freenas_config['rsyncd']['port']}
EOD;
- }
-
- if (isset($config['sshd']['enable']))
- {
- $mDNSResponder .= <<<EOD
+ }
+
+ if (isset($config['sshd']['enable'])) {
+ $mDNSResponder .= <<<EOD
"{$config['system']['hostname']} SSH Server" _ssh._tcp local. {$config['sshd']['port']}
EOD;
- }
-
- if (isset($freenas_config['ftp']['enable']))
- {
- $mDNSResponder .= <<<EOD
+ }
+
+ if (isset($freenas_config['ftp']['enable'])) {
+ $mDNSResponder .= <<<EOD
"{$config['system']['hostname']} FTP Server" _ftp._tcp local. {$freenas_config['ftp']['port']}
EOD;
- }
-
- if (isset($freenas_config['samba']['enable']))
- {
- $mDNSResponder .= <<<EOD
+ }
+
+ if (isset($freenas_config['samba']['enable'])) {
+ $mDNSResponder .= <<<EOD
"{$config['system']['hostname']} Samba Server" _smb._tcp local. 139
EOD;
- }
-
- if (isset($freenas_config['nfs']['enable']))
- {
-
- /* If no share configured, exit */
- if (!is_array($freenas_config['mounts']['mount']))
- break;
-
- $a_mount = &$freenas_config['mounts']['mount'];
-
- foreach ($a_mount as $mount)
- {
- $mDNSResponder .= <<<EOD
+ }
+
+ if (isset($freenas_config['nfs']['enable'])) {
+ /* If no share configured, exit */
+ if (!is_array($freenas_config['mounts']['mount'])) { break; }
+
+ $a_mount = &$freenas_config['mounts']['mount'];
+
+ foreach ($a_mount as $mount) {
+ $mDNSResponder .= <<<EOD
"{$config['system']['hostname']} NFS: {$mount['sharename']}" _nfs._tcp local. 2049 path=/mnt/{$mount['sharename']}
EOD;
- }
- }
-
- fwrite($fd, $mDNSResponder);
- fclose($fd);
+ } // end foreach
+ } // end if
+
+ fwrite($fd, $mDNSResponder);
+ fclose($fd);
- /* run mDNSResponder */
- mwexec("/usr/local/sbin/mDNSResponder -f {$g['varetc_path']}/mDNSResponder.conf");
+ /* run mDNSResponder */
+ mwexec("/usr/local/sbin/mDNSResponder -f {$g['varetc_path']}/mDNSResponder.conf");
- if ($g['booting'])
- echo "done\n";
-
- return 0;
+ if ($g['booting']) { echo "done\n"; }
+
+ return 0;
}
-function services_mdnsresponder_configure()
-{
- global $freenas_config, $config, $g;
-
-
- /* kill any running snmpd */
- sigkillbypid("{$g['varrun_path']}/mDNSResponder.pid", "TERM");
+/* this function is currently not used */
+function services_mdnsresponder_configure() {
+ global $freenas_config, $config, $g;
-
- if (isset($config['system']['zeroconf_disable']))
- return 0;
-
- $fd = fopen("{$g['varetc_path']}/mDNSResponder.conf", "w");
- if (!$fd) {
- printf("Error: cannot open mDNSResponder.conf in services_bonjour_configure().\n");
- return 1;
- }
-
- if ($config['system']['webgui']['port']) {
- $mDNSResponder = <<<EOD
+ /* kill any running snmpd */
+ sigkillbypid("{$g['varrun_path']}/mDNSResponder.pid", "TERM");
+
+ if (isset($config['system']['zeroconf_disable'])) { return 0; }
+
+ $fd = fopen("{$g['varetc_path']}/mDNSResponder.conf", "w");
+
+ if (!$fd) {
+ printf("Error: cannot open mDNSResponder.conf in services_bonjour_configure().\n");
+ return 1;
+ }
+
+ if ($config['system']['webgui']['port']) {
+ $mDNSResponder = <<<EOD
"{$config['system']['hostname']} Web Admin"
_http._tcp local.
{$config['system']['webgui']['port']}
EOD;
- }
- else {
- $mDNSResponder = <<<EOD
+ } else {
+ $mDNSResponder = <<<EOD
"{$config['system']['hostname']} Web Admin"
_http._tcp local.
80
EOD;
- }
-
-
- if (isset($freenas_config['afp']['enable'])) {
- $mDNSResponder .= <<<EOD
+ } // end if
+
+ if (isset($freenas_config['afp']['enable'])) {
+ $mDNSResponder .= <<<EOD
"{$config['system']['hostname']} AFP Server"
_afpovertcp._tcp local.
548
EOD;
- }
-
- if (isset($freenas_config['rsyncd']['enable'])) {
- $mDNSResponder .= <<<EOD
+ }
+
+ if (isset($freenas_config['rsyncd']['enable'])) {
+ $mDNSResponder .= <<<EOD
"{$config['system']['hostname']} RSYNC Server"
_rsync._tcp. local.
{$freenas_config['rsyncd']['port']}
EOD;
- }
-
- if (isset($config['sshd']['enable'])) {
- $mDNSResponder .= <<<EOD
+ }
+
+ if (isset($config['sshd']['enable'])) {
+ $mDNSResponder .= <<<EOD
"{$freenas_config['system']['hostname']} SSH Server"
_ssh._tcp local.
{$config['sshd']['port']}
EOD;
- }
-
- if (isset($freenas_config['ftp']['enable'])) {
- $mDNSResponder .= <<<EOD
+ }
+
+ if (isset($freenas_config['ftp']['enable'])) {
+ $mDNSResponder .= <<<EOD
"{$config['system']['hostname']} FTP Server"
_ftp._tcp local.
{$freenas_config['ftp']['port']}
EOD;
- }
-
- if (isset($freenas_config['samba']['enable'])) {
- $mDNSResponder .= <<<EOD
+ }
+
+ if (isset($freenas_config['samba']['enable'])) {
+ $mDNSResponder .= <<<EOD
"{$config['system']['hostname']} Samba Server"
-_smb._tcp local.
+_smb._tcp local.
139
EOD;
- }
-
- if (isset($freenas_config['nfs']['enable'])) {
-
- /* If no share configured, exit */
- if (!is_array($freenas_config['mounts']['mount']))
- break;
-
- $a_mount = &$freenas_config['mounts']['mount'];
-
- foreach ($a_mount as $mount) {
- $mDNSResponder .= <<<EOD
+ }
+
+ if (isset($freenas_config['nfs']['enable'])) {
+ /* If no share configured, exit */
+ if (!is_array($freenas_config['mounts']['mount'])) { break; }
+
+ $a_mount = &$freenas_config['mounts']['mount'];
+
+ foreach ($a_mount as $mount) {
+ $mDNSResponder .= <<<EOD
"{$config['system']['hostname']} NFS: {$mount['sharename']}"
_nfs._tcp local.
2049 path=/mnt/{$mount['sharename']}
EOD;
- }
- }
-
- fwrite($fd, $mDNSResponder);
- fclose($fd);
+ } // end foreach
+ }
+ fwrite($fd, $mDNSResponder);
+ fclose($fd);
- /* run mDNSResponder */
- mwexec("/usr/local/sbin/mDNSResponderPosix -b -f {$g['varetc_path']}/mDNSResponder.conf");
- if ($g['booting'])
- echo "done\n";
-
- return 0;
+ /* run mDNSResponder */
+ mwexec("/usr/local/sbin/mDNSResponderPosix -b -f {$g['varetc_path']}/mDNSResponder.conf");
+
+ if ($g['booting']) { echo "done\n"; }
+
+ return 0;
}
?> \ No newline at end of file
diff --git a/packages/freenas/pkg/freenas_system.inc b/packages/freenas/pkg/freenas_system.inc
index 83751d6b..2bd0a30a 100644
--- a/packages/freenas/pkg/freenas_system.inc
+++ b/packages/freenas/pkg/freenas_system.inc
@@ -1,70 +1,80 @@
<?php
+/* $Id$ */
+/* ========================================================================== */
/*
- guiconfig.inc
- part of m0n0wall (http://m0n0.ch/wall)
-
- Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
- All rights reserved.
-
- Modified for FreeNAS (http://freenas.org) by Olivier Cochard <cochard@gmail.com>
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
+ freenas_system.inc
+ part of pfSense (http://www.pfSense.com)
+ Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name>
+ All rights reserved.
+
+ Based on FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ All rights reserved.
+ */
+/* ========================================================================== */
+/*
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+/* ========================================================================== */
require_once("globals.inc");
$freenas_config =& $config['installedpackages']['freenas']['config'][0];
function system_do_extensions($early = false) {
- global $config, $g;
-
- if (!is_dir("{$g['etc_path']}/inc/ext"))
- return;
-
- $dh = @opendir("{$g['etc_path']}/inc/ext");
- if ($dh) {
- while (($extd = readdir($dh)) !== false) {
- if (($extd === ".") || ($extd === ".."))
- continue;
- $rcfile = "{$g['etc_path']}/inc/ext/" . $extd . "/" . ($early ? "rc.early" : "rc");
- if (file_exists($rcfile))
- passthru($rcfile);
- }
- closedir($dh);
- }
+ global $config, $g;
+
+ if (!is_dir("{$g['etc_path']}/inc/ext")) { return; }
+
+ $dh = @opendir("{$g['etc_path']}/inc/ext");
+
+ if ($dh) {
+ while (($extd = readdir($dh)) !== false) {
+ if (($extd === ".") || ($extd === "..")) { continue; }
+
+ $rcfile = "{$g['etc_path']}/inc/ext/" . $extd . "/" . ($early ? "rc.early" : "rc");
+
+ if (file_exists($rcfile)) { passthru($rcfile); }
+ } // end while
+
+ closedir($dh);
+ } // end if
}
-function system_set_termcap()
-{
- global $config;
-
- if (isset($config['diag']['ipfstatentries'])) {
- $lines = $config['diag']['ipfstatentries'] + 6;
- }
- else {
- $lines = 306;
- }
-
- $termcap = <<<EOD
+function system_set_termcap() {
+ global $config;
+
+ if (isset($config['diag']['ipfstatentries'])) {
+ $lines = $config['diag']['ipfstatentries'] + 6;
+ } else {
+ $lines = 306;
+ }
+
+ /* do not remove the tabs below or replace them using whitespaces */
+ $termcap = <<<EOD
cons25w|ansiw|ansi80x25-raw:\
:am:bs:NP:ms:pt:AX:eo:bw:ut:km:\
:co#80:li#25:pa#64:Co#8:it#8:\
@@ -111,47 +121,49 @@ xterm-basic|xterm common (XFree86):\
EOD;
- if (!file_exists("/usr/share/misc"))
- mkdir("/usr/share/misc");
+ if (!file_exists("/usr/share/misc")) { mkdir("/usr/share/misc"); }
+
+ $fd = @fopen("/usr/share/misc/termcap", "w");
+
+ if (!$fd) {
+ printf("Error: cannot open termcap in system_set_termcap().\n");
+ return 1;
+ }
+
+ chmod("/usr/share/misc/termcap", 0644);
+ fwrite($fd, $termcap);
+ fclose($fd);
- $fd = @fopen("/usr/share/misc/termcap", "w");
- if (!$fd) {
- printf("Error: cannot open termcap in system_set_termcap().\n");
- return 1;
- }
- chmod("/usr/share/misc/termcap", 0644);
- fwrite($fd, $termcap);
- fclose($fd);
-
- return 0;
+ return 0;
}
-function system_users_create()
-{
- /* Create All the passwd file */
- global $config, $g;
-
- if ($g['booting'])
- echo "Generating user database... ";
-
- system_user_masterpasswd();
- system_user_group();
- system_user_pwdmkdb();
-
- if ($g['booting'])
- echo "done\n";
-
- return 0;
+/* TODO: Figure out whether this function can be removed cause
+ * implements its own user management framework.
+ */
+function system_users_create() {
+ /* Create All the passwd file */
+ global $config, $g;
+ if ($g['booting']) { echo "Generating user database... "; }
+
+ system_user_masterpasswd();
+ system_user_group();
+ system_user_pwdmkdb();
+
+ if ($g['booting']) { echo "done\n"; }
+
+ return 0;
}
-function system_user_masterpasswd()
-{
- /* Create the master.passwd file*/
- global $config, $g, $userindex, $groupindex;
+/* TODO: Figure out whether this function can be removed cause
+ * implements its own user management framework.
+ */
+function system_user_masterpasswd() {
+ /* Create the master.passwd file*/
+ global $config, $g, $userindex, $groupindex;
$root = getUNIXRoot();
-
- $masterpasswd = <<<EOD
+
+ $masterpasswd = <<<EOD
root:{$root['password']}:0:0::0:0:Charlie &:/root:/bin/sh
toor:*:0:0::0:0:Bourne-again Superuser:/root:
daemon:*:1:1::0:0:Owner of many system processes:/root:/usr/sbin/nologin
@@ -172,12 +184,10 @@ ftp:*:21:50::0:0:FTP user:/mnt:/sbin/nologin
sshd:*:22:22::0:0:Secure Shell Daemon:/var/empty:/usr/sbin/nologin
EOD;
-
- if (is_array($config['system']['user']))
- {
- foreach ($config['system']['user'] as $user)
- {
- $password= $user['password'];
+
+ if (is_array($config['system']['user'])) {
+ foreach ($config['system']['user'] as $user) {
+ $password= $user['password'];
$groupname = $user['groupname'];
$group =& $config['system']['group'][$groupindex[$groupname]];
@@ -187,63 +197,57 @@ EOD;
if (! empty($newuser)) { $user = $newuser; }
if (! empty($newgroup)) { $group = $newgroup; }
}
-
- if (hasShellAccess($user['name']))
- {
- $masterpasswd .= <<<EOD
+
+ if (hasShellAccess($user['name'])) {
+ $masterpasswd .= <<<EOD
{$user['name']}:{$password}:{$user['uid']}:{$group['gid']}::0:0:{$user['fullname']}:/mnt:/etc/rc.initial
EOD;
- }
- else
- {
- $masterpasswd .= <<<EOD
+ } else {
+ $masterpasswd .= <<<EOD
{$user['name']}:{$password}:{$user['uid']}:{$group['gid']}::0:0:{$user['fullname']}:/mnt:/usr/local/bin/scponly
EOD;
- }
- }
+ } // end if
+ } // end foreach
+ } // end if
- }
-
- $fd = fopen("/etc/master.passwd", "w");
- if (!$fd)
- {
- printf("Error: cannot open master.passwd in system_user_masterpasswd().\n");
- return 1;
- }
+ $fd = fopen("/etc/master.passwd", "w");
+
+ if (!$fd) {
+ printf("Error: cannot open master.passwd in system_user_masterpasswd().\n");
+ return 1;
+ }
+ fwrite($fd, $masterpasswd);
+ fclose($fd);
- fwrite($fd, $masterpasswd);
- fclose($fd);
-
- return 0;
+return 0;
}
-function system_user_group()
-{
- /* Create the group file*/
- global $config, $g;
-
- $groupfile = <<<EOD
+/* TODO: Figure out whether this function can be removed cause
+ * implements its own user management framework.
+ */
+function system_user_group() {
+ /* Create the group file*/
+ global $config, $g;
+
+ $groupfile = <<<EOD
wheel:*:0:root
EOD;
- /* If user exist with full shell, put them on the wheel group */
- if (is_array($config['system']['user']))
- {
- foreach ($config['system']['user'] as $user)
- {
- if (hasShellAccess($user['name']) && isSystemAdmin($user['name']))
- {
- $groupfile .= <<<EOD
+ /* If user exist with full shell, put them on the wheel group */
+ if (is_array($config['system']['user'])) {
+ foreach ($config['system']['user'] as $user) {
+ if (hasShellAccess($user['name']) && isSystemAdmin($user['name'])) {
+ $groupfile .= <<<EOD
,{$user['name']}
EOD;
- }
- }
- }
+ } // end if
+ } // end foreach
+ } // end if
- $groupfile .= <<<EOD
+ $groupfile .= <<<EOD
daemon:*:1:
kmem:*:2:
@@ -255,21 +259,18 @@ bin:*:7:
staff:*:20:
EOD;
- /* If user exist without full shell, put them on the staff group */
- if (is_array($config['system']['user']))
- {
- foreach ($config['system']['user'] as $user)
- {
- if (hasShellAccess($user['name']))
- {
- $groupfile .= <<<EOD
+ /* If user exist without full shell, put them on the staff group */
+ if (is_array($config['system']['user'])) {
+ foreach ($config['system']['user'] as $user) {
+ if (hasShellAccess($user['name'])) {
+ $groupfile .= <<<EOD
{$user['name']},
EOD;
- }
- }
- }
+ } // end if
+ } // end foreach
+ } // end if
- $groupfile .= <<<EOD
+ $groupfile .= <<<EOD
sshd:*:22:
smmsp:*:25:
@@ -287,111 +288,102 @@ nobody:*:65534:
admin:*:0:
EOD;
- if (is_array($config['system']['group']))
- {
- foreach ($config['system']['group'] as $group)
- {
+
+ if (is_array($config['system']['group'])) {
+ foreach ($config['system']['group'] as $group) {
if (empty($group['gid'])) {
$newgroup = assignGID($group['name']);
if (! empty($newgroup)) { $group = $newgroup; }
}
- $groupfile .= <<<EOD
+ $groupfile .= <<<EOD
{$group['name']}:*:{$group['gid']}:
EOD;
+ } // end foreach
+ } // end if
- }
- }
+ $fd = fopen("/etc/group", "w");
+
+ if (!$fd) {
+ printf("Error: cannot open group in system_user_group().\n");
+ return 1;
+ }
- $fd = fopen("/etc/group", "w");
- if (!$fd)
- {
- printf("Error: cannot open group in system_user_group().\n");
- return 1;
- }
+ fwrite($fd, $groupfile);
+ fclose($fd);
+ return 0;
+}
- fwrite($fd, $groupfile);
- fclose($fd);
+function system_user_pwdmkdb() {
+ /* Generate the db of password */
+ global $config, $g;
- return 0;
+ mwexec("/usr/sbin/pwd_mkdb -p -d /etc /etc/master.passwd");
+ return 0;
}
-function system_user_pwdmkdb()
-{
- /* Generate the db of password */
- global $config, $g;
-
- mwexec("/usr/sbin/pwd_mkdb -p -d /etc /etc/master.passwd");
+function system_user_samba() {
+ /* Generate the db of password */
+
+ // TODO: MUST FIND A WAY OF USING UNIX CRYPTED PASSWORD IN THE PLACE OF CLEAR TEXT PASSWORD FOR GENERATING SAMBA DB!!!
+
+ global $config, $g;
+
+ if (is_array($config['system']['user'])) {
+ foreach ($config['system']['user'] as $user) {
+ /* TODO: the password in config.xml is already encrypted */
+ $password = escapeshellcmd($user['password']);
+ $login = escapeshellcmd($user['name']);
+ mwexec("(/bin/echo {$password}; /bin/echo {$password}) | /usr/local/bin/smbpasswd -s -a {$login}");
+ //mwexec("(/bin/echo {$password}; /bin/echo {$password}) | /usr/local/bin/pdbedit -tau {$login}");
+ } // end foreach
+ } // end if
- return 0;
+ return 0;
}
-function system_user_samba()
-{
- /* Generate the db of password */
- global $config, $g;
-
- if (is_array($config['system']['user']))
- {
-
- foreach ($config['system']['user'] as $user)
- {
- /* TODO: the password in config.xml is already encrypted */
- $password = escapeshellcmd($user['password']);
- $login = escapeshellcmd($user['name']);
- mwexec("(/bin/echo {$password}; /bin/echo {$password}) | /usr/local/bin/smbpasswd -s -a {$login}");
- //mwexec("(/bin/echo {$password}; /bin/echo {$password}) | /usr/local/bin/pdbedit -tau {$login}");
- }
- }
-
- return 0;
+function system_pam_configure() {
+ /* Create the pam configuration files*/
+ global $config, $g;
-}
+ if (!file_exists("{$g['varetc_path']}/pam.d")) {
+ mkdir("{$g['varetc_path']}/pam.d", 0744);
+ }
-function system_pam_configure()
-{
- /* Create the pam configuration files*/
- global $config, $g;
-
- if (!file_exists("{$g['varetc_path']}/pam.d"))
- mkdir("{$g['varetc_path']}/pam.d", 0744);
-
- $system = <<<EOD
- # System-wide defaults
+ $system = <<<EOD
+# System-wide defaults
# auth
auth sufficient pam_opie.so no_warn no_fake_prompts
auth requisite pam_opieaccess.so no_warn allow_local
EOD;
-
- if (isset($config['ad']['enable']))
- {
- $system .= <<<EOD
+
+ if (isset($config['ad']['enable'])) {
+ $system .= <<<EOD
#auth sufficient /usr/local/lib/pam_winbind.so debug try_first_pass
EOD;
- }
+ }
- $system .= <<<EOD
+ $system .= <<<EOD
auth required pam_unix.so no_warn try_first_pass nullok
# account
EOD;
- if (isset($config['ad']['enable']))
- {
- $system .= <<<EOD
+ if (isset($config['ad']['enable'])) {
+ $system .= <<<EOD
#account sufficient /usr/local/lib/pam_winbind.so
EOD;
- }
+ }
- $system .= <<<EOD
+ $system .= <<<EOD
account required pam_login_access.so
account required pam_unix.so
@@ -401,32 +393,30 @@ session required pam_lastlog.so no_fail
# password
EOD;
-
- if (isset($config['ad']['enable']))
- {
- $system .= <<<EOD
+
+ if (isset($config['ad']['enable'])) {
+ $system .= <<<EOD
#password sufficient /usr/local/lib/pam_winbind.so debug try_first_pass
EOD;
- }
-
- $system .= <<<EOD
+ }
+
+ $system .= <<<EOD
password required pam_unix.so no_warn try_first_pass
EOD;
-
-
- $fd = fopen("{$g['varetc_path']}/pam.d/system", "w");
- if (!$fd)
- {
- printf("Error: cannot open /pam.d/system in system_pam_configure().\n");
- return 1;
- }
- fwrite($fd, $system);
- fclose($fd);
+ $fd = fopen("{$g['varetc_path']}/pam.d/system", "w");
- $sshd .= <<<EOD
+ if (!$fd) {
+ printf("Error: cannot open /pam.d/system in system_pam_configure().\n");
+ return 1;
+ }
+
+ fwrite($fd, $system);
+ fclose($fd);
+
+ $sshd .= <<<EOD
# PAM configuration for the "sshd" service
# auth
@@ -436,30 +426,28 @@ auth requisite pam_opieaccess.so no_warn allow_local
EOD;
- if (isset($config['ad']['enable']))
- {
- $sshd .= <<<EOD
+ if (isset($config['ad']['enable'])) {
+ $sshd .= <<<EOD
auth sufficient /usr/local/lib/pam_winbind.so debug try_first_pass
EOD;
- }
+ }
- $sshd .= <<<EOD
+ $sshd .= <<<EOD
auth required pam_unix.so no_warn try_first_pass
# account
EOD;
- if (isset($config['ad']['enable']))
- {
- $sshd .= <<<EOD
+ if (isset($config['ad']['enable'])) {
+ $sshd .= <<<EOD
account sufficient /usr/local/lib/pam_winbind.so
EOD;
- }
+ }
- $sshd .= <<<EOD
+ $sshd .= <<<EOD
account required pam_unix.so
# session
@@ -469,32 +457,30 @@ session required pam_permit.so
EOD;
-if (isset($config['ad']['enable']))
- {
- $sshd .= <<<EOD
+ if (isset($config['ad']['enable'])) {
+ $sshd .= <<<EOD
password sufficient /usr/local/lib/pam_winbind.so debug try_first_pass
EOD;
- }
+ }
-
-$sshd .= <<<EOD
+ $sshd .= <<<EOD
password required pam_unix.so no_warn try_first_pass
EOD;
-
- unset($fd);
- $fd = fopen("{$g['varetc_path']}/pam.d/sshd", "w");
- if (!$fd)
- {
- printf("Error: cannot open /pam.d/sshd in system_pam_configure().\n");
- return 1;
- }
- fwrite($fd, $sshd);
- fclose($fd);
-
- $ftp = <<<EOD
+ unset($fd);
+ $fd = fopen("{$g['varetc_path']}/pam.d/sshd", "w");
+
+ if (!$fd) {
+ printf("Error: cannot open /pam.d/sshd in system_pam_configure().\n");
+ return 1;
+ }
+
+ fwrite($fd, $sshd);
+ fclose($fd);
+
+ $ftp = <<<EOD
# PAM configuration for the "ftpd" service
# auth
@@ -504,30 +490,28 @@ auth requisite pam_opieaccess.so no_warn allow_local
EOD;
- if (isset($config['ad']['enable']))
- {
- $ftp .= <<<EOD
+ if (isset($config['ad']['enable'])) {
+ $ftp .= <<<EOD
auth sufficient /usr/local/lib/pam_winbind.so debug try_first_pass
EOD;
- }
+ }
- $ftp .= <<<EOD
+ $ftp .= <<<EOD
auth required pam_unix.so no_warn try_first_pass
# account
EOD;
-if (isset($config['ad']['enable']))
- {
- $ftp .= <<<EOD
+ if (isset($config['ad']['enable'])) {
+ $ftp .= <<<EOD
account sufficient /usr/local/lib/pam_winbind.so
EOD;
- }
+ }
- $ftp .= <<<EOD
+ $ftp .= <<<EOD
account required pam_login_access.so
account required pam_unix.so
@@ -535,21 +519,19 @@ account required pam_unix.so
session required pam_permit.so
EOD;
-
- unset($fd);
-
- $fd = fopen("{$g['varetc_path']}/pam.d/ftp", "w");
- if (!$fd)
- {
- printf("Error: cannot open /pam.d/ftp in system_pam_configure().\n");
- return 1;
- }
-
- fwrite($fd, $ftp);
- fclose($fd);
-
-
- $login = <<<EOD
+
+ unset($fd);
+ $fd = fopen("{$g['varetc_path']}/pam.d/ftp", "w");
+
+ if (!$fd) {
+ printf("Error: cannot open /pam.d/ftp in system_pam_configure().\n");
+ return 1;
+ }
+
+ fwrite($fd, $ftp);
+ fclose($fd);
+
+ $login = <<<EOD
# PAM configuration for the "login" service
#
@@ -558,15 +540,14 @@ auth required pam_nologin.so no_warn
EOD;
- if (isset($config['ad']['enable']))
- {
- $login .= <<<EOD
+ if (isset($config['ad']['enable'])) {
+ $login .= <<<EOD
auth sufficient /usr/local/lib/pam_winbind.so debug try_first_pass
EOD;
- }
+ }
- $login .= <<<EOD
+ $login .= <<<EOD
auth sufficient pam_self.so no_warn
auth include system
@@ -574,15 +555,14 @@ auth include system
EOD;
-if (isset($config['ad']['enable']))
- {
- $login .= <<<EOD
+ if (isset($config['ad']['enable'])) {
+ $login .= <<<EOD
account sufficient /usr/local/lib/pam_winbind.so
EOD;
- }
+ }
- $login .= <<<EOD
+ $login .= <<<EOD
account requisite pam_securetty.so
account include system
@@ -593,27 +573,23 @@ session include system
password include system
EOD;
-
- unset($fd);
-
- $fd = fopen("{$g['varetc_path']}/pam.d/login", "w");
- if (!$fd)
- {
- printf("Error: cannot open /pam.d/login in system_pam_configure().\n");
- return 1;
- }
-
- fwrite($fd, $login);
- fclose($fd);
-
- unset($fd);
-
- /* Create the nsswitch.conf file*/
-
-
- if (isset($config['ad']['enable']))
- {
- $nsswitch = <<<EOD
+
+ unset($fd);
+ $fd = fopen("{$g['varetc_path']}/pam.d/login", "w");
+
+ if (!$fd) {
+ printf("Error: cannot open /pam.d/login in system_pam_configure().\n");
+ return 1;
+ }
+
+ fwrite($fd, $login);
+ fclose($fd);
+
+ unset($fd);
+
+ /* Create the nsswitch.conf file*/
+ if (isset($config['ad']['enable'])) {
+ $nsswitch = <<<EOD
group: files winbind
group_compat: nis
hosts: files dns wins
@@ -623,11 +599,8 @@ passwd_compat: nis
shells: files
EOD;
-
- }
- else
- {
- $nsswitch = <<<EOD
+ } else {
+ $nsswitch = <<<EOD
group: compat
group_compat: nis
hosts: files dns
@@ -637,248 +610,229 @@ passwd_compat: nis
shells: files
EOD;
- }
-
-
- $fd = fopen("{$g['varetc_path']}/nsswitch.conf", "w");
- if (!$fd)
- {
- printf("Error: cannot open /var/etc/nsswitch.conf in system_pam_configure().\n");
- return 1;
- }
+ } // end if
+
+ $fd = fopen("{$g['varetc_path']}/nsswitch.conf", "w");
- fwrite($fd, $nsswitch);
- fclose($fd);
-
- unset($fd);
-
- return 0;
+ if (!$fd) {
+ printf("Error: cannot open /var/etc/nsswitch.conf in system_pam_configure().\n");
+ return 1;
+ }
-}
+ fwrite($fd, $nsswitch);
+ fclose($fd);
-function system_tuning()
-{
- /* fine tune kernel value */
- global $config, $g;
-
- if (isset($config['system']['tune'])) {
-
- if ($g['booting'])
- echo 'Tuning the system... ';
-
- mwexec('/sbin/sysctl net.inet.tcp.delayed_ack=0');
- mwexec('/sbin/sysctl net.inet.tcp.sendspace=65536');
- mwexec('/sbin/sysctl net.inet.tcp.recvspace=65536');
- mwexec('/sbin/sysctl net.inet.udp.recvspace=65536');
- mwexec('/sbin/sysctl net.inet.udp.maxdgram=57344');
- mwexec('/sbin/sysctl net.local.stream.recvspace=65535');
- mwexec('/sbin/sysctl net.local.stream.sendspace=65535');
- mwexec('/sbin/sysctl kern.ipc.maxsockbuf=2097152');
- mwexec('/sbin/sysctl kern.ipc.somaxconn=8192');
- /* mwexec('/sbin/sysctl kern.ipc.maxsockets=16424'); */
- mwexec('/sbin/sysctl kern.ipc.nmbclusters=60000');
- mwexec('/sbin/sysctl kern.maxfiles=65536');
- mwexec('/sbin/sysctl kern.maxfilesperproc=32768');
- mwexec('/sbin/sysctl net.inet.tcp.inflight.enable=0');
-
- if ($g['booting'])
- echo "done\n";
- return 0;
-
- }
- else {
- // Set the default value (if previously changed) if not booting mode
- if (!$g['booting']) {
- mwexec('/sbin/sysctl net.inet.tcp.delayed_ack=1');
- mwexec('/sbin/sysctl net.inet.tcp.sendspace=32768');
- mwexec('/sbin/sysctl net.inet.tcp.recvspace=65536');
- mwexec('/sbin/sysctl net.inet.udp.recvspace=42080');
- mwexec('/sbin/sysctl net.inet.udp.maxdgram=9216');
- mwexec('/sbin/sysctl net.local.stream.recvspace=8192');
- mwexec('/sbin/sysctl net.local.stream.sendspace=8192');
- mwexec('/sbin/sysctl kern.ipc.maxsockbuf=262144');
- mwexec('/sbin/sysctl kern.ipc.somaxconn=128');
- /* mwexec('/sbin/sysctl kern.ipc.maxsockets=16424'); */
- mwexec('/sbin/sysctl kern.ipc.nmbclusters=3072');
- mwexec('/sbin/sysctl kern.maxfiles=1064');
- mwexec('/sbin/sysctl kern.maxfilesperproc=957');
- }
-
- return 0;
- }
+ unset($fd);
+ return 0;
}
-function system_install_mount_cd($cdrom)
-{
- /* Part of install process: Mount the CDROM */
-
- global $config, $g;
-
- /* Creating tempo directory for cdrom*/
- echo "Creating Mount point for the CDROM:\n";
- if (mwexec("/bin/mkdir /mnt/cdrom_fr_0507"))
- return 1;
-
- /* Monting the CDROM */
- echo "Mount CDROM:\n";
- if (mwexec("/sbin/mount_cd9660 /dev/$cdrom /mnt/cdrom_fr_0507"))
- return 1;
-
- return 0;
+function system_tuning() {
+ /* fine tune kernel value */
+ global $config, $g;
+
+ if (isset($config['system']['tune'])) {
+ if ($g['booting']) { echo 'Tuning the system... '; }
+
+ mwexec('/sbin/sysctl net.inet.tcp.delayed_ack=0');
+ mwexec('/sbin/sysctl net.inet.tcp.sendspace=65536');
+ mwexec('/sbin/sysctl net.inet.tcp.recvspace=65536');
+ mwexec('/sbin/sysctl net.inet.udp.recvspace=65536');
+ mwexec('/sbin/sysctl net.inet.udp.maxdgram=57344');
+ mwexec('/sbin/sysctl net.local.stream.recvspace=65535');
+ mwexec('/sbin/sysctl net.local.stream.sendspace=65535');
+ mwexec('/sbin/sysctl kern.ipc.maxsockbuf=2097152');
+ mwexec('/sbin/sysctl kern.ipc.somaxconn=8192');
+ /* This variable can be set on the boot conf file only: */
+ /* mwexec('/sbin/sysctl kern.ipc.maxsockets=16424'); */
+ mwexec('/sbin/sysctl kern.ipc.nmbclusters=60000');
+ mwexec('/sbin/sysctl kern.maxfiles=65536');
+ mwexec('/sbin/sysctl kern.maxfilesperproc=32768');
+ mwexec('/sbin/sysctl net.inet.tcp.inflight.enable=0');
+
+ if ($g['booting']) { echo "done\n"; }
+ return 0;
+ } else {
+ /* Set the default value (if previously changed) if not booting mode */
+ if (!$g['booting']) {
+ mwexec('/sbin/sysctl net.inet.tcp.delayed_ack=1');
+ mwexec('/sbin/sysctl net.inet.tcp.sendspace=32768');
+ mwexec('/sbin/sysctl net.inet.tcp.recvspace=65536');
+ mwexec('/sbin/sysctl net.inet.udp.recvspace=42080');
+ mwexec('/sbin/sysctl net.inet.udp.maxdgram=9216');
+ mwexec('/sbin/sysctl net.local.stream.recvspace=8192');
+ mwexec('/sbin/sysctl net.local.stream.sendspace=8192');
+ mwexec('/sbin/sysctl kern.ipc.maxsockbuf=262144');
+ mwexec('/sbin/sysctl kern.ipc.somaxconn=128');
+ /* mwexec('/sbin/sysctl kern.ipc.maxsockets=16424'); */
+ mwexec('/sbin/sysctl kern.ipc.nmbclusters=3072');
+ mwexec('/sbin/sysctl kern.maxfiles=1064');
+ mwexec('/sbin/sysctl kern.maxfilesperproc=957');
+ } // end if
+
+ return 0;
+ } // end if
}
-function system_install_init_fulldisk($harddrive)
-{
-
- /* Part of install process: Initialize the destination disk with one partition */
-
- global $config, $g;
-
- echo "Erasing partitions:\n";
- if (mwexec("/bin/dd if=/dev/zero of=/dev/$harddrive bs=1k count=20"))
- return 1;
-
- echo "Creating the primary partition and install simple MBR:\n";
- if (mwexec("/sbin/fdisk -BI -b /boot/mbr $harddrive"))
- return 1;
-
- /* Must wait that the /dev is upatded with the new information */
- echo "Waiting for system update..";
- $devtotest="/dev/$harddrive". "s1";
- $i=0;
-
- while (!file_exists($devtotest)) {
- sleep(1);
- echo ".";
- $i++;
- if ($i==20)
- return 1;
- }
- echo "\n";
-
- echo "Erasing primary partition:\n";
- if (mwexec("/bin/dd if=/dev/zero of=/dev/" . escapeshellarg($harddrive) . "s1 bs=32k count=16"))
- return 1;
-
- echo "Creating FreeBSD partition:\n";
- if (mwexec("/sbin/bsdlabel -B -w -b /boot/boot " . escapeshellarg($harddrive) ."s1 auto"))
- return 1;
-
- echo "Setting BSDlabel:\n";
-
- disks_bsdlabel($harddrive,"s1","4.2BSD");
-
- echo "Creating UFS filesystem:\n";
- if (mwexec("/sbin/newfs -U /dev/" . escapeshellarg($harddrive) . "s1"))
- return 1;
-
- return 0;
+/* TODO: Probably a function that is not needed */
+function system_install_mount_cd($cdrom) {
+ /* Part of install process: Mount the CDROM */
+ global $config, $g;
+
+ /* Creating tempo directory for cdrom*/
+ echo "Creating Mount point for the CDROM:\n";
+ if (mwexec("/bin/mkdir /mnt/cdrom_fr_0507")) { return 1; }
+
+ /* Mounting the CDROM */
+ echo "Mount CDROM:\n";
+ if (mwexec("/sbin/mount_cd9660 /dev/$cdrom /mnt/cdrom_fr_0507")) { return 1; }
+
+ return 0;
}
+/* TODO: Probably a function that is not needed */
+function system_install_init_fulldisk($harddrive) {
+ /* Part of install process: Initialize the destination disk with one partition */
+ global $config, $g;
+
+ echo "Erasing partitions:\n";
+ if (mwexec("/bin/dd if=/dev/zero of=/dev/$harddrive bs=1k count=20")) { return 1; }
+
+ echo "Creating the primary partition and install simple MBR:\n";
+ if (mwexec("/sbin/fdisk -BI -b /boot/mbr $harddrive")) { return 1; }
+
+ /* Must wait that the /dev is upatded with the new information */
+ /* There should be a more intelligent code here than this stupid timer... */
+ echo "Waiting for system update..";
+ $devtotest="/dev/$harddrive". "s1";
+ $i=0;
+
+ while (!file_exists($devtotest)) {
+ sleep(1);
+ echo ".";
+ $i++;
+
+ if ($i==20) { return 1; }
+ }
+ echo "\n";
+
+ echo "Erasing primary partition:\n";
+ if (mwexec("/bin/dd if=/dev/zero of=/dev/" . escapeshellarg($harddrive) . "s1 bs=32k count=16")) {
+ return 1;
+ }
+
+ echo "Creating FreeBSD partition:\n";
+ if (mwexec("/sbin/bsdlabel -B -w -b /boot/boot " . escapeshellarg($harddrive) ."s1 auto")) {
+ return 1;
+ }
+
+ echo "Setting BSDlabel:\n";
+
+ disks_bsdlabel($harddrive,"s1","4.2BSD");
-function system_install_init_halfdisk($harddrive)
-{
- /* Part of install process: Initialize the destination disk with 2 partitions */
-
- global $config, $g;
-
- /* Create the partitions */
- fdisk_hd_install($harddrive);
-
- if (mwexec("(/bin/echo y; /bin/echo y) | /sbin/fdisk -B -b /boot/mbr $harddrive"))
- return 0;
-
- /* Must wait that the /dev is upatded with the new information */
-
- echo "Waiting for system update..";
-
- $devtotest="/dev/$harddrive". "s2";
- $i=0;
- while (!file_exists($devtotest))
- {
- sleep(1);
- echo ".";
- $i++;
- if ($i==20)
- return 1;
- }
- echo "\n";
-
- echo "Creating BSD Label:\n";
- if (mwexec("/sbin/bsdlabel -B -w -b /boot/boot " . escapeshellarg($harddrive) ."s1 auto"))
- return 1;
- if (mwexec("/sbin/bsdlabel -w " . escapeshellarg($harddrive) ."s2 auto"))
- return 1;
-
- echo "Modify BSD Label information:\n";
-
- disks_bsdlabel($harddrive,"s1","4.2BSD");
- disks_bsdlabel($harddrive,"s2","4.2BSD");
-
- echo "Creating filesystem:\n";
- if (mwexec("/sbin/newfs -U /dev/" . escapeshellarg($harddrive) . "s1"))
- return 1;
- if (mwexec("/sbin/newfs -U /dev/" . escapeshellarg($harddrive) . "s2"))
- return 1;
-
- return 0;
+ echo "Creating UFS filesystem:\n";
+ if (mwexec("/sbin/newfs -U /dev/" . escapeshellarg($harddrive) . "s1")) { return 1; }
+ return 0;
}
-function system_install_mount_destdisk($harddrive)
-{
-
- /* Part of install process: Mount the destination disk */
-
- global $config, $g;
-
- echo "Creation tempory mouting point:\n";
- if (mwexec("/bin/mkdir /mnt/install_fr_0507"))
- return 1;
-
- echo "Mount destination disk:\n";
- if (mwexec("/sbin/mount /dev/" . escapeshellarg($harddrive) . "s1 /mnt/install_fr_0507"))
- return 1;
-
- return 0;
-
+/* TODO: Probably a function that is not needed */
+function system_install_init_halfdisk($harddrive) {
+ /* Part of install process: Initialize the destination disk with 2 partitions */
+ global $config, $g;
+
+ /* Create the partitions */
+ fdisk_hd_install($harddrive);
+
+ if (mwexec("(/bin/echo y; /bin/echo y) | /sbin/fdisk -B -b /boot/mbr $harddrive")) { return 0; }
+
+ /* Must wait that the /dev is upatded with the new information */
+ echo "Waiting for system update..";
+
+ $devtotest="/dev/$harddrive". "s2";
+ $i=0;
+ while (!file_exists($devtotest)) {
+ sleep(1);
+ echo ".";
+ $i++;
+
+ if ($i==20) { return 1; }
+ }
+ echo "\n";
+
+ echo "Creating BSD Label:\n";
+ if (mwexec("/sbin/bsdlabel -B -w -b /boot/boot " . escapeshellarg($harddrive) ."s1 auto")) {
+ return 1;
+ }
+ if (mwexec("/sbin/bsdlabel -w " . escapeshellarg($harddrive) ."s2 auto")) {
+ return 1;
+ }
+
+ echo "Modify BSD Label information:\n";
+
+ disks_bsdlabel($harddrive,"s1","4.2BSD");
+ disks_bsdlabel($harddrive,"s2","4.2BSD");
+
+ echo "Creating filesystem:\n";
+ if (mwexec("/sbin/newfs -U /dev/" . escapeshellarg($harddrive) . "s1")) {
+ return 1;
+ }
+ if (mwexec("/sbin/newfs -U /dev/" . escapeshellarg($harddrive) . "s2")) {
+ return 1;
+ }
+
+ return 0;
}
+/* TODO: Probably a function that is not needed */
+function system_install_mount_destdisk($harddrive) {
+ /* Part of install process: Mount the destination disk */
+ global $config, $g;
+
+ echo "Creation tempory mouting point:\n";
+ if (mwexec("/bin/mkdir /mnt/install_fr_0507")) { return 1; }
+
+ echo "Mount destination disk:\n";
+ if (mwexec("/sbin/mount /dev/" . escapeshellarg($harddrive) . "s1 /mnt/install_fr_0507")) {
+ return 1;
+ }
-function system_install_unmount()
-{
-
- /* Part of install process: Unmounting the disk */
-
- global $config, $g;
-
- /* Unmounting disk */
- if (mwexec("/sbin/umount /mnt/install_fr_0507"))
- return 1;
- if (mwexec("/sbin/umount /mnt/cdrom_fr_0507"))
- return 1;
- if (mwexec("/bin/rm -rf /mnt/cdrom_fr_0507"))
- return 1;
- if (mwexec("/bin/rm -rf /mnt/install_fr_0507"))
- return 1;
-
- return 0;
+ return 0;
}
-function system_install_installation($harddrive)
-{
- /* Part of install process: dd image file on the destination disk */
-
- global $config, $g;
-
- echo "Installation:\n";
-
- if (mwexec("/usr/bin/gunzip -S \"\" -c /mnt/cdrom_fr_0507/FreeNAS-generic-pc.gz | dd of=/dev/" . escapeshellarg($harddrive) . " bs=16k > /dev/null 2>&1"))
- return 1;
-
- return 0;
+/* TODO: Probably a function that is not needed */
+function system_install_unmount() {
+ /* Part of install process: Unmounting the disk */
+ global $config, $g;
+
+ /* Unmounting disk */
+ if (mwexec("/sbin/umount /mnt/install_fr_0507")) { return 1; }
+ if (mwexec("/sbin/umount /mnt/cdrom_fr_0507")) { return 1; }
+
+ /* using 'rm -rf' for deleting the temp directory is too dangerous here... */
+ /*
+ if (mwexec("/bin/rm -rf /mnt/cdrom_fr_0507")) { return 1; }
+ if (mwexec("/bin/rm -rf /mnt/install_fr_0507")) { return 1; }
+ */
+
+ /* Test: replace with PHP function rmdir */
+ @rmdir ("/mnt/cdrom_fr_0507");
+ @rmdir ("/mnt/install_fr_0507");
+
+ return 0;
+}
+
+/* TODO: Probably a function that is not needed */
+function system_install_installation($harddrive) {
+ /* Part of install process: dd image file on the destination disk */
+ global $config, $g;
+
+ echo "Installation:\n";
+ if (mwexec("/usr/bin/gunzip -S \"\" -c /mnt/cdrom_fr_0507/FreeNAS-generic-pc.gz | dd of=/dev/" . escapeshellarg($harddrive) . " bs=16k > /dev/null 2>&1")) {
+ return 1;
+ }
+ return 0;
}
?> \ No newline at end of file
diff --git a/packages/freenas/pkg/freenas_utils.inc b/packages/freenas/pkg/freenas_utils.inc
index d3b1379c..a18a9795 100644
--- a/packages/freenas/pkg/freenas_utils.inc
+++ b/packages/freenas/pkg/freenas_utils.inc
@@ -1,680 +1,1044 @@
<?php
/* $Id$ */
+/* ========================================================================== */
/*
- utils.inc
- part of FreeNAS (http://www.freenas.org)
- Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
- All rights reserved.
-
- Based on m0n0wall (http://m0n0.ch/wall)
- Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
- All rights reserved.
-
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
+ freenas_utils.inc
+ part of pfSense (http://www.pfSense.com)
+ Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name>
+ All rights reserved.
+
+ Based on FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ All rights reserved.
+ */
+/* ========================================================================== */
+/*
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+/* ========================================================================== */
/* returns true if $desc is a valid description (alphanum and space, _ , - , .)*/
-function is_validdesc($desc)
-{
-
- if (!is_string($desc))
- return false;
-
- if (preg_match("/^[A-Za-z0-9]([A-Za-z0-9_\-\.\s]*[A-Za-z0-9])*$/", $desc))
- return true;
- else
- return false;
+function is_validdesc($desc) {
+ if (!is_string($desc)) { return false; }
+
+ if (preg_match("/^[A-Za-z0-9]([A-Za-z0-9_\-\.\s]*[A-Za-z0-9])*$/", $desc)) {
+ return true;
+ } else {
+ return false;
+ }
}
/* returns true if $login is a valid login name (alphanum,dot, _ , -)*/
-function is_validlogin($login)
-{
-
- if (!is_string($login))
- return false;
-
- if (preg_match("/^[A-Za-z0-9]([A-Za-z0-9_\-\.\s]*[A-Za-z0-9])*$/", $login))
- return true;
-
- else
- return false;
+function is_validlogin($login) {
+ if (!is_string($login)) { return false; }
+
+ if (preg_match("/^[A-Za-z0-9]([A-Za-z0-9_\-\.\s]*[A-Za-z0-9])*$/", $login)) {
+ return true;
+ } else {
+ return false;
+ }
+}
+
+/* returns true if $password is a valid password (not used of special : character)*/
+function is_validpassword($password) {
+ if (!is_string($password)) { return false; }
+
+ if (strstr($password, ':')) {
+ return false;
+ } else {
+ return true;
+ }
}
/* returns true if $login is a valid share name (alphanum,dot, _ , -)*/
-function is_validsharename($sharename)
-{
-
- if (!is_string($sharename))
- return false;
-
- if (preg_match("/^[A-Za-z0-9]([A-Za-z0-9_\-\.\s]*[A-Za-z0-9])*$/", $sharename))
- return true;
-
- else
- return false;
+function is_validsharename($sharename) {
+ if (!is_string($sharename)) { return false; }
+
+ if (preg_match("/^[A-Za-z0-9]([A-Za-z0-9_\-\.\s]*[A-Za-z0-9])*$/", $sharename)){
+ return true;
+ } else {
+ return false;
+ }
+}
+
+/* Returns true if $workgroup is a valid workgroup name */
+/* A workgroup name can contain up to 15 characters, including letters, numbers, */
+/* and the following characters: ! @ # $ % ^ & ( ) _ - ; : ' " , . */
+/* It cannot contain any spaces, and must begin with a letter or number. */
+function is_workgroup($workgroup) {
+ if (!is_string($workgroup)) { return false; }
+
+ if (preg_match("/^[\w\d]+[\w\d\!\@\#\$\%\^\&\(\)\_\-\;\:\'\"\,\.]*$/", $workgroup)) {
+ return true;
+ } else {
+ return false;
+ }
}
function get_mounts_list()
{
- // Return list of mounted disk
- //example: Array
- // [0] => Array
- // (
- // [mp] => /mnt/ad0s1
- // [mdisk] => ad0s1
- // )
-
-
- global $g;
-
- exec("/sbin/mount",$rawdata);
-
- $mountlist = array();
- $i=0;
-
- foreach ($rawdata as $line)
- {
- $aline = explode(" ", $line);
-
- if ((chop($aline[0]) == "/dev/md0") || (chop($aline[0]) == "devfs") || (chop($aline[0]) == "/dev/fd0"))
- continue;
- $mountlist[$i]['mp']=chop($aline[2]);
- // Get the complete name /dev/devicename
-
- $complete=explode("/",chop($aline[0]));
-
- $devname=$complete[2];
-
- // Test if it's a gvinum or gmirror device
- if ((strcmp($devname,"gvinum") == 0) || (strcmp($devname,"mirror") == 0))
- $devname=$complete[3];
-
- $mountlist[$i]['mdisk']=$devname;
- $i++;
- }
-
- return $mountlist;
+ // Return list of mounted disk
+ //example: Array
+ // [0] => Array
+ // (
+ // [mp] => /mnt/ad0s1
+ // [mdisk] => ad0s1
+ // )
+ global $g;
+
+ exec("/sbin/mount",$rawdata);
+
+ $mountlist = array();
+ $i=0;
+
+ foreach ($rawdata as $line) {
+ $aline = explode(" ", $line);
+
+ if ((chop($aline[0]) == "/dev/md0") || (chop($aline[0]) == "devfs") || (chop($aline[0]) == "/dev/fd0")) {
+ continue;
+ }
+
+ $mountlist[$i]['fullname'] = chop($aline[0]);
+ $mountlist[$i]['mp'] = chop($aline[2]);
+
+ // Get the complete name /dev/devicename
+ $complete = explode("/",chop($aline[0]));
+ $devname = $complete[2];
+
+ // Test if it's a gvinum or gmirror device
+ if ((strcmp($devname,"gvinum") == 0) || (strcmp($devname,"mirror") == 0)) {
+ $devname = $complete[3];
+ }
+
+ $mountlist[$i]['mdisk']=$devname;
+ $i++;
+ } // end foreach
+
+ return $mountlist;
}
-function get_sraid_disks_list()
-{
- /* Return list of ALL software volume: gvinum, gmirror */
- $disklist = array_merge((array)get_gvinum_disks_list(),(array)get_gmirror_disks_list());
- return $disklist;
+function get_mount_use() {
+ // Return list of mounted use
+ // example: Array
+ // [mount_point_name] => Array
+ // (
+ // [capacity] => 48%
+ // [used] => 2.4G
+ // [avail] => 2.6G
+ // [size] => 5.4G
+ // )
+ global $freenas_config, $g;
+
+ exec("/bin/df -h",$rawdata);
+ $result = array();
+
+ foreach ($rawdata as $line) {
+ /* separe the line by space*/
+ $aline = preg_split("/[\s,]+/", $line);
+ $tmp = explode("/",chop($aline[5]));
+ $mounted_on = $tmp[2];
+ $capacity = chop($aline[4]);
+ $avail = chop($aline[3]);
+ $used = chop($aline[2]);
+ $size = chop($aline[1]);
+
+ if (is_array($freenas_config['mounts']['mount'])) {
+ foreach ($freenas_config['mounts']['mount'] as $mountcfg) {
+ if (strcmp($mounted_on,$mountcfg['sharename']) == 0) {
+ $result[$mounted_on] = array();
+ $result[$mounted_on]['capacity'] = $capacity;
+ $result[$mounted_on]['avail'] = $avail;
+ $result[$mounted_on]['used'] = $used;
+ $result[$mounted_on]['size'] = $size;
+ }
+ } // end foreach
+ } else {
+ return 0;
+ } // end if
+ } // end foreach
+
+ //print_r($result);
+
+ return $result;
}
-function get_gvinum_disks_list()
-{
- /* Get information about gvinum volume */
- global $g;
-
- /* Return list of Software RAID disk */
-
+function get_sraid_disks_list() {
+ /* Return list of ALL software volume: gvinum, gmirror */
+ $disklist = array_merge((array)get_gvinum_disks_list(),(array)get_gmirror_disks_list(),(array)get_gconcat_disks_list(),(array)get_gstripe_disks_list(),(array)get_graid5_disks_list());
+ return $disklist;
+}
+
+function get_gvinum_disks_list() {
+ /* Get information about gvinum volume */
+ global $g;
+
+ /* Return list of Software RAID disk */
//[volumename] => Array
// (
// [type] => Software RAID - gvinum
// [desc] => UP
// [size] => 6149 MB
// )
+
+ /* on envoie la commande d'affichage de la liste des volumes*/
+ exec("/sbin/gvinum list",$rawdata);
+
+ foreach ($rawdata as $line) {
+ /* Split the line using the space as separator */
+ $aline = preg_split("/\s+/", $line);
+
+ /* Get the line that begin with the letter 'V' */
+ if ($aline[0] != "V") { continue ; }
+
+ $diskname = chop($aline[1]);
+ $disklist[$diskname] = array();
+ $disklist[$diskname]['name'] = $diskname;
+ $disklist[$diskname]['fullname'] = "/dev/gvinum/" . $diskname;
+ $disklist[$diskname]['type'] = "Software RAID - gvinum";
+ $disklist[$diskname]['size'] = "$aline[7] $aline[8]" ;
+ $disklist[$diskname]['desc'] = $aline[3];
+ } // end foreach
- /* on envoie la commande d'affichage de la liste des volumes*/
- exec("/sbin/gvinum list",$rawdata);
-
- foreach ($rawdata as $line)
- {
-
-
- /* Separe la ligne par les espace */
- $aline = preg_split("/\s+/", $line);
-
- /* Récupčre la ligne commencant par 'V' */
- if ($aline[0] != "V")
- {
- continue ;
- }
-
- $diskname = chop($aline[1]);
-
- $disklist[$diskname]=array();
-
- $disklist[$diskname]['type'] = "Software RAID - gvinum";
-
- $disklist[$diskname]['size'] = "$aline[7] $aline[8]" ;
-
- $disklist[$diskname]['desc'] = $aline[3];
-
- }
-
-
- return $disklist;
+ return $disklist;
}
-function get_gmirror_disks_list()
-{
- /* Get information about gmirror volume */
- global $g;
-
-
- //[volumename] => Array
- // (
- // [type] => Software RAID - gmirror
- // [desc] => COMPLETE
- // [size] => 6149M
- // )
+function get_gmirror_disks_list() {
+ /* Get information about gmirror volume */
+ global $g;
+
+ //[volumename] => Array
+ // (
+ // [type] => Software RAID - gmirror
+ // [desc] => COMPLETE
+ // [size] => 6149M
+ // )
+
+ /* Display all configured gmirror volume */
+ exec("/sbin/gmirror list", $rawdata);
+
+ $foundname = 0 ;
+ $founddesc = 0 ;
+ $goodname = 0 ;
+
+ foreach ($rawdata as $line) {
+ /* Use space for break the line */
+ $aline = preg_split("/\s+/", $line);
+
+ // First Step: Getting the array name
+ // look for this output:
+ // Geom name: pouet
+ if ( (strcmp($aline[0],"Geom") == 0) && (strcmp($aline[1],"name:") == 0) ) {
+ $diskname = $aline[2];
+ $disklist[$diskname]=array();
+ $disklist[$diskname]['name']=$diskname;
+ $disklist[$diskname]['fullname']= "/dev/mirror/" . $diskname;
+ $foundname = 1 ;
+ continue ;
+ }
+ // Second Step: Getting the array status
+ // look for this output:
+ // State: COMPLETE
+ if ( (strcmp($aline[0],"State:") == 0) && $foundname) {
+ $desc = $aline[1];
+ $disklist[$diskname]['desc'] = $desc;
+ $founddesc=1;
+ continue ;
+ }
- /* Display all configured gmirror volume*/
- exec("/sbin/gmirror list",$rawdata);
-
- $foundname = 0 ;
- $founddesc = 0 ;
- $goodname = 0 ;
-
- foreach ($rawdata as $line) {
-
-
- /* Use space for break the line */
- $aline = preg_split("/\s+/", $line);
-
- // First Step: Getting the array name
- // look for this output:
- // Geom name: pouet
-
- if ( (strcmp($aline[0],"Geom") == 0) && (strcmp($aline[1],"name:") == 0) ) {
- $diskname = $aline[2];
- $disklist[$diskname]=array();
- $foundname = 1 ;
- continue ;
- }
-
- // Second Step: Getting the array status
- // look for this output:
- // State: COMPLETE
-
- if ( (strcmp($aline[0],"State:") == 0) && $foundname) {
-
- $desc = $aline[1];
- $disklist[$diskname]['desc'] = $desc;
- $founddesc=1;
- continue ;
- }
-
- // Third Step: Getting the array Size
- // look for this output:
- // Name: mirror/pouet
- // Mediasize: 107373568 (102M)
-
- if (preg_match("/Name: mirror\/(.*)$/", $line, $matches)) {
- if ($matches[1]=$diskname) {
- $goodname=1;
- continue ;
- }
-
- }
-
- if (($aline[0] = "Mediasize:") && $goodname) {
- // extract the size between the ( )
- preg_match("/.*\\(([^\)]*)\).*/",$aline[3],$match);
- $disklist[$diskname]['size'] = $match[1];
- $disklist[$diskname]['type'] = "Software RAID - gmirror";
-
- // init the check variable for the next RAID volume
- $foundname = 0 ;
- $founddesc = 0 ;
- $goodname = 0 ;
-
- continue ;
-
- }
-
- }
-
- return $disklist;
-
+ // Third Step: Getting the array Size
+ // look for this output:
+ // Name: mirror/pouet
+ // Mediasize: 107373568 (102M)
+ if (preg_match("/Name: mirror\/(.*)$/", $line, $matches)) {
+ if ($matches[1]=$diskname) {
+ $goodname=1;
+ continue ;
+ }
+ }
+
+ if (($aline[0] = "Mediasize:") && $goodname) {
+ // extract the size between the ( )
+ preg_match("/.*\\(([^\)]*)\).*/",$aline[3],$match);
+ $disklist[$diskname]['size'] = $match[1];
+ $disklist[$diskname]['type'] = "Software RAID - gmirror";
+
+ // init the check variable for the next RAID volume
+ $foundname = 0 ;
+ $founddesc = 0 ;
+ $goodname = 0 ;
+
+ continue ;
+
+ }
+ } // end foreach
+
+ return $disklist;
}
+function get_gconcat_disks_list() {
+ /* Get information about gconcat volume */
+ global $g;
+ //[volumename] => Array
+ // (
+ // [type] => Software RAID - gconcat
+ // [desc] => COMPLETE
+ // [size] => 6149M
+ // [name] => concat1
+ // [fullname] => /dev/concat/concat1
+ // )
-function get_ata_disks_list()
-{
- /* Return list of ATA disk */
-
- //[ad0] => Array
- // (
- // [type] => IDE
- // [desc] => QUANTUM FIREBALL EX6.4A/A0A.0D00
- // [size] => 6149MB
- // )
+ /* Display all configured gconcat volume*/
+ exec("/sbin/gconcat list",$rawdata);
+ $foundname = 0 ;
+ $founddesc = 0 ;
+ $goodname = 0 ;
- global $g;
-
- /* Recupere le dmesg */
- exec("/sbin/dmesg",$rawdmesg);
-
- $disklist = array();
-
- /******* Getting IDE disk informations *******/
-
- exec("/sbin/atacontrol list",$rawdata);
-
- foreach ($rawdata as $line) {
-
- /* Separe la ligne par les espace */
- $aline = preg_split("/\s+/", $line);
-
- /* Si ATA alors NEXT */
- if ($aline[0] == "ATA")
- continue ;
-
- $diskname = chop($aline[2]);
-
- /* Exlude CDROM (acdX) and Empty (no) */
- if (!preg_match("/^(acd)/", $diskname ) & $diskname != "no") {
-
- $disklist[$diskname]=array();
-
- $disklist[$diskname]['type'] = "IDE";
-
- /* Match the description witch is include between < and > */
-
- preg_match("/.*\<([^>]*)>.*/",$line,$match);
-
- $disklist[$diskname]['desc'] = $match[1];
-
- /* Looking for the disk size */
- foreach ($rawdmesg as $dmesgline) {
-
- /* Take only the first dmesg line */
- if (!$disklist[$diskname]['size']) {
-
- /* Separe la ligne par les espace */
- $dmesgtab = explode(" ", $dmesgline);
- $dmesgtab[0] = rtrim($dmesgtab[0],":");
- if ($dmesgtab[0]!="" &&(strcasecmp($dmesgtab[0],$diskname) == 0))
- $disklist[$diskname]['size'] = $dmesgtab[1];
- }
- }
-
- }
-
- }
- return $disklist;
+ foreach ($rawdata as $line) {
+ /* Use space for break the line */
+ $aline = preg_split("/\s+/", $line);
+
+ // First Step: Getting the array name
+ // look for this output:
+ // Geom name: pouet
+ if ( (strcmp($aline[0],"Geom") == 0) && (strcmp($aline[1],"name:") == 0) ) {
+ $diskname = $aline[2];
+ $disklist[$diskname]=array();
+ $disklist[$diskname]['name']=$diskname;
+ $disklist[$diskname]['fullname']= "/dev/concat/" . $diskname;
+ $foundname = 1 ;
+ continue ;
+ }
+
+ // Second Step: Getting the array status
+ // look for this output:
+ // State: UP
+ if ( (strcmp($aline[0],"State:") == 0) && $foundname) {
+
+ $desc = $aline[1];
+ $disklist[$diskname]['desc'] = $desc;
+ $founddesc=1;
+ continue ;
+ }
+
+ // Third Step: Getting the array Size
+ // look for this output:
+ // Name: concat/pouet
+ // Mediasize: 107373568 (102M)
+ if (preg_match("/Name: concat\/(.*)$/", $line, $matches)) {
+ if ($matches[1]=$diskname) {
+ $goodname=1;
+ continue ;
+ }
+
+ }
+
+ if (($aline[0] = "Mediasize:") && $goodname) {
+ // extract the size between the ( )
+ preg_match("/.*\\(([^\)]*)\).*/",$aline[3],$match);
+ $disklist[$diskname]['size'] = $match[1];
+ $disklist[$diskname]['type'] = "Software RAID - gconcat";
+
+ // init the check variable for the next RAID volume
+ $foundname = 0 ;
+ $founddesc = 0 ;
+ $goodname = 0 ;
+
+ continue ;
+ }
+ }
+
+ return $disklist;
}
+function get_gstripe_disks_list() {
+ /* Get information about gstripe volume */
+ global $g;
-function get_scsi_disks_list()
-{
- /* Recupere la liste des disques SCSI */
-
- //[ad0] => Array
- // (
- // [type] => IDE
- // [desc] => QUANTUM FIREBALL EX6.4A/A0A.0D00
- // [size] => 6149MB
- // )
+ //[volumename] => Array
+ // (
+ // [type] => Software RAID - gstripe
+ // [desc] => COMPLETE
+ // [size] => 6149M
+ // [name] => raid0
+ // [fullname] => /dev/stripe/raid0
+ // )
+ /* Display all configured gstripe volume*/
+ exec("/sbin/gstripe list",$rawdata);
- global $g;
-
- /* Recupere le dmesg */
- exec("/sbin/dmesg",$rawdmesg);
-
- /* on envoie la commande d'affichage de la liste des disques*/
- exec("/sbin/camcontrol devlist",$rawdata);
-
- foreach ($rawdata as $line) {
-
- /* Get information include between parenthese: (pass0,da0) or (da0,pass0)*/
-
- preg_match("/.*\(([^>]*)\).*/",$line,$match);
-
- /* Sépare le resultat par la virgule */
- $temp = preg_split("/,/", $match[1]);
-
- // Check if diskname is the first (da0,pass0) or the second (pass0,da0) arguement
- $diskname = $temp[1];
- if ($diskname[0] == "p")
- $diskname = $temp[0];
-
- /* On exlus les lecteurs cd */
- if (!preg_match("/^(cd)/", $diskname )) {
- $disklist[$diskname]=array();
- $disklist[$diskname]['type'] = "SCSI";
- /* Recupčre la description: ce qu'il y a entre < et > */
-
- preg_match("/.*\<([^>]*)>.*/",$line,$match);
-
- $disklist[$diskname]['desc'] = $match[1];
-
- /* Looking for the disk size */
- foreach ($rawdmesg as $dmesgline) {
- /* Separe la ligne par les espace */
- $dmesgtab = explode(" ", $dmesgline);
- $dmesgtab[0] = rtrim($dmesgtab[0],":");
- if ($dmesgtab[0]!="" &&(strcasecmp($dmesgtab[0],$diskname) == 0))
- $disklist[$diskname]['size'] = $dmesgtab[1];
-
- }
-
- }
- }
- return $disklist;
+ $foundname = 0 ;
+ $founddesc = 0 ;
+ $goodname = 0 ;
+
+ foreach ($rawdata as $line) {
+ /* Use space for break the line */
+ $aline = preg_split("/\s+/", $line);
+
+ // First Step: Getting the array name
+ // look for this output:
+ // Geom name: pouet
+ if ( (strcmp($aline[0],"Geom") == 0) && (strcmp($aline[1],"name:") == 0) ) {
+ $diskname = $aline[2];
+ $disklist[$diskname]=array();
+ $disklist[$diskname]['name']=$diskname;
+ $disklist[$diskname]['fullname']= "/dev/stripe/" . $diskname;
+ $foundname = 1 ;
+ continue ;
+ }
+
+ // Second Step: Getting the array status
+ // look for this output:
+ // State: UP
+ if ( (strcmp($aline[0],"State:") == 0) && $foundname) {
+ $desc = $aline[1];
+ $disklist[$diskname]['desc'] = $desc;
+ $founddesc=1;
+ continue ;
+ }
+
+ // Third Step: Getting the array Size
+ // look for this output:
+ // Name: stripe/pouet
+ // Mediasize: 107373568 (102M)
+ if (preg_match("/Name: stripe\/(.*)$/", $line, $matches)) {
+ if ($matches[1]=$diskname) {
+ $goodname=1;
+ continue ;
+ }
+
+ }
+
+ if (($aline[0] = "Mediasize:") && $goodname) {
+ // extract the size between the ( )
+ preg_match("/.*\\(([^\)]*)\).*/",$aline[3],$match);
+ $disklist[$diskname]['size'] = $match[1];
+ $disklist[$diskname]['type'] = "Software RAID - gstripe";
+
+ // init the check variable for the next RAID volume
+ $foundname = 0 ;
+ $founddesc = 0 ;
+ $goodname = 0 ;
+
+ continue ;
+
+ }
+ }
+
+ return $disklist;
+}
+
+function get_graid5_disks_list() {
+ /* Get information about graid5 volume */
+ global $g;
+
+ //[volumename] => Array
+ // (
+ // [type] => Software RAID - graid5
+ // [desc] => COMPLETE
+ // [size] => 6149M
+ // [name] => BIG1
+ // [fullname] => /dev/raid5/BIG1
+ // )
+ /* Display all configured graid5 volume*/
+ exec("/sbin/graid5 list",$rawdata);
+
+ $foundname = 0 ;
+ $founddesc = 0 ;
+ $goodname = 0 ;
+
+ foreach ($rawdata as $line) {
+ /* Use space for break the line */
+ $aline = preg_split("/\s+/", $line);
+
+ // First Step: Getting the array name
+ // look for this output:
+ // Geom name: pouet
+ if ( (strcmp($aline[0],"Geom") == 0) && (strcmp($aline[1],"name:") == 0) ) {
+ $diskname = $aline[2];
+ $disklist[$diskname]=array();
+ $disklist[$diskname]['name']=$diskname;
+ $disklist[$diskname]['fullname']= "/dev/raid5/" . $diskname;
+ $foundname = 1 ;
+ continue ;
+ }
+
+ // Second Step: Getting the array status
+ // look for this output:
+ // State: COMPLETE
+ if ( (strcmp($aline[0],"State:") == 0) && $foundname) {
+ $desc = $aline[1];
+ $disklist[$diskname]['desc'] = $desc;
+ $founddesc=1;
+ continue ;
+ }
+
+ // Third Step: Getting the array Size
+ // look for this output:
+ // Name: raid5/pouet
+ // Mediasize: 107373568 (102M)
+ if (preg_match("/Name: raid5\/(.*)$/", $line, $matches)) {
+ if ($matches[1]=$diskname) {
+ $goodname=1;
+ continue ;
+ }
+ }
+
+ if (($aline[0] = "Mediasize:") && $goodname) {
+ // extract the size between the ( )
+ preg_match("/.*\\(([^\)]*)\).*/",$aline[3],$match);
+ $disklist[$diskname]['size'] = $match[1];
+ $disklist[$diskname]['type'] = "Software RAID - graid5";
+
+ // init the check variable for the next RAID volume
+ $foundname = 0 ;
+ $founddesc = 0 ;
+ $goodname = 0 ;
+
+ continue ;
+ }
+ }
+
+ return $disklist;
}
-function get_hraid_disks_list()
-{
- /* Recupere la liste des disques RAID */
-
- $kerneldisks = explode(" ", trim(preg_replace("/kern.disks: /", "", exec("/sbin/sysctl kern.disks"))));
-
- /* Recupere la liste des disques ATA et SCSI */
-
- $diskdetected = array_merge((array)get_ata_disks_list(),(array)get_scsi_disks_list());
-
- /* Recupere le dmesg */
- exec("/sbin/dmesg",$rawdmesg);
-
-
- foreach ($kerneldisks as $diskname) {
- $allready=1;
-
- // Check of this entry is IDE or SCSI (allready detected)
- foreach ($diskdetected as $diskfoundk => $diskfoundv) {
-
- if (strcasecmp($diskfoundk,$diskname) == 0)
- $allready=0;
- }
-
- if ($allready) {
-
- /* If not an IDE and SCSI disk */
- $disklist[$diskname]=array();
-
- $disklist[$diskname]['type'] = "RAID";
-
- /* Looking for the disk size in the dmesg */
- foreach ($rawdmesg as $dmesgline) {
- /* Separe la ligne par les espace */
- $dmesgtab = explode(" ", $dmesgline);
- $dmesgtab[0] = rtrim($dmesgtab[0],":");
- // si la ligne commence par le nom du disque: attention il y a 2 lignes
- if ($dmesgtab[0]!="" &&(strcasecmp($dmesgtab[0],$diskname) == 0)) {
- // the first line as this example "aacd0: <RAID 5> on aac0"
-
- if (strcasecmp(substr($dmesgtab[1], 0, 1),"<") == 0) {
- /* Match the description witch is include between < and > */
- preg_match("/.*\<([^>]*)>.*/",$dmesgline,$match);
- $disklist[$diskname]['desc'] = $match[1];
- }
- else {
- // si c'est la deuxieme ligne, elle ressemble a "aacd0: 138850MB (284365824 sectors)"
- $disklist[$diskname]['size'] = $dmesgtab[1];
- }
-
- }
- }
- }
-
- }
-
- return $disklist;
+function get_ata_disks_list() {
+ /* Return list of ATA disk */
+
+ //[ad0] => Array
+ // (
+ // [type] => IDE
+ // [desc] => QUANTUM FIREBALL EX6.4A/A0A.0D00
+ // [size] => 6149MB
+ // )
+
+ global $g;
+
+ /* Recupere le dmesg */
+ exec("/sbin/dmesg",$rawdmesg);
+
+ $disklist = array();
+
+ /******* Getting IDE disk informations *******/
+ exec("/sbin/atacontrol list",$rawdata);
+
+ foreach ($rawdata as $line) {
+ /* Separe la ligne par les espace */
+ $aline = preg_split("/\s+/", $line);
+
+ /* Si ATA alors NEXT */
+ if ($aline[0] == "ATA") { continue ; }
+
+ $diskname = chop($aline[2]);
+
+ /* Exlude CDROM (acdX) and Empty (no) */
+ if (!preg_match("/^(acd)/", $diskname ) & $diskname != "no") {
+ $disklist[$diskname] = array();
+ $disklist[$diskname]['name']=$diskname;
+ $disklist[$diskname]['fullname']= "/dev/" . $diskname;
+
+ $disklist[$diskname]['type'] = "IDE";
+
+ /* Match the description witch is include between < and > */
+ preg_match("/.*\<([^>]*)>.*/",$line,$match);
+
+ $disklist[$diskname]['desc'] = $match[1];
+
+ /* Looking for the disk size */
+ foreach ($rawdmesg as $dmesgline) {
+ /* Take only the first dmesg line */
+ if (!$disklist[$diskname]['size']) {
+ /* Separe la ligne par les espace */
+ $dmesgtab = explode(" ", $dmesgline);
+ $dmesgtab[0] = rtrim($dmesgtab[0],":");
+ if ($dmesgtab[0]!="" &&(strcasecmp($dmesgtab[0],$diskname) == 0))
+ $disklist[$diskname]['size'] = $dmesgtab[1];
+ } // end if
+ } // end foreach
+ } // end if
+ } // end foreach
+
+ return $disklist;
}
-function get_physical_disks_list()
-{
- /* Return list of ALL disk: physical, hardware RAID and Software RAID disk */
- $disklist = array_merge((array)get_ata_disks_list(),(array)get_scsi_disks_list(),(array)get_hraid_disks_list());
- return $disklist;
+function get_scsi_disks_list() {
+ /* Recupere la liste des disques SCSI */
+
+ //[ad0] => Array
+ // (
+ // [type] => IDE
+ // [desc] => QUANTUM FIREBALL EX6.4A/A0A.0D00
+ // [size] => 6149MB
+ // )
+
+ global $g;
+
+ /* Recupere le dmesg */
+ exec("/sbin/dmesg",$rawdmesg);
+
+ /* on envoie la commande d'affichage de la liste des disques*/
+ exec("/sbin/camcontrol devlist",$rawdata);
+
+ foreach ($rawdata as $line) {
+ /* Get information include between parenthese: (pass0,da0) or (da0,pass0)*/
+ preg_match("/.*\(([^>]*)\).*/",$line,$match);
+ /* Sépare le resultat par la virgule */
+ $temp = preg_split("/,/", $match[1]);
+
+ // Check if diskname is the first (da0,pass0) or the second (pass0,da0) arguement
+ $diskname = $temp[1];
+
+ if ($diskname[0] == "p") { $diskname = $temp[0]; }
+
+ /* On exlus les lecteurs cd */
+ if (!preg_match("/^(cd)/", $diskname )) {
+ $disklist[$diskname] = array();
+ $disklist[$diskname]['name'] = $diskname;
+ $disklist[$diskname]['fullname'] = "/dev/" . $diskname;
+ $disklist[$diskname]['type'] = "SCSI";
+ /* Recupčre la description: ce qu'il y a entre < et > */
+
+ preg_match("/.*\<([^>]*)>.*/",$line,$match);
+
+ $disklist[$diskname]['desc'] = $match[1];
+
+ /* Looking for the disk size */
+ foreach ($rawdmesg as $dmesgline) {
+ /* Separe la ligne par les espace */
+ $dmesgtab = explode(" ", $dmesgline);
+ $dmesgtab[0] = rtrim($dmesgtab[0],":");
+ if ($dmesgtab[0]!="" &&(strcasecmp($dmesgtab[0],$diskname) == 0)) {
+ $disklist[$diskname]['size'] = $dmesgtab[1];
+ }
+ } // end foreach
+ } // end if
+ } // end foreach
+
+ return $disklist;
}
-function get_all_disks_list()
-{
- /* Return list of ALL disk: physical, hardware RAID and Software RAID disk */
- $disklist = array_merge((array)get_ata_disks_list(),(array)get_scsi_disks_list(),(array)get_hraid_disks_list(), (array)get_sraid_disks_list());
- return $disklist;
+function get_hraid_disks_list() {
+ /* Recupere la liste des disques RAID */
+ $kerneldisks = explode(" ", trim(preg_replace("/kern.disks: /", "", exec("/sbin/sysctl kern.disks"))));
+
+ /* Recupere la liste des disques ATA et SCSI */
+ $diskdetected = array_merge((array)get_ata_disks_list(),(array)get_scsi_disks_list());
+
+ /* Recupere le dmesg */
+ exec("/sbin/dmesg",$rawdmesg);
+
+ foreach ($kerneldisks as $diskname) {
+ $allready=1;
+
+ // Check of this entry is IDE or SCSI (allready detected)
+ foreach ($diskdetected as $diskfoundk => $diskfoundv) {
+ if (strcasecmp($diskfoundk,$diskname) == 0) {
+ $allready = 0;
+ }
+ }
+
+ if ($allready) {
+ /* If not an IDE and SCSI disk */
+ $disklist[$diskname]=array();
+ $disklist[$diskname]['name']=$diskname;
+ $disklist[$diskname]['fullname']= "/dev/" . $diskname;
+
+ $disklist[$diskname]['type'] = "RAID";
+
+ /* Looking for the disk size in the dmesg */
+ foreach ($rawdmesg as $dmesgline) {
+ /* Separe la ligne par les espace */
+ $dmesgtab = explode(" ", $dmesgline);
+ $dmesgtab[0] = rtrim($dmesgtab[0],":");
+ // si la ligne commence par le nom du disque: attention il y a 2 lignes
+ if ($dmesgtab[0]!="" &&(strcasecmp($dmesgtab[0],$diskname) == 0)) {
+ // the first line as this example "aacd0: <RAID 5> on aac0"
+ if (strcasecmp(substr($dmesgtab[1], 0, 1),"<") == 0) {
+ /* Match the description witch is include between < and > */
+ preg_match("/.*\<([^>]*)>.*/",$dmesgline,$match);
+ $disklist[$diskname]['desc'] = $match[1];
+ } else{
+ // si c'est la deuxieme ligne, elle ressemble a "aacd0: 138850MB (284365824 sectors)"
+ $disklist[$diskname]['size'] = $dmesgtab[1];
+ } // end if
+ } // end if
+ } // end foreach
+ } // end if
+ } // end foreach
+ return $disklist;
}
-function get_disks_size($diskname)
-{
- /* Return size of the disk */
- $disklist=get_physical_disks_list();
-
- $disksize=0;
-
- foreach ($disklist as $diskk => $diskv) {
- if (strcmp($diskk,$diskname)==0)
- $disksize=$diskv['size'];
- }
- return $disksize;
-
+function get_physical_disks_list() {
+ /* Return list of ALL disk: physical, hardware RAID and Software RAID disk */
+ $disklist = array_merge((array)get_ata_disks_list(),(array)get_scsi_disks_list(),(array)get_hraid_disks_list());
+ return $disklist;
+}
+
+function get_all_disks_list() {
+ /* Return list of ALL disk: physical, hardware RAID and Software RAID disk */
+ $disklist = array_merge((array)get_ata_disks_list(),(array)get_scsi_disks_list(),(array)get_hraid_disks_list(), (array)get_sraid_disks_list());
+ return $disklist;
+}
+
+function get_disks_size($diskname) {
+ /* Return size of the disk */
+ $disklist=get_physical_disks_list();
+ $disksize=0;
+
+ foreach ($disklist as $diskk => $diskv) {
+ if (strcmp($diskk,$diskname)==0) {
+ $disksize=$diskv['size'];
+ }
+ }
+
+ return $disksize;
}
-function get_cdrom_list()
-{
- /* Return list of IDE AND SCSI CDROM */
- // exemple: Array
- // [acd0] => Array
- // (
- // [type] => IDE
- // [desc] => TDK CDRW241040B/57S2
- // )
+function get_cdrom_list() {
+ /* Return list of IDE AND SCSI CDROM */
+ // exemple: Array
+ // [acd0] => Array
+ // (
+ // [type] => IDE
+ // [desc] => TDK CDRW241040B/57S2
+ // )
+
+ global $g;
+
+ /* Recupere la liste des disques IDE */
+ exec("/sbin/atacontrol list",$rawdata);
+
+ /* Recupere le dmesg */
+ exec("/sbin/dmesg",$rawdmesg);
+
+ $disklist = array();
+
+ /* Variable $i utilisé pour l'index du tableau */
+ $i=0;
+ foreach ($rawdata as $line) {
+ /* Separe la ligne par les espace */
+ $aline = preg_split("/\s+/", $line);
+
+ /* Si ATA alors NEXT */
+ if ($aline[0] == "ATA") { continue ; }
+
+ $diskname = chop($aline[2]);
+
+ /* Exlude disk (adX) and Empty (no) */
+ if (!preg_match("/^(ad)/", $diskname ) & $diskname != "no") {
+ $disklist[$diskname]=array();
+ $disklist[$diskname]['name']=$diskname;
+ $disklist[$diskname]['fullname']= "/dev/" . $diskname;
+
+ $disklist[$diskname]['type'] = "IDE";
+
+ /* Match the description witch is include between < and > */
+ preg_match("/.*\<([^>]*)>.*/",$line,$match);
+
+ $disklist[$diskname]['desc'] = $match[1];
+
+ $i++;
+ } // end if
+ } // end foreach
+
+ /* Get the SCSI disk list */
+
+ /* Cleaning used variable and initialize array */
+ unset($rawdata);
+ unset($dmesgtab);
+ reset($rawdmesg);
+
+ /* Get the result of the command camcontrol*/
+ exec("/sbin/camcontrol devlist",$rawdata);
+ foreach ($rawdata as $line) {
+ /* Get information include between parenthese: (pass0,da0) or (da0,pass0)*/
+ preg_match("/.*\(([^>]*)\).*/",$line,$match);
-
- global $g;
-
- /* Recupere la liste des disques IDE */
- exec("/sbin/atacontrol list",$rawdata);
-
- /* Recupere le dmesg */
- exec("/sbin/dmesg",$rawdmesg);
-
- $disklist = array();
-
- /* Variable $i utilisé pour l'index du tableau */
- $i=0;
- foreach ($rawdata as $line) {
-
-
- /* Separe la ligne par les espace */
- $aline = preg_split("/\s+/", $line);
-
- /* Si ATA alors NEXT */
- if ($aline[0] == "ATA")
- continue ;
-
- $diskname = chop($aline[2]);
-
- /* Exlude disk (adX) and Empty (no) */
- if (!preg_match("/^(ad)/", $diskname ) & $diskname != "no") {
-
- $disklist[$diskname]=array();
-
- // $disklist[$i]['name'] = chop($aline[2]);
-
-
- $disklist[$diskname]['type'] = "IDE";
-
- /* Match the description witch is include between < and > */
-
- preg_match("/.*\<([^>]*)>.*/",$line,$match);
-
- $disklist[$diskname]['desc'] = $match[1];
-
-
- $i++;
-
- }
-
- }
-
- /* Get the SCSI disk list */
-
- /* Cleaning used variable and initialize array */
- unset($rawdata);
- unset($dmesgtab);
- reset($rawdmesg);
-
- /* Get the result of the command camcontrol*/
- exec("/sbin/camcontrol devlist",$rawdata);
-
- foreach ($rawdata as $line) {
-
- /* Get information include between parenthese: (pass0,da0) or (da0,pass0)*/
-
- preg_match("/.*\(([^>]*)\).*/",$line,$match);
-
- /* Sépare le resultat par la virgule */
- $temp = preg_split("/,/", $match[1]);
-
- // Check if diskname is the first (da0,pass0) or the second (pass0,da0) arguement
- $diskname = $temp[1];
- if ($diskname[0] == "p")
- $diskname = $temp[0];
-
- /* On exlus les lecteurs disque dur da */
- if (!preg_match("/^(da)/", $diskname )) {
- $disklist[$diskname]=array();
- $disklist[$diskname]['type'] = "SCSI";
- /* Recupčre la description: ce qu'il y a entre < et > */
-
- preg_match("/.*\<([^>]*)>.*/",$line,$match);
-
- $disklist[$diskname]['desc'] = $match[1];
-
- $i++;
-
- }
-
- }
-
- return $disklist;
+ /* Sépare le resultat par la virgule */
+ $temp = preg_split("/,/", $match[1]);
+
+ // Check if diskname is the first (da0,pass0) or the second (pass0,da0) arguement
+ $diskname = $temp[1];
+ if ($diskname[0] == "p") { $diskname = $temp[0]; }
+
+ /* On exlus les lecteurs disque dur da */
+ if (!preg_match("/^(da)/", $diskname )) {
+ $disklist[$diskname]=array();
+ $disklist[$diskname]['name']=$diskname;
+ $disklist[$diskname]['fullname']= "/dev/" . $diskname;
+ $disklist[$diskname]['type'] = "SCSI";
+
+ /* Recupčre la description: ce qu'il y a entre < et > */
+ preg_match("/.*\<([^>]*)>.*/",$line,$match);
+
+ $disklist[$diskname]['desc'] = $match[1];
+
+ $i++;
+ } // end if
+ } // end foreach
+
+ return $disklist;
}
-function freenas_install($src,$dst)
-{
-
- // Creating source directory
- passthru("/bin/mkdir /mnt/src");
-
- // Mount the source function is_cdrom must BE CREATED!!!!
-
- if (is_cdrom($src))
- {
- echo "Mount CDROM:\n";
- passthru("/sbin/mount_cd9660 /dev/$src /mnt/src");
- }
- else
- {
- echo "Mount disk:\n";
- passthru("/sbin/mount -t ufs /dev/$src /mnt/src");
- }
-
-
- echo "Erasing primary partitions:\n";
- passthru("/bin/dd if=/dev/zero of=/dev/$dst bs=1k count=20");
-
- echo "Creation 1 booting primary parition:\n";
- passthru("/sbin/fdisk -BI -b /boot/boot0 $dst");
-
- /* echo "Installing bootloader:\n";
- passthru("/usr/sbin/boot0cfg -B -b /boot/boot0 $dst"); */
-
- echo "Erasing FreeBSD partition on the primary:\n";
- passthru("/bin/dd if=/dev/zero of=/dev/" . escapeshellarg($dst) . "s1 bs=32k count=16");
-
- echo "Creating FreeBSD partition:\n";
- passthru("/sbin/bsdlabel -B -w -b /boot/boot " . escapeshellarg($dst) ."s1 auto");
-
- echo "Modify partition information:\n";
-
- /* Generation de la table des partitions dans un fichier temp */
-
- passthru("/sbin/bsdlabel " . escapeshellarg($dst) ."s1 > label.tmp");
-
- /* copie de ce fichier dans un tableau*/
- $tableau = file("label.tmp");
-
- // Ouverture du fichier en mode ajout
- $handle = fopen("label.tmp", 'a');
-
- while(list(,$val) = each($tableau))
- {
- // Si la ligne contient le mot "unused"
-
- if (ereg ("unused",$val))
- {
- // On remplace c: par a:
- $val = ereg_replace ("c:","a:", $val);
- // On remplace unused par 4.2BSD
- $val = ereg_replace ("unused","4.2BSD", $val);
- // On ajoute cette ligne ŕ la fin du fichier
- fwrite($handle, $val);
- }
- }
- // Fermeture du fichier
- fclose($handle);
-
- // On injecte la nouvelle table des paritions
- passthru("/sbin/bsdlabel -R -B " . escapeshellarg($dst) ."s1 label.tmp");
-
- echo "Creating filesystem:\n";
- passthru("/sbin/newfs /dev/" . escapeshellarg($dst) . "s1");
-
- echo "Creation temp mouting point:\n";
- passthru("/bin/mkdir /mnt/src");
-
- echo "Mount disk:\n";
- passthru("/sbin/mount /dev/" . escapeshellarg($dst) . "s1 /mnt/dst");
-
- echo "Installation:\n";
-
- passthru("/bin/cp -pr /mnt/src/boot /mnt/dst");
- passthru("/bin/cp /mnt/src/cf.gz /mnt/dst/mfsroot.gz");
-
- if ($src == CDROM)
- passthru("/bin/rm -f /mnt/dst/boot/cdloader");
-
- passthru("mkdir /mnt/dst/conf");
- passthru("/bin/cp /conf/config.xml /mnt/dst/conf/");
-
-
- /* demontage des disques */
- passthru("/sbin/umount /mnt/dst");
- passthru("/sbin/umount /mnt/src");
- passthru("/bin/rm -rf /mnt/src");
- passthru("/bin/rm -rf /mnt/dst");
+/* Get list of disks from given type of filesystem. */
+function get_fstype_disks_list($fstype) {
+ global $freenas_config;
+
+ $result = array();
+
+ /* Scan all physical disk */
+ if (is_array($freenas_config['disks']['disk'])) {
+ foreach ($freenas_config['disks']['disk'] as $disk) {
+ if (strcmp($disk['fstype'],$fstype) == 0) {
+ $result[] = $disk;
+ }
+ } // end foreach
+ } // end if
+
+ /* Scan all gmirror volume */
+ if (is_array($freenas_config['gmirror']['vdisk'])) {
+ foreach ($freenas_config['gmirror']['vdisk'] as $disk) {
+ if (strcmp($disk['fstype'],$fstype) == 0) {
+ $result[] = $disk;
+ }
+ } // end foreach
+ } // end if
+
+ /* Scan all gconcat volume */
+ if (is_array($freenas_config['gconcat']['vdisk'])) {
+ foreach ($freenas_config['gconcat']['vdisk'] as $disk) {
+ if (strcmp($disk['fstype'],$fstype) == 0) {
+ $result[] = $disk;
+ }
+ } // end foreach
+ } // end if
+
+ /* Scan all gstripe volume */
+ if (is_array($freenas_config['gstripe']['vdisk'])) {
+ foreach ($freenas_config['gstripe']['vdisk'] as $disk) {
+ if (strcmp($disk['fstype'],$fstype) == 0) {
+ $result[] = $disk;
+ }
+ } // end foreach
+ } // end if
+
+ /* Scan all gvinum volume */
+ if (is_array($freenas_config['gvinum']['vdisk'])) {
+ foreach ($freenas_config['gvinum']['vdisk'] as $disk) {
+ if (strcmp($disk['fstype'],$fstype) == 0) {
+ $result[] = $disk;
+ }
+ } // end foreach
+ } // end if
+
+ /* Scan all graid5 volume */
+ if (is_array($freenas_config['graid5']['vdisk'])) {
+ foreach ($freenas_config['graid5']['vdisk'] as $disk) {
+ if (strcmp($disk['fstype'],$fstype) == 0) {
+ $result[] = $disk;
+ }
+ } // end foreach
+ } // end if
+
+ return $result;
+}
+
+/* Get list of supported filesystem types */
+function get_fstype_list() {
+ $fstlist = array(
+ ""=>"Unformated",
+ "ufs"=>"UFS with Soft Updates (use 8% space disk)",
+ "ufs_no_su"=>"UFS",
+ "ufsgpt"=>"UFS (EFI/GPT) with Soft Updates (use 8% space disk)",
+ "ufsgpt_no_su"=>"UFS (EFI/GPT)",
+ "msdos"=>"FAT32",
+ "ntfs"=>"NTFS",
+ "softraid"=>"Software RAID");
+/*
+ "gmirror"=>"Software RAID: gmirror",
+ "gconcat"=>"Software RAID: gconcat",
+ "gstripe"=>"Software RAID: gstripe",
+ "graid5"=>"Software RAID: graid5",
+ "gvinum"=>"Software RAID: gvinum");
+*/
+ return $fstlist;
+}
+
+function get_fstype_shortdesc($fstype) {
+ $shortdesc = "";
+
+ switch($fstype) {
+ case "": $shortdesc = "Unformated";
+ break;
+ case "ufs":
+ case "ufs_no_su":
+ case "ufsgpt":
+ case "ufsgpt_no_su": $shortdesc = "UFS";
+ break;
+ case "msdos": $shortdesc = "FAT32";
+ break;
+ case "ntfs": $shortdesc = "NTFS";
+ break;
+ case "gmirror": $shortdesc = "gmirror";
+ break;
+ case "gconcat": $shortdesc = "gconcat";
+ break;
+ case "gstripe": $shortdesc = "gstripe";
+ break;
+ case "graid5": $shortdesc = "graid5";
+ break;
+ case "gvinum": $shortdesc = "gvinum";
+ break;
+ case "softraid": $shortdesc = "softraid";
+ break;
+ } // end switch
+
+ return $shortdesc;
+}
+
+/* Search in a multidimensional array */
+function array_search_ex($needle, $haystack, $key) {
+ foreach($haystack as $haystackval => $value) {
+ $found = false;
+
+ if (is_array($needle) && is_array($key)) {
+ foreach ($needle as $n => $needlev) {
+ $found = ($value[$key[$n]] == $needlev);
+
+ if (false == $found) { break; }
+ }
+ } else {
+ $found = ($value[$key] == $needle);
+ } // end if
+
+ if (true == $found) { return $haystackval; }
+ } // end foreach
+
+ return false;
+}
+/* TODO: This function is probably not needed. */
+function freenas_install($src,$dst) {
+ // Creating source directory
+ passthru("/bin/mkdir /mnt/src");
+
+ // Mount the source function is_cdrom must BE CREATED!!!!
+
+ if (is_cdrom($src)) {
+ echo "Mount CDROM:\n";
+ passthru("/sbin/mount_cd9660 /dev/$src /mnt/src");
+ } else {
+ echo "Mount disk:\n";
+ passthru("/sbin/mount -t ufs /dev/$src /mnt/src");
+ } // end if
+
+ echo "Erasing primary partitions:\n";
+ passthru("/bin/dd if=/dev/zero of=/dev/$dst bs=1k count=20");
+
+ echo "Creation 1 booting primary parition:\n";
+ passthru("/sbin/fdisk -BI -b /boot/boot0 $dst");
+
+ /* echo "Installing bootloader:\n";
+ passthru("/usr/sbin/boot0cfg -B -b /boot/boot0 $dst"); */
+
+ echo "Erasing FreeBSD partition on the primary:\n";
+ passthru("/bin/dd if=/dev/zero of=/dev/" . escapeshellarg($dst) . "s1 bs=32k count=16");
+
+ echo "Creating FreeBSD partition:\n";
+ passthru("/sbin/bsdlabel -B -w -b /boot/boot " . escapeshellarg($dst) ."s1 auto");
+
+ echo "Modify partition information:\n";
+
+ /* Generation de la table des partitions dans un fichier temp */
+
+ passthru("/sbin/bsdlabel " . escapeshellarg($dst) ."s1 > label.tmp");
+
+ /* copie de ce fichier dans un tableau*/
+ $tableau = file("label.tmp");
+
+ // Ouverture du fichier en mode ajout
+ $handle = fopen("label.tmp", 'a');
+
+ while(list(,$val) = each($tableau)) {
+ // Si la ligne contient le mot "unused"
+
+ if (ereg ("unused",$val)) {
+ // On remplace c: par a:
+ $val = ereg_replace ("c:","a:", $val);
+ // On remplace unused par 4.2BSD
+ $val = ereg_replace ("unused","4.2BSD", $val);
+ // On ajoute cette ligne ŕ la fin du fichier
+ fwrite($handle, $val);
+ } // end if
+ } // end while
+
+ // Fermeture du fichier
+ fclose($handle);
+
+ // On injecte la nouvelle table des paritions
+ passthru("/sbin/bsdlabel -R -B " . escapeshellarg($dst) ."s1 label.tmp");
+
+ echo "Creating filesystem:\n";
+ passthru("/sbin/newfs /dev/" . escapeshellarg($dst) . "s1");
+
+ echo "Creation temp mouting point:\n";
+ passthru("/bin/mkdir /mnt/src");
+
+ echo "Mount disk:\n";
+ passthru("/sbin/mount /dev/" . escapeshellarg($dst) . "s1 /mnt/dst");
+
+ echo "Installation:\n";
+
+ passthru("/bin/cp -pr /mnt/src/boot /mnt/dst");
+ passthru("/bin/cp /mnt/src/cf.gz /mnt/dst/mfsroot.gz");
+
+ if ($src == CDROM) {
+ passthru("/bin/rm -f /mnt/dst/boot/cdloader");
+ }
+
+ passthru("mkdir /mnt/dst/conf");
+ passthru("/bin/cp /conf/config.xml /mnt/dst/conf/");
+
+ /* demontage des disques */
+ passthru("/sbin/umount /mnt/dst");
+ passthru("/sbin/umount /mnt/src");
+ passthru("/bin/rm -rf /mnt/src");
+ passthru("/bin/rm -rf /mnt/dst");
}
/* Force kill a process by name */
function forcekillbyname($procname) {
- return mwexec("/usr/bin/killall -9 " . escapeshellarg($procname));
+ return mwexec("/usr/bin/killall -9 " . escapeshellarg($procname));
}
?> \ No newline at end of file
diff --git a/packages/freenas/pkg/rc.freenas b/packages/freenas/pkg/rc.freenas
index d13c49ff..3b5c6c0c 100644
--- a/packages/freenas/pkg/rc.freenas
+++ b/packages/freenas/pkg/rc.freenas
@@ -1,11 +1,13 @@
#!/usr/local/bin/php -f
<?php
/* $Id$ */
-/*
+/* ========================================================================== */
rc.freenas
part of pfSense (http://www.pfSense.com)
Copyright (C) 2006 Daniel S. Haischt
All rights reserved.
+/* ========================================================================== */
+/*
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
@@ -27,7 +29,8 @@
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-*/
+ */
+/* ========================================================================== */
require_once("globals.inc");
@@ -75,6 +78,9 @@ services_ftpd_configure();
/* start NFS service */
services_nfs_configure();
+/* configure Unison service */
+services_unison_configure();
+
/* start SSH service */
/* services_sshd_configure(); */
@@ -84,6 +90,9 @@ services_afpd_configure();
/* start RSYNC client/slave mode service */
services_rsyncclient_configure();
+/* start RSYNC local service */
+services_rsync_local_configure();
+
/* Start cron */
services_cron_configure();
diff --git a/packages/freenas/www/diag_ad_infos.php b/packages/freenas/www/diag_ad_infos.php
index 6c956261..e9882a70 100644
--- a/packages/freenas/www/diag_ad_infos.php
+++ b/packages/freenas/www/diag_ad_infos.php
@@ -1,36 +1,44 @@
<?php
/* $Id$ */
+/* ========================================================================== */
/*
- disks_manage_edit.php
- part of FreeNAS (http://www.freenas.org)
- Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
- All rights reserved.
-
- Based on m0n0wall (http://m0n0.ch/wall)
- Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
+ diag_ad_infos.php
+ part of pfSense (http://www.pfSense.com)
+ Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name>
+ All rights reserved.
+
+ Based on FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ All rights reserved.
+ */
+/* ========================================================================== */
+/*
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+/* ========================================================================== */
$pgtitle = array(gettext("Diagnostics"),
gettext("Active Directory Infos"));
@@ -77,8 +85,8 @@ echo $pfSenseHead->getHTML();
<tr>
<td class="tabnavtbl">
<?php
- $tab_array = array();
- $tab_array[0] = array(gettext("Disks"), false, "diag_disks_infos.php");
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Disks"), false, "diag_disks_infos.php");
$tab_array[1] = array(gettext("Partitions"), false, "diag_part_infos.php");
$tab_array[2] = array(gettext("SMART"), false, "diag_smart_infos.php");
$tab_array[3] = array(gettext("ataidle"), false, "diag_ataidle_infos.php");
@@ -86,61 +94,55 @@ echo $pfSenseHead->getHTML();
$tab_array[5] = array(gettext("Mounts"), false, "diag_mounts_infos.php");
$tab_array[6] = array(gettext("Software RAID"), false, "diag_raid_infos.php");
$tab_array[7] = array(gettext("iSCSI"), false, "diag_iscsi_infos.php");
- display_top_tabs($tab_array);
+ display_top_tabs($tab_array);
?>
</td>
</tr>
<tr>
<td class="tabnavtbl">
<?php
- $tab_array = array();
- $tab_array[0] = array(gettext("Manage RAID"), true, "diag_ad_infos.php");
- display_top_tabs($tab_array);
+ $tab_array = array();
+ $tab_array[0] = array(gettext("MS Domain"), true, "diag_ad_infos.php");
+ display_top_tabs($tab_array);
?>
</td>
</tr>
<tr>
<td>
- <div id="mainarea">
+ <div id="mainarea">
<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="left" valign="top">
<?php
if (! isset($freenas_config['ad']['enable'])) {
- echo "<strong>AD Authentication disable</strong><br />";
+ echo "<strong>AD Authentication disable</strong><br />";
} else {
echo "<pre style=\"font-size: medium;\">";
- echo "<strong>Accessiblity test to MS domain:</strong><br />";
- echo htmlspecialchars("Results for net rpc testjoin:") . "<br />";
-
- exec("/usr/local/bin/net rpc testjoin",$rawdata);
- foreach ($rawdata as $line)
- {
- echo htmlspecialchars($line) . "<br />";
- }
- unset ($rawdata);
-
- echo "<br />";
- echo htmlspecialchars("Ping winbindd to see if it is alive:") . "<br />";
-
- exec("/usr/local/bin/wbinfo -p",$rawdata);
- foreach ($rawdata as $line)
- {
- echo htmlspecialchars($line) . "<br />";
- }
- unset ($rawdata);
-
- echo "<br />";
- echo htmlspecialchars("Check shared secret:") . "<br />";
-
- exec("/usr/local/bin/wbinfo -t",$rawdata);
- foreach ($rawdata as $line)
- {
- echo htmlspecialchars($line) . "<br />";
- }
- unset ($rawdata);
-
- echo "<br>";
+ echo "<strong>Accessiblity test to MS domain:</strong><br />";
+ echo htmlspecialchars("Results for net rpc testjoin:") . "<br />";
+ exec("/usr/local/bin/net rpc testjoin",$rawdata);
+ foreach ($rawdata as $line)
+ {
+ echo htmlspecialchars($line) . "<br />";
+ }
+ unset ($rawdata);
+ echo "<br />";
+ echo htmlspecialchars("Ping winbindd to see if it is alive:") . "<br />";
+ exec("/usr/local/bin/wbinfo -p",$rawdata);
+ foreach ($rawdata as $line)
+ {
+ echo htmlspecialchars($line) . "<br />";
+ }
+ unset ($rawdata);
+ echo "<br />";
+ echo htmlspecialchars("Check shared secret:") . "<br />";
+ exec("/usr/local/bin/wbinfo -t",$rawdata);
+ foreach ($rawdata as $line)
+ {
+ echo htmlspecialchars($line) . "<br />";
+ }
+ unset ($rawdata);
+ echo "<br>";
echo "</pre>";
}
?>
@@ -149,7 +151,7 @@ echo $pfSenseHead->getHTML();
</table>
</div>
</td>
- </tr>
+ </tr>
</table>
</form>
<?php include("fend.inc"); ?>
diff --git a/packages/freenas/www/diag_ataidle_infos.php b/packages/freenas/www/diag_ataidle_infos.php
index b0136a82..7ba6c737 100644
--- a/packages/freenas/www/diag_ataidle_infos.php
+++ b/packages/freenas/www/diag_ataidle_infos.php
@@ -1,36 +1,44 @@
<?php
/* $Id$ */
+/* ========================================================================== */
/*
- disks_manage_edit.php
- part of FreeNAS (http://www.freenas.org)
- Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
- All rights reserved.
-
- Based on m0n0wall (http://m0n0.ch/wall)
- Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
+ diag_ataidle_infos.php
+ part of pfSense (http://www.pfSense.com)
+ Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name>
+ All rights reserved.
+
+ Based on FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ All rights reserved.
+ */
+/* ========================================================================== */
+/*
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+/* ========================================================================== */
$pgtitle = array(gettext("Diagnostics"),
gettext("ATAidle Infos"));
@@ -77,8 +85,8 @@ echo $pfSenseHead->getHTML();
<tr>
<td class="tabnavtbl">
<?php
- $tab_array = array();
- $tab_array[0] = array(gettext("Disks"), false, "diag_disks_infos.php");
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Disks"), false, "diag_disks_infos.php");
$tab_array[1] = array(gettext("Partitions"), false, "diag_part_infos.php");
$tab_array[2] = array(gettext("SMART"), false, "diag_smart_infos.php");
$tab_array[3] = array(gettext("ataidle"), true, "diag_ataidle_infos.php");
@@ -86,51 +94,46 @@ echo $pfSenseHead->getHTML();
$tab_array[5] = array(gettext("Mounts"), false, "diag_mounts_infos.php");
$tab_array[6] = array(gettext("Software RAID"), false, "diag_raid_infos.php");
$tab_array[7] = array(gettext("iSCSI"), false, "diag_iscsi_infos.php");
- display_top_tabs($tab_array);
+ display_top_tabs($tab_array);
?>
</td>
</tr>
<tr>
<td class="tabnavtbl">
<?php
- $tab_array = array();
- $tab_array[0] = array(gettext("Manage RAID"), false, "diag_ad_infos.php");
- display_top_tabs($tab_array);
+ $tab_array = array();
+ $tab_array[0] = array(gettext("MS Domain"), false, "diag_ad_infos.php");
+ display_top_tabs($tab_array);
?>
</td>
</tr>
<tr>
<td>
- <div id="mainarea">
+ <div id="mainarea">
<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="left" valign="top">
<?php
echo "<pre style=\"font-size: medium;\">";
$disklist=get_ata_disks_list();
-
echo "<strong>List of Advanced ATA capabilities on all ATA disk:</strong><br />";
foreach ($disklist as $disknamek => $disknamev)
{
-
- /* Found the channel and device number from the /dev name */
- /* Divise the number by 2, the interger is the channel number, the rest is the device */
-
- echo htmlspecialchars("Results for $disknamek:") . "<br />";
- $value=trim($disknamek,'ad');
-
- $value=intval($value);
- $channel = $value/2;
- $device=$value % 2;
- $channel=intval($channel);
-
- exec("/usr/local/sbin/ataidle $channel $device",$rawdata);
- foreach ($rawdata as $line)
- {
- echo htmlspecialchars($line) . "<br />";
- }
- unset ($rawdata);
- }
+ /* Found the channel and device number from the /dev name */
+ /* Divise the number by 2, the interger is the channel number, the rest is the device */
+ echo htmlspecialchars("Results for $disknamek:") . "<br />";
+ $value=trim($disknamek,'ad');
+ $value=intval($value);
+ $channel = $value/2;
+ $device=$value % 2;
+ $channel=intval($channel);
+ exec("/usr/local/sbin/ataidle $channel $device",$rawdata);
+ foreach ($rawdata as $line)
+ {
+ echo htmlspecialchars($line) . "<br />";
+ }
+ unset ($rawdata);
+ }
echo "</pre>";
?>
</td>
@@ -138,7 +141,7 @@ echo $pfSenseHead->getHTML();
</table>
</div>
</td>
- </tr>
+ </tr>
</table>
</form>
<?php include("fend.inc"); ?>
diff --git a/packages/freenas/www/diag_disk_infos.php b/packages/freenas/www/diag_disk_infos.php
index 38d73412..31419040 100644
--- a/packages/freenas/www/diag_disk_infos.php
+++ b/packages/freenas/www/diag_disk_infos.php
@@ -1,36 +1,44 @@
<?php
/* $Id$ */
+/* ========================================================================== */
/*
- disks_manage_edit.php
- part of FreeNAS (http://www.freenas.org)
- Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
- All rights reserved.
-
- Based on m0n0wall (http://m0n0.ch/wall)
- Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
+ diag_ataidle_infos.php
+ part of pfSense (http://www.pfSense.com)
+ Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name>
+ All rights reserved.
+
+ Based on FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ All rights reserved.
+ */
+/* ========================================================================== */
+/*
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+/* ========================================================================== */
$pgtitle = array(gettext("Diagnostics"),
gettext("Disk Infos"));
@@ -77,8 +85,8 @@ echo $pfSenseHead->getHTML();
<tr>
<td class="tabnavtbl">
<?php
- $tab_array = array();
- $tab_array[0] = array(gettext("Disks"), true, "diag_disks_infos.php");
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Disks"), true, "diag_disks_infos.php");
$tab_array[1] = array(gettext("Partitions"), false, "diag_part_infos.php");
$tab_array[2] = array(gettext("SMART"), false, "diag_smart_infos.php");
$tab_array[3] = array(gettext("ataidle"), false, "diag_ataidle_infos.php");
@@ -86,47 +94,40 @@ echo $pfSenseHead->getHTML();
$tab_array[5] = array(gettext("Mounts"), false, "diag_mounts_infos.php");
$tab_array[6] = array(gettext("Software RAID"), false, "diag_raid_infos.php");
$tab_array[7] = array(gettext("iSCSI"), false, "diag_iscsi_infos.php");
- display_top_tabs($tab_array);
+ display_top_tabs($tab_array);
?>
</td>
</tr>
<tr>
<td class="tabnavtbl">
<?php
- $tab_array = array();
- $tab_array[0] = array(gettext("Manage RAID"), false, "diag_ad_infos.php");
- display_top_tabs($tab_array);
+ $tab_array = array();
+ $tab_array[0] = array(gettext("MS Domain"), false, "diag_ad_infos.php");
+ display_top_tabs($tab_array);
?>
</td>
</tr>
<tr>
<td>
- <div id="mainarea">
+ <div id="mainarea">
<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="left" valign="top">
<?php
exec("/sbin/atacontrol list",$iderawdata);
-
echo "<pre style=\"font-size: medium;\">";
-
echo "<strong>List of detected ATA disks:</strong><br />";
foreach ($iderawdata as $line)
{
echo htmlspecialchars($line) . "<br />";
}
-
unset ($line);
-
exec("/sbin/camcontrol devlist",$scsirawdata);
-
echo "<strong>List of detected SCSI disks:</strong><br />";
foreach ($scsirawdata as $line)
{
- echo htmlspecialchars($line) . "<br />";
-
+ echo htmlspecialchars($line) . "<br />";
}
-
echo "</pre>";
?>
</td>
@@ -134,7 +135,7 @@ echo $pfSenseHead->getHTML();
</table>
</div>
</td>
- </tr>
+ </tr>
</table>
</form>
<?php include("fend.inc"); ?>
diff --git a/packages/freenas/www/diag_fn_logs_daemon.php b/packages/freenas/www/diag_fn_logs_daemon.php
index 2f447b8d..1eaa1f0f 100644
--- a/packages/freenas/www/diag_fn_logs_daemon.php
+++ b/packages/freenas/www/diag_fn_logs_daemon.php
@@ -1,35 +1,44 @@
<?php
/* $Id$ */
+/* ========================================================================== */
/*
- diag_logs_settings.php
- Copyright (C) 2004 Scott Ullrich
- All rights reserved.
+ diag_fn_logs_daemon.php
+ part of pfSense (http://www.pfSense.com)
+ Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name>
+ All rights reserved.
- originially part of m0n0wall (http://m0n0.ch/wall)
- Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
- All rights reserved.
+ Based on FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ All rights reserved.
+ */
+/* ========================================================================== */
+/*
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+/* ========================================================================== */
$pgtitle = array(gettext("Diagnostics"),
gettext("System logs"),
@@ -46,16 +55,16 @@ if (!$nentries)
if ($_POST['clear'])
{
- exec("/usr/sbin/clog -i -s 262144 /var/log/daemon.log");
- /* redirect to avoid reposting form data on refresh */
- pfSenseHeader("diag_logs_daemon.php");
- exit;
+ exec("/usr/sbin/clog -i -s 262144 /var/log/daemon.log");
+ /* redirect to avoid reposting form data on refresh */
+ pfSenseHeader("diag_fn_logs_daemon.php");
+ exit;
}
/* if ajax is calling, give them an update message */
if(isAjax())
- print_info_box_np($savemsg);
-
+ print_info_box_np($savemsg);
+
include("head.inc");
/* put your custom HTML head content here */
/* using some of the $pfSenseHead function calls */
@@ -71,36 +80,36 @@ echo $pfSenseHead->getHTML();
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr><td>
<?php
- $tab_array = array();
- $tab_array[] = array(gettext("Samba"), false, "diag_fn_logs_samba.php");
- $tab_array[] = array(gettext("FTP"), false, "diag_fn_logs_ftp.php");
- $tab_array[] = array(gettext("RSYNCD"), false, "diag_fn_logs_rsyncd.php");
+ $tab_array = array();
+ $tab_array[] = array(gettext("Samba"), false, "diag_fn_logs_samba.php");
+ $tab_array[] = array(gettext("FTP"), false, "diag_fn_logs_ftp.php");
+ $tab_array[] = array(gettext("RSYNCD"), false, "diag_fn_logs_rsyncd.php");
$tab_array[] = array(gettext("SSHD"), false, "diag_fn_logs_sshd.php");
- $tab_array[] = array(gettext("SMARTD"), false, "diag_fn_logs_smartd.php");
- $tab_array[] = array(gettext("Daemon"), true, "diag_fn_logs_daemon.php");
- $tab_array[] = array(gettext("Settings"), false, "diag_fn_logs_settings.php");
- display_top_tabs($tab_array);?>
+ $tab_array[] = array(gettext("SMARTD"), false, "diag_fn_logs_smartd.php");
+ $tab_array[] = array(gettext("Daemon"), true, "diag_fn_logs_daemon.php");
+ $tab_array[] = array(gettext("Settings"), false, "diag_fn_logs_settings.php");
+ display_top_tabs($tab_array);?>
</td></tr>
<tr>
<td>
- <div id="mainarea">
- <table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td class="listtopic">
- Last <?=$nentries;?> Daemon log entries
- </td>
- </tr>
- <?php dump_clog("/var/log/daemon.log", $nentries); ?>
- <tr>
- <td align="left" valign="top" height="12">&nbsp;</td>
- </tr>
- <tr>
- <td align="left" valign="top">
- <input name="clear" type="submit" class="formbtn" value="Clear log" />
- </td>
- </tr>
- </table>
- </div>
+ <div id="mainarea">
+ <table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0">
+ <tr>
+ <td class="listtopic">
+ Last <?=$nentries;?> Daemon log entries
+ </td>
+ </tr>
+ <?php dump_clog("/var/log/daemon.log", $nentries); ?>
+ <tr>
+ <td align="left" valign="top" height="12">&nbsp;</td>
+ </tr>
+ <tr>
+ <td align="left" valign="top">
+ <input name="clear" type="submit" class="formbtn" value="Clear log" />
+ </td>
+ </tr>
+ </table>
+ </div>
</td>
</tr>
</table>
diff --git a/packages/freenas/www/diag_fn_logs_ftp.php b/packages/freenas/www/diag_fn_logs_ftp.php
index 02972e0e..21d8cfb2 100644
--- a/packages/freenas/www/diag_fn_logs_ftp.php
+++ b/packages/freenas/www/diag_fn_logs_ftp.php
@@ -1,35 +1,44 @@
<?php
/* $Id$ */
+/* ========================================================================== */
/*
- diag_logs_settings.php
- Copyright (C) 2004 Scott Ullrich
- All rights reserved.
+ diag_fn_logs_ftp.php
+ part of pfSense (http://www.pfSense.com)
+ Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name>
+ All rights reserved.
- originially part of m0n0wall (http://m0n0.ch/wall)
- Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
- All rights reserved.
+ Based on FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ All rights reserved.
+ */
+/* ========================================================================== */
+/*
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+/* ========================================================================== */
$pgtitle = array(gettext("Diagnostics"),
gettext("System logs"),
@@ -41,21 +50,20 @@ require_once("freenas_guiconfig.inc");
require_once("freenas_functions.inc");
$nentries = $config['syslog']['nentries'];
-if (!$nentries)
- $nentries = 50;
+if (!$nentries) { $nentries = 50; }
if ($_POST['clear'])
{
- exec("/usr/sbin/clog -i -s 262144 /var/log/ftp.log");
- /* redirect to avoid reposting form data on refresh */
- pfSenseHeader("diag_fn_logs_ftp.php");
- exit;
+ exec("/usr/sbin/clog -i -s 262144 /var/log/ftp.log");
+ /* redirect to avoid reposting form data on refresh */
+ pfSenseHeader("diag_fn_logs_ftp.php");
+ exit;
}
/* if ajax is calling, give them an update message */
if(isAjax())
- print_info_box_np($savemsg);
-
+ print_info_box_np($savemsg);
+
include("head.inc");
/* put your custom HTML head content here */
/* using some of the $pfSenseHead function calls */
@@ -71,36 +79,36 @@ echo $pfSenseHead->getHTML();
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr><td>
<?php
- $tab_array = array();
- $tab_array[] = array(gettext("Samba"), false, "diag_fn_logs_samba.php");
- $tab_array[] = array(gettext("FTP"), true, "diag_fn_logs_ftp.php");
- $tab_array[] = array(gettext("RSYNCD"), false, "diag_fn_logs_rsyncd.php");
+ $tab_array = array();
+ $tab_array[] = array(gettext("Samba"), false, "diag_fn_logs_samba.php");
+ $tab_array[] = array(gettext("FTP"), true, "diag_fn_logs_ftp.php");
+ $tab_array[] = array(gettext("RSYNCD"), false, "diag_fn_logs_rsyncd.php");
$tab_array[] = array(gettext("SSHD"), false, "diag_fn_logs_sshd.php");
- $tab_array[] = array(gettext("SMARTD"), false, "diag_fn_logs_smartd.php");
- $tab_array[] = array(gettext("Daemon"), false, "diag_fn_logs_daemon.php");
- $tab_array[] = array(gettext("Settings"), false, "diag_fn_logs_settings.php");
- display_top_tabs($tab_array);?>
+ $tab_array[] = array(gettext("SMARTD"), false, "diag_fn_logs_smartd.php");
+ $tab_array[] = array(gettext("Daemon"), false, "diag_fn_logs_daemon.php");
+ $tab_array[] = array(gettext("Settings"), false, "diag_fn_logs_settings.php");
+ display_top_tabs($tab_array);?>
</td></tr>
<tr>
<td>
- <div id="mainarea">
- <table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td class="listtopic">
- Last <?=$nentries;?> FTP log entries
- </td>
- </tr>
- <?php dump_clog("/var/log/ftp.log", $nentries); ?>
- <tr>
- <td align="left" valign="top" height="12">&nbsp;</td>
- </tr>
- <tr>
- <td align="left" valign="top">
- <input name="clear" type="submit" class="formbtn" value="Clear log" />
- </td>
- </tr>
- </table>
- </div>
+ <div id="mainarea">
+ <table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0">
+ <tr>
+ <td class="listtopic">
+ Last <?=$nentries;?> FTP log entries
+ </td>
+ </tr>
+ <?php dump_clog("/var/log/ftp.log", $nentries); ?>
+ <tr>
+ <td align="left" valign="top" height="12">&nbsp;</td>
+ </tr>
+ <tr>
+ <td align="left" valign="top">
+ <input name="clear" type="submit" class="formbtn" value="Clear log" />
+ </td>
+ </tr>
+ </table>
+ </div>
</td>
</tr>
</table>
diff --git a/packages/freenas/www/diag_fn_logs_rsyncd.php b/packages/freenas/www/diag_fn_logs_rsyncd.php
index 733ad67f..44ab3d85 100644
--- a/packages/freenas/www/diag_fn_logs_rsyncd.php
+++ b/packages/freenas/www/diag_fn_logs_rsyncd.php
@@ -1,35 +1,44 @@
<?php
/* $Id$ */
+/* ========================================================================== */
/*
- diag_logs_settings.php
- Copyright (C) 2004 Scott Ullrich
- All rights reserved.
+ diag_fn_logs_rsyncd.php
+ part of pfSense (http://www.pfSense.com)
+ Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name>
+ All rights reserved.
- originially part of m0n0wall (http://m0n0.ch/wall)
- Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
- All rights reserved.
+ Based on FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ All rights reserved.
+ */
+/* ========================================================================== */
+/*
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+/* ========================================================================== */
$pgtitle = array(gettext("Diagnostics"),
gettext("System logs"),
@@ -41,20 +50,19 @@ require_once("freenas_guiconfig.inc");
require_once("freenas_functions.inc");
$nentries = $config['syslog']['nentries'];
-if (!$nentries)
- $nentries = 50;
+if (!$nentries) { $nentries = 50; }
if ($_POST['clear']) {
- exec("/usr/sbin/clog -i -s 262144 /var/log/rsyncd.log");
- /* redirect to avoid reposting form data on refresh */
- pfSenseHeader("diag_fn_logs_rsyncd.php");
- exit;
+ exec("/usr/sbin/clog -i -s 262144 /var/log/rsyncd.log");
+ /* redirect to avoid reposting form data on refresh */
+ pfSenseHeader("diag_fn_logs_rsyncd.php");
+ exit;
}
/* if ajax is calling, give them an update message */
if(isAjax())
- print_info_box_np($savemsg);
-
+ print_info_box_np($savemsg);
+
include("head.inc");
/* put your custom HTML head content here */
/* using some of the $pfSenseHead function calls */
@@ -70,36 +78,36 @@ echo $pfSenseHead->getHTML();
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr><td>
<?php
- $tab_array = array();
- $tab_array[] = array(gettext("Samba"), false, "diag_fn_logs_samba.php");
- $tab_array[] = array(gettext("FTP"), false, "diag_fn_logs_ftp.php");
- $tab_array[] = array(gettext("RSYNCD"), true, "diag_fn_logs_rsyncd.php");
+ $tab_array = array();
+ $tab_array[] = array(gettext("Samba"), false, "diag_fn_logs_samba.php");
+ $tab_array[] = array(gettext("FTP"), false, "diag_fn_logs_ftp.php");
+ $tab_array[] = array(gettext("RSYNCD"), true, "diag_fn_logs_rsyncd.php");
$tab_array[] = array(gettext("SSHD"), false, "diag_fn_logs_sshd.php");
- $tab_array[] = array(gettext("SMARTD"), false, "diag_fn_logs_smartd.php");
- $tab_array[] = array(gettext("Daemon"), false, "diag_fn_logs_daemon.php");
- $tab_array[] = array(gettext("Settings"), false, "diag_fn_logs_settings.php");
- display_top_tabs($tab_array);?>
+ $tab_array[] = array(gettext("SMARTD"), false, "diag_fn_logs_smartd.php");
+ $tab_array[] = array(gettext("Daemon"), false, "diag_fn_logs_daemon.php");
+ $tab_array[] = array(gettext("Settings"), false, "diag_fn_logs_settings.php");
+ display_top_tabs($tab_array);?>
</td></tr>
<tr>
<td>
- <div id="mainarea">
- <table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td class="listtopic">
- Last <?=$nentries;?> RSYNCD log entries
- </td>
- </tr>
- <?php dump_clog("/var/log/rsyncd.log", $nentries); ?>
- <tr>
- <td align="left" valign="top" height="12">&nbsp;</td>
- </tr>
- <tr>
- <td align="left" valign="top">
- <input name="clear" type="submit" class="formbtn" value="Clear log" />
- </td>
- </tr>
- </table>
- </div>
+ <div id="mainarea">
+ <table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0">
+ <tr>
+ <td class="listtopic">
+ Last <?=$nentries;?> RSYNCD log entries
+ </td>
+ </tr>
+ <?php dump_clog("/var/log/rsyncd.log", $nentries); ?>
+ <tr>
+ <td align="left" valign="top" height="12">&nbsp;</td>
+ </tr>
+ <tr>
+ <td align="left" valign="top">
+ <input name="clear" type="submit" class="formbtn" value="Clear log" />
+ </td>
+ </tr>
+ </table>
+ </div>
</td>
</tr>
</table>
diff --git a/packages/freenas/www/diag_fn_logs_samba.php b/packages/freenas/www/diag_fn_logs_samba.php
index 75a34df2..436de12d 100644
--- a/packages/freenas/www/diag_fn_logs_samba.php
+++ b/packages/freenas/www/diag_fn_logs_samba.php
@@ -1,35 +1,44 @@
<?php
/* $Id$ */
+/* ========================================================================== */
/*
- diag_logs_settings.php
- Copyright (C) 2004 Scott Ullrich
- All rights reserved.
+ diag_fn_logs_samba.php
+ part of pfSense (http://www.pfSense.com)
+ Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name>
+ All rights reserved.
- originially part of m0n0wall (http://m0n0.ch/wall)
- Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
- All rights reserved.
+ Based on FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ All rights reserved.
+ */
+/* ========================================================================== */
+/*
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+/* ========================================================================== */
$pgtitle = array(gettext("Diagnostics"),
gettext("System logs"),
@@ -41,22 +50,21 @@ require_once("freenas_guiconfig.inc");
require_once("freenas_functions.inc");
$nentries = $config['syslog']['nentries'];
-if (!$nentries)
- $nentries = 50;
+if (!$nentries) { $nentries = 50; }
if ($_POST['clear']) {
- exec("/bin/cp /dev/null /var/log/samba/log.nmbd");
- exec("/bin/cp /dev/null /var/log/samba/log.smbd");
- exec("/bin/cp /dev/null /var/log/samba/log.winbindd");
- /* redirect to avoid reposting form data on refresh */
- pfSenseHeader("diag_fn_logs_samba.php");
- exit;
+ exec("/bin/cp /dev/null /var/log/samba/log.nmbd");
+ exec("/bin/cp /dev/null /var/log/samba/log.smbd");
+ exec("/bin/cp /dev/null /var/log/samba/log.winbindd");
+ /* redirect to avoid reposting form data on refresh */
+ pfSenseHeader("diag_fn_logs_samba.php");
+ exit;
}
/* if ajax is calling, give them an update message */
if(isAjax())
- print_info_box_np($savemsg);
-
+ print_info_box_np($savemsg);
+
include("head.inc");
/* put your custom HTML head content here */
/* using some of the $pfSenseHead function calls */
@@ -72,91 +80,91 @@ echo $pfSenseHead->getHTML();
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr><td>
<?php
- $tab_array = array();
- $tab_array[] = array(gettext("Samba"), true, "diag_fn_logs_samba.php");
- $tab_array[] = array(gettext("FTP"), false, "diag_fn_logs_ftp.php");
- $tab_array[] = array(gettext("RSYNCD"), false, "diag_fn_logs_rsyncd.php");
+ $tab_array = array();
+ $tab_array[] = array(gettext("Samba"), true, "diag_fn_logs_samba.php");
+ $tab_array[] = array(gettext("FTP"), false, "diag_fn_logs_ftp.php");
+ $tab_array[] = array(gettext("RSYNCD"), false, "diag_fn_logs_rsyncd.php");
$tab_array[] = array(gettext("SSHD"), false, "diag_fn_logs_sshd.php");
- $tab_array[] = array(gettext("SMARTD"), false, "diag_fn_logs_smartd.php");
- $tab_array[] = array(gettext("Daemon"), false, "diag_fn_logs_daemon.php");
- $tab_array[] = array(gettext("Settings"), false, "diag_fn_logs_settings.php");
- display_top_tabs($tab_array);?>
+ $tab_array[] = array(gettext("SMARTD"), false, "diag_fn_logs_smartd.php");
+ $tab_array[] = array(gettext("Daemon"), false, "diag_fn_logs_daemon.php");
+ $tab_array[] = array(gettext("Settings"), false, "diag_fn_logs_settings.php");
+ display_top_tabs($tab_array);?>
</td></tr>
<tr>
<td>
- <div id="mainarea">
- <table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td class="listtopic">
- Last <?=$nentries;?> nmbd service log entries
- </td>
- </tr>
- <?php
- if (file_exists("/var/log/samba/log.nmbd")) {
- exec("cat /var/log/samba/log.nmbd", $rawlog);
- } else {
- $rawlog=array("No logs");
- }
- ?>
- <?php foreach ($rawlog as $log) { ?>
- <tr>
- <td class="listr" nowrap>
- <pre><?php echo htmlspecialchars($log); } ?></pre>
- </td>
- </tr>
- <tr>
- <td align="left" valign="top" height="12">&nbsp;</td>
- </tr>
- <?php unset ($rawlog); ?>
- <tr>
- <td class="listtopic">
- Last <?=$nentries;?> smbd service log entries
- </td>
- </tr>
- <?php
- if (file_exists("/var/log/samba/log.smbd")) {
- exec("cat /var/log/samba/log.smbd", $rawlog);
- } else {
- $rawlog=array("No logs");
- }
- ?>
- <?php foreach ($rawlog as $log) { ?>
- <tr>
- <td class="listr" nowrap>
- <pre><?php echo htmlspecialchars($log); } ?></pre>
- </td>
- </tr>
- <tr>
- <td align="left" valign="top" height="12">&nbsp;</td>
- </tr>
- <tr>
- <td class="listtopic">
- Last <?=$nentries;?> winbindd service log entries
- </td>
- </tr>
- <?php
- if (file_exists("/var/log/samba/log.winbindd")) {
- exec("cat /var/log/samba/log.winbindd", $rawlog);
- } else {
- $rawlog=array("No logs");
- }
- ?>
- <?php foreach ($rawlog as $log) { ?>
- <tr>
- <td class="listr" nowrap>
- <pre><?php echo htmlspecialchars($log); } ?></pre>
- </td>
- </tr>
- <tr>
- <td align="left" valign="top" height="12">&nbsp;</td>
- </tr>
- <tr>
- <td align="left" valign="top">
- <input name="clear" type="submit" class="formbtn" value="Clear log" />
- </td>
- </tr>
- </table>
- </div>
+ <div id="mainarea">
+ <table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0">
+ <tr>
+ <td class="listtopic">
+ Last <?=$nentries;?> nmbd service log entries
+ </td>
+ </tr>
+ <?php
+ if (file_exists("/var/log/samba/log.nmbd")) {
+ exec("cat /var/log/samba/log.nmbd", $rawlog);
+ } else {
+ $rawlog=array("No logs");
+ }
+ ?>
+ <?php foreach ($rawlog as $log) { ?>
+ <tr>
+ <td class="listr" nowrap>
+ <pre><?php echo htmlspecialchars($log); } ?></pre>
+ </td>
+ </tr>
+ <tr>
+ <td align="left" valign="top" height="12">&nbsp;</td>
+ </tr>
+ <?php unset ($rawlog); ?>
+ <tr>
+ <td class="listtopic">
+ Last <?=$nentries;?> smbd service log entries
+ </td>
+ </tr>
+ <?php
+ if (file_exists("/var/log/samba/log.smbd")) {
+ exec("cat /var/log/samba/log.smbd", $rawlog);
+ } else {
+ $rawlog=array("No logs");
+ }
+ ?>
+ <?php foreach ($rawlog as $log) { ?>
+ <tr>
+ <td class="listr" nowrap>
+ <pre><?php echo htmlspecialchars($log); } ?></pre>
+ </td>
+ </tr>
+ <tr>
+ <td align="left" valign="top" height="12">&nbsp;</td>
+ </tr>
+ <tr>
+ <td class="listtopic">
+ Last <?=$nentries;?> winbindd service log entries
+ </td>
+ </tr>
+ <?php
+ if (file_exists("/var/log/samba/log.winbindd")) {
+ exec("cat /var/log/samba/log.winbindd", $rawlog);
+ } else {
+ $rawlog=array("No logs");
+ }
+ ?>
+ <?php foreach ($rawlog as $log) { ?>
+ <tr>
+ <td class="listr" nowrap>
+ <pre><?php echo htmlspecialchars($log); } ?></pre>
+ </td>
+ </tr>
+ <tr>
+ <td align="left" valign="top" height="12">&nbsp;</td>
+ </tr>
+ <tr>
+ <td align="left" valign="top">
+ <input name="clear" type="submit" class="formbtn" value="Clear log" />
+ </td>
+ </tr>
+ </table>
+ </div>
</td>
</tr>
</table>
diff --git a/packages/freenas/www/diag_fn_logs_settings.php b/packages/freenas/www/diag_fn_logs_settings.php
index 1853df13..a51e8479 100644
--- a/packages/freenas/www/diag_fn_logs_settings.php
+++ b/packages/freenas/www/diag_fn_logs_settings.php
@@ -1,35 +1,44 @@
<?php
/* $Id$ */
+/* ========================================================================== */
/*
- diag_logs_settings.php
- Copyright (C) 2004 Scott Ullrich
- All rights reserved.
+ diag_fn_logs_settings.php
+ part of pfSense (http://www.pfSense.com)
+ Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name>
+ All rights reserved.
- originially part of m0n0wall (http://m0n0.ch/wall)
- Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
- All rights reserved.
+ Based on FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ All rights reserved.
+ */
+/* ========================================================================== */
+/*
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+/* ========================================================================== */
$pgtitle = array(gettext("Diagnostics"),
gettext("System logs"),
@@ -60,61 +69,59 @@ $pconfig['rsyncd'] = isset($config['syslog']['rsyncd']);
$pconfig['smartd'] = isset($config['syslog']['smartd']);
$pconfig['daemon'] = isset($config['syslog']['daemon']);
-if (!$pconfig['nentries'])
- $pconfig['nentries'] = 50;
+if (!$pconfig['nentries']) { $pconfig['nentries'] = 50; }
if ($_POST) {
-
- unset($input_errors);
- $pconfig = $_POST;
-
- /* input validation */
- if ($_POST['enable'] && !is_ipaddr($_POST['remoteserver'])) {
- $input_errors[] = gettext("A valid IP address must be specified.");
- }
- if (($_POST['nentries'] < 5) || ($_POST['nentries'] > 2000)) {
- $input_errors[] = gettext("Number of log entries to show must be between 5 and 2000.");
- }
-
- if (!$input_errors) {
- $config['syslog']['reverse'] = $_POST['reverse'] ? true : false;
- $config['syslog']['nentries'] = (int)$_POST['nentries'];
- $config['syslog']['remoteserver'] = $_POST['remoteserver'];
- $config['syslog']['filter'] = $_POST['filter'] ? true : false;
- $config['syslog']['dhcp'] = $_POST['dhcp'] ? true : false;
- $config['syslog']['portalauth'] = $_POST['portalauth'] ? true : false;
- $config['syslog']['vpn'] = $_POST['vpn'] ? true : false;
- $config['syslog']['system'] = $_POST['system'] ? true : false;
- $config['syslog']['disablelocallogging'] = $_POST['disablelocallogging'] ? true : false;
- $config['syslog']['enable'] = $_POST['enable'] ? true : false;
- $oldnologdefaultblock = isset($config['syslog']['nologdefaultblock']);
- $config['syslog']['nologdefaultblock'] = $_POST['logdefaultblock'] ? false : true;
- $config['syslog']['rawfilter'] = $_POST['rawfilter'] ? true : false;
- $config['syslog']['webservlogs'] = $_POST['webservlogs'] ? true : false;
- $config['syslog']['sshd'] = $_POST['sshd'] ? true : false;
- $config['syslog']['ftp'] = $_POST['ftp'] ? true : false;
- $config['syslog']['rsyncd'] = $_POST['rsyncd'] ? true : false;
- $config['syslog']['smartd'] = $_POST['smartd'] ? true : false;
- $config['syslog']['daemon'] = $_POST['daemon'] ? true : false;
- if($config['syslog']['enable'] == false)
- unset($config['syslog']['remoteserver']);
-
- write_config();
-
- $retval = 0;
- config_lock();
- $retval = system_syslogd_start();
- if ($oldnologdefaultblock !== isset($config['syslog']['nologdefaultblock']))
- $retval |= filter_configure();
- config_unlock();
- $savemsg = get_std_save_message($retval);
- }
+ unset($input_errors);
+ $pconfig = $_POST;
+
+ /* input validation */
+ if ($_POST['enable'] && !is_ipaddr($_POST['remoteserver'])) {
+ $input_errors[] = gettext("A valid IP address must be specified.");
+ }
+ if (($_POST['nentries'] < 5) || ($_POST['nentries'] > 2000)) {
+ $input_errors[] = gettext("Number of log entries to show must be between 5 and 2000.");
+ }
+
+ if (!$input_errors) {
+ $config['syslog']['reverse'] = $_POST['reverse'] ? true : false;
+ $config['syslog']['nentries'] = (int)$_POST['nentries'];
+ $config['syslog']['remoteserver'] = $_POST['remoteserver'];
+ $config['syslog']['filter'] = $_POST['filter'] ? true : false;
+ $config['syslog']['dhcp'] = $_POST['dhcp'] ? true : false;
+ $config['syslog']['portalauth'] = $_POST['portalauth'] ? true : false;
+ $config['syslog']['vpn'] = $_POST['vpn'] ? true : false;
+ $config['syslog']['system'] = $_POST['system'] ? true : false;
+ $config['syslog']['disablelocallogging'] = $_POST['disablelocallogging'] ? true : false;
+ $config['syslog']['enable'] = $_POST['enable'] ? true : false;
+ $oldnologdefaultblock = isset($config['syslog']['nologdefaultblock']);
+ $config['syslog']['nologdefaultblock'] = $_POST['logdefaultblock'] ? false : true;
+ $config['syslog']['rawfilter'] = $_POST['rawfilter'] ? true : false;
+ $config['syslog']['webservlogs'] = $_POST['webservlogs'] ? true : false;
+ $config['syslog']['sshd'] = $_POST['sshd'] ? true : false;
+ $config['syslog']['ftp'] = $_POST['ftp'] ? true : false;
+ $config['syslog']['rsyncd'] = $_POST['rsyncd'] ? true : false;
+ $config['syslog']['smartd'] = $_POST['smartd'] ? true : false;
+ $config['syslog']['daemon'] = $_POST['daemon'] ? true : false;
+ if($config['syslog']['enable'] == false)
+ unset($config['syslog']['remoteserver']);
+
+ write_config();
+
+ $retval = 0;
+ config_lock();
+ $retval = system_syslogd_start();
+ if ($oldnologdefaultblock !== isset($config['syslog']['nologdefaultblock']))
+ $retval |= filter_configure();
+ config_unlock();
+ $savemsg = get_std_save_message($retval);
+ }
}
/* if ajax is calling, give them an update message */
if(isAjax())
- print_info_box_np($savemsg);
-
+ print_info_box_np($savemsg);
+
include("head.inc");
/* put your custom HTML head content here */
/* using some of the $pfSenseHead function calls */
@@ -126,34 +133,34 @@ function enable_change(enable_over) {
endis = !(document.iform.enable.checked || enable_over);
endis ? color = '#D4D0C8' : color = '#FFFFFF';
- if (document.iform.enable.checked || enable_over) {
- document.iform.remoteserver.disabled = 0;
- document.iform.filter.disabled = 0;
- document.iform.dhcp.disabled = 0;
- document.iform.portalauth.disabled = 0;
- document.iform.vpn.disabled = 0;
+ if (document.iform.enable.checked || enable_over) {
+ document.iform.remoteserver.disabled = 0;
+ document.iform.filter.disabled = 0;
+ document.iform.dhcp.disabled = 0;
+ document.iform.portalauth.disabled = 0;
+ document.iform.vpn.disabled = 0;
document.iform.system.disabled = 0;
- document.iform.webservlogs.disabled = 0;
+ document.iform.webservlogs.disabled = 0;
document.iform.sshd.disabled = 0;
document.iform.ftp.disabled = 0;
document.iform.rsyncd.disabled = 0;
document.iform.smartd.disabled = 0;
document.iform.daemon.disabled = 0;
-
- } else {
- document.iform.remoteserver.disabled = 1;
- document.iform.filter.disabled = 1;
- document.iform.dhcp.disabled = 1;
- document.iform.portalauth.disabled = 1;
- document.iform.vpn.disabled = 1;
- document.iform.system.disabled = 1;
- document.iform.webservlogs.disabled = 1;
+
+ } else {
+ document.iform.remoteserver.disabled = 1;
+ document.iform.filter.disabled = 1;
+ document.iform.dhcp.disabled = 1;
+ document.iform.portalauth.disabled = 1;
+ document.iform.vpn.disabled = 1;
+ document.iform.system.disabled = 1;
+ document.iform.webservlogs.disabled = 1;
document.iform.sshd.disabled = 1;
document.iform.ftp.disabled = 1;
document.iform.rsyncd.disabled = 1;
document.iform.smartd.disabled = 1;
document.iform.daemon.disabled = 1;
- }
+ }
/* color adjustments */
document.iform.remoteserver.style.backgrounColor = color;
@@ -187,102 +194,108 @@ echo $pfSenseHead->getHTML();
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr><td>
<?php
- $tab_array = array();
- $tab_array[] = array(gettext("Samba"), false, "diag_fn_logs_samba.php");
- $tab_array[] = array(gettext("FTP"), false, "diag_fn_logs_ftp.php");
- $tab_array[] = array(gettext("RSYNCD"), false, "diag_fn_logs_rsyncd.php");
+ $tab_array = array();
+ $tab_array[] = array(gettext("Samba"), false, "diag_fn_logs_samba.php");
+ $tab_array[] = array(gettext("FTP"), false, "diag_fn_logs_ftp.php");
+ $tab_array[] = array(gettext("RSYNCD"), false, "diag_fn_logs_rsyncd.php");
$tab_array[] = array(gettext("SSHD"), false, "diag_fn_logs_sshd.php");
- $tab_array[] = array(gettext("SMARTD"), false, "diag_fn_logs_smartd.php");
- $tab_array[] = array(gettext("Daemon"), false, "diag_fn_logs_daemon.php");
- $tab_array[] = array(gettext("Settings"), true, "diag_fn_logs_settings.php");
- display_top_tabs($tab_array);?>
+ $tab_array[] = array(gettext("SMARTD"), false, "diag_fn_logs_smartd.php");
+ $tab_array[] = array(gettext("Daemon"), false, "diag_fn_logs_daemon.php");
+ $tab_array[] = array(gettext("Settings"), true, "diag_fn_logs_settings.php");
+ display_top_tabs($tab_array);?>
</td></tr>
<tr>
<td>
- <div id="mainarea">
- <table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td width="22%" valign="top" class="vtable">&nbsp;</td>
- <td width="78%" class="vtable"> <input name="reverse" class="formfld" type="checkbox" id="reverse" value="yes" <?php if ($pconfig['reverse']) echo "checked"; ?> />
- <strong><?=gettext("Show log entries in reverse order (newest entries on top)");?></strong></td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vtable">&nbsp;</td>
- <td width="78%" class="vtable"><?=gettext("Number of log entries to show");?>:
- <input name="nentries" id="nentries" type="text" class="formfld unknown" size="4" value="<?=htmlspecialchars($pconfig['nentries']);?>" /></td>
- </tr>
- <tr>
- <td valign="top" class="vtable">&nbsp;</td>
- <td class="vtable"> <input name="logdefaultblock" class="formfld" type="checkbox" id="logdefaultblock" value="yes" <?php if ($pconfig['logdefaultblock']) echo "checked"; ?> />
- <strong><?=gettext("Log packets blocked by the default rule");?></strong><br />
- <?=gettext("Hint: packets that are blocked by the
- implicit default block rule will not be logged anymore
- if you uncheck this option. Per-rule logging options are not affected.");?></td>
- </tr>
- <tr>
- <td valign="top" class="vtable">&nbsp;</td>
- <td class="vtable"> <input name="rawfilter" class="formfld" type="checkbox" id="rawfilter" value="yes" <?php if ($pconfig['rawfilter']) echo "checked"; ?> />
- <strong><?=gettext("Show raw filter logs");?></strong><br />
- <?=gettext("Hint: If this is checked, filter logs are shown as generated by the packet filter, without any formatting. This will reveal more detailed information.");?> </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vtable">&nbsp;</td>
- <td width="78%" class="vtable"> <input name="disablelocallogging" class="formfld" type="checkbox" id="disablelocallogging" value="yes" <?php if ($pconfig['disablelocallogging']) echo "checked"; ?> onclick="enable_change(false)" />
- <strong><?=gettext("Disable writing log files to the local disk");?></strong></td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vtable">&nbsp;</td>
- <td width="78%" class="vtable"> <input name="enable" class="formfld" type="checkbox" id="enable" value="yes" <?php if ($pconfig['enable']) echo "checked"; ?> onclick="enable_change(false)" />
- <strong><?=gettext("Enable syslog'ing to remote syslog server");?></strong></td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncell">Remote syslog
- server</td>
- <td width="78%" class="vtable">
- <input name="remoteserver" id="remoteserver" type="text" class="formfld unknown" size="20" value="<?=htmlspecialchars($pconfig['remoteserver']);?>" />
- <br /><?=gettext("IP address of remote syslog server");?>
- <br /><br />
- <input name="system" id="system" class="formfld" type="checkbox" value="yes" onclick="enable_change(false)" <?php if ($pconfig['system']) echo "checked=\"checked\""; ?> />
- <?=gettext("system events");?><br />
- <input name="filter" id="filter" class="formfld" type="checkbox" value="yes" <?php if ($pconfig['filter']) echo "checked=\"checked\""; ?> />
- <?=gettext("firewall events");?><br />
- <input name="dhcp" id="dhcp" class="formfld" type="checkbox" value="yes" <?php if ($pconfig['dhcp']) echo "checked=\"checked\""; ?> />
- <?=gettext("DHCP service events");?><br />
- <input name="portalauth" id="portalauth" class="formfld" type="checkbox" value="yes" <?php if ($pconfig['portalauth']) echo "checked=\"checked\""; ?> />
- <?=gettext("Portal Auth");?><br />
- <input name="vpn" id="vpn" class="formfld" type="checkbox" value="yes" <?php if ($pconfig['vpn']) echo "checked=\"checked\""; ?> />
- <?=gettext("PPTP VPN events");?><br />
- <input name="webservlogs" id="webservlogs" class="formfld" type="checkbox" value="yes" <?php if ($pconfig['webservlogs']) echo "checked=\"checked\""; ?> />
- <?=gettext("webConfigurator Logs");?><br />
- <input name="sshd" id="sshd" class="formfld" type="checkbox" value="yes" <?php if ($pconfig['sshd']) echo "checked=\"checked\""; ?> />
- <?=gettext("SSHD events");?><br />
- <input name="ftp" id="ftp" class="formfld" type="checkbox" value="yes" <?php if ($pconfig['ftp']) echo "checked=\"checked\""; ?> />
- <?=gettext("FTP events");?><br />
- <input name="rsyncd" id="rsyncd" class="formfld" type="checkbox" value="yes" <?php if ($pconfig['rsyncd']) echo "checked=\"checked\""; ?> />
- <?=gettext("RSYNCD events");?><br />
- <input name="smartd" id="smartd" class="formfld" type="checkbox" value="yes" <?php if ($pconfig['smartd']) echo "checked=\"checked\""; ?> />
- <?=gettext("SMARTD events");?><br />
- <input name="daemon" id="daemon" class="formfld" type="checkbox" value="yes" <?php if ($pconfig['daemon']) echo "checked=\"checked\""; ?> />
- <?=gettext("Daemon events");?><br />
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top">&nbsp;</td>
- <td width="78%"> <input id="submit" name="Submit" type="submit" class="formbtn" value="Save" onclick="enable_change(true)" />
- </td>
- </tr>
- <tr>
- <td width="22%" height="53" valign="top">&nbsp;</td>
- <td width="78%"><strong><span class="red"><?=gettext("Note");?>:</span></strong><br />
- <?=gettext("
- syslog sends UDP datagrams to port 514 on the specified
- remote syslog server. Be sure to set syslogd on the
- remote server to accept syslog messages from {$g['product_name']}.
- ");?>
- </td>
- </tr>
- </table>
- </div>
+ <div id="mainarea">
+ <table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0">
+ <tr>
+ <td width="22%" valign="top" class="vtable">&nbsp;</td>
+ <td width="78%" class="vtable"> <input name="reverse" class="formfld" type="checkbox" id="reverse" value="yes" <?php if ($pconfig['reverse']) echo "checked"; ?> />
+ <strong><?=gettext("Show log entries in reverse order (newest entries on top)");?></strong>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vtable">&nbsp;</td>
+ <td width="78%" class="vtable"><?=gettext("Number of log entries to show");?>:
+ <input name="nentries" id="nentries" type="text" class="formfld unknown" size="4" value="<?=htmlspecialchars($pconfig['nentries']);?>" />
+ </td>
+ </tr>
+ <tr>
+ <td valign="top" class="vtable">&nbsp;</td>
+ <td class="vtable"> <input name="logdefaultblock" class="formfld" type="checkbox" id="logdefaultblock" value="yes" <?php if ($pconfig['logdefaultblock']) echo "checked"; ?> />
+ <strong><?=gettext("Log packets blocked by the default rule");?></strong><br />
+ <?=gettext("Hint: packets that are blocked by the
+ implicit default block rule will not be logged anymore
+ if you uncheck this option. Per-rule logging options are not affected.");?>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top" class="vtable">&nbsp;</td>
+ <td class="vtable"> <input name="rawfilter" class="formfld" type="checkbox" id="rawfilter" value="yes" <?php if ($pconfig['rawfilter']) echo "checked"; ?> />
+ <strong><?=gettext("Show raw filter logs");?></strong><br />
+ <?=gettext("Hint: If this is checked, filter logs are shown as generated by the packet filter, without any formatting. This will reveal more detailed information.");?>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vtable">&nbsp;</td>
+ <td width="78%" class="vtable"> <input name="disablelocallogging" class="formfld" type="checkbox" id="disablelocallogging" value="yes" <?php if ($pconfig['disablelocallogging']) echo "checked"; ?> onclick="enable_change(false)" />
+ <strong><?=gettext("Disable writing log files to the local disk");?></strong>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vtable">&nbsp;</td>
+ <td width="78%" class="vtable"> <input name="enable" class="formfld" type="checkbox" id="enable" value="yes" <?php if ($pconfig['enable']) echo "checked"; ?> onclick="enable_change(false)" />
+ <strong><?=gettext("Enable syslog'ing to remote syslog server");?></strong>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell">Remote syslog server</td>
+ <td width="78%" class="vtable">
+ <input name="remoteserver" id="remoteserver" type="text" class="formfld unknown" size="20" value="<?=htmlspecialchars($pconfig['remoteserver']);?>" />
+ <br /><?=gettext("IP address of remote syslog server");?>
+ <br /><br />
+ <input name="system" id="system" class="formfld" type="checkbox" value="yes" onclick="enable_change(false)" <?php if ($pconfig['system']) echo "checked=\"checked\""; ?> />
+ <?=gettext("system events");?><br />
+ <input name="filter" id="filter" class="formfld" type="checkbox" value="yes" <?php if ($pconfig['filter']) echo "checked=\"checked\""; ?> />
+ <?=gettext("firewall events");?><br />
+ <input name="dhcp" id="dhcp" class="formfld" type="checkbox" value="yes" <?php if ($pconfig['dhcp']) echo "checked=\"checked\""; ?> />
+ <?=gettext("DHCP service events");?><br />
+ <input name="portalauth" id="portalauth" class="formfld" type="checkbox" value="yes" <?php if ($pconfig['portalauth']) echo "checked=\"checked\""; ?> />
+ <?=gettext("Portal Auth");?><br />
+ <input name="vpn" id="vpn" class="formfld" type="checkbox" value="yes" <?php if ($pconfig['vpn']) echo "checked=\"checked\""; ?> />
+ <?=gettext("PPTP VPN events");?><br />
+ <input name="webservlogs" id="webservlogs" class="formfld" type="checkbox" value="yes" <?php if ($pconfig['webservlogs']) echo "checked=\"checked\""; ?> />
+ <?=gettext("webConfigurator Logs");?><br />
+ <input name="sshd" id="sshd" class="formfld" type="checkbox" value="yes" <?php if ($pconfig['sshd']) echo "checked=\"checked\""; ?> />
+ <?=gettext("SSHD events");?><br />
+ <input name="ftp" id="ftp" class="formfld" type="checkbox" value="yes" <?php if ($pconfig['ftp']) echo "checked=\"checked\""; ?> />
+ <?=gettext("FTP events");?><br />
+ <input name="rsyncd" id="rsyncd" class="formfld" type="checkbox" value="yes" <?php if ($pconfig['rsyncd']) echo "checked=\"checked\""; ?> />
+ <?=gettext("RSYNCD events");?><br />
+ <input name="smartd" id="smartd" class="formfld" type="checkbox" value="yes" <?php if ($pconfig['smartd']) echo "checked=\"checked\""; ?> />
+ <?=gettext("SMARTD events");?><br />
+ <input name="daemon" id="daemon" class="formfld" type="checkbox" value="yes" <?php if ($pconfig['daemon']) echo "checked=\"checked\""; ?> />
+ <?=gettext("Daemon events");?><br />
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top">&nbsp;</td>
+ <td width="78%">
+ <input id="submit" name="Submit" type="submit" class="formbtn" value="Save" onclick="enable_change(true)" />
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" height="53" valign="top">&nbsp;</td>
+ <td width="78%"><strong><span class="red"><?=gettext("Note");?>:</span></strong><br />
+ <?=gettext("
+ syslog sends UDP datagrams to port 514 on the specified
+ remote syslog server. Be sure to set syslogd on the
+ remote server to accept syslog messages from {$g['product_name']}.
+ ");?>
+ </td>
+ </tr>
+ </table>
+ </div>
</td>
</tr>
</table>
diff --git a/packages/freenas/www/diag_fn_logs_smartd.php b/packages/freenas/www/diag_fn_logs_smartd.php
index ca575631..7e57d543 100644
--- a/packages/freenas/www/diag_fn_logs_smartd.php
+++ b/packages/freenas/www/diag_fn_logs_smartd.php
@@ -1,35 +1,44 @@
<?php
/* $Id$ */
+/* ========================================================================== */
/*
- diag_logs_settings.php
- Copyright (C) 2004 Scott Ullrich
- All rights reserved.
+ diag_fn_logs_smartd.php
+ part of pfSense (http://www.pfSense.com)
+ Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name>
+ All rights reserved.
- originially part of m0n0wall (http://m0n0.ch/wall)
- Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
- All rights reserved.
+ Based on FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ All rights reserved.
+ */
+/* ========================================================================== */
+/*
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+/* ========================================================================== */
$pgtitle = array(gettext("Diagnostics"),
gettext("System logs"),
@@ -41,21 +50,20 @@ require_once("freenas_guiconfig.inc");
require_once("freenas_functions.inc");
$nentries = $config['syslog']['nentries'];
-if (!$nentries)
- $nentries = 50;
+if (!$nentries) { $nentries = 50; }
if ($_POST['clear'])
{
- exec("/usr/sbin/clog -i -s 262144 /var/log/smartd.log");
- /* redirect to avoid reposting form data on refresh */
- pfSenseHeader("diag_fn_logs_smartd.php");
- exit;
+ exec("/usr/sbin/clog -i -s 262144 /var/log/smartd.log");
+ /* redirect to avoid reposting form data on refresh */
+ pfSenseHeader("diag_fn_logs_smartd.php");
+ exit;
}
/* if ajax is calling, give them an update message */
if(isAjax())
- print_info_box_np($savemsg);
-
+ print_info_box_np($savemsg);
+
include("head.inc");
/* put your custom HTML head content here */
/* using some of the $pfSenseHead function calls */
@@ -71,36 +79,36 @@ echo $pfSenseHead->getHTML();
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr><td>
<?php
- $tab_array = array();
- $tab_array[] = array(gettext("Samba"), false, "diag_fn_logs_samba.php");
- $tab_array[] = array(gettext("FTP"), false, "diag_fn_logs_ftp.php");
- $tab_array[] = array(gettext("RSYNCD"), false, "diag_fn_logs_rsyncd.php");
+ $tab_array = array();
+ $tab_array[] = array(gettext("Samba"), false, "diag_fn_logs_samba.php");
+ $tab_array[] = array(gettext("FTP"), false, "diag_fn_logs_ftp.php");
+ $tab_array[] = array(gettext("RSYNCD"), false, "diag_fn_logs_rsyncd.php");
$tab_array[] = array(gettext("SSHD"), false, "diag_fn_logs_sshd.php");
- $tab_array[] = array(gettext("SMARTD"), true, "diag_fn_logs_smartd.php");
- $tab_array[] = array(gettext("Daemon"), false, "diag_fn_logs_daemon.php");
- $tab_array[] = array(gettext("Settings"), false, "diag_fn_logs_settings.php");
- display_top_tabs($tab_array);?>
+ $tab_array[] = array(gettext("SMARTD"), true, "diag_fn_logs_smartd.php");
+ $tab_array[] = array(gettext("Daemon"), false, "diag_fn_logs_daemon.php");
+ $tab_array[] = array(gettext("Settings"), false, "diag_fn_logs_settings.php");
+ display_top_tabs($tab_array);?>
</td></tr>
<tr>
<td>
- <div id="mainarea">
- <table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td class="listtopic">
- Last <?=$nentries;?> SmartD log entries
- </td>
- </tr>
- <?php dump_clog("/var/log/smartd.log", $nentries); ?>
- <tr>
- <td align="left" valign="top" height="12">&nbsp;</td>
- </tr>
- <tr>
- <td align="left" valign="top">
- <input name="clear" type="submit" class="formbtn" value="Clear log" />
- </td>
- </tr>
- </table>
- </div>
+ <div id="mainarea">
+ <table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0">
+ <tr>
+ <td class="listtopic">
+ Last <?=$nentries;?> SmartD log entries
+ </td>
+ </tr>
+ <?php dump_clog("/var/log/smartd.log", $nentries); ?>
+ <tr>
+ <td align="left" valign="top" height="12">&nbsp;</td>
+ </tr>
+ <tr>
+ <td align="left" valign="top">
+ <input name="clear" type="submit" class="formbtn" value="Clear log" />
+ </td>
+ </tr>
+ </table>
+ </div>
</td>
</tr>
</table>
diff --git a/packages/freenas/www/diag_fn_logs_sshd.php b/packages/freenas/www/diag_fn_logs_sshd.php
index e39230b6..bc61d57f 100644
--- a/packages/freenas/www/diag_fn_logs_sshd.php
+++ b/packages/freenas/www/diag_fn_logs_sshd.php
@@ -1,35 +1,44 @@
<?php
/* $Id$ */
+/* ========================================================================== */
/*
- diag_logs_settings.php
- Copyright (C) 2004 Scott Ullrich
- All rights reserved.
+ diag_fn_logs_sshd.php
+ part of pfSense (http://www.pfSense.com)
+ Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name>
+ All rights reserved.
- originially part of m0n0wall (http://m0n0.ch/wall)
- Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
- All rights reserved.
+ Based on FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ All rights reserved.
+ */
+/* ========================================================================== */
+/*
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+/* ========================================================================== */
$pgtitle = array(gettext("Diagnostics"),
gettext("System logs"),
@@ -41,20 +50,19 @@ require_once("freenas_guiconfig.inc");
require_once("freenas_functions.inc");
$nentries = $config['syslog']['nentries'];
-if (!$nentries)
- $nentries = 50;
+if (!$nentries) { $nentries = 50; }
if ($_POST['clear']) {
- exec("/usr/sbin/clog -i -s 262144 /var/log/sshd.log");
- /* redirect to avoid reposting form data on refresh */
- pfSenseHeader("diag_logs_sshd.php");
- exit;
+ exec("/usr/sbin/clog -i -s 262144 /var/log/sshd.log");
+ /* redirect to avoid reposting form data on refresh */
+ pfSenseHeader("diag_fn_logs_sshd.php");
+ exit;
}
/* if ajax is calling, give them an update message */
if(isAjax())
- print_info_box_np($savemsg);
-
+ print_info_box_np($savemsg);
+
include("head.inc");
/* put your custom HTML head content here */
/* using some of the $pfSenseHead function calls */
@@ -70,36 +78,36 @@ echo $pfSenseHead->getHTML();
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr><td>
<?php
- $tab_array = array();
- $tab_array[] = array(gettext("Samba"), false, "diag_fn_logs_samba.php");
- $tab_array[] = array(gettext("FTP"), false, "diag_fn_logs_ftp.php");
- $tab_array[] = array(gettext("RSYNCD"), false, "diag_fn_logs_rsyncd.php");
+ $tab_array = array();
+ $tab_array[] = array(gettext("Samba"), false, "diag_fn_logs_samba.php");
+ $tab_array[] = array(gettext("FTP"), false, "diag_fn_logs_ftp.php");
+ $tab_array[] = array(gettext("RSYNCD"), false, "diag_fn_logs_rsyncd.php");
$tab_array[] = array(gettext("SSHD"), true, "diag_fn_logs_sshd.php");
- $tab_array[] = array(gettext("SMARTD"), false, "diag_fn_logs_smartd.php");
- $tab_array[] = array(gettext("Daemon"), false, "diag_fn_logs_daemon.php");
- $tab_array[] = array(gettext("Settings"), false, "diag_fn_logs_settings.php");
- display_top_tabs($tab_array);?>
+ $tab_array[] = array(gettext("SMARTD"), false, "diag_fn_logs_smartd.php");
+ $tab_array[] = array(gettext("Daemon"), false, "diag_fn_logs_daemon.php");
+ $tab_array[] = array(gettext("Settings"), false, "diag_fn_logs_settings.php");
+ display_top_tabs($tab_array);?>
</td></tr>
<tr>
<td>
- <div id="mainarea">
- <table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td class="listtopic">
- Last <?=$nentries;?> SSHD log entries
- </td>
- </tr>
- <?php dump_clog("/var/log/sshd.log", $nentries); ?>
- <tr>
- <td align="left" valign="top" height="12">&nbsp;</td>
- </tr>
- <tr>
- <td align="left" valign="top">
- <input name="clear" type="submit" class="formbtn" value="Clear log" />
- </td>
- </tr>
- </table>
- </div>
+ <div id="mainarea">
+ <table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0">
+ <tr>
+ <td class="listtopic">
+ Last <?=$nentries;?> SSHD log entries
+ </td>
+ </tr>
+ <?php dump_clog("/var/log/sshd.log", $nentries); ?>
+ <tr>
+ <td align="left" valign="top" height="12">&nbsp;</td>
+ </tr>
+ <tr>
+ <td align="left" valign="top">
+ <input name="clear" type="submit" class="formbtn" value="Clear log" />
+ </td>
+ </tr>
+ </table>
+ </div>
</td>
</tr>
</table>
diff --git a/packages/freenas/www/diag_iscsi_infos.php b/packages/freenas/www/diag_iscsi_infos.php
index b378f6b2..05c136e8 100644
--- a/packages/freenas/www/diag_iscsi_infos.php
+++ b/packages/freenas/www/diag_iscsi_infos.php
@@ -1,36 +1,44 @@
<?php
/* $Id$ */
+/* ========================================================================== */
/*
- disks_manage_edit.php
- part of FreeNAS (http://www.freenas.org)
- Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
- All rights reserved.
-
- Based on m0n0wall (http://m0n0.ch/wall)
- Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
+ diag_iscsi_infos.php
+ part of pfSense (http://www.pfSense.com)
+ Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name>
+ All rights reserved.
+
+ Based on FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ All rights reserved.
+ */
+/* ========================================================================== */
+/*
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+/* ========================================================================== */
$pgtitle = array(gettext("Diagnostics"),
gettext("iSCSI Infos"));
@@ -77,8 +85,8 @@ echo $pfSenseHead->getHTML();
<tr>
<td class="tabnavtbl">
<?php
- $tab_array = array();
- $tab_array[0] = array(gettext("Disks"), false, "diag_disks_infos.php");
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Disks"), false, "diag_disks_infos.php");
$tab_array[1] = array(gettext("Partitions"), false, "diag_part_infos.php");
$tab_array[2] = array(gettext("SMART"), false, "diag_smart_infos.php");
$tab_array[3] = array(gettext("ataidle"), false, "diag_ataidle_infos.php");
@@ -86,38 +94,38 @@ echo $pfSenseHead->getHTML();
$tab_array[5] = array(gettext("Mounts"), false, "diag_mounts_infos.php");
$tab_array[6] = array(gettext("Software RAID"), false, "diag_raid_infos.php");
$tab_array[7] = array(gettext("iSCSI"), true, "diag_iscsi_infos.php");
- display_top_tabs($tab_array);
+ display_top_tabs($tab_array);
?>
</td>
</tr>
<tr>
<td class="tabnavtbl">
<?php
- $tab_array = array();
- $tab_array[0] = array(gettext("Manage RAID"), false, "diag_ad_infos.php");
- display_top_tabs($tab_array);
+ $tab_array = array();
+ $tab_array[0] = array(gettext("MS Domain"), false, "diag_ad_infos.php");
+ display_top_tabs($tab_array);
?>
</td>
</tr>
<tr>
<td>
- <div id="mainarea">
+ <div id="mainarea">
<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="left" valign="top">
<?php
if (! isset($freenas_config['iscsi']['enable'])) {
- echo "<strong>iSCSI initiator disabled</strong><br />";
+ echo "<strong>iSCSI initiator disabled</strong><br />";
} else {
echo "<pre style=\"font-size: medium;\">";
- echo "<strong>Show the list of available target Name on the iSCSI target</strong><br>";
-
- exec("/usr/local/sbin/iscontrol -d targetaddress={$freenas_config['iscsi']['targetaddress']}",$rawdata);
- foreach ($rawdata as $line)
- {
- echo htmlspecialchars($line) . "<br>";
- }
- unset ($rawdata);
+ echo "<strong>Show the list of available target Name on the iSCSI target</strong><br>";
+
+ exec("/usr/local/sbin/iscontrol -d targetaddress={$freenas_config['iscsi']['targetaddress']}",$rawdata);
+ foreach ($rawdata as $line)
+ {
+ echo htmlspecialchars($line) . "<br>";
+ }
+ unset ($rawdata);
echo "</pre>";
}
?>
@@ -126,7 +134,7 @@ echo $pfSenseHead->getHTML();
</table>
</div>
</td>
- </tr>
+ </tr>
</table>
</form>
<?php include("fend.inc"); ?>
diff --git a/packages/freenas/www/diag_mounts_infos.php b/packages/freenas/www/diag_mounts_infos.php
index e0bea806..29eb49f5 100644
--- a/packages/freenas/www/diag_mounts_infos.php
+++ b/packages/freenas/www/diag_mounts_infos.php
@@ -1,36 +1,44 @@
<?php
/* $Id$ */
+/* ========================================================================== */
/*
- disks_manage_edit.php
- part of FreeNAS (http://www.freenas.org)
- Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
- All rights reserved.
-
- Based on m0n0wall (http://m0n0.ch/wall)
- Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
+ diag_mounts_infos.php
+ part of pfSense (http://www.pfSense.com)
+ Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name>
+ All rights reserved.
+
+ Based on FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ All rights reserved.
+ */
+/* ========================================================================== */
+/*
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+/* ========================================================================== */
$pgtitle = array(gettext("Diagnostics"),
gettext("Mount Infos"));
@@ -77,8 +85,8 @@ echo $pfSenseHead->getHTML();
<tr>
<td class="tabnavtbl">
<?php
- $tab_array = array();
- $tab_array[0] = array(gettext("Disks"), false, "diag_disks_infos.php");
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Disks"), false, "diag_disks_infos.php");
$tab_array[1] = array(gettext("Partitions"), false, "diag_part_infos.php");
$tab_array[2] = array(gettext("SMART"), false, "diag_smart_infos.php");
$tab_array[3] = array(gettext("ataidle"), false, "diag_ataidle_infos.php");
@@ -86,34 +94,34 @@ echo $pfSenseHead->getHTML();
$tab_array[5] = array(gettext("Mounts"), true, "diag_mounts_infos.php");
$tab_array[6] = array(gettext("Software RAID"), false, "diag_raid_infos.php");
$tab_array[7] = array(gettext("iSCSI"), false, "diag_iscsi_infos.php");
- display_top_tabs($tab_array);
+ display_top_tabs($tab_array);
?>
</td>
</tr>
<tr>
<td class="tabnavtbl">
<?php
- $tab_array = array();
- $tab_array[0] = array(gettext("Manage RAID"), false, "diag_ad_infos.php");
- display_top_tabs($tab_array);
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Manage RAID"), false, "diag_ad_infos.php");
+ display_top_tabs($tab_array);
?>
</td>
</tr>
<tr>
<td>
- <div id="mainarea">
+ <div id="mainarea">
<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="left" valign="top">
<?php
echo "<pre style=\"font-size: medium;\">";
echo "<strong>List of mounted point:</strong><br />";
- exec("/sbin/mount",$mountrawdata);
- foreach ($mountrawdata as $line)
- {
+ exec("/sbin/mount",$mountrawdata);
+ foreach ($mountrawdata as $line)
+ {
echo htmlspecialchars($line) . "<br />";
- }
- unset ($line);
+ }
+ unset ($line);
echo "</pre>";
?>
</td>
@@ -121,7 +129,7 @@ echo $pfSenseHead->getHTML();
</table>
</div>
</td>
- </tr>
+ </tr>
</table>
</form>
<?php include("fend.inc"); ?>
diff --git a/packages/freenas/www/diag_part_infos.php b/packages/freenas/www/diag_part_infos.php
index d28e1ae2..011a771c 100644
--- a/packages/freenas/www/diag_part_infos.php
+++ b/packages/freenas/www/diag_part_infos.php
@@ -1,36 +1,44 @@
<?php
/* $Id$ */
+/* ========================================================================== */
/*
- disks_manage_edit.php
- part of FreeNAS (http://www.freenas.org)
- Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
- All rights reserved.
-
- Based on m0n0wall (http://m0n0.ch/wall)
- Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
+ diag_part_infos.php
+ part of pfSense (http://www.pfSense.com)
+ Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name>
+ All rights reserved.
+
+ Based on FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ All rights reserved.
+ */
+/* ========================================================================== */
+/*
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+/* ========================================================================== */
$pgtitle = array(gettext("Diagnostics"),
gettext("Partition Infos"));
@@ -77,8 +85,8 @@ echo $pfSenseHead->getHTML();
<tr>
<td class="tabnavtbl">
<?php
- $tab_array = array();
- $tab_array[0] = array(gettext("Disks"), false, "diag_disks_infos.php");
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Disks"), false, "diag_disks_infos.php");
$tab_array[1] = array(gettext("Partitions"), true, "diag_part_infos.php");
$tab_array[2] = array(gettext("SMART"), false, "diag_smart_infos.php");
$tab_array[3] = array(gettext("ataidle"), false, "diag_ataidle_infos.php");
@@ -86,30 +94,28 @@ echo $pfSenseHead->getHTML();
$tab_array[5] = array(gettext("Mounts"), false, "diag_mounts_infos.php");
$tab_array[6] = array(gettext("Software RAID"), false, "diag_raid_infos.php");
$tab_array[7] = array(gettext("iSCSI"), false, "diag_iscsi_infos.php");
- display_top_tabs($tab_array);
+ display_top_tabs($tab_array);
?>
</td>
</tr>
<tr>
<td class="tabnavtbl">
<?php
- $tab_array = array();
- $tab_array[0] = array(gettext("Manage RAID"), false, "diag_ad_infos.php");
- display_top_tabs($tab_array);
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Manage RAID"), false, "diag_ad_infos.php");
+ display_top_tabs($tab_array);
?>
</td>
</tr>
<tr>
<td>
- <div id="mainarea">
+ <div id="mainarea">
<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="left" valign="top">
<?php
echo "<pre style=\"font-size: medium;\">";
-
$disklist = get_physical_disks_list();
-
echo "<strong>List of partition on all detected disk:</strong><br />";
foreach ($disklist as $disknamek => $disknamev)
{
@@ -127,7 +133,7 @@ echo $pfSenseHead->getHTML();
</table>
</div>
</td>
- </tr>
+ </tr>
</table>
</form>
<?php include("fend.inc"); ?>
diff --git a/packages/freenas/www/diag_raid_infos.php b/packages/freenas/www/diag_raid_infos.php
index 32bccf23..88b9a5fc 100644
--- a/packages/freenas/www/diag_raid_infos.php
+++ b/packages/freenas/www/diag_raid_infos.php
@@ -1,36 +1,44 @@
<?php
/* $Id$ */
+/* ========================================================================== */
/*
- disks_manage_edit.php
- part of FreeNAS (http://www.freenas.org)
- Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
- All rights reserved.
-
- Based on m0n0wall (http://m0n0.ch/wall)
- Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
+ diag_raid_infos.php
+ part of pfSense (http://www.pfSense.com)
+ Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name>
+ All rights reserved.
+
+ Based on FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ All rights reserved.
+ */
+/* ========================================================================== */
+/*
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+/* ========================================================================== */
$pgtitle = array(gettext("Diagnostics"),
gettext("RAID Infos"));
@@ -77,8 +85,8 @@ echo $pfSenseHead->getHTML();
<tr>
<td class="tabnavtbl">
<?php
- $tab_array = array();
- $tab_array[0] = array(gettext("Disks"), false, "diag_disks_infos.php");
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Disks"), false, "diag_disks_infos.php");
$tab_array[1] = array(gettext("Partitions"), false, "diag_part_infos.php");
$tab_array[2] = array(gettext("SMART"), false, "diag_smart_infos.php");
$tab_array[3] = array(gettext("ataidle"), false, "diag_ataidle_infos.php");
@@ -86,22 +94,22 @@ echo $pfSenseHead->getHTML();
$tab_array[5] = array(gettext("Mounts"), false, "diag_mounts_infos.php");
$tab_array[6] = array(gettext("Software RAID"), true, "diag_raid_infos.php");
$tab_array[7] = array(gettext("iSCSI"), false, "diag_iscsi_infos.php");
- display_top_tabs($tab_array);
+ display_top_tabs($tab_array);
?>
</td>
</tr>
<tr>
<td class="tabnavtbl">
<?php
- $tab_array = array();
- $tab_array[0] = array(gettext("Manage RAID"), false, "diag_ad_infos.php");
- display_top_tabs($tab_array);
+ $tab_array = array();
+ $tab_array[0] = array(gettext("MS Domain"), false, "diag_ad_infos.php");
+ display_top_tabs($tab_array);
?>
</td>
</tr>
<tr>
<td>
- <div id="mainarea">
+ <div id="mainarea">
<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="left" valign="top">
@@ -114,7 +122,6 @@ echo $pfSenseHead->getHTML();
}
unset ($line);
unset ($rawdata);
-
echo "<strong>Software RAID - gvinum status:</strong><br />";
exec("/sbin/gvinum list",$rawdata);
foreach ($rawdata as $line) {
@@ -128,7 +135,7 @@ echo $pfSenseHead->getHTML();
</table>
</div>
</td>
- </tr>
+ </tr>
</table>
</form>
<?php include("fend.inc"); ?>
diff --git a/packages/freenas/www/diag_smart_infos.php b/packages/freenas/www/diag_smart_infos.php
index b2d91157..d265d1b7 100644
--- a/packages/freenas/www/diag_smart_infos.php
+++ b/packages/freenas/www/diag_smart_infos.php
@@ -1,36 +1,44 @@
<?php
/* $Id$ */
+/* ========================================================================== */
/*
- disks_manage_edit.php
- part of FreeNAS (http://www.freenas.org)
- Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
- All rights reserved.
-
- Based on m0n0wall (http://m0n0.ch/wall)
- Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
+ diag_smart_infos.php
+ part of pfSense (http://www.pfSense.com)
+ Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name>
+ All rights reserved.
+
+ Based on FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ All rights reserved.
+ */
+/* ========================================================================== */
+/*
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+/* ========================================================================== */
$pgtitle = array(gettext("Diagnostics"),
gettext("SMART Infos"));
@@ -77,8 +85,8 @@ echo $pfSenseHead->getHTML();
<tr>
<td class="tabnavtbl">
<?php
- $tab_array = array();
- $tab_array[0] = array(gettext("Disks"), false, "diag_disks_infos.php");
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Disks"), false, "diag_disks_infos.php");
$tab_array[1] = array(gettext("Partitions"), false, "diag_part_infos.php");
$tab_array[2] = array(gettext("SMART"), true, "diag_smart_infos.php");
$tab_array[3] = array(gettext("ataidle"), false, "diag_ataidle_infos.php");
@@ -86,38 +94,37 @@ echo $pfSenseHead->getHTML();
$tab_array[5] = array(gettext("Mounts"), false, "diag_mounts_infos.php");
$tab_array[6] = array(gettext("Software RAID"), false, "diag_raid_infos.php");
$tab_array[7] = array(gettext("iSCSI"), false, "diag_iscsi_infos.php");
- display_top_tabs($tab_array);
+ display_top_tabs($tab_array);
?>
</td>
</tr>
<tr>
<td class="tabnavtbl">
<?php
- $tab_array = array();
- $tab_array[0] = array(gettext("Manage RAID"), false, "diag_ad_infos.php");
- display_top_tabs($tab_array);
+ $tab_array = array();
+ $tab_array[0] = array(gettext("MS Domain"), false, "diag_ad_infos.php");
+ display_top_tabs($tab_array);
?>
</td>
</tr>
<tr>
<td>
- <div id="mainarea">
+ <div id="mainarea">
<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="left" valign="top">
<?php
echo "<pre style=\"font-size: medium;\">";
$disklist = get_physical_disks_list();
-
echo "<strong>List of SMART capabilities on all detected disk:</strong><br />";
foreach ($disklist as $disknamek => $disknamev)
{
- exec("/usr/local/sbin/smartctl -a /dev/$disknamek",$fdiskrawdata);
- foreach ($fdiskrawdata as $line)
- {
- echo htmlspecialchars($line) . "<br />";
- }
- unset ($fdiskrawdata);
+ exec("/usr/local/sbin/smartctl -a /dev/$disknamek",$fdiskrawdata);
+ foreach ($fdiskrawdata as $line)
+ {
+ echo htmlspecialchars($line) . "<br />";
+ }
+ unset ($fdiskrawdata);
}
echo "</pre>";
?>
@@ -126,7 +133,7 @@ echo $pfSenseHead->getHTML();
</table>
</div>
</td>
- </tr>
+ </tr>
</table>
</form>
<?php include("fend.inc"); ?>
diff --git a/packages/freenas/www/diag_space_infos.php b/packages/freenas/www/diag_space_infos.php
index b9a7554a..e0726b07 100644
--- a/packages/freenas/www/diag_space_infos.php
+++ b/packages/freenas/www/diag_space_infos.php
@@ -1,36 +1,44 @@
<?php
/* $Id$ */
+/* ========================================================================== */
/*
- disks_manage_edit.php
- part of FreeNAS (http://www.freenas.org)
- Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
- All rights reserved.
-
- Based on m0n0wall (http://m0n0.ch/wall)
- Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
+ diag_space_infos.php
+ part of pfSense (http://www.pfSense.com)
+ Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name>
+ All rights reserved.
+
+ Based on FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ All rights reserved.
+ */
+/* ========================================================================== */
+/*
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+/* ========================================================================== */
$pgtitle = array(gettext("Diagnostics"),
gettext("Space Infos"));
@@ -77,8 +85,8 @@ echo $pfSenseHead->getHTML();
<tr>
<td class="tabnavtbl">
<?php
- $tab_array = array();
- $tab_array[0] = array(gettext("Disks"), false, "diag_disks_infos.php");
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Disks"), false, "diag_disks_infos.php");
$tab_array[1] = array(gettext("Partitions"), false, "diag_part_infos.php");
$tab_array[2] = array(gettext("SMART"), false, "diag_smart_infos.php");
$tab_array[3] = array(gettext("ataidle"), false, "diag_ataidle_infos.php");
@@ -86,33 +94,32 @@ echo $pfSenseHead->getHTML();
$tab_array[5] = array(gettext("Mounts"), false, "diag_mounts_infos.php");
$tab_array[6] = array(gettext("Software RAID"), false, "diag_raid_infos.php");
$tab_array[7] = array(gettext("iSCSI"), false, "diag_iscsi_infos.php");
- display_top_tabs($tab_array);
+ display_top_tabs($tab_array);
?>
</td>
</tr>
<tr>
<td class="tabnavtbl">
<?php
- $tab_array = array();
- $tab_array[0] = array(gettext("Manage RAID"), false, "diag_ad_infos.php");
- display_top_tabs($tab_array);
+ $tab_array = array();
+ $tab_array[0] = array(gettext("MS Domain"), false, "diag_ad_infos.php");
+ display_top_tabs($tab_array);
?>
</td>
</tr>
<tr>
<td>
- <div id="mainarea">
+ <div id="mainarea">
<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="left" valign="top">
<?php
echo "<pre style=\"font-size: medium;\">";
exec("/bin/df -h",$rawdata);
-
echo "<strong>Free Space:</strong><br />";
foreach ($rawdata as $line)
{
- echo htmlspecialchars($line) . "<br />";
+ echo htmlspecialchars($line) . "<br />";
}
echo "</pre>";
?>
@@ -121,7 +128,7 @@ echo $pfSenseHead->getHTML();
</table>
</div>
</td>
- </tr>
+ </tr>
</table>
</form>
<?php include("fend.inc"); ?>
diff --git a/packages/freenas/www/disks_manage.php b/packages/freenas/www/disks_manage.php
index 9aa8c732..b6dece05 100644
--- a/packages/freenas/www/disks_manage.php
+++ b/packages/freenas/www/disks_manage.php
@@ -1,40 +1,44 @@
-#!/usr/local/bin/php
<?php
/* $Id$ */
+/* ========================================================================== */
/*
- disks_manage.php
- part of FreeNAS (http://www.freenas.org)
- Copyright (C) 2005-2006 Olivier Cochard <olivier@freenas.org>.
- All rights reserved.
-
- Based on m0n0wall (http://m0n0.ch/wall)
- Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
- All rights reserved.
-
- Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
+ disks_manage.php
+ part of pfSense (http://www.pfSense.com)
+ Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name>
+ All rights reserved.
+
+ Based on FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ All rights reserved.
+ */
+/* ========================================================================== */
+/*
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+/* ========================================================================== */
$pgtitle = array(gettext("System"),
gettext("Disks"),
@@ -46,61 +50,60 @@ require_once("freenas_guiconfig.inc");
require_once("freenas_functions.inc");
if (!is_array($freenas_config['disks']['disk']))
- $freenas_config['disks']['disk'] = array();
-
+ $freenas_config['disks']['disk'] = array();
+
disks_sort();
$a_disk_conf = &$freenas_config['disks']['disk'];
if ($_POST) {
-
- unset($input_errors);
-
- /* input validation */
-
- if ($_POST['apply']) {
- $retval = 0;
- if (! file_exists($d_sysrebootreqd_path)) {
- config_lock();
- /* reload all components that mount disk */
- // disks_mount_all();
- /* Is formated?: If not create FS */
- /* $retval = disk_disks_create_ufs(); */
-
- config_unlock();
- }
- $savemsg = get_std_save_message($retval);
- if ($retval == 0) {
- if (file_exists($d_diskdirty_path)) {
- unlink($d_diskdirty_path);
+ unset($input_errors);
+
+ /* input validation */
+
+ if ($_POST['apply']) {
+ $retval = 0;
+ if (! file_exists($d_sysrebootreqd_path)) {
+ config_lock();
+ /* reload all components that mount disk */
+ // disks_mount_all();
+ /* Is formated?: If not create FS */
+ /* $retval = disk_disks_create_ufs(); */
+
+ config_unlock();
+ }
+ $savemsg = get_std_save_message($retval);
+ if ($retval == 0) {
+ if (file_exists($d_diskdirty_path)) {
+ unlink($d_diskdirty_path);
}
- }
- }
-
- /* if this is an AJAX caller then handle via JSON */
- if(isAjax() && is_array($input_errors)) {
- input_errors2Ajax($input_errors);
- exit;
- }
-
- if (!$input_errors) {
- /* No errors detected, so update the config */
- }
+ }
+ }
+
+ /* if this is an AJAX caller then handle via JSON */
+ if(isAjax() && is_array($input_errors)) {
+ input_errors2Ajax($input_errors);
+ exit;
+ }
+
+ if (!$input_errors) {
+ /* No errors detected, so update the config */
+ }
}
if ($_GET['act'] == "del") {
- if ($a_disk_conf[$_GET['id']]) {
- unset($a_disk_conf[$_GET['id']]);
- write_config();
- touch($d_diskdirty_path);
- pfSenseHeader("disks_manage.php");
- exit;
- }
+ if ($a_disk_conf[$_GET['id']]) {
+ unset($a_disk_conf[$_GET['id']]);
+ write_config();
+ touch($d_diskdirty_path);
+ pfSenseHeader("disks_manage.php");
+ exit;
+ }
}
/* if ajax is calling, give them an update message */
if(isAjax())
- print_info_box_np($savemsg);
+ print_info_box_np($savemsg);
include("head.inc");
/* put your custom HTML head content here */
@@ -124,79 +127,80 @@ echo $pfSenseHead->getHTML();
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr><td class="tabnavtbl">
<?php
- $tab_array = array();
- $tab_array[0] = array(gettext("Manage"), true, "disks_manage.php");
- $tab_array[1] = array(gettext("Format"), false, "disks_manage_init.php");
- $tab_array[2] = array(gettext("iSCSI Initiator"), false, "disks_manage_iscsi.php");
- display_top_tabs($tab_array);
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Manage"), true, "disks_manage.php");
+ $tab_array[1] = array(gettext("Format"), false, "disks_manage_init.php");
+ $tab_array[2] = array(gettext("Tools"), false, "disks_manage_tools.php");
+ $tab_array[3] = array(gettext("iSCSI Initiator"), false, "disks_manage_iscsi.php");
+ display_top_tabs($tab_array);
?>
</td></tr>
<tr>
<td>
- <div id="mainarea">
- <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td class="listhdrr"><?=gettext("Disk");?></td>
- <td class="listhdrr"><?=gettext("Size");?></td>
- <td class="listhdrr"><?=gettext("Description");?></td>
- <td class="listhdrr"><?=gettext("Standby time");?></td>
- <td class="listhdrr"><?=gettext("File system");?></td>
- <td class="listhdrr"><?=gettext("Status");?></td>
- <td class="list">&nbsp;</td>
- </tr>
- <?php $i = 0; foreach ($a_disk_conf as $disk): ?>
- <tr>
- <td valign="middle" class="listr">
- <?=htmlspecialchars($disk['name']);?>
- </td>
- <td valign="middle" class="listr">
- <?=htmlspecialchars($disk['size']);?>
- </td>
- <td valign="middle" class="listr">
- <?=htmlspecialchars($disk['desc']);?>&nbsp;
- </td>
- <td valign="middle" class="listr">
- <?php
- if ($disk['harddiskstandby']) {
- $value = $disk['harddiskstandby'];
- //htmlspecialchars($value);
- echo $value;
- } else {
- echo "Always on";
- }
- ?>
- </td>
- <td valign="middle" class="listr">
- <?= ($disk['fstype']) ? $disk['fstype']: gettext("unknown or unformatted"); ?>
- </td>
- <td valign="middle" class="listr">
- <?php
- $stat = disks_status($disk);
- echo $stat;
- ?>
- </td>
- <td valign="middle" class="list">
- <a href="disks_manage_edit.php?id=<?=$i;?>">
- <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" title="<?=gettext("edit disk");?>" width="17" height="17" border="0" alt="" />
- </a>
- <a href="disks_manage.php?act=del&id=<?=$i;?>">
- <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" title="<?=gettext("delete disk");?>" width="17" height="17" border="0" alt="" />
- </a>
- </td>
- </tr>
- <?php $i++; endforeach; ?>
- <tr>
- <td class="list" colspan="6"></td>
- <td class="list" nowrap>
- <a href="disks_manage_edit.php">
- <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" title="<?=gettext("add disk");?>" width="17" height="17" border="0" alt="" />
- </a>
- </td>
- </tr>
-</table>
-</div>
+ <div id="mainarea">
+ <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td class="listhdrr"><?=gettext("Disk");?></td>
+ <td class="listhdrr"><?=gettext("Size");?></td>
+ <td class="listhdrr"><?=gettext("Description");?></td>
+ <td class="listhdrr"><?=gettext("Standby time");?></td>
+ <td class="listhdrr"><?=gettext("File system");?></td>
+ <td class="listhdrr"><?=gettext("Status");?></td>
+ <td class="list">&nbsp;</td>
+ </tr>
+ <?php $i = 0; foreach ($a_disk_conf as $disk): ?>
+ <tr>
+ <td valign="middle" class="listr">
+ <?=htmlspecialchars($disk['name']);?>
+ </td>
+ <td valign="middle" class="listr">
+ <?=htmlspecialchars($disk['size']);?>
+ </td>
+ <td valign="middle" class="listr">
+ <?=htmlspecialchars($disk['desc']);?>&nbsp;
+ </td>
+ <td valign="middle" class="listr">
+ <?php
+ if ($disk['harddiskstandby']) {
+ $value = $disk['harddiskstandby'];
+ //htmlspecialchars($value);
+ echo $value;
+ } else {
+ echo "Always on";
+ }
+ ?>
+ </td>
+ <td valign="middle" class="listr">
+ <?= ($disk['fstype']) ? $disk['fstype']: gettext("unknown or unformatted"); ?>
+ </td>
+ <td valign="middle" class="listr">
+ <?php
+ $stat = disks_status($disk);
+ echo $stat;
+ ?>
+ </td>
+ <td valign="middle" class="list">
+ <a href="disks_manage_edit.php?id=<?=$i;?>">
+ <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" title="<?=gettext("edit disk");?>" width="17" height="17" border="0" alt="" />
+ </a>
+ <a href="disks_manage.php?act=del&id=<?=$i;?>">
+ <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" title="<?=gettext("delete disk");?>" width="17" height="17" border="0" alt="" />
+ </a>
+ </td>
+ </tr>
+ <?php $i++; endforeach; ?>
+ <tr>
+ <td class="list" colspan="6"></td>
+ <td class="list" nowrap>
+ <a href="disks_manage_edit.php">
+ <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" title="<?=gettext("add disk");?>" width="17" height="17" border="0" alt="" />
+ </a>
+ </td>
+ </tr>
+ </table>
+ </div>
</td>
- </tr>
+ </tr>
</table>
</form>
<?php include("fend.inc"); ?>
diff --git a/packages/freenas/www/disks_manage_edit.php b/packages/freenas/www/disks_manage_edit.php
index f45c0709..80e11ef3 100644
--- a/packages/freenas/www/disks_manage_edit.php
+++ b/packages/freenas/www/disks_manage_edit.php
@@ -1,36 +1,44 @@
<?php
/* $Id$ */
+/* ========================================================================== */
/*
- disks_manage_edit.php
- part of FreeNAS (http://www.freenas.org)
- Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
- All rights reserved.
-
- Based on m0n0wall (http://m0n0.ch/wall)
- Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
+ disks_manage_edit.php
+ part of pfSense (http://www.pfSense.com)
+ Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name>
+ All rights reserved.
+
+ Based on FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ All rights reserved.
+ */
+/* ========================================================================== */
+/*
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+/* ========================================================================== */
$pgtitle = array(gettext("System"),
gettext("Disks"),
@@ -44,13 +52,13 @@ require_once("freenas_functions.inc");
$id = $_GET['id'];
if (isset($_POST['id']))
- $id = $_POST['id'];
+ $id = $_POST['id'];
/* get disk list (without CDROM) */
$disklist = get_physical_disks_list();
if (!is_array($freenas_config['disks']['disk']))
- $freenas_config['disks']['disk'] = array();
+ $freenas_config['disks']['disk'] = array();
disks_sort();
@@ -58,13 +66,13 @@ $a_disk = &$freenas_config['disks']['disk'];
if (isset($id) && $a_disk[$id])
{
- $pconfig['name'] = $a_disk[$id]['name'];
- $pconfig['harddiskstandby'] = $a_disk[$id]['harddiskstandby'];
- $pconfig['acoustic'] = $a_disk[$id]['acoustic'];
- $pconfig['fstype'] = $a_disk[$id]['fstype'];
- $pconfig['apm'] = $a_disk[$id]['apm'];
- $pconfig['udma'] = $a_disk[$id]['udma'];
-
+ $pconfig['name'] = $a_disk[$id]['name'];
+ $pconfig['harddiskstandby'] = $a_disk[$id]['harddiskstandby'];
+ $pconfig['acoustic'] = $a_disk[$id]['acoustic'];
+ $pconfig['fstype'] = $a_disk[$id]['fstype'];
+ $pconfig['apm'] = $a_disk[$id]['apm'];
+ $pconfig['udma'] = $a_disk[$id]['udma'];
+ $pconfig['fullname'] = $a_disk[$id]['fullname'];
}
if (! empty($_POST))
@@ -80,22 +88,21 @@ if (! empty($_POST))
$reqdfieldsn = split(",", "Name");
do_input_validation_new($_POST, $reqdfields, $reqdfieldsn, &$error_bucket);
- $pconfig = $_POST;
-
- /* check for name conflicts */
- foreach ($a_disk as $disk)
- {
- if (isset($id) && ($a_disk[$id]) && ($a_disk[$id] === $disk))
- continue;
-
- if ($disk['name'] == $_POST['name'])
- {
+ $pconfig = $_POST;
+
+ /* check for name conflicts */
+ foreach ($a_disk as $disk)
+ {
+ if (isset($id) && ($a_disk[$id]) && ($a_disk[$id] === $disk)) { continue; }
+
+ if ($disk['name'] == $_POST['name'])
+ {
$error_bucket[] = array("error" => gettext("This disk already exists in the disk list."),
"field" => "name");
break;
- }
- }
-
+ }
+ }
+
if (is_array($error_bucket))
foreach($error_bucket as $elem)
$input_errors[] =& $elem["error"];
@@ -106,40 +113,42 @@ if (! empty($_POST))
exit;
}
- if (!$input_errors)
- {
- $disks = array();
-
- $devname = $_POST['name'];
- $devharddiskstandby = $_POST['harddiskstandby'];
- $harddiskacoustic = $_POST['acoustic'];
- $harddiskapm = $_POST['apm'];
- $harddiskudma = $_POST['udma'];
- $harddiskfstype = $_POST['fstype'];
-
- $disks['name'] = $devname;
- $disks['harddiskstandby'] = $devharddiskstandby ;
- $disks['acoustic'] = $harddiskacoustic ;
- if ($harddiskfstype) $disks['fstype'] = $harddiskfstype ;
- $disks['apm'] = $harddiskapm ;
- $disks['udma'] = $harddiskudma ;
- $disks['type'] = $disklist[$devname]['type'];
- $disks['desc'] = $disklist[$devname]['desc'];
- $disks['size'] = $disklist[$devname]['size'];
-
- if (isset($id) && $a_disk[$id])
- $a_disk[$id] = $disks;
- else
- $a_disk[] = $disks;
-
- touch($d_diskdirty_path);
-
- disks_set_ataidle();
- write_config();
-
- pfSenseHeader("disks_manage.php");
- exit;
- }
+ if (!$input_errors)
+ {
+ $disks = array();
+
+ $devname = $_POST['name'];
+ $devharddiskstandby = $_POST['harddiskstandby'];
+ $harddiskacoustic = $_POST['acoustic'];
+ $harddiskapm = $_POST['apm'];
+ $harddiskudma = $_POST['udma'];
+ $harddiskfstype = $_POST['fstype'];
+
+ $disks['name'] = $devname;
+ $disks['fullname'] = "/dev/$devname";
+ $disks['harddiskstandby'] = $devharddiskstandby ;
+ $disks['acoustic'] = $harddiskacoustic ;
+ if ($harddiskfstype) { $disks['fstype'] = $harddiskfstype; }
+ $disks['apm'] = $harddiskapm ;
+ $disks['udma'] = $harddiskudma ;
+ $disks['type'] = $disklist[$devname]['type'];
+ $disks['desc'] = $disklist[$devname]['desc'];
+ $disks['size'] = $disklist[$devname]['size'];
+
+ if (isset($id) && $a_disk[$id]) {
+ $a_disk[$id] = $disks;
+ } else {
+ $a_disk[] = $disks;
+ }
+
+ touch($d_diskdirty_path);
+
+ disks_set_ataidle();
+ write_config();
+
+ pfSenseHeader("disks_manage.php");
+ exit;
+ }
}
include("head.inc");
@@ -160,23 +169,23 @@ echo $pfSenseHead->getHTML();
<tr>
<td width="22%" valign="top" class="vncellreq"><?=gettext("Disk");?></td>
<td width="78%" class="vtable">
- <select name="name" class="formselect" id="name">
- <?php foreach ($disklist as $diski => $diskv): ?>
- <option value="<?=$diski;?>" <?php if ($diski == $pconfig['name']) echo "selected=\"selected\"";?>>
- <?php echo htmlspecialchars($diski . ": " .$diskv['size'] . " (" . $diskv['desc'] . ")");?>
- </option>
- <?php endforeach; ?>
+ <select name="name" class="formselect" id="name">
+ <?php foreach ($disklist as $diski => $diskv): ?>
+ <option value="<?=$diski;?>" <?php if ($diski == $pconfig['name']) echo "selected=\"selected\"";?>>
+ <?php echo htmlspecialchars($diski . ": " .$diskv['size'] . " (" . $diskv['desc'] . ")");?>
+ </option>
+ <?php endforeach; ?>
</select>
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("UDMA mode");?></td>
<td width="78%" class="vtable">
- <select name="udma" class="formselect" id="udma">
+ <select name="udma" class="formselect" id="udma">
<?php
$types = explode(",", "Auto,UDMA-33,UDMA-66,UDMA-100,UDMA-133");
- $vals = explode(" ", "auto UDMA2 UDMA4 UDMA5 UDMA6");
- $j = 0;
+ $vals = explode(" ", "auto UDMA2 UDMA4 UDMA5 UDMA6");
+ $j = 0;
for ($j = 0; $j < count($vals); $j++):
?>
@@ -224,12 +233,12 @@ echo $pfSenseHead->getHTML();
<td width="22%" valign="top" class="vncell"><?=gettext("acoustic level");?></td>
<td width="78%" class="vtable">
<select name="acoustic" class="formselect">
- <?php
+ <?php
$acvals = array(0=>"Disabled",1=>"Minimum performance, Minimum acoustic output",64=>"Medium acoustic output",127=>"Maximum performance, maximum acoustic output");
?>
- <?php foreach ($acvals as $acval => $acname): ?>
+ <?php foreach ($acvals as $acval => $acname): ?>
<option value="<?=$acval;?>" <?php if($pconfig['acoustic'] == $acval) echo 'selected';?>><?=htmlspecialchars($acname);?></option>
- <?php endforeach; ?>
+ <?php endforeach; ?>
</select>
<br />
<?= gettext("This allows you to set how loud the drive is while it\'s operating.<em>Do not set this for CF cards.</em>"); ?>
@@ -239,19 +248,8 @@ echo $pfSenseHead->getHTML();
<td width="22%" valign="top" class="vncell"><?=gettext("preformated FS");?></td>
<td width="78%" class="vtable">
<select name="fstype" class="formselect">
- <?php
- $fstvals = array(
- ""=>"unformated",
- "ufs"=>"UFS with Soft Updates (use 8% space disk)",
- "ufs_no_su"=>"UFS",
- "ufsgpt"=>"UFS (EFI/GPT) with Soft Updates (use 8% space disk)",
- "ufsgpt_no_su"=>"UFS (EFI/GPT)",
- "msdos"=>"FAT32",
- "ntfs"=>"NTFS",
- "raid"=>"Software RAID: gmirror",
- "raid"=>"Software RAID: gvinum");
- ?>
- <?php foreach ($fstvals as $fstval => $fstname): ?>
+ <?php $fstlist = get_fstype_list(); ?>
+ <?php foreach ($fstlist as $fstval => $fstname): ?>
<option value="<?=$fstval;?>" <?php if($pconfig['fstype'] == $fstval) echo 'selected';?>><?=htmlspecialchars($fstname);?></option>
<?php endforeach; ?>
</select>
diff --git a/packages/freenas/www/disks_manage_init.php b/packages/freenas/www/disks_manage_init.php
index 7e120634..7267cec3 100644
--- a/packages/freenas/www/disks_manage_init.php
+++ b/packages/freenas/www/disks_manage_init.php
@@ -1,36 +1,44 @@
<?php
/* $Id$ */
+/* ========================================================================== */
/*
- disks_manage_edit.php
- part of FreeNAS (http://www.freenas.org)
- Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
- All rights reserved.
-
- Based on m0n0wall (http://m0n0.ch/wall)
- Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
+ disks_manage_init.php
+ part of pfSense (http://www.pfSense.com)
+ Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name>
+ All rights reserved.
+
+ Based on FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ All rights reserved.
+ */
+/* ========================================================================== */
+/*
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+/* ========================================================================== */
$pgtitle = array(gettext("System"),
gettext("Disks"),
@@ -42,11 +50,49 @@ require_once("freenas_guiconfig.inc");
require_once("freenas_functions.inc");
if (!is_array($freenas_config['disks']['disk']))
- $freenas_config['disks']['disk'] = array();
+ $freenas_config['disks']['disk'] = array();
disks_sort();
+if (!is_array($freenas_config['gconcat']['vdisk']))
+ $freenas_config['gconcat']['vdisk'] = array();
+
+gconcat_sort();
+
+if (!is_array($freenas_config['gmirror']['vdisk']))
+ $freenas_config['gmirror']['vdisk'] = array();
+
+gmirror_sort();
+
+if (!is_array($freenas_config['graid5']['vdisk']))
+ $freenas_config['graid5']['vdisk'] = array();
+
+graid5_sort();
+
+if (!is_array($freenas_config['gstripe']['vdisk']))
+ $freenas_config['gstripe']['vdisk'] = array();
+
+gstripe_sort();
+
+if (!is_array($freenas_config['gvinum']['vdisk']))
+ $freenas_config['gvinum']['vdisk'] = array();
+
+gvinum_sort();
+
+// Get all fstype supported by FreeNAS
+$a_fst = get_fstype_list();
+// Remove NTFS: can't format on NTFS under FreeNAS
+unset($a_fst['ntfs']);
+// Remove the first blank line 'unknown'
+$a_fst = array_slice($a_fst, 1);
+
$a_disk = &$freenas_config['disks']['disk'];
+$a_gconcat = &$freenas_config['gconcat']['vdisk'];
+$a_gmirror = &$freenas_config['gmirror']['vdisk'];
+$a_gstripe = &$freenas_config['gstripe']['vdisk'];
+$a_graid5 = &$freenas_config['graid5']['vdisk'];
+$a_gvinum = &$freenas_config['gvinum']['vdisk'];
+$all_disk = array_merge($a_disk,$a_gconcat,$a_gmirror,$a_gstripe,$a_graid5,$a_gvinum);
if (! empty($_POST))
{
@@ -58,8 +104,8 @@ if (! empty($_POST))
$pconfig = $_POST;
/* input validation */
- $reqdfields = explode(" ", "disk type");
- $reqdfieldsn = explode(",", "Disk,Type");
+ $reqdfields = explode(" ", "disk type");
+ $reqdfieldsn = explode(",", "Disk,Type");
do_input_validation_new($_POST, $reqdfields, $reqdfieldsn, &$error_bucket);
@@ -69,51 +115,111 @@ if (! empty($_POST))
/* if this is an AJAX caller then handle via JSON */
if(isAjax() && is_array($error_bucket)) {
- input_errors2Ajax(NULL, $error_bucket);
- exit;
+ input_errors2Ajax(NULL, $error_bucket);
+ exit;
}
- if (!$input_errors)
- {
- $do_format = true;
- $disk = $_POST['disk'];
- $type = $_POST['type'];
- $diskid = $_POST['id'];
- $notinitmbr= $_POST['notinitmbr'];
-
- /* found the name in the config: Must be a better way for did that */
-
- $id=0;
- $i=0;
- foreach ($a_disk as $disks)
- {
- $diskname=$disks['name'];
- if (strcmp($diskname,$disk)==0)
- $id=$i;
- $i++;
- }
-
- if ($type == "ufs" || $type == "ufsgpt" || $type == "ufs_no_su" || $type == "ufsgpt_no_su")
- $a_disk[$id]['fstype'] = "ufs";
- else
- $a_disk[$id]['fstype'] = $type;
- write_config();
- }
+ if (!$input_errors)
+ {
+ $do_format = true;
+ $disk = $_POST['disk'];
+ $type = $_POST['type'];
+ $notinitmbr= $_POST['notinitmbr'];
+
+ /* Check if disk is mounted. */
+ if(disks_check_mount_fullname($disk)) {
+ $errormsg = sprintf(gettext("The disk is currently mounted! <a href=%s>Unmount</a> this disk first before proceeding."), "disks_mount_tools.php?disk={$disk}&action=umount");
+ $do_format = false;
+ }
+
+ if($do_format) {
+ /* Get the id of the disk array entry. */
+ $NotFound = 1;
+ $id = array_search_ex($disk, $a_disk, "fullname");
+
+ if ($id) {
+ /* Set new filesystem type. */
+ $a_disk[$id]['fstype'] = $type;
+ $NotFound = 0;
+ }
+ else {
+ $id = array_search_ex($disk, $a_gmirror, "fullname");
+ }
+ if (($id !== false) && $NotFound) {
+ /* Set new filesystem type. */
+ $a_gmirror[$id]['fstype'] = $type;
+ $NotFound = 0;
+ }
+ else {
+ $id = array_search_ex($disk, $a_gstripe, "fullname");
+ }
+ if (($id !== false) && $NotFound) {
+ /* Set new filesystem type. */
+ $a_gstripe[$id]['fstype'] = $type;
+ $NotFound = 0;
+ }
+ else {
+ $id = array_search_ex($disk, $a_gconcat, "fullname");
+ }
+ if (($id !== false) && $NotFound) {
+ /* Set new filesystem type. */
+ $a_gconcat[$id]['fstype'] = $type;
+ $NotFound = 0;
+ }
+ else {
+ $id = array_search_ex($disk, $a_graid5, "fullname");
+ }
+ if (($id !== false) && $NotFound) {
+ /* Set new filesystem type. */
+ $a_graid5[$id]['fstype'] = $type;
+ $NotFound = 0;
+ }
+ else {
+ $id = array_search_ex($disk, $a_gvinum, "fullname");
+ }
+ if (($id !== false) && $NotFound) {
+ /* Set new filesystem type. */
+ $a_gvinum[$id]['fstype'] = $type;
+ $NotFound = 0;
+ }
+
+ write_config();
+ }
+ }
}
if (!isset($do_format))
{
- $do_format = false;
- $disk = '';
- $type = '';
+ $do_format = false;
+ $disk = '';
+ $type = '';
}
include("head.inc");
/* put your custom HTML head content here */
/* using some of the $pfSenseHead function calls */
+$pfSenseHead->setCloseHead(false);
echo $pfSenseHead->getHTML();
?>
+<script language="JavaScript">
+<!--
+function disk_change() {
+ switch(document.iform.disk.value)
+ {
+ <?php foreach ($a_disk as $diskv): ?>
+ case "<?=$diskv['fullname'];?>":
+ <?php $i = 0;?>
+ <?php foreach ($a_fst as $fstval => $fstname): ?>
+ document.iform.type.options[<?=$i++;?>].selected = <?php if($diskv['fstype'] == $fstval){echo "true";}else{echo "false";};?>;
+ <?php endforeach; ?>
+ break;
+ <?php endforeach; ?>
+ }
+}
+// -->
+</script>
+</head>
<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>">
<?php include("fbegin.inc"); ?>
@@ -126,9 +232,10 @@ echo $pfSenseHead->getHTML();
<td>
<?php
$tab_array = array();
- $tab_array[0] = array(gettext("Manage"), false, "disks_manage.php");
- $tab_array[1] = array(gettext("Format"), true, "disks_manage_init.php");
- $tab_array[2] = array(gettext("iSCSI Initiator"), false, "disks_manage_iscsi.php");
+ $tab_array[0] = array(gettext("Manage"), false, "disks_manage.php");
+ $tab_array[1] = array(gettext("Format"), true, "disks_manage_init.php");
+ $tab_array[2] = array(gettext("Tools"), false, "disks_manage_tools.php");
+ $tab_array[3] = array(gettext("iSCSI Initiator"), false, "disks_manage_iscsi.php");
display_top_tabs($tab_array);
?>
</td>
@@ -141,12 +248,12 @@ echo $pfSenseHead->getHTML();
<tr>
<td width="22%" valign="top" class="vncellreq"><?=gettext("Disk");?></td>
<td width="78%" class="vtable">
- <select name="disk" class="formselect" id="disk">
- <?php foreach ($a_disk as $diskn): ?>
- <option value="<?=$diskn['name'];?>"<?php if ($diskn['name'] == $disk) echo "selected=\"selected\"";?>>
- <?php echo htmlspecialchars($diskn['name'] . ": " .$diskn['size'] . " (" . $diskn['desc'] . ")");?>
- </option>
- <?php endforeach; ?>
+ <select name="disk" class="formselect" id="disk" onchange="disk_change();">
+ <?php foreach ($all_disk as $diskv): ?>
+ <option value="<?=$diskv['fullname'];?>"<?php if ($diskv['name'] == $disk) echo "selected";?>>
+ <?php echo htmlspecialchars($diskv['name'] . ": " .$diskv['size'] . " (" . $diskv['desc'] . ")");?>
+ <?php endforeach; ?>
+ </option>
</select>
</td>
</tr>
@@ -154,18 +261,14 @@ echo $pfSenseHead->getHTML();
<td width="22%" valign="top" class="vncellreq"><?=gettext("File system");?></td>
<td width="78%" class="vtable">
<select name="type" class="formselect" id="type">
- <option value="ufs" <?php if ($type == "ufs") echo "selected=\"selected\""; ?>>UFS with Soft Updates (use 8% space disk)</option>
- <option value="ufs_no_su" <?php if ($type == "ufs_no_su") echo "selected=\"selected\""; ?>>UFS</option>
- <option value="ufsgpt" <?php if ($type == "ufsgpt") echo "selected=\"selected\""; ?>>UFS (EFI/GPT) with Soft Updates (use 8% space disk)</option>
- <option value="ufsgpt_no_su" <?php if ($type == "ufsgpt_no_su") echo "selected=\"selected\""; ?>>UFS (EFI/GPT)</option>
- <option value="msdos" <?php if ($type == "msdos") echo "selected=\"selected\""; ?>>FAT32</option>
- <option value="gmirror" <?php if ($type == "gmirror") echo "selected=\"selected\""; ?>>Software RAID: Geom mirror</option>
- <option value="raid" <?php if ($type == "raid") echo "selected=\"selected\""; ?>>Software RAID: Geom Vinum</option>
- </select>
+ <?php foreach ($a_fst as $fstval => $fstname): ?>
+ <option value="<?=$fstval;?>" <?php if($type == $fstval) echo 'selected="selected"';?>><?=htmlspecialchars($fstname);?></option>
+ <?php endforeach; ?>
+ </select>
</td>
</tr>
<tr>
- <td width="22%" valign="top" class="vncellreq"><?=gettext("File system");?></td>
+ <td width="22%" valign="top" class="vncellreq"><?=gettext("Don't Erase MBR");?></td>
<td width="78%" class="vtable">
<input name="notinitmbr" id="notinitmbr" type="checkbox" value="yes" /><br />
<?= gettext("don't erase the MBR (useful for some RAID controller cards)"); ?>
@@ -177,100 +280,106 @@ echo $pfSenseHead->getHTML();
<input id="submitt" name="Submitt" type="submit" class="formbtn" value="<?=gettext("Format disk!");?>" />
</td>
</tr>
- <tr>
- <td valign="top" colspan="2">
- <?
+ <tr>
+ <td valign="top" colspan="2">
+ <?
if ($do_format) {
- echo "<strong>Disk initialization details:</strong>";
- echo('<pre style="font-size: small; border: solid 1px silver; padding: 4px;">');
- ob_end_flush();
-
- /* Erase MBR if not checked*/
-
- if (!$notinitmbr) {
- echo "Erasing MBR\n";
- system("dd if=/dev/zero of=/dev/" . escapeshellarg($disk) . " bs=32k count=640");
-
- }
- else
- echo "Keeping the MBR\n";
-
- switch ($type)
- {
- case "ufs":
- /* Initialize disk */
- system("/sbin/fdisk -I -b /boot/mbr " . escapeshellarg($disk));
- echo "\"fdisk: Geom not found\" is not an error message!\n";
- /* Initialise the partition (optional) */
- system("/bin/dd if=/dev/zero of=/dev/" . escapeshellarg($disk) . "s1 bs=32k count=16");
- /* Create s1 label */
- system("/sbin/bsdlabel -w " . escapeshellarg($disk) . "s1 auto");
- // Create filesystem
- system("/sbin/newfs -U /dev/" . escapeshellarg($disk) . "s1");
- break;
- case "ufs_no_su":
- /* Initialize disk */
- system("/sbin/fdisk -I -b /boot/mbr " . escapeshellarg($disk));
- /* Initialise the partition (optional) */
- system("/bin/dd if=/dev/zero of=/dev/" . escapeshellarg($disk) . "s1 bs=32k count=16");
- /* Create s1 label */
- system("/sbin/bsdlabel -w " . escapeshellarg($disk) . "s1 auto");
- // Create filesystem
- system("/sbin/newfs -m 0 /dev/" . escapeshellarg($disk) . "s1");
- break;
- case "ufsgpt":
- /* Create GPT partition table */
- system("/sbin/gpt destroy " . escapeshellarg($disk));
- system("/sbin/gpt create -f " . escapeshellarg($disk));
- system("/sbin/gpt add -t ufs " . escapeshellarg($disk));
- // Create filesystem
- system("/sbin/newfs -U /dev/" . escapeshellarg($disk) . "p1");
- break;
- case "ufsgpt_no_su":
- /* Create GPT partition table */
- system("/sbin/gpt destroy " . escapeshellarg($disk));
- system("/sbin/gpt create -f " . escapeshellarg($disk));
- system("/sbin/gpt add -t ufs " . escapeshellarg($disk));
- // Create filesystem
- system("/sbin/newfs -m 0 /dev/" . escapeshellarg($disk) . "p1");
- break;
- case "gmirror":
- /* Initialize disk */
- system("/sbin/fdisk -I -b /boot/mbr " . escapeshellarg($disk));
- /* Initialise the partition (optional) */
- system("/bin/dd if=/dev/zero of=/dev/" . escapeshellarg($disk) . "s1 bs=32k count=16");
- /* Create s1 label */
- //system("/sbin/bsdlabel -w " . escapeshellarg($disk) . "s1 auto");
- /* Delete old gmirror information */
- system("/sbin/gmirror clear /dev/" . escapeshellarg($disk));
- break;
- case "raid":
- /* Initialize disk */
- system("/sbin/fdisk -I -b /boot/mbr " . escapeshellarg($disk));
- echo "\"fdisk: Geom not found\"is not an error message!\n";
- /* Initialise the partition (optional) */
- system("/bin/dd if=/dev/zero of=/dev/" . escapeshellarg($disk) . "s1 bs=32k count=16");
- /* Create s1 label */
- system("/sbin/bsdlabel -w " . escapeshellarg($disk) . "s1 auto");
- break;
- case "msdos":
- /* Initialize disk */
- system("/sbin/fdisk -I -b /boot/mbr " . escapeshellarg($disk));
- echo "\"fdisk: Geom not found\"is not an error message!\n";
- /* Initialise the partition (optional) */
- system("/bin/dd if=/dev/zero of=/dev/" . escapeshellarg($disk) . "s1 bs=32k count=16");
- /* Create s1 label */
- system("/sbin/bsdlabel -w " . escapeshellarg($disk) . "s1 auto");
- // Create filesystem
- system("/sbin/newfs_msdos -F 32 /dev/" . escapeshellarg($disk) . "s1");
- break;
- }
-
- echo('</pre>');
- }
- ?>
- </td>
- </tr>
+ echo "<strong>Disk initialization details:</strong>";
+ echo('<pre style="font-size: small; border: solid 1px silver; padding: 4px;">');
+ ob_end_flush();
+
+ /* Erase MBR if not checked*/
+ if (!$notinitmbr) {
+ echo "Erasing MBR\n";
+ system("dd if=/dev/zero of=/dev/" . escapeshellarg($disk) . " bs=32k count=640");
+ }
+ else {
+ echo "Keeping the MBR and all partitions\n";
+ }
+
+ switch ($type)
+ {
+ case "ufs":
+ /* Initialize disk */
+ echo "Creating one parition:\n";
+ system("/sbin/fdisk -I -b /boot/mbr " . escapeshellarg($disk));
+ /* Initialise the partition (optional) */
+ echo "Initializing parition:\n";
+ system("/bin/dd if=/dev/zero of=/dev/" . escapeshellarg($disk) . "s1 bs=32k count=16");
+ /* Create s1 label */
+ echo "Creating BSD label:\n";
+ system("/sbin/bsdlabel -w " . escapeshellarg($disk) . "s1 auto");
+ // Create filesystem
+ echo "Creating Filesystem:\n";
+ system("/sbin/newfs -U /dev/" . escapeshellarg($disk) . "s1");
+ echo "Done!\n";
+ break;
+ case "ufs_no_su":
+ /* Initialize disk */
+ echo "Creating one parition:\n";
+ system("/sbin/fdisk -I -b /boot/mbr " . escapeshellarg($disk));
+ /* Initialise the partition (optional) */
+ echo "Initializing parition:\n";
+ system("/bin/dd if=/dev/zero of=/dev/" . escapeshellarg($disk) . "s1 bs=32k count=16");
+ /* Create s1 label */
+ echo "Creating BSD label:\n";
+ system("/sbin/bsdlabel -w " . escapeshellarg($disk) . "s1 auto");
+ // Create filesystem
+ echo "Creating Filesystem:\n";
+ system("/sbin/newfs -m 0 /dev/" . escapeshellarg($disk) . "s1");
+ echo "Done!\n";
+ break;
+ case "ufsgpt":
+ /* Create GPT partition table */
+ echo "Destroying old GTP information:\n";
+ system("/sbin/gpt destroy " . escapeshellarg($disk));
+ echo "Creating GPT partition:\n";
+ system("/sbin/gpt create -f " . escapeshellarg($disk));
+ system("/sbin/gpt add -t ufs " . escapeshellarg($disk));
+ // Create filesystem
+ echo "Creating Filesystem with Soft Updates:\n";
+ system("/sbin/newfs -U /dev/" . escapeshellarg($disk) . "p1");
+ echo "Done!\n";
+ break;
+ case "ufsgpt_no_su":
+ /* Create GPT partition table */
+ echo "Destroying old GTP information:\n";
+ system("/sbin/gpt destroy " . escapeshellarg($disk));
+ echo "Creating GPT partition:\n";
+ system("/sbin/gpt create -f " . escapeshellarg($disk));
+ system("/sbin/gpt add -t ufs " . escapeshellarg($disk));
+ // Create filesystem
+ echo "Creating Filesystem without Soft Updates:\n";
+ system("/sbin/newfs -m 0 /dev/" . escapeshellarg($disk) . "p1");
+ echo "Done!\n";
+ break;
+ case "softraid":
+ /* Initialize disk */
+ system("/sbin/fdisk -I -b /boot/mbr " . escapeshellarg($disk));
+ /* Initialise the partition (optional) */
+ system("/bin/dd if=/dev/zero of=/dev/" . escapeshellarg($disk) . "s1 bs=32k count=16");
+ /* Delete old gmirror information */
+ system("/sbin/gmirror clear " . escapeshellarg($disk));
+ echo "Done!\n";
+ break;
+ case "msdos":
+ /* Initialize disk */
+ system("/sbin/fdisk -I -b /boot/mbr " . escapeshellarg($disk));
+ /* Initialise the partition (optional) */
+ system("/bin/dd if=/dev/zero of=/dev/" . escapeshellarg($disk) . "s1 bs=32k count=16");
+ /* Create s1 label */
+ system("/sbin/bsdlabel -w " . escapeshellarg($disk) . "s1 auto");
+ // Create filesystem
+ system("/sbin/newfs_msdos -F 32 /dev/" . escapeshellarg($disk) . "s1");
+ echo "Done!\n";
+ break;
+ }
+
+ echo('</pre>');
+ }
+ ?>
+ </td>
+ </tr>
<tr>
<td align="left" valign="top" colspan="2">
<span class="red">
diff --git a/packages/freenas/www/disks_manage_iscsi.php b/packages/freenas/www/disks_manage_iscsi.php
index 96c8eb0d..5180fc1a 100644
--- a/packages/freenas/www/disks_manage_iscsi.php
+++ b/packages/freenas/www/disks_manage_iscsi.php
@@ -1,36 +1,44 @@
<?php
/* $Id$ */
+/* ========================================================================== */
/*
- disks_manage_edit.php
- part of FreeNAS (http://www.freenas.org)
- Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
- All rights reserved.
-
- Based on m0n0wall (http://m0n0.ch/wall)
- Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
+ disks_manage_iscsi.php
+ part of pfSense (http://www.pfSense.com)
+ Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name>
+ All rights reserved.
+
+ Based on FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ All rights reserved.
+ */
+/* ========================================================================== */
+/*
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+/* ========================================================================== */
$pgtitle = array(gettext("System"),
gettext("Disks"),
@@ -43,7 +51,7 @@ require_once("freenas_functions.inc");
if (! is_array($freenas_config['iscsi']))
{
- $freenas_config['iscsi'] = array();
+ $freenas_config['iscsi'] = array();
}
$pconfig['enable'] = isset($freenas_config['iscsi']['enable']);
@@ -56,23 +64,23 @@ if (! empty($_POST))
unset($error_bucket);
/* simple error list */
unset($input_errors);
- unset($do_format);
- $pconfig = $_POST;
+ $pconfig = $_POST;
+
/* input validation */
- if ($_POST['enable'])
- {
- $reqdfields = array_merge($reqdfields, explode(" ", "targetaddress targetname"));
- $reqdfieldsn = array_merge($reqdfieldsn, explode(",", "targetaddress,targetname"));
- }
-
- do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
-
- if ($_POST['enable'] && !is_ipaddr($_POST['targetaddress'])){
+ if ($_POST['enable'])
+ {
+ $reqdfields = array_merge($reqdfields, explode(" ", "targetaddress targetname"));
+ $reqdfieldsn = array_merge($reqdfieldsn, explode(",", "targetaddress,targetname"));
+ }
+
+ do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
+
+ if ($_POST['enable'] && !is_ipaddr($_POST['targetaddress'])){
$error_bucket[] = array("error" => gettext("A valid IP address must be specified."),
"field" => "targetaddress");
}
-
+
if (is_array($error_bucket))
foreach($error_bucket as $elem)
$input_errors[] =& $elem["error"];
@@ -83,24 +91,24 @@ if (! empty($_POST))
exit;
}
- if (!$input_errors)
- {
- $freenas_config['iscsi']['enable'] = $_POST['enable'] ? true : false;
- $freenas_config['iscsi']['targetaddress'] = $_POST['targetaddress'];
- $freenas_config['iscsi']['targetname'] = $_POST['targetname'];
-
- write_config();
-
- $retval = 0;
- if (! file_exists($d_sysrebootreqd_path))
- {
- /* nuke the cache file */
- config_lock();
- services_iscsi_configure();
- config_unlock();
- }
- $savemsg = get_std_save_message($retval);
- }
+ if (!$input_errors)
+ {
+ $freenas_config['iscsi']['enable'] = $_POST['enable'] ? true : false;
+ $freenas_config['iscsi']['targetaddress'] = $_POST['targetaddress'];
+ $freenas_config['iscsi']['targetname'] = $_POST['targetname'];
+
+ write_config();
+
+ $retval = 0;
+ if (! file_exists($d_sysrebootreqd_path))
+ {
+ /* nuke the cache file */
+ config_lock();
+ services_iscsi_configure();
+ config_unlock();
+ }
+ $savemsg = get_std_save_message($retval);
+ }
}
include("head.inc");
@@ -145,7 +153,8 @@ echo $pfSenseHead->getHTML();
$tab_array = array();
$tab_array[0] = array(gettext("Manage"), false, "disks_manage.php");
$tab_array[1] = array(gettext("Format"), false, "disks_manage_init.php");
- $tab_array[2] = array(gettext("iSCSI Initiator"), true, "disks_manage_iscsi.php");
+ $tab_array[2] = array(gettext("Tools"), false, "disks_manage_tools.php");
+ $tab_array[3] = array(gettext("iSCSI Initiator"), true, "disks_manage_iscsi.php");
display_top_tabs($tab_array);
?>
</td>
diff --git a/packages/freenas/www/disks_manage_tools.php b/packages/freenas/www/disks_manage_tools.php
new file mode 100644
index 00000000..a0bb3901
--- /dev/null
+++ b/packages/freenas/www/disks_manage_tools.php
@@ -0,0 +1,275 @@
+<?php
+/* $Id$ */
+/* ========================================================================== */
+/*
+ disks_manage_tools.php
+ part of pfSense (http://www.pfSense.com)
+ Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name>
+ All rights reserved.
+
+ Based on FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ All rights reserved.
+ */
+/* ========================================================================== */
+/*
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+/* ========================================================================== */
+
+$pgtitle = array(gettext("System"),
+ gettext("Disks"),
+ gettext("Tools"));
+
+require_once("freenas_config.inc");
+require_once("guiconfig.inc");
+require_once("freenas_guiconfig.inc");
+require_once("freenas_functions.inc");
+
+if (!is_array($freenas_config['disks']['disk']))
+ $freenas_config['disks']['disk'] = array();
+
+disks_sort();
+
+$a_disk_conf = &$freenas_config['disks']['disk'];
+
+if ($_POST) {
+ unset($input_errors);
+ unset($do_action);
+
+ /* input validation */
+ $reqdfields = explode(" ", "disk action");
+ $reqdfieldsn = explode(",", "Disk,Action");
+ do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
+
+ if (!$input_errors)
+ {
+ $do_action = true;
+ $disk = $_POST['disk'];
+ $action = $_POST['action'];
+ $partition = $_POST['partition'];
+ $umount = $_POST['umount'];
+ }
+}
+
+if (!isset($do_action))
+{
+ $do_action = false;
+ $disk = '';
+ $action = '';
+ $partition = '';
+ $umount = false;
+}
+
+/* if ajax is calling, give them an update message */
+if(isAjax())
+ print_info_box_np($savemsg);
+
+include("head.inc");
+/* put your custom HTML head content here */
+/* using some of the $pfSenseHead function calls */
+$pfSenseHead->setCloseHead(false);
+echo $pfSenseHead->getHTML();
+
+?>
+<script type="text/javascript">
+<!--
+function disk_change() {
+ var next = null;
+ // Remove all entries from partition combobox.
+ document.iform.partition.length = 0;
+ // Insert entries for partition combobox.
+ switch(document.iform.disk.value)
+ {
+ <?php foreach ($a_disk as $diskv): ?>
+ case "<?=$diskv['name'];?>":
+ <?php $partinfo = disks_get_partition_info($diskv['name']);?>
+ <?php foreach($partinfo as $partinfon => $partinfov): ?>
+ if(document.all) // MS IE workaround.
+ next = document.iform.partition.length;
+ document.iform.partition.add(new Option("<?=$partinfon;?>","s<?=$partinfon;?>",false,<?php if("s{$partinfon}"==$partition){echo "true";}else{echo "false";};?>), next);
+ <?php endforeach; ?>
+ break;
+ <?php endforeach; ?>
+ }
+}
+// -->
+</script>
+</head>
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>">
+<?php include("fbegin.inc"); ?>
+<?php if ($input_errors) print_input_errors($input_errors); ?>
+<?php if ($savemsg) print_info_box($savemsg); ?>
+
+<form action="disks_manage_tools.php" method="post" name="iform" id="iform">
+<div id="inputerrors"></div>
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr><td class="tabnavtbl">
+<?php
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Manage"), false, "disks_manage.php");
+ $tab_array[1] = array(gettext("Format"), false, "disks_manage_init.php");
+ $tab_array[2] = array(gettext("Tools"), true, "disks_manage_tools.php");
+ $tab_array[3] = array(gettext("iSCSI Initiator"), false, "disks_manage_iscsi.php");
+ display_top_tabs($tab_array);
+?>
+ </td></tr>
+ <tr>
+ <td>
+ <div id="mainarea">
+ <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td width="22%" valign="top" class="vncellreq"><?=gettext("Disk");?></td>
+ <td width="78%" class="vtable">
+ <select name="disk" class="formfld" id="disk" onchange="disk_change()">
+ <?php foreach ($a_disk as $diskn): ?>
+ <option value="<?=$diskn['name'];?>"<?php if ($diskn['name'] == $disk) echo "selected";?>>
+ <?php echo htmlspecialchars($diskn['name'] . ": " .$diskn['size'] . " (" . $diskn['desc'] . ")");?>
+ <?php endforeach; ?>
+ </option>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq"><?=gettext("Partition");?></td>
+ <td width="78%" class="vtable">
+ <td valign="top" class="vncellreq"><?=_PARTITION;?></td>
+ <td class="vtable">
+ <select name="partition" class="formfld" id="partition"></select>
+ </td>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq"><?=gettext("Command");?></td>
+ <td width="78%" class="vtable">
+ <td valign="top" class="vncellreq"><?=_PARTITION;?></td>
+ <td class="vtable">
+ <select name="action" class="formfld" id="action">
+ <option value="fsck" <?php if ($action == "fsck") echo "selected"; ?>>fsck</option>
+ </select>
+ </td>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq"></td>
+ <td width="78%" class="vtable">
+ <td valign="top" class="vncellreq"><?=_PARTITION;?></td>
+ <td class="vtable">
+ <input name="umount" type="checkbox" id="umount" value="yes" <?php if ($umount) echo "checked"; ?> />
+ <strong>
+ <?= gettext("Unmount disk/partition"); ?>
+ </strong>
+ <span class="vexpl">
+ <br />
+ <?= gettext("If the selected disk/partition is mounted it will be unmounted temporary to perform selected command, otherwise the commands work in read-only mode."); ?>
+ </span>
+ </td>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq">&nbsp;</td>
+ <td width="78%" class="vtable">
+ <td valign="top" class="vncellreq"><?=_PARTITION;?></td>
+ <td class="vtable">
+ <input name="Submit" type="submit" class="formbtn" value="<?= gettext("Send Command!"); ?>">
+ </td>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq">&nbsp;</td>
+ <td width="78%" class="vtable">
+ <td valign="top" class="vncellreq"><?=_PARTITION;?></td>
+ <td class="vtable">
+ <?php
+ if($do_action)
+ {
+ echo("<strong>" . gettext("Command output:") . "</strong><br>");
+ echo('<pre>');
+ ob_end_flush();
+
+ switch($action)
+ {
+ case "fsck":
+ /* Get the id of the disk. */
+ $id = array_search_ex($disk, $a_disk, "name");
+ /* Get the filesystem type of the disk. */
+ $type = $a_disk[$id]['fstype'];
+ /* Check if disk is mounted. */
+ $ismounted = disks_check_mount($disk,$partition);
+
+ /* Umount disk if necessary. */
+ if($umount && $ismounted) {
+ echo("<strong class='red'>" . gettext("Note") . ":</strong> " . gettext("The disk is currently mounted! The mount point will be removed temporary to perform selected command.") . "<br><br>");
+ disks_umount_ex($disk,$partition);
+ }
+
+ switch($type)
+ {
+ case "":
+ case "ufs":
+ case "ufs_no_su":
+ case "ufsgpt":
+ case "ufsgpt_no_su":
+ system("/sbin/fsck_ufs -y -f /dev/" . escapeshellarg($disk . $partition));
+ break;
+ case "gmirror":
+ case "gvinum":
+ case "graid5":
+ $infomsg = sprintf(gettext("Use <a href='%s'>RAID tools</a> for this disk!"), "disks_raid_{$type}_tools.php");
+ print_info_box_np($infomsg);
+ break;
+ case "msdos":
+ system("/sbin/fsck_msdosfs -y -f /dev/" . escapeshellarg($disk . $partition));
+ break;
+ }
+
+ /* Mount disk if necessary. */
+ if($umount && $ismounted) {
+ disks_mount_ex($disk,$partition);
+ }
+
+ break;
+ }
+ echo('</pre>');
+ }
+ ?>
+ </td>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </td>
+ </tr>
+</table>
+</form>
+<script type="text/javascript">
+<!--
+ disk_change();
+//-->
+</script>
+<?php include("fend.inc"); ?>
+</body>
+</html>
diff --git a/packages/freenas/www/disks_mount.php b/packages/freenas/www/disks_mount.php
index c83cec60..9a6a2a63 100644
--- a/packages/freenas/www/disks_mount.php
+++ b/packages/freenas/www/disks_mount.php
@@ -1,36 +1,44 @@
<?php
/* $Id$ */
+/* ========================================================================== */
/*
- disks_manage_edit.php
- part of FreeNAS (http://www.freenas.org)
- Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
- All rights reserved.
-
- Based on m0n0wall (http://m0n0.ch/wall)
- Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
+ disks_mount.php
+ part of pfSense (http://www.pfSense.com)
+ Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name>
+ All rights reserved.
+
+ Based on FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ All rights reserved.
+ */
+/* ========================================================================== */
+/*
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+/* ========================================================================== */
$pgtitle = array(gettext("System"),
gettext("Disks"),
@@ -42,7 +50,7 @@ require_once("freenas_guiconfig.inc");
require_once("freenas_functions.inc");
if (!is_array($freenas_config['mounts']['mount']))
- $freenas_config['mounts']['mount'] = array();
+ $freenas_config['mounts']['mount'] = array();
mount_sort();
@@ -89,23 +97,23 @@ if (! empty($_POST))
if ($_GET['act'] == "del")
{
- if ($a_mount[$_GET['id']]) {
- disks_umount_adv($a_mount[$_GET['id']]);
- unset($a_mount[$_GET['id']]);
- write_config();
- touch($d_mountdirty_path);
- pfSenseHeader("disks_mount.php");
- exit;
- }
+ if ($a_mount[$_GET['id']]) {
+ disks_umount_adv($a_mount[$_GET['id']]);
+ unset($a_mount[$_GET['id']]);
+ write_config();
+ touch($d_mountdirty_path);
+ pfSenseHeader("disks_mount.php");
+ exit;
+ }
}
if ($_GET['act'] == "ret")
{
- if ($a_mount[$_GET['id']]) {
- disks_mount($a_mount[$_GET['id']]);
- pfSenseHeader("disks_mount.php");
- exit;
- }
+ if ($a_mount[$_GET['id']]) {
+ disks_mount($a_mount[$_GET['id']]);
+ pfSenseHeader("disks_mount.php");
+ exit;
+ }
}
include("head.inc");
@@ -126,82 +134,102 @@ echo $pfSenseHead->getHTML();
<?php print_info_box_np(gettext("The mount point list has been changed.") . "<br />" .
gettext("You must apply the changes in order for them to take effect."));?>
<?php endif; ?>
- <div id="inputerrors"></div>
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td class="listhdrr"><?=gettext("Disk");?></td>
- <td class="listhdrr"><?=gettext("Partition");?></td>
- <td class="listhdrr"><?=gettext("File system");?></td>
- <td class="listhdrr"><?=gettext("Share name");?></td>
- <td class="listhdrr"><?=gettext("Description");?></td>
- <td class="listhdrr"><?=gettext("Status");?></td>
- <td class="list">&nbsp;</td>
- </tr>
- <?php $i = 0; foreach ($a_mount as $mount): ?>
- <tr>
- <td valign="middle" class="listlr">
- <?=htmlspecialchars($mount['mdisk']);?> &nbsp;
- </td>
- <td valign="middle" class="listr">
- <?=htmlspecialchars($mount['partition']);?>&nbsp;
- </td>
- <td valign="middle" class="listr">
- <?=htmlspecialchars($mount['fstype']);?>&nbsp;
- </td>
- <td valign="middle" class="listr">
- <?=htmlspecialchars($mount['sharename']);?>&nbsp;
- </td>
- <td valign="middle" class="listr">
- <?=htmlspecialchars($mount['desc']);?>&nbsp;
- </td>
- </td>
- <td valign="middle" class="listbg" style="color: #FFFFFF;">
- <?php
- if (file_exists($d_mountdirty_path)) {
- $stat = gettext("configuring");
- } else {
- $stat = disks_mount_status($mount);
- if ($stat == "ERROR")
- $stat = "ERROR - <a href=\"disks_mount.php?act=ret&id=$i\">retry</a>";
- }
- echo $stat;
- ?>
- </td>
- <td valign="middle" class="list">
- <a href="disks_mount_edit.php?id=<?=$i;?>">
- <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" title="<?=gettext("edit mount");?>" width="17" height="17" border="0" alt="" />
- </a>
- <a href="disks_mount.php?act=del&id=<?=$i;?>">
- <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" onclick="return confirm('<?= gettext("Do you really want to delete this mount point? All elements that still use it will become invalid (e.g. share)!"); ?>');" title="<?=gettext("delete mount");?>" width="17" height="17" border="0" alt="" />
- </a>
- </td>
- </tr>
- <?php $i++; endforeach; ?>
- <tr>
- <td class="list" colspan="6"></td>
- <td class="list" nowrap>
- <a href="disks_mount_edit.php">
- <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" title="<?=gettext("add mount");?>" width="17" height="17" border="0" alt="" />
- </a>
- </td>
- </tr>
- <tr>
- <td align="left" valign="top" colspan="7">
- <span class="red">
- <strong>Note:</strong>
- </span>
- <br />
- <span class="vexpl">
- <?= gettext("Second configuration step: Declaring the filesystem used by your"); ?>
- </span>
- <br />
- <span class="vexpl">
- <a href="disks_manage.php">previously configured disk</a>
- </span>
- </td>
- </tr>
- </table>
- </form>
+
+<div id="inputerrors"></div>
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr><td class="tabnavtbl">
+<?php
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Manage"), true, "disks_mount.php");
+ $tab_array[1] = array(gettext("Tools"), false, "disks_miunt_tools.php");
+ display_top_tabs($tab_array);
+?>
+ </td></tr>
+ <tr>
+ <td>
+ <div id="mainarea">
+ <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td class="listhdrr"><?=gettext("Disk");?></td>
+ <td class="listhdrr"><?=gettext("Partition");?></td>
+ <td class="listhdrr"><?=gettext("File system");?></td>
+ <td class="listhdrr"><?=gettext("Share name");?></td>
+ <td class="listhdrr"><?=gettext("Description");?></td>
+ <td class="listhdrr"><?=gettext("Status");?></td>
+ <td class="list">&nbsp;</td>
+ </tr>
+ <?php $i = 0; foreach ($a_mount as $mount): ?>
+ <tr>
+ <td valign="middle" class="listlr">
+ <?=htmlspecialchars($mount['mdisk']);?> &nbsp;
+ </td>
+ <td valign="middle" class="listr">
+ <?=htmlspecialchars($mount['partition']);?>&nbsp;
+ </td>
+ <td valign="middle" class="listr">
+ <?=htmlspecialchars($mount['fstype']);?>&nbsp;
+ </td>
+ <td valign="middle" class="listr">
+ <?=htmlspecialchars($mount['sharename']);?>&nbsp;
+ </td>
+ <td valign="middle" class="listr">
+ <?=htmlspecialchars($mount['desc']);?>&nbsp;
+ </td>
+ </td>
+ <td valign="middle" class="listbg" style="color: #FFFFFF;">
+ <?php
+ if (file_exists($d_mountdirty_path)) {
+ $stat = gettext("configuring");
+ } else {
+ $stat = disks_check_mount($mount);
+ if ($stat == 0) {
+ $stat = "ERROR - <a href=\"disks_mount.php?act=ret&id=$i\">retry</a>";
+ } else {
+ $stat = gettext("OK");
+ }
+ }
+ echo $stat;
+ ?>
+ </td>
+ <td valign="middle" class="list">
+ <a href="disks_mount_edit.php?id=<?=$i;?>">
+ <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" title="<?=gettext("edit mount");?>" width="17" height="17" border="0" alt="" />
+ </a>
+ <a href="disks_mount.php?act=del&id=<?=$i;?>">
+ <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" onclick="return confirm('<?= gettext("Do you really want to delete this mount point? All elements that still use it will become invalid (e.g. share)!"); ?>');" title="<?=gettext("delete mount");?>" width="17" height="17" border="0" alt="" />
+ </a>
+ </td>
+ </tr>
+ <?php $i++; endforeach; ?>
+ <tr>
+ <td class="list" colspan="6"></td>
+ <td class="list" nowrap>
+ <a href="disks_mount_edit.php">
+ <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" title="<?=gettext("add mount");?>" width="17" height="17" border="0" alt="" />
+ </a>
+ </td>
+ </tr>
+ <tr>
+ <td align="left" valign="top" colspan="7">
+ <span class="red">
+ <strong>Note:</strong>
+ </span>
+ <br />
+ <span class="vexpl">
+ <?= gettext("Second configuration step: Declaring the filesystem used by your"); ?>
+ </span>
+ <br />
+ <span class="vexpl">
+ <a href="disks_manage.php">previously configured disk</a>
+ </span>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </td>
+ </tr>
+ </table>
+</form>
<?php include("fend.inc"); ?>
<?= checkForInputErrors(); ?>
</body>
diff --git a/packages/freenas/www/disks_mount_edit.php b/packages/freenas/www/disks_mount_edit.php
index 02d7d5f3..b4cd7378 100644
--- a/packages/freenas/www/disks_mount_edit.php
+++ b/packages/freenas/www/disks_mount_edit.php
@@ -1,36 +1,44 @@
<?php
/* $Id$ */
+/* ========================================================================== */
/*
- disks_manage_edit.php
- part of FreeNAS (http://www.freenas.org)
- Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
- All rights reserved.
-
- Based on m0n0wall (http://m0n0.ch/wall)
- Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
+ disks_mount_edit.php
+ part of pfSense (http://www.pfSense.com)
+ Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name>
+ All rights reserved.
+
+ Based on FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ All rights reserved.
+ */
+/* ========================================================================== */
+/*
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+/* ========================================================================== */
$pgtitle = array(gettext("System"),
gettext("Disks"),
@@ -42,46 +50,61 @@ require_once("guiconfig.inc");
require_once("freenas_guiconfig.inc");
require_once("freenas_functions.inc");
+$id = $_GET['id'];
+if (isset($_POST['id']))
+ $id = $_POST['id'];
+
if (!is_array($freenas_config['mounts']['mount']))
- $freenas_config['mounts']['mount'] = array();
+ $freenas_config['mounts']['mount'] = array();
mount_sort();
if (!is_array($freenas_config['disks']['disk']))
- $freenas_config['disks']['disk'] = array();
-
+ $freenas_config['disks']['disk'] = array();
+
disks_sort();
-if (!is_array($freenas_config['raid']['vdisk']))
- $freenas_config['raid']['vdisk'] = array();
+if (!is_array($freenas_config['gvinum']['vdisk']))
+ $freenas_config['gvinum']['vdisk'] = array();
gvinum_sort();
if (!is_array($freenas_config['gmirror']['vdisk']))
- $freenas_config['gmirror']['vdisk'] = array();
+ $freenas_config['gmirror']['vdisk'] = array();
gmirror_sort();
+if (!is_array($freenas_config['gconcat']['vdisk']))
+ $freenas_config['gconcat']['vdisk'] = array();
+
+gconcat_sort();
+
+if (!is_array($freenas_config['gstripe']['vdisk']))
+ $freenas_config['gstripe']['vdisk'] = array();
+
+gstripe_sort();
+
+if (!is_array($freenas_config['graid5']['vdisk']))
+ $freenas_config['graid5']['vdisk'] = array();
+
+graid5_sort();
+
$a_mount = &$freenas_config['mounts']['mount'];
-$a_disk = array_merge($freenas_config['disks']['disk'],$freenas_config['raid']['vdisk'],$freenas_config['gmirror']['vdisk']);
+$a_disk = array_merge($freenas_config['disks']['disk'],$freenas_config['gvinum']['vdisk'],$freenas_config['gmirror']['vdisk'],$freenas_config['gconcat']['vdisk'],$freenas_config['gstripe']['vdisk'],$freenas_config['graid5']['vdisk']);
/* Load the cfdevice file*/
$filename=$g['varetc_path']."/cfdevice";
if (file_exists($filename))
$cfdevice = trim(file_get_contents("$filename"));
-
-$id = $_GET['id'];
-if (isset($_POST['id']))
- $id = $_POST['id'];
-
if (isset($id) && $a_mount[$id]) {
- $pconfig['mdisk'] = $a_mount[$id]['mdisk'];
- $pconfig['partition'] = $a_mount[$id]['partition'];
- $pconfig['fstype'] = $a_mount[$id]['fstype'];
- $pconfig['sharename'] = $a_mount[$id]['sharename'];
- $pconfig['desc'] = $a_mount[$id]['desc'];
+ $pconfig['mdisk'] = $a_mount[$id]['mdisk'];
+ $pconfig['partition'] = $a_mount[$id]['partition'];
+ $pconfig['fullname'] = $a_mount[$id]['fullname'];
+ $pconfig['fstype'] = $a_mount[$id]['fstype'];
+ $pconfig['sharename'] = $a_mount[$id]['sharename'];
+ $pconfig['desc'] = $a_mount[$id]['desc'];
}
if (! empty($_POST))
@@ -91,59 +114,57 @@ if (! empty($_POST))
/* simple error list */
unset($input_errors);
$pconfig = $_POST;
-
+
/* input validation */
$reqdfields = split(" ", "partition mdisk fstype");
$reqdfieldsn = split(",", "Partition,Mdisk,Fstype");
-
+
do_input_validation_new($_POST, $reqdfields, $reqdfieldsn, &$error_bucket);
-
- if (($_POST['sharename'] && !is_validsharename($_POST['sharename'])))
- {
+
+ if (($_POST['sharename'] && !is_validsharename($_POST['sharename'])))
+ {
$error_bucket[] = array("error" => gettext("The share name may only consist of the characters a-z, A-Z, 0-9, _ , -."),
"field" => "sharename");
- }
-
-
- if (($_POST['desc'] && !is_validdesc($_POST['desc'])))
- {
+ }
+
+
+ if (($_POST['desc'] && !is_validdesc($_POST['desc'])))
+ {
$error_bucket[] = array("error" => gettext("The description name contain invalid characters."),
"field" => "desc");
-
- }
- $device=$_POST['mdisk'].$_POST['partition'];
-
- if ($device == $cfdevice )
- {
+
+ }
+ $device=$_POST['mdisk'].$_POST['partition'];
+
+ if ($device == $cfdevice )
+ {
$error_bucket[] = array("error" => gettext("Can't mount the system partition 1, the DATA partition is the 2."),
"field" => "mdisk");
-
- }
-
- /* check for name conflicts */
- foreach ($a_mount as $mount)
- {
- if (isset($id) && ($a_mount[$id]) && ($a_mount[$id] === $mount))
- continue;
-
- /* Remove the duplicate disk use
- if ($mount['mdisk'] == $_POST['mdisk'])
- {
- $input_errors[] = "This device already exists in the mount point list.";
- break;
- }
- */
-
- if (($_POST['sharename']) && ($mount['sharename'] == $_POST['sharename']))
- {
+
+ }
+
+ /* check for name conflicts */
+ foreach ($a_mount as $mount)
+ {
+ if (isset($id) && ($a_mount[$id]) && ($a_mount[$id] === $mount))
+ continue;
+
+ /* Check for duplicate mount point */
+ if ($mount['mdisk'] == $_POST['mdisk'])
+ {
+ $error_bucket[] = array("error" => gettext("This disk/partition is allready configured."),
+ "field" => "mdisk");
+ break;
+ }
+
+ if (($_POST['sharename']) && ($mount['sharename'] == $_POST['sharename']))
+ {
$error_bucket[] = array("error" => gettext("Duplicate Share Name."),
"field" => "sharename");
- break;
- }
-
-
- }
-
+ break;
+ }
+ }
+
if (is_array($error_bucket))
foreach($error_bucket as $elem)
$input_errors[] =& $elem["error"];
@@ -154,30 +175,34 @@ if (! empty($_POST))
exit;
}
- if (!$input_errors)
- {
- $mount = array();
- $mount['mdisk'] = $_POST['mdisk'];
- $mount['partition'] = $_POST['partition'];
- $mount['fstype'] = $_POST['fstype'];
- $mount['desc'] = $_POST['desc'];
- /* if not sharename given, create one */
- if (!$_POST['sharename'])
- $mount['sharename'] = "disk_{$_POST['mdisk']}_part_{$_POST['partition']}";
- else
- $mount['sharename'] = $_POST['sharename'];
- if (isset($id) && $a_mount[$id])
- $a_mount[$id] = $mount;
- else
- $a_mount[] = $mount;
-
- touch($d_mountdirty_path);
-
- write_config();
-
- pfSenseHeader("disks_mount.php");
- exit;
- }
+ if (!$input_errors)
+ {
+ $mount = array();
+ $mount['mdisk'] = $_POST['mdisk'];
+ $mount['partition'] = $_POST['partition'];
+ $mount['fstype'] = $_POST['fstype'];
+ $mount['desc'] = $_POST['desc'];
+ /* if not sharename given, create one */
+ if (!$_POST['sharename'])
+ $mount['sharename'] = "disk_{$_POST['mdisk']}_part_{$_POST['partition']}";
+ else
+ $mount['sharename'] = $_POST['sharename'];
+
+ // Generate fullname
+ $mount['fullname'] = "{$mount['mdisk']}{$mount['partition']}";
+
+ if (isset($id) && $a_mount[$id])
+ $a_mount[$id] = $mount;
+ else
+ $a_mount[] = $mount;
+
+ touch($d_mountdirty_path);
+
+ write_config();
+
+ pfSenseHeader("disks_mount.php");
+ exit;
+ }
}
include("head.inc");
@@ -198,14 +223,15 @@ echo $pfSenseHead->getHTML();
<tr>
<td width="22%" valign="top" class="vncellreq"><?=gettext("Disk");?></td>
<td width="78%" class="vtable">
- <select name="mdisk" class="formselect" id="mdisk">
- <?php foreach ($a_disk as $disk): ?>
- <?php if ((strcmp($disk['fstype'],"raid")!=0) | (strcmp($disk['fstype'],"gmirror")!=0)): ?>
- <option value="<?=$disk['name'];?>" <?php if ($pconfig['mdisk'] == $disk['name']) echo "selected";?>>
- <?php echo htmlspecialchars($disk['name'] . ": " .$disk['size'] . " (" . $disk['desc'] . ")"); ?>
- </option>
- <?php endif; ?>
- <?php endforeach; ?>
+ <select name="mdisk" class="formselect" id="mdisk">
+ <?php foreach ($a_disk as $disk): ?>
+ <?php if (strcmp($disk['fstype'],"softraid")==0): ?>
+ <?php continue; ?>
+ <?php endif; ?>
+ <option value="<?=$disk['fullname'];?>" <?php if ($pconfig['mdisk'] == $disk['name']) echo "selected";?>>
+ <?php echo htmlspecialchars($disk['name'] . ": " .$disk['size'] . " (" . $disk['desc'] . ")"); ?>
+ </option>
+ <?php endforeach; ?>
</select>
</td>
</tr>
@@ -213,13 +239,14 @@ echo $pfSenseHead->getHTML();
<td width="22%" valign="top" class="vncellreq"><?=gettext("Partition");?></td>
<td width="78%" class="vtable">
<select name="partition" class="formselect" id="partition number">
- <option value="s1" <?php if ($pconfig['partition'] == "s1") echo "selected=\"selected\""; ?>>1</option>
- <option value="s2" <?php if ($pconfig['partition'] == "s2") echo "selected\"selected\""; ?>>2</option>
- <option value="s3" <?php if ($pconfig['partition'] == "s3") echo "selected\"selected\""; ?>>3</option>
- <option value="s4" <?php if ($pconfig['partition'] == "s4") echo "selected\"selected\""; ?>>4</option>
- <option value="gmirror" <?php if ($pconfig['partition'] == "gmirror") echo "selected\"selected\""; ?>><?=_SOFTRAID ;?> - gmirror</option>
- <option value="gvinum" <?php if ($pconfig['partition'] == "gvinum") echo "selected\"selected\""; ?>><?=_SOFTRAID ;?> - gvinum</option>
- <option value="p1" <?php if ($pconfig['partition'] == "gpt") echo "selected\"selected\""; ?>>GPT</option>
+ <option value="s1" <?php if ($pconfig['partition'] == "s1") echo "selected"; ?>>1 (or new software RAID method)</option>
+ <option value="s2" <?php if ($pconfig['partition'] == "s2") echo "selected"; ?>>2</option>
+ <option value="s3" <?php if ($pconfig['partition'] == "s3") echo "selected"; ?>>3</option>
+ <option value="s4" <?php if ($pconfig['partition'] == "s4") echo "selected"; ?>>4</option>
+ <option value="gmirror" <?php if ($pconfig['partition'] == "gmirror") echo "selected"; ?>>previous <?=_SOFTRAID ;?> - gmirror</option>
+ <option value="graid5" <?php if ($pconfig['partition'] == "graid5") echo "selected"; ?>>previous <?=_SOFTRAID ;?> - graid5</option>
+ <option value="gvinum" <?php if ($pconfig['partition'] == "gvinum") echo "selected"; ?>>previous <?=_SOFTRAID ;?> - gvinum</option>
+ <option value="p1" <?php if ($pconfig['partition'] == "gpt") echo "selected"; ?>>GPT (or new software RAID method with GPT)</option>
</select>
</td>
</tr>
diff --git a/packages/freenas/www/disks_mount_tools.php b/packages/freenas/www/disks_mount_tools.php
new file mode 100644
index 00000000..472b11b1
--- /dev/null
+++ b/packages/freenas/www/disks_mount_tools.php
@@ -0,0 +1,211 @@
+<?php
+/* $Id$ */
+/* ========================================================================== */
+/*
+ disks_mount_tools.php
+ part of pfSense (http://www.pfSense.com)
+ Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name>
+ All rights reserved.
+
+ Based on FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ All rights reserved.
+ */
+/* ========================================================================== */
+/*
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+/* ========================================================================== */
+
+$pgtitle = array(gettext("System"),
+ gettext("Disks"),
+ gettext("Mount Point"),
+ gettext("Tools"));
+
+require_once("freenas_config.inc");
+require_once("guiconfig.inc");
+require_once("freenas_guiconfig.inc");
+require_once("freenas_functions.inc");
+
+if (!is_array($freenas_config['mounts']['mount']))
+ $freenas_config['mounts']['mount'] = array();
+
+mount_sort();
+
+$a_mount = &$freenas_config['mounts']['mount'];
+
+if (! empty($_POST))
+{
+ /* hash */
+ unset($error_bucket);
+ /* simple error list */
+ unset($input_errors);
+ unset($do_action);
+
+ /* input validation */
+ $reqdfields = explode(" ", "fullname action");
+ $reqdfieldsn = explode(",", "Fullname,Action");
+ do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
+
+ if (is_array($error_bucket))
+ foreach($error_bucket as $elem)
+ $input_errors[] =& $elem["error"];
+
+ /* if this is an AJAX caller then handle via JSON */
+ if(isAjax() && is_array($error_bucket)) {
+ input_errors2Ajax(NULL, $error_bucket);
+ exit;
+ }
+
+ if(!$input_errors)
+ {
+ $do_action = true;
+ $fullname = $_POST['fullname'];
+ $action = $_POST['action'];
+ }
+}
+
+if(!isset($do_action))
+{
+ $do_action = false;
+ $fullname = '';
+ $action = '';
+}
+
+// URL GET from the disks_manage_init.php page:
+// we get the $disk value, must found the $fullname now
+if(isset($_GET['disk'])) {
+ $disk = $_GET['disk'];
+ $id = array_search_ex($disk, $a_mount, "mdisk");
+
+ $fullname = $a_mount[$id]['fullname'];
+}
+if(isset($_GET['action'])) {
+ $action = $_GET['action'];
+}
+
+include("head.inc");
+/* put your custom HTML head content here */
+/* using some of the $pfSenseHead function calls */
+echo $pfSenseHead->getHTML();
+
+?>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>">
+<?php include("fbegin.inc"); ?>
+
+<?php if ($input_errors) print_input_errors($input_errors); ?>
+<?php if ($savemsg) print_info_box($savemsg); ?>
+
+<form id="iform" name="iform" action="disks_mount.php" method="post">
+
+<div id="inputerrors"></div>
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr><td class="tabnavtbl">
+<?php
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Manage"), true, "disks_mount.php");
+ $tab_array[1] = array(gettext("Tools"), false, "disks_miunt_tools.php");
+ display_top_tabs($tab_array);
+?>
+ </td></tr>
+ <tr>
+ <td>
+ <div id="mainarea">
+ <?php if ($input_errors) print_input_errors($input_errors); ?>
+ <form action="disks_mount_tools.php" method="post" name="iform" id="iform">
+ <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td valign="top" class="vncellreq"><?= gettext("Share Name"); ?></td>
+ <td class="vtable">
+ <select name="fullname" class="formfld" id="fullname">
+ <?php foreach ($a_mount as $mountv): ?>
+ <option value="<?=$mountv['fullname'];?>"<?php if ($mountv['fullname'] == $fullname) echo "selected";?>>
+ <?php echo htmlspecialchars($mountv['sharename'] . " (" . gettext("Disk") . ": " . $mountv['mdisk'] . " " . gettext("Partition") . ": " . $mountv['partition'] . ")");?>
+ <?php endforeach; ?>
+ </option>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top" class="vncellreq"><?= gettext("Command"); ?></td>
+ <td class="vtable">
+ <select name="action" class="formfld" id="action">
+ <option value="mount" <?php if ($action == "mount") echo "selected"; ?>>mount</option>
+ <option value="umount" <?php if ($action == "umount") echo "selected"; ?>>umount</option>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top">&nbsp;</td>
+ <td width="78%">
+ <input name="Submit" type="submit" class="formbtn" value="<?= gettext("Send Command!"); ?>">
+ </td>
+ </tr>
+ <tr>
+ <td valign="top" colspan="2">
+ <?php if($do_action)
+ {
+ echo("<strong>" . gettext("Command output") . ": </strong><br />");
+ echo('<pre>');
+ ob_end_flush();
+
+ /* Get the id of the mount array entry. */
+ $id = array_search_ex($fullname, $a_mount, "fullname");
+ /* Get the mount data. */
+ $mount = $a_mount[$id];
+
+ switch($action)
+ {
+ case "mount":
+ echo(gettext("Mounting...") . "<br />");
+ $result = disks_mount_fullname($fullname);
+ break;
+ case "umount":
+ echo(gettext("Umounting...") . "<br />");
+ $result = disks_umount_fullname($fullname);
+ break;
+ }
+
+ /* Display result */
+ echo((0 == $result) ? gettext("Successful") : gettext("Failed"));
+
+ echo('</pre>');
+ }
+ ?>
+ </td>
+ </tr>
+ </table>
+ </form>
+ </div>
+ </td>
+ </tr>
+ </table>
+</form>
+<?php include("fend.inc"); ?>
+<?= checkForInputErrors(); ?>
+</body>
+</html>
diff --git a/packages/freenas/www/disks_raid_gconcat.php b/packages/freenas/www/disks_raid_gconcat.php
new file mode 100644
index 00000000..e7fc9f81
--- /dev/null
+++ b/packages/freenas/www/disks_raid_gconcat.php
@@ -0,0 +1,236 @@
+<?php
+/* $Id$ */
+/* ========================================================================== */
+/*
+ disks_raid_gconcat.php
+ part of pfSense (http://www.pfSense.com)
+ Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name>
+ All rights reserved.
+
+ Based on FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ All rights reserved.
+ */
+/* ========================================================================== */
+/*
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+/* ========================================================================== */
+
+$pgtitle = array(gettext("System"),
+ gettext("Disks"),
+ gettext("GEOM Concat"),
+ gettext("RAID"));
+
+require_once("freenas_config.inc");
+require_once("guiconfig.inc");
+require_once("freenas_guiconfig.inc");
+require_once("freenas_functions.inc");
+
+if (!is_array($freenas_config['gconcat']['vdisk']))
+ $freenas_config['gconcat']['vdisk'] = array();
+
+gconcat_sort();
+
+$raidstatus=get_sraid_disks_list();
+
+$a_raid = &$freenas_config['gconcat']['vdisk'];
+
+if (! empty($_POST))
+{
+ /* hash */
+ unset($error_bucket);
+ /* simple error list */
+ unset($input_errors);
+
+ $pconfig = $_POST;
+
+ if (is_array($error_bucket))
+ foreach($error_bucket as $elem)
+ $input_errors[] =& $elem["error"];
+
+ /* if this is an AJAX caller then handle via JSON */
+ if(isAjax() && is_array($error_bucket)) {
+ input_errors2Ajax(NULL, $error_bucket);
+ exit;
+ }
+
+ if ($_POST['apply']) {
+ $retval = 0;
+ if (!file_exists($d_sysrebootreqd_path))
+ {
+ config_lock();
+ /* reload all components that create raid device */
+ disks_raid_gconcat_configure();
+ config_unlock();
+ write_config();
+ }
+ $savemsg = get_std_save_message($retval);
+ if ($retval == 0) {
+ if (file_exists($d_raidconfdirty_path))
+ unlink($d_raidconfdirty_path);
+ }
+ }
+}
+
+if ($_GET['act'] == "del") {
+ if ($a_raid[$_GET['id']]) {
+ $raidname=$a_raid[$_GET['id']]['name'];
+ disks_raid_gconcat_delete($raidname);
+ unset($a_raid[$_GET['id']]);
+ write_config();
+ touch($d_raidconfdirty_path);
+ pfSenseHeader("disks_raid_gconcat.php");
+ exit;
+ }
+}
+
+include("head.inc");
+/* put your custom HTML head content here */
+/* using some of the $pfSenseHead function calls */
+echo $pfSenseHead->getHTML();
+
+?>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>">
+<?php include("fbegin.inc"); ?>
+<?php if ($input_errors) print_input_errors($input_errors); ?>
+<?php if ($savemsg) print_info_box($savemsg); ?>
+
+<form action="disks_raid_gconcat.php" method="post" name="iform" id="iform">
+<?php if (file_exists($d_diskdirty_path)): ?>
+<?php print_info_box_np(gettext("The Raid configuration has been changed.") . "<br />" .
+ gettext("You must apply the changes in order for them to take effect."));?>
+<?php endif; ?>
+
+<div id="inputerrors"></div>
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td class="tabnavtbl">
+<?php
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Geom Mirror"), false, "disks_raid_gmirror.php");
+ $tab_array[1] = array(gettext("Geom Concat"), true, "disks_raid_gconcat.php");
+ $tab_array[2] = array(gettext("Geom Stripe"), false, "disks_raid_gstripe.php");
+ $tab_array[3] = array(gettext("Geom RAID5"), false, "disks_raid_graid5.php");
+ $tab_array[4] = array(gettext("Geom Vinum"), false, "disks_raid_gvinum.php");
+ display_top_tabs($tab_array);
+?>
+ </td>
+ </tr>
+ <tr>
+ <td class="tabnavtbl">
+<?php
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Manage RAID"), true, "disks_raid_gconcat.php");
+ /* $tab_array[1] = array(gettext("Format RAID"), false, "disks_raid_gmirror_init.php"); */
+ $tab_array[1] = array(gettext("Tools"), false, "disks_raid_gconcat_tools.php");
+ $tab_array[2] = array(gettext("Information"), false, "disks_raid_gconcat_infos.php");
+ display_top_tabs($tab_array);
+?>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div id="mainarea">
+ <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td class="listhdrr"><?=gettext("Volume name");?></td>
+ <td class="listhdrr"><?=gettext("Type");?></td>
+ <td class="listhdrr"><?=gettext("Size");?></td>
+ <td class="listhdrr"><?=gettext("Status");?></td>
+ <td class="list">&nbsp;</td>
+ </tr>
+ <?php $i = 0; foreach ($a_raid as $raid): ?>
+ <tr>
+ <td valign="middle" class="listr">
+ <?=htmlspecialchars($raid['name']);?>
+ </td>
+ <td valign="middle" class="listr">
+ <?=htmlspecialchars($raid['type']);?>
+ </td>
+ <td valign="middle" class="listr">
+ <?php
+ $raidconfiguring = file_exists($d_raidconfdirty_path) &&
+ in_array($raid['name']."\n",file($d_raidconfdirty_path));
+ if ($raidconfiguring)
+ echo gettext("configuring");
+ else {
+ $tempo=$raid['name'];
+ echo "{$raidstatus[$tempo]['size']}";
+ }
+ ?>&nbsp;
+ </td>
+ <td valign="middle" class="listr">
+ <?php
+ if ($raidconfiguring)
+ echo gettext("configuring");
+ else {
+ echo "{$raidstatus[$tempo]['desc']}";
+ }
+ ?>&nbsp;
+ </td>
+ <td valign="middle" class="list">
+ <a href="disks_raid_gconcat_edit.php?id=<?=$i;?>">
+ <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" title="<?=gettext("edit raid");?>" width="17" height="17" border="0" alt="" />
+ </a>
+ <a href="disks_raid_gconcat.php?act=del&id=<?=$i;?>">
+ <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" title="<?=gettext("delete raid");?>" width="17" height="17" border="0" alt="" />
+ </a>
+ </td>
+ </tr>
+ <?php $i++; endforeach; ?>
+ <tr>
+ <td class="list" colspan="4"></td>
+ <td class="list" nowrap>
+ <a href="disks_raid_gconcat_edit.php">
+ <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" title="<?=gettext("add disk");?>" width="17" height="17" border="0" alt="" />
+ </a>
+ </td>
+ </tr>
+ <tr>
+ <td align="left" valign="top" colspan="5">
+ <span class="red">
+ <strong><?= gettext("Note:"); ?></strong>
+ </span>
+ <br />
+ <span class="vexpl"><?= gettext("Optional configuration step: Configuring a virtual RAID disk using your"); ?></span>
+ <br />
+ <span class="vexpl"><a href="disks_manage.php"><?= gettext("previsously configured disk."); ?></a></span>
+ <br />
+ <span class="vexpl"><?= gettext("Wait for the \"up\" status before format it and mount it!."); ?></span>
+ </span>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </td>
+ </tr>
+</table>
+</form>
+<?php include("fend.inc"); ?>
+</body>
+</html>
diff --git a/packages/freenas/www/disks_raid_gconcat_edit.php b/packages/freenas/www/disks_raid_gconcat_edit.php
new file mode 100644
index 00000000..f4bd33cc
--- /dev/null
+++ b/packages/freenas/www/disks_raid_gconcat_edit.php
@@ -0,0 +1,256 @@
+<?php
+/* $Id$ */
+/* ========================================================================== */
+/*
+ disks_raid_gconcat_edit.php
+ part of pfSense (http://www.pfSense.com)
+ Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name>
+ All rights reserved.
+
+ Based on FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ All rights reserved.
+ */
+/* ========================================================================== */
+/*
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+/* ========================================================================== */
+
+$pgtitle = array(gettext("System"),
+ gettext("Disks"),
+ gettext("GEOM Concat"),
+ gettext("RAID"),
+ isset($id) ? gettext("Edit") : gettext("Add"));
+
+require_once("freenas_config.inc");
+require_once("guiconfig.inc");
+require_once("freenas_guiconfig.inc");
+require_once("freenas_functions.inc");
+
+$id = $_GET['id'];
+if (isset($_POST['id']))
+ $id = $_POST['id'];
+
+if (!is_array($freenas_config['gconcat']['vdisk']))
+ $freenas_config['gconcat']['vdisk'] = array();
+
+gconcat_sort();
+disks_sort();
+
+$a_raid = &$freenas_config['gconcat']['vdisk'];
+$all_raid = array_merge((array)$freenas_config['graid5']['vdisk'],(array)$freenas_config['gconcat']['vdisk'],(array)$freenas_config['gvinum']['vdisk'],(array)$freenas_config['gstripe']['vdisk'],(array)$freenas_config['gconcat']['vdisk']);
+$a_disk = get_fstype_disks_list("softraid");
+
+if (!sizeof($a_disk)) {
+ $nodisk_errors[] = gettext("You must add disks first.");
+}
+
+if (isset($id) && $a_raid[$id]) {
+ $pconfig['name'] = $a_raid[$id]['name'];
+ $pconfig['type'] = $a_raid[$id]['type'];
+ $pconfig['diskr'] = $a_raid[$id]['diskr'];
+ $pconfig['fullname'] = $a_raid[$id]['fullname'];
+}
+
+if (! empty($_POST))
+{
+ /* hash */
+ unset($error_bucket);
+ /* simple error list */
+ unset($input_errors);
+
+ $reqdfields = explode(" ", "name");
+ $reqdfieldsn = explode(",", "Name");
+
+ do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
+
+ if (($_POST['name'] && !is_validaliasname($_POST['name'])))
+ {
+ $error_bucket[] = array("error" => gettext("The device name may only consist of the characters a-z, A-Z, 0-9."),
+ "field" => "name");
+ }
+
+ /* check for name conflicts */
+ foreach ($a_raid as $raid)
+ {
+ if (isset($id) && ($a_raid[$id]) && ($a_raid[$id] === $raid))
+ continue;
+
+ if ($raid['name'] == $_POST['name'])
+ {
+ $error_bucket[] = array("error" => gettext("This device already exists in the raid volume list."),
+ "field" => "name");
+ break;
+ }
+ }
+
+ /* check the number of RAID disk for volume */
+
+ if (count($_POST['diskr']) < 2)
+ $error_bucket[] = array("error" => gettext("There must be a minimum of 2 disks in a JBOD."),
+ "field" => "diskr");
+
+ if (is_array($error_bucket))
+ foreach($error_bucket as $elem)
+ $input_errors[] =& $elem["error"];
+
+ /* if this is an AJAX caller then handle via JSON */
+ if(isAjax() && is_array($error_bucket)) {
+ input_errors2Ajax(NULL, $error_bucket);
+ exit;
+ }
+
+ if (!$input_errors) {
+ $raid = array();
+ $raid['name'] = $_POST['name'];
+ $raid['type'] = "JBOD";
+ $raid['diskr'] = $_POST['diskr'];
+ $raid['desc'] = "Software gconcat JBOD";
+ $raid['fullname'] = "/dev/concat/{$raid['name']}";
+
+ if (isset($id) && $a_raid[$id])
+ $a_raid[$id] = $raid;
+ else
+ $a_raid[] = $raid;
+
+ $fd = @fopen("$d_raidconfdirty_path", "a");
+ if (!$fd) {
+ echo "ERR Could not save RAID configuration.\n";
+ exit(0);
+ }
+ fwrite($fd, "$raid[name]\n");
+ fclose($fd);
+
+ write_config();
+
+ pfSenseHeader("disks_raid_gconcat.php");
+ exit;
+ }
+}
+
+include("head.inc");
+/* put your custom HTML head content here */
+/* using some of the $pfSenseHead function calls */
+echo $pfSenseHead->getHTML();
+
+?>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>">
+<?php include("fbegin.inc"); ?>
+<?php if ($input_errors) print_input_errors($input_errors); ?>
+<?php if ($savemsg) print_info_box($savemsg); ?>
+
+<div id="inputerrors"></div>
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td class="tabnavtbl">
+<?php
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Geom Mirror"), false, "disks_raid_gmirror.php");
+ $tab_array[1] = array(gettext("Geom Concat"), true, "disks_raid_gconcat.php");
+ $tab_array[2] = array(gettext("Geom Stripe"), false, "disks_raid_gstripe.php");
+ $tab_array[3] = array(gettext("Geom RAID5"), false, "disks_raid_graid5.php");
+ $tab_array[4] = array(gettext("Geom Vinum"), false, "disks_raid_gvinum.php");
+ display_top_tabs($tab_array);
+?>
+ </td>
+ </tr>
+ <tr>
+ <td class="tabnavtbl">
+<?php
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Manage RAID"), true, "disks_raid_gmirror.php");
+ /* $tab_array[1] = array(gettext("Format RAID"), false, "disks_raid_gmirror_init.php"); */
+ $tab_array[1] = array(gettext("Tools"), false, "disks_raid_gmirror_tools.php");
+ $tab_array[2] = array(gettext("Information"), false, "disks_raid_gmirror_infos.php");
+ display_top_tabs($tab_array);
+?>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div id="mainarea">
+ <form action="disks_raid_gconcat_edit.php" method="post" name="iform" id="iform">
+ <table class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0">
+ <tr>
+ <td width="22%" valign="top" class="vncellreq"><?=gettext("Raid name");?></td>
+ <td width="78%" class="vtable">
+ <input name="name" type="text" class="formfld unknown" id="name" size="20" value="<?=htmlspecialchars($pconfig['name']);?>" />
+ </td>
+ </tr>
+ <tr>
+ <td valign="top" class="vncellreq"><?= gettext("Type"); ?></td>
+ <td class="vtable">JBOD</td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq"><?= gettext("Members of this volume"); ?></td>
+ <td width="78%" class="vtable">
+ <?
+ $i=0;
+ $disable_script="";
+
+ foreach ($a_disk as $diskv) {
+ $r_name="";
+
+ foreach($all_raid as $raid) {
+ if (in_array($diskv['fullname'],(array)$raid['diskr'])) {
+ $r_name=$raid['name'];
+ if ($r_name!=$pconfig['name']) $disable_script.="document.getElementById($i).disabled=1;\n";
+ break;
+ }
+ }
+ echo "<input name='diskr[]' id='$i' type='checkbox' value='$diskv[fullname]'".
+ ((is_array($pconfig['diskr']) && in_array($diskv['fullname'],$pconfig['diskr'])) ? " checked=\"checked\"" : "") .
+ " />$diskv[name] ($diskv[size], $diskv[desc])".(($r_name) ? " - assigned to $r_name" : "")."<br />\n";
+ $i++;
+
+ $i++;
+ }
+
+ if ($disable_script)
+ echo "<script type='text/javascript'><!--\n$disable_script--></script>\n";
+ ?>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top">&nbsp;</td>
+ <td width="78%">
+ <input name="Submit" type="submit" class="formbtn" value="Save" />
+ <?php if (isset($id) && $a_raid[$id]): ?>
+ <input name="id" type="hidden" value="<?=$id;?>" />
+ <?php endif; ?>
+ </td>
+ </tr>
+ </table>
+ </form>
+ </div>
+ </td>
+ </tr>
+</table>
+<?php include("fend.inc"); ?>
+</body>
+</html>
diff --git a/packages/freenas/www/disks_raid_gconcat_infos.php b/packages/freenas/www/disks_raid_gconcat_infos.php
new file mode 100644
index 00000000..09dfd76a
--- /dev/null
+++ b/packages/freenas/www/disks_raid_gconcat_infos.php
@@ -0,0 +1,143 @@
+<?php
+/* $Id$ */
+/* ========================================================================== */
+/*
+ disks_raid_gconcat_infos.php
+ part of pfSense (http://www.pfSense.com)
+ Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name>
+ All rights reserved.
+
+ Based on FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ All rights reserved.
+ */
+/* ========================================================================== */
+/*
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+/* ========================================================================== */
+
+$pgtitle = array(gettext("System"),
+ gettext("Disks"),
+ gettext("GEOM Concat"),
+ gettext("Information"));
+
+require_once("guiconfig.inc");
+require_once("freenas_guiconfig.inc");
+require_once("freenas_functions.inc");
+
+if (! empty($_POST))
+{
+ /* hash */
+ unset($error_bucket);
+ /* simple error list */
+ unset($input_errors);
+
+ if (is_array($error_bucket))
+ foreach($error_bucket as $elem)
+ $input_errors[] =& $elem["error"];
+
+ /* if this is an AJAX caller then handle via JSON */
+ if(isAjax() && is_array($error_bucket)) {
+ input_errors2Ajax(NULL, $error_bucket);
+ exit;
+ }
+
+ if (!$input_errors) {
+ }
+}
+if (!isset($do_action)) {
+}
+
+include("head.inc");
+/* put your custom HTML head content here */
+/* using some of the $pfSenseHead function calls */
+echo $pfSenseHead->getHTML();
+
+?>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>">
+<?php include("fbegin.inc"); ?>
+<?php if ($input_errors) print_input_errors($input_errors); ?>
+<?php if ($savemsg) print_info_box($savemsg); ?>
+
+<div id="inputerrors"></div>
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td class="tabnavtbl">
+<?php
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Geom Mirror"), false, "disks_raid_gmirror.php");
+ $tab_array[1] = array(gettext("Geom Concat"), true, "disks_raid_gconcat.php");
+ $tab_array[2] = array(gettext("Geom Stripe"), false, "disks_raid_gstripe.php");
+ $tab_array[3] = array(gettext("Geom RAID5"), false, "disks_raid_graid5.php");
+ $tab_array[4] = array(gettext("Geom Vinum"), false, "disks_raid_gvinum.php");
+ display_top_tabs($tab_array);
+?>
+ </td>
+ </tr>
+ <tr>
+ <td class="tabnavtbl">
+<?php
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Manage RAID"), false, "disks_raid_gconcat.php");
+ /* $tab_array[1] = array(gettext("Format RAID"), false, "disks_raid_gconcat_init.php"); */
+ $tab_array[1] = array(gettext("Tools"), false, "disks_raid_gconcat_tools.php");
+ $tab_array[2] = array(gettext("Information"), true, "disks_raid_gconcat_infos.php");
+ display_top_tabs($tab_array);
+?>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div id="mainarea">
+ <form action="disks_raid_gconcat_infos.php" method="post" name="iform" id="iform">
+ <table class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0">
+ <tr>
+ <td width="100%" class="vtable">
+ <?php
+ echo "<pre>";
+ echo "<strong>" . gettext("Software RAID information and status") . "</strong><br />";
+
+ exec("/sbin/gconcat list",$rawdata);
+ foreach ($rawdata as $line){
+ echo htmlspecialchars($line) . "<br>";
+ }
+
+ unset ($line);
+ echo "</pre>";
+ ?>
+ </td>
+ </tr>
+ </table>
+ </form>
+ </div>
+ </td>
+ </tr>
+</table>
+<?php include("fend.inc"); ?>
+</body>
+</html>
diff --git a/packages/freenas/www/disks_raid_gconcat_tools.php b/packages/freenas/www/disks_raid_gconcat_tools.php
new file mode 100644
index 00000000..7783450d
--- /dev/null
+++ b/packages/freenas/www/disks_raid_gconcat_tools.php
@@ -0,0 +1,187 @@
+<?php
+/*
+ disks_raid_gmirror_tools.php
+ part of pfSense (http://www.pfSense.com)
+ Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name>
+ All rights reserved.
+
+ Based on FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ All rights reserved.
+ */
+/* ========================================================================== */
+/*
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+/* ========================================================================== */
+
+$pgtitle = array(gettext("System"),
+ gettext("Disks"),
+ gettext("GEOM Concat"),
+ gettext("Tools"));
+
+require_once("freenas_config.inc");
+require_once("guiconfig.inc");
+require_once("freenas_guiconfig.inc");
+require_once("freenas_functions.inc");
+
+if (! empty($_POST))
+{
+ /* hash */
+ unset($error_bucket);
+ /* simple error list */
+ unset($input_errors);
+ unset($do_action);
+
+ $reqdfields = explode(" ", "action object");
+ $reqdfieldsn = explode(",", "Action,Object");
+
+ do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
+
+ if (is_array($error_bucket))
+ foreach($error_bucket as $elem)
+ $input_errors[] =& $elem["error"];
+
+ /* if this is an AJAX caller then handle via JSON */
+ if(isAjax() && is_array($error_bucket)) {
+ input_errors2Ajax(NULL, $error_bucket);
+ exit;
+ }
+
+ if (!$input_errors) {
+ $do_action = true;
+ $action = $_POST['action'];
+ $object = $_POST['object'];
+ }
+ }
+ if (!isset($do_action)) {
+ $do_action = false;
+ $action = '';
+ $object = '';
+}
+
+include("head.inc");
+/* put your custom HTML head content here */
+/* using some of the $pfSenseHead function calls */
+echo $pfSenseHead->getHTML();
+
+?>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>">
+<?php include("fbegin.inc"); ?>
+<?php if ($input_errors) print_input_errors($input_errors); ?>
+<?php if ($savemsg) print_info_box($savemsg); ?>
+
+<div id="inputerrors"></div>
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td class="tabnavtbl">
+<?php
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Geom Mirror"), false, "disks_raid_gmirror.php");
+ $tab_array[1] = array(gettext("Geom Concat"), true, "disks_raid_gconcat.php");
+ $tab_array[2] = array(gettext("Geom Stripe"), false, "disks_raid_gstripe.php");
+ $tab_array[3] = array(gettext("Geom RAID5"), false, "disks_raid_graid5.php");
+ $tab_array[4] = array(gettext("Geom Vinum"), false, "disks_raid_gvinum.php");
+ display_top_tabs($tab_array);
+?>
+ </td>
+ </tr>
+ <tr>
+ <td class="tabnavtbl">
+<?php
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Manage RAID"), false, "disks_raid_gmirror.php");
+ /* $tab_array[1] = array(gettext("Format RAID"), false, "disks_raid_gmirror_init.php"); */
+ $tab_array[1] = array(gettext("Tools"), true, "disks_raid_gmirror_tools.php");
+ $tab_array[2] = array(gettext("Information"), false, "disks_raid_gmirror_infos.php");
+ display_top_tabs($tab_array);
+?>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div id="mainarea">
+ <form action="disks_raid_gmirror_tools.php" method="post" name="iform" id="iform">
+ <table class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0">
+ <tr>
+ <td width="22%" valign="top" class="vncellreq"><?=gettext("Object name");?></td>
+ <td width="78%" class="vtable">
+ <input name="object" type="text" class="formfld unknown" id="object" size="20" value="<?=htmlspecialchars($disk);?>" />
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq"><?=gettext("Object name");?></td>
+ <td width="78%" class="vtable">
+ <select name="action" class="formselect" id="action">
+ <option value="list" <?php if ($action == "list") echo "selected"; ?>>list</option>
+ <option value="status" <?php if ($action == "status") echo "selected"; ?>>status</option>
+ <option value="clear" <?php if ($action == "clear") echo "selected"; ?>>clear</option>
+ <option value="stop" <?php if ($action == "stop") echo "selected"; ?>>stop</option>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top">&nbsp;</td>
+ <td width="78%">
+ <input name="Submit" type="submit" class="formbtn" value="Send Command!" />
+ </td>
+ </tr>
+ <tr>
+ <td valign="top" colspan="2">
+ <?
+ if ($do_action) {
+ echo("<strong>" . gettext("GCONCAT command output:") . "</strong><br />");
+ echo('<pre>');
+ ob_end_flush();
+
+ system("/sbin/gmirror $action " . escapeshellarg($object));
+
+ echo('</pre>');
+ }
+ ?>
+ </td>
+ </tr>
+ <tr>
+ <td align="left" valign="top" colspan="2">
+ <span class="red">
+ <strong>WARNING:</strong><br />
+ </span>
+ <ol>
+ <li><span class="vexpl"><?= gettext("Use these specials actions for debugging only!"); ?></span></li>
+ <li><span class="vexpl"><?= gettext("There is no need of using this menu for start a RAID volume (start automaticaly)."); ?></span></li>
+ </ol>
+ </td>
+ </tr>
+ </table>
+ </form>
+ </div>
+ </td>
+ </tr>
+</table>
+<?php include("fend.inc"); ?>
+</body>
+</html>
diff --git a/packages/freenas/www/disks_raid_gmirror.php b/packages/freenas/www/disks_raid_gmirror.php
index 44b4be70..78390a64 100644
--- a/packages/freenas/www/disks_raid_gmirror.php
+++ b/packages/freenas/www/disks_raid_gmirror.php
@@ -1,36 +1,44 @@
<?php
/* $Id$ */
+/* ========================================================================== */
/*
- disks_manage_edit.php
- part of FreeNAS (http://www.freenas.org)
- Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
- All rights reserved.
-
- Based on m0n0wall (http://m0n0.ch/wall)
- Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
+ disks_raid_gmirror.php
+ part of pfSense (http://www.pfSense.com)
+ Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name>
+ All rights reserved.
+
+ Based on FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ All rights reserved.
+ */
+/* ========================================================================== */
+/*
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+/* ========================================================================== */
$pgtitle = array(gettext("System"),
gettext("Disks"),
@@ -43,7 +51,7 @@ require_once("freenas_guiconfig.inc");
require_once("freenas_functions.inc");
if (!is_array($freenas_config['gmirror']['vdisk']))
- $freenas_config['gmirror']['vdisk'] = array();
+ $freenas_config['gmirror']['vdisk'] = array();
gmirror_sort();
@@ -70,33 +78,34 @@ if (! empty($_POST))
exit;
}
- if ($_POST['apply']) {
- $retval = 0;
- if (!file_exists($d_sysrebootreqd_path))
- {
- config_lock();
- /* reload all components that create raid device */
- disks_raid_gmirror_configure();
- config_unlock();
- write_config();
- }
- $savemsg = get_std_save_message($retval);
- if ($retval == 0) {
- if (file_exists($d_raidconfdirty_path))
- unlink($d_raidconfdirty_path);
- }
- }
+ if ($_POST['apply']) {
+ $retval = 0;
+ if (!file_exists($d_sysrebootreqd_path))
+ {
+ config_lock();
+ /* reload all components that create raid device */
+ disks_raid_gmirror_configure();
+ config_unlock();
+ write_config();
+ }
+ $savemsg = get_std_save_message($retval);
+ if ($retval == 0) {
+ if (file_exists($d_raidconfdirty_path))
+ unlink($d_raidconfdirty_path);
+ }
+ }
}
if ($_GET['act'] == "del") {
- if ($a_raid[$_GET['id']]) {
- $raidname=$a_raid[$_GET['id']]['name'];
- disks_raid_gmirror_delete($raidname);
- unset($a_raid[$_GET['id']]);
- write_config();
- pfSenseHeader("disks_raid_gmirror.php");
- exit;
- }
+ if ($a_raid[$_GET['id']]) {
+ $raidname=$a_raid[$_GET['id']]['name'];
+ disks_raid_gmirror_delete($raidname);
+ unset($a_raid[$_GET['id']]);
+ write_config();
+ touch($d_raidconfdirty_path);
+ pfSenseHeader("disks_raid_gmirror.php");
+ exit;
+ }
}
include("head.inc");
@@ -122,82 +131,85 @@ echo $pfSenseHead->getHTML();
<tr>
<td class="tabnavtbl">
<?php
- $tab_array = array();
- $tab_array[0] = array(gettext("Geom Mirror"), true, "disks_raid_gmirror.php");
- $tab_array[1] = array(gettext("Geom Vinum (unstable)"), false, "disks_raid_gvinum.php");
- display_top_tabs($tab_array);
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Geom Mirror"), true, "disks_raid_gmirror.php");
+ $tab_array[1] = array(gettext("Geom Concat"), false, "disks_raid_gconcat.php");
+ $tab_array[2] = array(gettext("Geom Stripe"), false, "disks_raid_gstripe.php");
+ $tab_array[3] = array(gettext("Geom RAID5"), false, "disks_raid_graid5.php");
+ $tab_array[4] = array(gettext("Geom Vinum"), false, "disks_raid_gvinum.php");
+ display_top_tabs($tab_array);
?>
</td>
</tr>
<tr>
<td class="tabnavtbl">
<?php
- $tab_array = array();
- $tab_array[0] = array(gettext("Manage RAID"), true, "disks_raid_gmirror.php");
- $tab_array[1] = array(gettext("Format RAID"), false, "disks_raid_gmirror_init.php");
- $tab_array[2] = array(gettext("Tools"), false, "disks_raid_gmirror_tools.php");
- $tab_array[3] = array(gettext("Information"), false, "disks_raid_gmirror_infos.php");
- display_top_tabs($tab_array);
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Manage RAID"), true, "disks_raid_gmirror.php");
+ /* $tab_array[1] = array(gettext("Format RAID"), false, "disks_raid_gmirror_init.php"); */
+ $tab_array[1] = array(gettext("Tools"), false, "disks_raid_gmirror_tools.php");
+ $tab_array[2] = array(gettext("Information"), false, "disks_raid_gmirror_infos.php");
+ display_top_tabs($tab_array);
?>
</td>
</tr>
<tr>
<td>
- <div id="mainarea">
+ <div id="mainarea">
<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
- <td class="listhdrr"><?=gettext("Volume name");?></td>
- <td class="listhdrr"><?=gettext("Type");?></td>
+ <td class="listhdrr"><?=gettext("Volume name");?></td>
+ <td class="listhdrr"><?=gettext("Type");?></td>
<td class="listhdrr"><?=gettext("Size");?></td>
<td class="listhdrr"><?=gettext("Status");?></td>
- <td class="list">&nbsp;</td>
+ <td class="list">&nbsp;</td>
</tr>
<?php $i = 0; foreach ($a_raid as $raid): ?>
<tr>
- <td valign="middle" class="listr">
+ <td valign="middle" class="listr">
<?=htmlspecialchars($raid['name']);?>
- </td>
- <td valign="middle" class="listr">
+ </td>
+ <td valign="middle" class="listr">
<?=htmlspecialchars($raid['type']);?>
- </td>
- <td valign="middle" class="listr">
+ </td>
+ <td valign="middle" class="listr">
<?php
- $raidconfiguring = file_exists($d_raidconfdirty_path) &&
+ $raidconfiguring = file_exists($d_raidconfdirty_path) &&
in_array($raid['name']."\n",file($d_raidconfdirty_path));
if ($raidconfiguring)
- echo gettext("configuring");
- else {
- $tempo=$raid['name'];
- echo "{$raidstatus[$tempo]['size']}";
- }
+ echo gettext("configuring");
+ else {
+ $tempo=$raid['name'];
+ echo "{$raidstatus[$tempo]['size']}";
+ }
?>&nbsp;
- </td>
- <td valign="middle" class="listr">
+ </td>
+ <td valign="middle" class="listr">
<?php
if ($raidconfiguring)
- echo gettext("configuring");
- else {
- echo "{$raidstatus[$tempo]['desc']}";
- }
- ?>&nbsp;
- </td>
- <td valign="middle" class="list">
+ echo gettext("configuring");
+ else {
+ echo "{$raidstatus[$tempo]['desc']}";
+ }
+ ?>&nbsp;
+ </td>
+ <td valign="middle" class="list">
<a href="disks_raid_gmirror_edit.php?id=<?=$i;?>">
<img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" title="<?=gettext("edit raid");?>" width="17" height="17" border="0" alt="" />
</a>
- <a href="disks_raid_gmirror.php?act=del&id=<?=$i;?>">
+ <a href="disks_raid_gmirror.php?act=del&id=<?=$i;?>">
<img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" title="<?=gettext("delete raid");?>" width="17" height="17" border="0" alt="" />
</a>
- </td>
+ </td>
</tr>
<?php $i++; endforeach; ?>
<tr>
- <td class="list" colspan="4"></td>
- <td class="list" nowrap>
- <a href="disks_raid_gmirror_edit.php">
+ <td class="list" colspan="4"></td>
+ <td class="list" nowrap>
+ <a href="disks_raid_gmirror_edit.php">
<img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" title="<?=gettext("add disk");?>" width="17" height="17" border="0" alt="" />
</a>
- </td>
+ </td>
</tr>
<tr>
<td align="left" valign="top" colspan="5">
diff --git a/packages/freenas/www/disks_raid_gmirror_edit.php b/packages/freenas/www/disks_raid_gmirror_edit.php
index b67d90d2..ac08a442 100644
--- a/packages/freenas/www/disks_raid_gmirror_edit.php
+++ b/packages/freenas/www/disks_raid_gmirror_edit.php
@@ -1,71 +1,80 @@
<?php
/* $Id$ */
+/* ========================================================================== */
/*
- disks_manage_edit.php
- part of FreeNAS (http://www.freenas.org)
- Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
- All rights reserved.
-
- Based on m0n0wall (http://m0n0.ch/wall)
- Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
+ disks_raid_gmirror_edit.php
+ part of pfSense (http://www.pfSense.com)
+ Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name>
+ All rights reserved.
+
+ Based on FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ All rights reserved.
+ */
+/* ========================================================================== */
+/*
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+/* ========================================================================== */
$pgtitle = array(gettext("System"),
gettext("Disks"),
gettext("GEOM Mirror"),
gettext("RAID"),
- gettext("Edit"));
+ isset($id) ? gettext("Edit") : gettext("Add"));
require_once("freenas_config.inc");
require_once("guiconfig.inc");
require_once("freenas_guiconfig.inc");
require_once("freenas_functions.inc");
+$id = $_GET['id'];
+if (isset($_POST['id']))
+ $id = $_POST['id'];
+
if (!is_array($freenas_config['gmirror']['vdisk']))
- $freenas_config['gmirror']['vdisk'] = array();
+ $freenas_config['gmirror']['vdisk'] = array();
gmirror_sort();
-
-if (!is_array($freenas_config['disks']['disk']))
- $nodisk_errors[] = _DISKSRAIDEDITPHP_MSGADDDISKFIRST;
-else
- disks_sort();
+disks_sort();
$a_raid = &$freenas_config['gmirror']['vdisk'];
+$all_raid = array_merge((array)$freenas_config['graid5']['vdisk'],(array)$freenas_config['gmirror']['vdisk'],(array)$freenas_config['gvinum']['vdisk'],(array)$freenas_config['gstripe']['vdisk'],(array)$freenas_config['gconcat']['vdisk']);
+$a_disk = get_fstype_disks_list("softraid");
-$a_disk = &$freenas_config['disks']['disk'];
+if (!sizeof($a_disk)) {
+ $nodisk_errors[] = gettext("You must add disks first.");
+}
-$id = $_GET['id'];
-if (isset($_POST['id']))
- $id = $_POST['id'];
-
if (isset($id) && $a_raid[$id]) {
- $pconfig['name'] = $a_raid[$id]['name'];
- $pconfig['type'] = $a_raid[$id]['type'];
- $pconfig['balance'] = $a_raid[$id]['balance'];
- $pconfig['diskr'] = $a_raid[$id]['diskr'];
+ $pconfig['name'] = $a_raid[$id]['name'];
+ $pconfig['fullname'] = $a_raid[$id]['fullname'];
+ $pconfig['type'] = $a_raid[$id]['type'];
+ $pconfig['balance'] = $a_raid[$id]['balance'];
+ $pconfig['diskr'] = $a_raid[$id]['diskr'];
}
if (! empty($_POST))
@@ -74,36 +83,36 @@ if (! empty($_POST))
unset($error_bucket);
/* simple error list */
unset($input_errors);
-
- $reqdfields = explode(" ", "name");
- $reqdfieldsn = explode(",", "Name");
-
- do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
- if (($_POST['name'] && !is_validaliasname($_POST['name'])))
- {
+ $reqdfields = explode(" ", "name");
+ $reqdfieldsn = explode(",", "Name");
+
+ do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
+
+ if (($_POST['name'] && !is_validaliasname($_POST['name'])))
+ {
$error_bucket[] = array("error" => gettext("The device name may only consist of the characters a-z, A-Z, 0-9."),
"field" => "name");
- }
-
-
- /* check for name conflicts */
- foreach ($a_raid as $raid)
- {
- if (isset($id) && ($a_raid[$id]) && ($a_raid[$id] === $raid))
- continue;
-
- if ($raid['name'] == $_POST['name'])
- {
+ }
+
+
+ /* check for name conflicts */
+ foreach ($a_raid as $raid)
+ {
+ if (isset($id) && ($a_raid[$id]) && ($a_raid[$id] === $raid))
+ continue;
+
+ if ($raid['name'] == $_POST['name'])
+ {
$error_bucket[] = array("error" => gettext("This device already exists in the raid volume list."),
"field" => "name");
- break;
- }
- }
-
- /* check the number of RAID disk for volume */
-
- if (count($_POST['diskr']) != 2)
+ break;
+ }
+ }
+
+ /* check the number of RAID disk for volume */
+
+ if (count($_POST['diskr']) != 2)
$error_bucket[] = array("error" => gettext("There must be 2 disks in a RAID 1 volume."),
"field" => "diskr");
@@ -117,32 +126,33 @@ if (! empty($_POST))
exit;
}
- if (!$input_errors) {
- $raid = array();
- $raid['name'] = $_POST['name'];
- $raid['balance'] = $_POST['balance'];
- $raid['type'] = 1;
- $raid['diskr'] = $_POST['diskr'];
- $raid['desc'] = "Software RAID {$_POST['type']}";
-
- if (isset($id) && $a_raid[$id])
- $a_raid[$id] = $raid;
- else
- $a_raid[] = $raid;
-
- $fd = @fopen("$d_raidconfdirty_path", "a");
- if (!$fd) {
- echo "ERR Could not save RAID configuration.\n";
- exit(0);
- }
- fwrite($fd, "$raid[name]\n");
- fclose($fd);
-
- write_config();
-
- pfSenseHeader("disks_raid_gmirror.php");
- exit;
- }
+ if (!$input_errors) {
+ $raid = array();
+ $raid['name'] = $_POST['name'];
+ $raid['balance'] = $_POST['balance'];
+ $raid['type'] = 1;
+ $raid['diskr'] = $_POST['diskr'];
+ $raid['desc'] = "Software RAID {$_POST['type']}";
+ $raid['fullname'] = "/dev/mirror/{$raid['name']}";
+
+ if (isset($id) && $a_raid[$id])
+ $a_raid[$id] = $raid;
+ else
+ $a_raid[] = $raid;
+
+ $fd = @fopen("$d_raidconfdirty_path", "a");
+ if (!$fd) {
+ echo "ERR Could not save RAID configuration.\n";
+ exit(0);
+ }
+ fwrite($fd, "$raid[name]\n");
+ fclose($fd);
+
+ write_config();
+
+ pfSenseHeader("disks_raid_gmirror.php");
+ exit;
+ }
}
include("head.inc");
@@ -162,22 +172,25 @@ echo $pfSenseHead->getHTML();
<tr>
<td class="tabnavtbl">
<?php
- $tab_array = array();
- $tab_array[0] = array(gettext("Geom Mirror"), true, "disks_raid_gmirror.php");
- $tab_array[1] = array(gettext("Geom Vinum (unstable)"), false, "disks_raid_gvinum.php");
- display_top_tabs($tab_array);
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Geom Mirror"), true, "disks_raid_gmirror.php");
+ $tab_array[1] = array(gettext("Geom Concat"), false, "disks_raid_gconcat.php");
+ $tab_array[2] = array(gettext("Geom Stripe"), false, "disks_raid_gstripe.php");
+ $tab_array[3] = array(gettext("Geom RAID5"), false, "disks_raid_graid5.php");
+ $tab_array[4] = array(gettext("Geom Vinum"), false, "disks_raid_gvinum.php");
+ display_top_tabs($tab_array);
?>
</td>
</tr>
<tr>
<td class="tabnavtbl">
<?php
- $tab_array = array();
- $tab_array[0] = array(gettext("Manage RAID"), true, "disks_raid_gmirror.php");
- $tab_array[1] = array(gettext("Format RAID"), false, "disks_raid_gmirror_init.php");
- $tab_array[2] = array(gettext("Tools"), false, "disks_raid_gmirror_tools.php");
- $tab_array[3] = array(gettext("Information"), false, "disks_raid_gmirror_infos.php");
- display_top_tabs($tab_array);
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Manage RAID"), true, "disks_raid_gmirror.php");
+ /* $tab_array[1] = array(gettext("Format RAID"), false, "disks_raid_gmirror_init.php"); */
+ $tab_array[1] = array(gettext("Tools"), false, "disks_raid_gmirror_tools.php");
+ $tab_array[2] = array(gettext("Information"), false, "disks_raid_gmirror_infos.php");
+ display_top_tabs($tab_array);
?>
</td>
</tr>
@@ -187,7 +200,7 @@ echo $pfSenseHead->getHTML();
<form action="disks_raid_gmirror_edit.php" method="post" name="iform" id="iform">
<table class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0">
<tr>
- <td width="22%" valign="top" class="vncellreq"><?=gettext("Volume name");?></td>
+ <td width="22%" valign="top" class="vncellreq"><?=gettext("Raid name");?></td>
<td width="78%" class="vtable">
<input name="name" type="text" class="formfld unknown" id="name" size="20" value="<?=htmlspecialchars($pconfig['name']);?>" />
</td>
@@ -202,14 +215,14 @@ echo $pfSenseHead->getHTML();
<td width="22%" valign="top" class="vncellreq"><?= gettext("Balance algorithm"); ?></td>
<td width="78%" class="vtable">
<select name="balance" class="formselect">
- <?php $balvals = array(
- "split"=>"Split request",
- "load"=>"Read from lowest load",
- "round-robin"=>"Round-robin read");
- ?>
- <?php foreach ($balvals as $balval => $balname): ?>
- <option value="<?=$balval;?>" <?php if($pconfig['balance'] == $balval) echo 'selected';?>><?=htmlspecialchars($balname);?></option>
- <?php endforeach; ?>
+ <?php $balvals = array(
+ "split"=>"Split request",
+ "load"=>"Read from lowest load",
+ "round-robin"=>"Round-robin read");
+ ?>
+ <?php foreach ($balvals as $balval => $balname): ?>
+ <option value="<?=$balval;?>" <?php if($pconfig['balance'] == $balval) echo 'selected';?>><?=htmlspecialchars($balname);?></option>
+ <?php endforeach; ?>
</select>
<br />
<?= gettext("Select your read balance algorithm."); ?></td>
@@ -224,21 +237,17 @@ echo $pfSenseHead->getHTML();
foreach ($a_disk as $diskv) {
$r_name="";
- if (strcmp($diskv['fstype'],"gmirror")==0) {
- foreach($a_raid as $raid) {
- if (in_array($diskv['name'],$raid['diskr'])) {
- $r_name=$raid['name'];
-
- if ($r_name!=$pconfig['name'])
- $disable_script.="document.getElementById($i).disabled=1;\n";
- break;
- }
+ foreach($all_raid as $raid) {
+ if (in_array($diskv['fullname'],(array)$raid['diskr'])) {
+ $r_name=$raid['name'];
+ if ($r_name!=$pconfig['name']) $disable_script.="document.getElementById($i).disabled=1;\n";
+ break;
}
-
- echo "<input name='diskr[]' id='$i' type='checkbox' value='$diskv[name]'".
- ((is_array($pconfig['diskr']) && in_array($diskv['name'], $pconfig['diskr'])) ? " checked=\"checked\"":"").
- " />$diskv[name] ($diskv[size], $diskv[desc])" . (($r_name) ? " - assigned to $r_name" : "") . "<br />\n";
}
+ echo "<input name='diskr[]' id='$i' type='checkbox' value='$diskv[fullname]'".
+ ((is_array($pconfig['diskr']) && in_array($diskv['fullname'],$pconfig['diskr'])) ? " checked=\"checked\"" : "") .
+ " />$diskv[name] ($diskv[size], $diskv[desc])".(($r_name) ? " - assigned to $r_name" : "")."<br />\n";
+ $i++;
$i++;
}
diff --git a/packages/freenas/www/disks_raid_gmirror_infos.php b/packages/freenas/www/disks_raid_gmirror_infos.php
index 5fb2d1e1..878f571e 100644
--- a/packages/freenas/www/disks_raid_gmirror_infos.php
+++ b/packages/freenas/www/disks_raid_gmirror_infos.php
@@ -1,36 +1,44 @@
<?php
/* $Id$ */
+/* ========================================================================== */
/*
- disks_manage_edit.php
- part of FreeNAS (http://www.freenas.org)
- Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
- All rights reserved.
-
- Based on m0n0wall (http://m0n0.ch/wall)
- Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
+ disks_raid_gmirror_infos.php
+ part of pfSense (http://www.pfSense.com)
+ Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name>
+ All rights reserved.
+
+ Based on FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ All rights reserved.
+ */
+/* ========================================================================== */
+/*
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+/* ========================================================================== */
$pgtitle = array(gettext("System"),
gettext("Disks"),
@@ -81,22 +89,25 @@ echo $pfSenseHead->getHTML();
<tr>
<td class="tabnavtbl">
<?php
- $tab_array = array();
- $tab_array[0] = array(gettext("Geom Mirror"), true, "disks_raid_gmirror.php");
- $tab_array[1] = array(gettext("Geom Vinum (unstable)"), false, "disks_raid_gvinum.php");
- display_top_tabs($tab_array);
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Geom Mirror"), true, "disks_raid_gmirror.php");
+ $tab_array[1] = array(gettext("Geom Concat"), false, "disks_raid_gconcat.php");
+ $tab_array[2] = array(gettext("Geom Stripe"), false, "disks_raid_gstripe.php");
+ $tab_array[3] = array(gettext("Geom RAID5"), false, "disks_raid_graid5.php");
+ $tab_array[4] = array(gettext("Geom Vinum"), false, "disks_raid_gvinum.php");
+ display_top_tabs($tab_array);
?>
</td>
</tr>
<tr>
<td class="tabnavtbl">
<?php
- $tab_array = array();
- $tab_array[0] = array(gettext("Manage RAID"), false, "disks_raid_gmirror.php");
- $tab_array[1] = array(gettext("Format RAID"), false, "disks_raid_gmirror_init.php");
- $tab_array[2] = array(gettext("Tools"), false, "disks_raid_gmirror_tools.php");
- $tab_array[3] = array(gettext("Information"), true, "disks_raid_gmirror_infos.php");
- display_top_tabs($tab_array);
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Manage RAID"), false, "disks_raid_gmirror.php");
+ /* $tab_array[1] = array(gettext("Format RAID"), false, "disks_raid_gmirror_init.php"); */
+ $tab_array[1] = array(gettext("Tools"), false, "disks_raid_gmirror_tools.php");
+ $tab_array[2] = array(gettext("Information"), true, "disks_raid_gmirror_infos.php");
+ display_top_tabs($tab_array);
?>
</td>
</tr>
@@ -125,7 +136,7 @@ echo $pfSenseHead->getHTML();
</form>
</div>
</td>
- </tr>
+ </tr>
</table>
<?php include("fend.inc"); ?>
</body>
diff --git a/packages/freenas/www/disks_raid_gmirror_init.php b/packages/freenas/www/disks_raid_gmirror_init.php
index ef991376..2b2d59af 100644
--- a/packages/freenas/www/disks_raid_gmirror_init.php
+++ b/packages/freenas/www/disks_raid_gmirror_init.php
@@ -1,36 +1,47 @@
<?php
/* $Id$ */
/*
- disks_manage_edit.php
- part of FreeNAS (http://www.freenas.org)
- Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
- All rights reserved.
-
- Based on m0n0wall (http://m0n0.ch/wall)
- Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
+ disks_raid_gmirror_init.php
+ part of pfSense (http://www.pfSense.com)
+ Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name>
+ All rights reserved.
+
+ Based on FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ All rights reserved.
+ */
+/* ========================================================================== */
+/*
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+/* ========================================================================== */
+
+/* ========================================================================== */
+/* == T H I S F I L E I S C U R R E N T L Y N O T U S E D == */
+/* ========================================================================== */
$pgtitle = array(gettext("System"),
gettext("Disks"),
diff --git a/packages/freenas/www/disks_raid_gmirror_tools.php b/packages/freenas/www/disks_raid_gmirror_tools.php
index a79d2a6b..9aae8c2d 100644
--- a/packages/freenas/www/disks_raid_gmirror_tools.php
+++ b/packages/freenas/www/disks_raid_gmirror_tools.php
@@ -1,36 +1,42 @@
<?php
-/* $Id$ */
/*
- disks_manage_edit.php
- part of FreeNAS (http://www.freenas.org)
- Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
- All rights reserved.
-
- Based on m0n0wall (http://m0n0.ch/wall)
- Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
+ disks_raid_gmirror_tools.php
+ part of pfSense (http://www.pfSense.com)
+ Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name>
+ All rights reserved.
+
+ Based on FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ All rights reserved.
+ */
+/* ========================================================================== */
+/*
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+/* ========================================================================== */
$pgtitle = array(gettext("System"),
gettext("Disks"),
@@ -48,11 +54,11 @@ if (! empty($_POST))
unset($error_bucket);
/* simple error list */
unset($input_errors);
-
- $reqdfields = explode(" ", "action object");
- $reqdfieldsn = explode(",", "Action,Object");
- do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
+ $reqdfields = explode(" ", "action object");
+ $reqdfieldsn = explode(",", "Action,Object");
+
+ do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
if (is_array($error_bucket))
foreach($error_bucket as $elem)
@@ -64,16 +70,16 @@ if (! empty($_POST))
exit;
}
- if (!$input_errors) {
- $do_action = true;
- $action = $_POST['action'];
- $object = $_POST['object'];
- }
-}
-if (!isset($do_action)) {
- $do_action = false;
- $action = '';
- $object = '';
+ if (!$input_errors) {
+ $do_action = true;
+ $action = $_POST['action'];
+ $object = $_POST['object'];
+ }
+ }
+ if (!isset($do_action)) {
+ $do_action = false;
+ $action = '';
+ $object = '';
}
include("head.inc");
@@ -93,23 +99,26 @@ echo $pfSenseHead->getHTML();
<tr>
<td class="tabnavtbl">
<?php
- $tab_array = array();
- $tab_array[0] = array(gettext("Geom Mirror"), true, "disks_raid_gmirror.php");
- $tab_array[1] = array(gettext("Geom Vinum (unstable)"), false, "disks_raid_gvinum.php");
- display_top_tabs($tab_array);
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Geom Mirror"), true, "disks_raid_gmirror.php");
+ $tab_array[1] = array(gettext("Geom Concat"), false, "disks_raid_gconcat.php");
+ $tab_array[2] = array(gettext("Geom Stripe"), false, "disks_raid_gstripe.php");
+ $tab_array[3] = array(gettext("Geom RAID5"), false, "disks_raid_graid5.php");
+ $tab_array[4] = array(gettext("Geom Vinum"), false, "disks_raid_gvinum.php");
+ display_top_tabs($tab_array);
?>
</td>
</tr>
<tr>
<td class="tabnavtbl">
<?php
- $tab_array = array();
- $tab_array[0] = array(gettext("Manage RAID"), false, "disks_raid_gmirror.php");
- $tab_array[1] = array(gettext("Format RAID"), false, "disks_raid_gmirror_init.php");
- $tab_array[2] = array(gettext("Tools"), true, "disks_raid_gmirror_tools.php");
- $tab_array[3] = array(gettext("Information"), false, "disks_raid_gmirror_infos.php");
- display_top_tabs($tab_array);
-?>
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Manage RAID"), false, "disks_raid_gmirror.php");
+ /* $tab_array[1] = array(gettext("Format RAID"), false, "disks_raid_gmirror_init.php"); */
+ $tab_array[1] = array(gettext("Tools"), false, "disks_raid_gmirror_tools.php");
+ $tab_array[2] = array(gettext("Information"), false, "disks_raid_gmirror_infos.php");
+ display_top_tabs($tab_array);
+?>
</td>
</tr>
<tr>
@@ -143,26 +152,23 @@ echo $pfSenseHead->getHTML();
<td width="22%" valign="top">&nbsp;</td>
<td width="78%">
<input name="Submit" type="submit" class="formbtn" value="Send Command!" />
- <?php if (isset($id) && $a_raid[$id]): ?>
- <input name="id" type="hidden" value="<?=$id;?>" />
- <?php endif; ?>
</td>
</tr>
- <tr>
- <td valign="top" colspan="2">
- <?
+ <tr>
+ <td valign="top" colspan="2">
+ <?
if ($do_action) {
- echo("<strong>" . gettext("GMIRROR command output:") . "</strong><br />");
- echo('<pre>');
- ob_end_flush();
-
- system("/sbin/gmirror $action " . escapeshellarg($object));
-
- echo('</pre>');
- }
- ?>
- </td>
- </tr>
+ echo("<strong>" . gettext("GMIRROR command output:") . "</strong><br />");
+ echo('<pre>');
+ ob_end_flush();
+
+ system("/sbin/gmirror $action " . escapeshellarg($object));
+
+ echo('</pre>');
+ }
+ ?>
+ </td>
+ </tr>
<tr>
<td align="left" valign="top" colspan="2">
<span class="red">
diff --git a/packages/freenas/www/disks_raid_graid5.php b/packages/freenas/www/disks_raid_graid5.php
new file mode 100644
index 00000000..6273b077
--- /dev/null
+++ b/packages/freenas/www/disks_raid_graid5.php
@@ -0,0 +1,236 @@
+<?php
+/* $Id$ */
+/* ========================================================================== */
+/*
+ disks_raid_graid5.php
+ part of pfSense (http://www.pfSense.com)
+ Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name>
+ All rights reserved.
+
+ Based on FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ All rights reserved.
+ */
+/* ========================================================================== */
+/*
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+/* ========================================================================== */
+
+$pgtitle = array(gettext("System"),
+ gettext("Disks"),
+ gettext("GEOM RAID5"),
+ gettext("RAID"));
+
+require_once("freenas_config.inc");
+require_once("guiconfig.inc");
+require_once("freenas_guiconfig.inc");
+require_once("freenas_functions.inc");
+
+if (!is_array($freenas_config['graid5']['vdisk']))
+ $freenas_config['graid5']['vdisk'] = array();
+
+graid5_sort();
+
+$raidstatus=get_sraid_disks_list();
+
+$a_raid = &$freenas_config['graid5']['vdisk'];
+
+if (! empty($_POST))
+{
+ /* hash */
+ unset($error_bucket);
+ /* simple error list */
+ unset($input_errors);
+
+ $pconfig = $_POST;
+
+ if (is_array($error_bucket))
+ foreach($error_bucket as $elem)
+ $input_errors[] =& $elem["error"];
+
+ /* if this is an AJAX caller then handle via JSON */
+ if(isAjax() && is_array($error_bucket)) {
+ input_errors2Ajax(NULL, $error_bucket);
+ exit;
+ }
+
+ if ($_POST['apply']) {
+ $retval = 0;
+ if (!file_exists($d_sysrebootreqd_path))
+ {
+ config_lock();
+ /* reload all components that create raid device */
+ disks_raid_graid5_configure();
+ config_unlock();
+ write_config();
+ }
+ $savemsg = get_std_save_message($retval);
+ if ($retval == 0) {
+ if (file_exists($d_raidconfdirty_path))
+ unlink($d_raidconfdirty_path);
+ }
+ }
+}
+
+if ($_GET['act'] == "del") {
+ if ($a_raid[$_GET['id']]) {
+ $raidname=$a_raid[$_GET['id']]['name'];
+ disks_raid_graid5_delete($raidname);
+ unset($a_raid[$_GET['id']]);
+ write_config();
+ touch($d_raidconfdirty_path);
+ pfSenseHeader("disks_raid_graid5.php");
+ exit;
+ }
+}
+
+include("head.inc");
+/* put your custom HTML head content here */
+/* using some of the $pfSenseHead function calls */
+echo $pfSenseHead->getHTML();
+
+?>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>">
+<?php include("fbegin.inc"); ?>
+<?php if ($input_errors) print_input_errors($input_errors); ?>
+<?php if ($savemsg) print_info_box($savemsg); ?>
+
+<form action="disks_raid_graid5.php" method="post" name="iform" id="iform">
+<?php if (file_exists($d_diskdirty_path)): ?>
+<?php print_info_box_np(gettext("The Raid configuration has been changed.") . "<br />" .
+ gettext("You must apply the changes in order for them to take effect."));?>
+<?php endif; ?>
+
+<div id="inputerrors"></div>
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td class="tabnavtbl">
+<?php
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Geom Mirror"), false, "disks_raid_gmirror.php");
+ $tab_array[1] = array(gettext("Geom Concat"), false, "disks_raid_gconcat.php");
+ $tab_array[2] = array(gettext("Geom Stripe"), false, "disks_raid_gstripe.php");
+ $tab_array[3] = array(gettext("Geom RAID5"), true, "disks_raid_graid5.php");
+ $tab_array[4] = array(gettext("Geom Vinum"), false, "disks_raid_gvinum.php");
+ display_top_tabs($tab_array);
+?>
+ </td>
+ </tr>
+ <tr>
+ <td class="tabnavtbl">
+<?php
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Manage RAID"), true, "disks_raid_graid5.php");
+ /* $tab_array[1] = array(gettext("Format RAID"), false, "disks_raid_gmirror_init.php"); */
+ $tab_array[1] = array(gettext("Tools"), false, "disks_raid_graid5_tools.php");
+ $tab_array[2] = array(gettext("Information"), false, "disks_raid_graid5_infos.php");
+ display_top_tabs($tab_array);
+?>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div id="mainarea">
+ <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td class="listhdrr"><?=gettext("Volume name");?></td>
+ <td class="listhdrr"><?=gettext("Type");?></td>
+ <td class="listhdrr"><?=gettext("Size");?></td>
+ <td class="listhdrr"><?=gettext("Status");?></td>
+ <td class="list">&nbsp;</td>
+ </tr>
+ <?php $i = 0; foreach ($a_raid as $raid): ?>
+ <tr>
+ <td valign="middle" class="listr">
+ <?=htmlspecialchars($raid['name']);?>
+ </td>
+ <td valign="middle" class="listr">
+ <?=htmlspecialchars($raid['type']);?>
+ </td>
+ <td valign="middle" class="listr">
+ <?php
+ $raidconfiguring = file_exists($d_raidconfdirty_path) &&
+ in_array($raid['name']."\n",file($d_raidconfdirty_path));
+ if ($raidconfiguring)
+ echo gettext("configuring");
+ else {
+ $tempo=$raid['name'];
+ echo "{$raidstatus[$tempo]['size']}";
+ }
+ ?>&nbsp;
+ </td>
+ <td valign="middle" class="listr">
+ <?php
+ if ($raidconfiguring)
+ echo gettext("configuring");
+ else {
+ echo "{$raidstatus[$tempo]['desc']}";
+ }
+ ?>&nbsp;
+ </td>
+ <td valign="middle" class="list">
+ <a href="disks_raid_graid5_edit.php?id=<?=$i;?>">
+ <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" title="<?=gettext("edit raid");?>" width="17" height="17" border="0" alt="" />
+ </a>
+ <a href="disks_raid_graid5.php?act=del&id=<?=$i;?>">
+ <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" title="<?=gettext("delete raid");?>" width="17" height="17" border="0" alt="" />
+ </a>
+ </td>
+ </tr>
+ <?php $i++; endforeach; ?>
+ <tr>
+ <td class="list" colspan="4"></td>
+ <td class="list" nowrap>
+ <a href="disks_raid_graid5_edit.php">
+ <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" title="<?=gettext("add disk");?>" width="17" height="17" border="0" alt="" />
+ </a>
+ </td>
+ </tr>
+ <tr>
+ <td align="left" valign="top" colspan="5">
+ <span class="red">
+ <strong><?= gettext("Note:"); ?></strong>
+ </span>
+ <br />
+ <span class="vexpl"><?= gettext("Optional configuration step: Configuring a virtual RAID disk using your"); ?></span>
+ <br />
+ <span class="vexpl"><a href="disks_manage.php"><?= gettext("previsously configured disk."); ?></a></span>
+ <br />
+ <span class="vexpl"><?= gettext("Wait for the \"up\" status before format it and mount it!."); ?></span>
+ </span>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </td>
+ </tr>
+</table>
+</form>
+<?php include("fend.inc"); ?>
+</body>
+</html>
diff --git a/packages/freenas/www/disks_raid_graid5_edit.php b/packages/freenas/www/disks_raid_graid5_edit.php
new file mode 100644
index 00000000..27069f6c
--- /dev/null
+++ b/packages/freenas/www/disks_raid_graid5_edit.php
@@ -0,0 +1,258 @@
+<?php
+/* $Id$ */
+/* ========================================================================== */
+/*
+ disks_raid_graid5_edit.php
+ part of pfSense (http://www.pfSense.com)
+ Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name>
+ All rights reserved.
+
+ Based on FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ All rights reserved.
+ */
+/* ========================================================================== */
+/*
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+/* ========================================================================== */
+
+$pgtitle = array(gettext("System"),
+ gettext("Disks"),
+ gettext("GEOM RAID5"),
+ gettext("RAID"),
+ isset($id) ? gettext("Edit") : gettext("Add"));
+
+require_once("freenas_config.inc");
+require_once("guiconfig.inc");
+require_once("freenas_guiconfig.inc");
+require_once("freenas_functions.inc");
+
+$id = $_GET['id'];
+if (isset($_POST['id']))
+ $id = $_POST['id'];
+
+if (!is_array($freenas_config['graid5']['vdisk']))
+ $freenas_config['graid5']['vdisk'] = array();
+
+graid5_sort();
+disks_sort();
+
+$a_raid = &$freenas_config['graid5']['vdisk'];
+$all_raid = array_merge((array)$freenas_config['graid5']['vdisk'],(array)$freenas_config['graid5']['vdisk'],(array)$freenas_config['gvinum']['vdisk'],(array)$freenas_config['gstripe']['vdisk'],(array)$freenas_config['graid5']['vdisk']);
+$a_disk = get_fstype_disks_list("softraid");
+
+if (!sizeof($a_disk)) {
+ $nodisk_errors[] = gettext("You must add disks first.");
+}
+
+if (isset($id) && $a_raid[$id]) {
+ $pconfig['name'] = $a_raid[$id]['name'];
+ $pconfig['type'] = $a_raid[$id]['type'];
+ $pconfig['diskr'] = $a_raid[$id]['diskr'];
+ $pconfig['fullname'] = $a_raid[$id]['fullname'];
+}
+
+if (! empty($_POST))
+{
+ /* hash */
+ unset($error_bucket);
+ /* simple error list */
+ unset($input_errors);
+
+ $reqdfields = explode(" ", "name");
+ $reqdfieldsn = explode(",", "Name");
+
+ do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
+
+ if (($_POST['name'] && !is_validaliasname($_POST['name'])))
+ {
+ $error_bucket[] = array("error" => gettext("The device name may only consist of the characters a-z, A-Z, 0-9."),
+ "field" => "name");
+ }
+
+ /* check for name conflicts */
+ foreach ($a_raid as $raid)
+ {
+ if (isset($id) && ($a_raid[$id]) && ($a_raid[$id] === $raid))
+ continue;
+
+ if ($raid['name'] == $_POST['name'])
+ {
+ $error_bucket[] = array("error" => gettext("This device already exists in the raid volume list."),
+ "field" => "name");
+ break;
+ }
+ }
+
+ /* check the number of RAID disk for volume */
+
+ if (count($_POST['diskr']) < 3)
+ $error_bucket[] = array("error" => gettext("There must be a minimum of 3 disks in a RAID 5 volume."),
+ "field" => "diskr");
+
+ if (is_array($error_bucket))
+ foreach($error_bucket as $elem)
+ $input_errors[] =& $elem["error"];
+
+ /* if this is an AJAX caller then handle via JSON */
+ if(isAjax() && is_array($error_bucket)) {
+ input_errors2Ajax(NULL, $error_bucket);
+ exit;
+ }
+
+ if (!$input_errors) {
+ $raid = array();
+ $raid['name'] = $_POST['name'];
+ $raid['type'] = "JBOD";
+ $raid['diskr'] = $_POST['diskr'];
+ $raid['desc'] = "Software graid5 RAID 5";
+ $raid['fullname'] = "/dev/raid5/{$raid['name']}";
+
+ if (isset($id) && $a_raid[$id])
+ $a_raid[$id] = $raid;
+ else
+ $a_raid[] = $raid;
+
+ $fd = @fopen("$d_raidconfdirty_path", "a");
+ if (!$fd) {
+ echo "ERR Could not save RAID configuration.\n";
+ exit(0);
+ }
+ fwrite($fd, "$raid[name]\n");
+ fclose($fd);
+
+ write_config();
+
+ pfSenseHeader("disks_raid_graid5.php");
+ exit;
+ }
+}
+
+include("head.inc");
+/* put your custom HTML head content here */
+/* using some of the $pfSenseHead function calls */
+echo $pfSenseHead->getHTML();
+
+?>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>">
+<?php include("fbegin.inc"); ?>
+<?php if ($input_errors) print_input_errors($input_errors); ?>
+<?php if ($savemsg) print_info_box($savemsg); ?>
+
+<div id="inputerrors"></div>
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td class="tabnavtbl">
+<?php
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Geom Mirror"), false, "disks_raid_gmirror.php");
+ $tab_array[1] = array(gettext("Geom Concat"), false, "disks_raid_gconcat.php");
+ $tab_array[2] = array(gettext("Geom Stripe"), false, "disks_raid_gstripe.php");
+ $tab_array[3] = array(gettext("Geom RAID5"), true, "disks_raid_graid5.php");
+ $tab_array[4] = array(gettext("Geom Vinum"), false, "disks_raid_gvinum.php");
+ display_top_tabs($tab_array);
+?>
+ </td>
+ </tr>
+ <tr>
+ <td class="tabnavtbl">
+<?php
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Manage RAID"), true, "disks_raid_graid5.php");
+ /* $tab_array[1] = array(gettext("Format RAID"), false, "disks_raid_gmirror_init.php"); */
+ $tab_array[1] = array(gettext("Tools"), false, "disks_raid_graid5_tools.php");
+ $tab_array[2] = array(gettext("Information"), false, "disks_raid_graid5_infos.php");
+ display_top_tabs($tab_array);
+?>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div id="mainarea">
+ <form action="disks_raid_graid5_edit.php" method="post" name="iform" id="iform">
+ <table class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0">
+ <tr>
+ <td width="22%" valign="top" class="vncellreq"><?=gettext("Raid name");?></td>
+ <td width="78%" class="vtable">
+ <input name="name" type="text" class="formfld unknown" id="name" size="20" value="<?=htmlspecialchars($pconfig['name']);?>" />
+ </td>
+ </tr>
+ <tr>
+ <td valign="top" class="vncellreq"><?= gettext("Type"); ?></td>
+ <td class="vtable">
+ RAID 5 (<?= gettext("rotated block-interleaved parity"); ?>)
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq"><?= gettext("Members of this volume"); ?></td>
+ <td width="78%" class="vtable">
+ <?
+ $i=0;
+ $disable_script="";
+
+ foreach ($a_disk as $diskv) {
+ $r_name="";
+
+ foreach($all_raid as $raid) {
+ if (in_array($diskv['fullname'],(array)$raid['diskr'])) {
+ $r_name=$raid['name'];
+ if ($r_name!=$pconfig['name']) $disable_script.="document.getElementById($i).disabled=1;\n";
+ break;
+ }
+ }
+ echo "<input name='diskr[]' id='$i' type='checkbox' value='$diskv[fullname]'".
+ ((is_array($pconfig['diskr']) && in_array($diskv['fullname'],$pconfig['diskr'])) ? " checked=\"checked\"" : "") .
+ " />$diskv[name] ($diskv[size], $diskv[desc])".(($r_name) ? " - assigned to $r_name" : "")."<br />\n";
+ $i++;
+
+ $i++;
+ }
+
+ if ($disable_script)
+ echo "<script type='text/javascript'><!--\n$disable_script--></script>\n";
+ ?>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top">&nbsp;</td>
+ <td width="78%">
+ <input name="Submit" type="submit" class="formbtn" value="Save" />
+ <?php if (isset($id) && $a_raid[$id]): ?>
+ <input name="id" type="hidden" value="<?=$id;?>" />
+ <?php endif; ?>
+ </td>
+ </tr>
+ </table>
+ </form>
+ </div>
+ </td>
+ </tr>
+</table>
+<?php include("fend.inc"); ?>
+</body>
+</html>
diff --git a/packages/freenas/www/disks_raid_graid5_infos.php b/packages/freenas/www/disks_raid_graid5_infos.php
new file mode 100644
index 00000000..31506011
--- /dev/null
+++ b/packages/freenas/www/disks_raid_graid5_infos.php
@@ -0,0 +1,143 @@
+<?php
+/* $Id$ */
+/* ========================================================================== */
+/*
+ disks_raid_graid5_infos.php
+ part of pfSense (http://www.pfSense.com)
+ Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name>
+ All rights reserved.
+
+ Based on FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ All rights reserved.
+ */
+/* ========================================================================== */
+/*
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+/* ========================================================================== */
+
+$pgtitle = array(gettext("System"),
+ gettext("Disks"),
+ gettext("GEOM RAID5"),
+ gettext("Information"));
+
+require_once("guiconfig.inc");
+require_once("freenas_guiconfig.inc");
+require_once("freenas_functions.inc");
+
+if (! empty($_POST))
+{
+ /* hash */
+ unset($error_bucket);
+ /* simple error list */
+ unset($input_errors);
+
+ if (is_array($error_bucket))
+ foreach($error_bucket as $elem)
+ $input_errors[] =& $elem["error"];
+
+ /* if this is an AJAX caller then handle via JSON */
+ if(isAjax() && is_array($error_bucket)) {
+ input_errors2Ajax(NULL, $error_bucket);
+ exit;
+ }
+
+ if (!$input_errors) {
+ }
+}
+if (!isset($do_action)) {
+}
+
+include("head.inc");
+/* put your custom HTML head content here */
+/* using some of the $pfSenseHead function calls */
+echo $pfSenseHead->getHTML();
+
+?>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>">
+<?php include("fbegin.inc"); ?>
+<?php if ($input_errors) print_input_errors($input_errors); ?>
+<?php if ($savemsg) print_info_box($savemsg); ?>
+
+<div id="inputerrors"></div>
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td class="tabnavtbl">
+<?php
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Geom Mirror"), false, "disks_raid_gmirror.php");
+ $tab_array[1] = array(gettext("Geom Concat"), false, "disks_raid_gconcat.php");
+ $tab_array[2] = array(gettext("Geom Stripe"), false, "disks_raid_gstripe.php");
+ $tab_array[3] = array(gettext("Geom RAID5"), true, "disks_raid_graid5.php");
+ $tab_array[4] = array(gettext("Geom Vinum"), false, "disks_raid_gvinum.php");
+ display_top_tabs($tab_array);
+?>
+ </td>
+ </tr>
+ <tr>
+ <td class="tabnavtbl">
+<?php
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Manage RAID"), false, "disks_raid_graid5.php");
+ /* $tab_array[1] = array(gettext("Format RAID"), false, "disks_raid_gconcat_init.php"); */
+ $tab_array[1] = array(gettext("Tools"), false, "disks_raid_graid5_tools.php");
+ $tab_array[2] = array(gettext("Information"), true, "disks_raid_graid5_infos.php");
+ display_top_tabs($tab_array);
+?>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div id="mainarea">
+ <form action="disks_raid_graid5_infos.php" method="post" name="iform" id="iform">
+ <table class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0">
+ <tr>
+ <td width="100%" class="vtable">
+ <?php
+ echo "<pre>";
+ echo "<strong>" . gettext("Software RAID information and status") . "</strong><br />";
+
+ exec("/sbin/graid5 list",$rawdata);
+ foreach ($rawdata as $line){
+ echo htmlspecialchars($line) . "<br>";
+ }
+
+ unset ($line);
+ echo "</pre>";
+ ?>
+ </td>
+ </tr>
+ </table>
+ </form>
+ </div>
+ </td>
+ </tr>
+</table>
+<?php include("fend.inc"); ?>
+</body>
+</html>
diff --git a/packages/freenas/www/disks_raid_graid5_tools.php b/packages/freenas/www/disks_raid_graid5_tools.php
new file mode 100644
index 00000000..c8b3cf5b
--- /dev/null
+++ b/packages/freenas/www/disks_raid_graid5_tools.php
@@ -0,0 +1,190 @@
+<?php
+/*
+ disks_raid_graid5_tools.php
+ part of pfSense (http://www.pfSense.com)
+ Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name>
+ All rights reserved.
+
+ Based on FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ All rights reserved.
+ */
+/* ========================================================================== */
+/*
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+/* ========================================================================== */
+
+$pgtitle = array(gettext("System"),
+ gettext("Disks"),
+ gettext("GEOM RAID5"),
+ gettext("Tools"));
+
+require_once("freenas_config.inc");
+require_once("guiconfig.inc");
+require_once("freenas_guiconfig.inc");
+require_once("freenas_functions.inc");
+
+if (! empty($_POST))
+{
+ /* hash */
+ unset($error_bucket);
+ /* simple error list */
+ unset($input_errors);
+ unset($do_action);
+
+ $reqdfields = explode(" ", "action object");
+ $reqdfieldsn = explode(",", "Action,Object");
+
+ do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
+
+ if (is_array($error_bucket))
+ foreach($error_bucket as $elem)
+ $input_errors[] =& $elem["error"];
+
+ /* if this is an AJAX caller then handle via JSON */
+ if(isAjax() && is_array($error_bucket)) {
+ input_errors2Ajax(NULL, $error_bucket);
+ exit;
+ }
+
+ if (!$input_errors) {
+ $do_action = true;
+ $action = $_POST['action'];
+ $object = $_POST['object'];
+ }
+ }
+ if (!isset($do_action)) {
+ $do_action = false;
+ $action = '';
+ $object = '';
+}
+
+include("head.inc");
+/* put your custom HTML head content here */
+/* using some of the $pfSenseHead function calls */
+echo $pfSenseHead->getHTML();
+
+?>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>">
+<?php include("fbegin.inc"); ?>
+<?php if ($input_errors) print_input_errors($input_errors); ?>
+<?php if ($savemsg) print_info_box($savemsg); ?>
+
+<div id="inputerrors"></div>
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td class="tabnavtbl">
+<?php
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Geom Mirror"), false, "disks_raid_gmirror.php");
+ $tab_array[1] = array(gettext("Geom Concat"), false, "disks_raid_gconcat.php");
+ $tab_array[2] = array(gettext("Geom Stripe"), false, "disks_raid_gstripe.php");
+ $tab_array[3] = array(gettext("Geom RAID5"), true, "disks_raid_graid5.php");
+ $tab_array[4] = array(gettext("Geom Vinum"), false, "disks_raid_gvinum.php");
+ display_top_tabs($tab_array);
+?>
+ </td>
+ </tr>
+ <tr>
+ <td class="tabnavtbl">
+<?php
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Manage RAID"), false, "disks_raid_graid5.php");
+ /* $tab_array[1] = array(gettext("Format RAID"), false, "disks_raid_graid5_init.php"); */
+ $tab_array[1] = array(gettext("Tools"), true, "disks_raid_graid5_tools.php");
+ $tab_array[2] = array(gettext("Information"), false, "disks_raid_graid5_infos.php");
+ display_top_tabs($tab_array);
+?>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div id="mainarea">
+ <form action="disks_raid_graid5_tools.php" method="post" name="iform" id="iform">
+ <table class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0">
+ <tr>
+ <td width="22%" valign="top" class="vncellreq"><?=gettext("Object name");?></td>
+ <td width="78%" class="vtable">
+ <input name="object" type="text" class="formfld unknown" id="object" size="20" value="<?=htmlspecialchars($disk);?>" />
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq"><?=gettext("Object name");?></td>
+ <td width="78%" class="vtable">
+ <select name="action" class="formselect" id="action">
+ <option value="list" <?php if ($action == "list") echo "selected"; ?>>list</option>
+ <option value="status" <?php if ($action == "status") echo "selected"; ?>>status</option>
+ <option value="insert" <?php if ($action == "insert") echo "selected"; ?>>insert</option>
+ <option value="remove" <?php if ($action == "remove") echo "selected"; ?>>remove</option>
+ <option value="clear" <?php if ($action == "clear") echo "selected"; ?>>clear</option>
+ <option value="stop" <?php if ($action == "stop") echo "selected"; ?>>stop</option>
+ <option value="destroy" <?php if ($action == "destroy") echo "selected"; ?>>destroy</option>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top">&nbsp;</td>
+ <td width="78%">
+ <input name="Submit" type="submit" class="formbtn" value="Send Command!" />
+ </td>
+ </tr>
+ <tr>
+ <td valign="top" colspan="2">
+ <?
+ if ($do_action) {
+ echo("<strong>" . gettext("GCONCAT command output:") . "</strong><br />");
+ echo('<pre>');
+ ob_end_flush();
+
+ system("/sbin/graid5 $action " . escapeshellarg($object));
+
+ echo('</pre>');
+ }
+ ?>
+ </td>
+ </tr>
+ <tr>
+ <td align="left" valign="top" colspan="2">
+ <span class="red">
+ <strong>WARNING:</strong><br />
+ </span>
+ <ol>
+ <li><span class="vexpl"><?= gettext("Use these specials actions for debugging only!"); ?></span></li>
+ <li><span class="vexpl"><?= gettext("There is no need of using this menu for start a RAID volume (start automaticaly)."); ?></span></li>
+ </ol>
+ </td>
+ </tr>
+ </table>
+ </form>
+ </div>
+ </td>
+ </tr>
+</table>
+<?php include("fend.inc"); ?>
+</body>
+</html>
diff --git a/packages/freenas/www/disks_raid_gstripe.php b/packages/freenas/www/disks_raid_gstripe.php
new file mode 100644
index 00000000..4d5f622d
--- /dev/null
+++ b/packages/freenas/www/disks_raid_gstripe.php
@@ -0,0 +1,236 @@
+<?php
+/* $Id$ */
+/* ========================================================================== */
+/*
+ disks_raid_gstripe.php
+ part of pfSense (http://www.pfSense.com)
+ Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name>
+ All rights reserved.
+
+ Based on FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ All rights reserved.
+ */
+/* ========================================================================== */
+/*
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+/* ========================================================================== */
+
+$pgtitle = array(gettext("System"),
+ gettext("Disks"),
+ gettext("GEOM Stripe"),
+ gettext("RAID"));
+
+require_once("freenas_config.inc");
+require_once("guiconfig.inc");
+require_once("freenas_guiconfig.inc");
+require_once("freenas_functions.inc");
+
+if (!is_array($freenas_config['gstripe']['vdisk']))
+ $freenas_config['gstripe']['vdisk'] = array();
+
+gstripe_sort();
+
+$raidstatus=get_sraid_disks_list();
+
+$a_raid = &$freenas_config['gstripe']['vdisk'];
+
+if (! empty($_POST))
+{
+ /* hash */
+ unset($error_bucket);
+ /* simple error list */
+ unset($input_errors);
+
+ $pconfig = $_POST;
+
+ if (is_array($error_bucket))
+ foreach($error_bucket as $elem)
+ $input_errors[] =& $elem["error"];
+
+ /* if this is an AJAX caller then handle via JSON */
+ if(isAjax() && is_array($error_bucket)) {
+ input_errors2Ajax(NULL, $error_bucket);
+ exit;
+ }
+
+ if ($_POST['apply']) {
+ $retval = 0;
+ if (!file_exists($d_sysrebootreqd_path))
+ {
+ config_lock();
+ /* reload all components that create raid device */
+ disks_raid_gstripe_configure();
+ config_unlock();
+ write_config();
+ }
+ $savemsg = get_std_save_message($retval);
+ if ($retval == 0) {
+ if (file_exists($d_raidconfdirty_path))
+ unlink($d_raidconfdirty_path);
+ }
+ }
+}
+
+if ($_GET['act'] == "del") {
+ if ($a_raid[$_GET['id']]) {
+ $raidname=$a_raid[$_GET['id']]['name'];
+ disks_raid_gstripe_delete($raidname);
+ unset($a_raid[$_GET['id']]);
+ write_config();
+ touch($d_raidconfdirty_path);
+ pfSenseHeader("disks_raid_gstripe.php");
+ exit;
+ }
+}
+
+include("head.inc");
+/* put your custom HTML head content here */
+/* using some of the $pfSenseHead function calls */
+echo $pfSenseHead->getHTML();
+
+?>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>">
+<?php include("fbegin.inc"); ?>
+<?php if ($input_errors) print_input_errors($input_errors); ?>
+<?php if ($savemsg) print_info_box($savemsg); ?>
+
+<form action="disks_raid_gstripe.php" method="post" name="iform" id="iform">
+<?php if (file_exists($d_diskdirty_path)): ?>
+<?php print_info_box_np(gettext("The Raid configuration has been changed.") . "<br />" .
+ gettext("You must apply the changes in order for them to take effect."));?>
+<?php endif; ?>
+
+<div id="inputerrors"></div>
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td class="tabnavtbl">
+<?php
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Geom Mirror"), false, "disks_raid_gmirror.php");
+ $tab_array[1] = array(gettext("Geom Concat"), false, "disks_raid_gconcat.php");
+ $tab_array[2] = array(gettext("Geom Stripe"), true, "disks_raid_gstripe.php");
+ $tab_array[3] = array(gettext("Geom RAID5"), false, "disks_raid_graid5.php");
+ $tab_array[4] = array(gettext("Geom Vinum"), false, "disks_raid_gvinum.php");
+ display_top_tabs($tab_array);
+?>
+ </td>
+ </tr>
+ <tr>
+ <td class="tabnavtbl">
+<?php
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Manage RAID"), true, "disks_raid_gstripe.php");
+ /* $tab_array[1] = array(gettext("Format RAID"), false, "disks_raid_gmirror_init.php"); */
+ $tab_array[1] = array(gettext("Tools"), false, "disks_raid_gstripe_tools.php");
+ $tab_array[2] = array(gettext("Information"), false, "disks_raid_gstripe_infos.php");
+ display_top_tabs($tab_array);
+?>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div id="mainarea">
+ <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td class="listhdrr"><?=gettext("Volume name");?></td>
+ <td class="listhdrr"><?=gettext("Type");?></td>
+ <td class="listhdrr"><?=gettext("Size");?></td>
+ <td class="listhdrr"><?=gettext("Status");?></td>
+ <td class="list">&nbsp;</td>
+ </tr>
+ <?php $i = 0; foreach ($a_raid as $raid): ?>
+ <tr>
+ <td valign="middle" class="listr">
+ <?=htmlspecialchars($raid['name']);?>
+ </td>
+ <td valign="middle" class="listr">
+ <?=htmlspecialchars($raid['type']);?>
+ </td>
+ <td valign="middle" class="listr">
+ <?php
+ $raidconfiguring = file_exists($d_raidconfdirty_path) &&
+ in_array($raid['name']."\n",file($d_raidconfdirty_path));
+ if ($raidconfiguring)
+ echo gettext("configuring");
+ else {
+ $tempo=$raid['name'];
+ echo "{$raidstatus[$tempo]['size']}";
+ }
+ ?>&nbsp;
+ </td>
+ <td valign="middle" class="listr">
+ <?php
+ if ($raidconfiguring)
+ echo gettext("configuring");
+ else {
+ echo "{$raidstatus[$tempo]['desc']}";
+ }
+ ?>&nbsp;
+ </td>
+ <td valign="middle" class="list">
+ <a href="disks_raid_gstripe_edit.php?id=<?=$i;?>">
+ <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" title="<?=gettext("edit raid");?>" width="17" height="17" border="0" alt="" />
+ </a>
+ <a href="disks_raid_gstripe.php?act=del&id=<?=$i;?>">
+ <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" title="<?=gettext("delete raid");?>" width="17" height="17" border="0" alt="" />
+ </a>
+ </td>
+ </tr>
+ <?php $i++; endforeach; ?>
+ <tr>
+ <td class="list" colspan="4"></td>
+ <td class="list" nowrap>
+ <a href="disks_raid_gstripe_edit.php">
+ <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" title="<?=gettext("add disk");?>" width="17" height="17" border="0" alt="" />
+ </a>
+ </td>
+ </tr>
+ <tr>
+ <td align="left" valign="top" colspan="5">
+ <span class="red">
+ <strong><?= gettext("Note:"); ?></strong>
+ </span>
+ <br />
+ <span class="vexpl"><?= gettext("Optional configuration step: Configuring a virtual RAID disk using your"); ?></span>
+ <br />
+ <span class="vexpl"><a href="disks_manage.php"><?= gettext("previsously configured disk."); ?></a></span>
+ <br />
+ <span class="vexpl"><?= gettext("Wait for the \"up\" status before format it and mount it!."); ?></span>
+ </span>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </td>
+ </tr>
+</table>
+</form>
+<?php include("fend.inc"); ?>
+</body>
+</html>
diff --git a/packages/freenas/www/disks_raid_gstripe_edit.php b/packages/freenas/www/disks_raid_gstripe_edit.php
new file mode 100644
index 00000000..ab18d6e7
--- /dev/null
+++ b/packages/freenas/www/disks_raid_gstripe_edit.php
@@ -0,0 +1,258 @@
+<?php
+/* $Id$ */
+/* ========================================================================== */
+/*
+ disks_raid_gstripe_edit.php
+ part of pfSense (http://www.pfSense.com)
+ Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name>
+ All rights reserved.
+
+ Based on FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ All rights reserved.
+ */
+/* ========================================================================== */
+/*
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+/* ========================================================================== */
+
+$pgtitle = array(gettext("System"),
+ gettext("Disks"),
+ gettext("GEOM Stripe"),
+ gettext("RAID"),
+ gettext("Edit"));
+
+require_once("freenas_config.inc");
+require_once("guiconfig.inc");
+require_once("freenas_guiconfig.inc");
+require_once("freenas_functions.inc");
+
+$id = $_GET['id'];
+if (isset($_POST['id']))
+ $id = $_POST['id'];
+
+if (!is_array($freenas_config['gstripe']['vdisk']))
+ $freenas_config['gstripe']['vdisk'] = array();
+
+gstripe_sort();
+disks_sort();
+
+$a_raid = &$freenas_config['gstripe']['vdisk'];
+$all_raid = array_merge((array)$freenas_config['gstripe']['vdisk'],(array)$freenas_config['gstripe']['vdisk'],(array)$freenas_config['gvinum']['vdisk'],(array)$freenas_config['gstripe']['vdisk'],(array)$freenas_config['gstripe']['vdisk']);
+$a_disk = get_fstype_disks_list("softraid");
+
+if (!sizeof($a_disk)) {
+ $nodisk_errors[] = gettext("You must add disks first.");
+}
+
+if (isset($id) && $a_raid[$id]) {
+ $pconfig['name'] = $a_raid[$id]['name'];
+ $pconfig['type'] = $a_raid[$id]['type'];
+ $pconfig['diskr'] = $a_raid[$id]['diskr'];
+ $pconfig['fullname'] = $a_raid[$id]['fullname'];
+}
+
+if (! empty($_POST))
+{
+ /* hash */
+ unset($error_bucket);
+ /* simple error list */
+ unset($input_errors);
+
+ $reqdfields = explode(" ", "name");
+ $reqdfieldsn = explode(",", "Name");
+
+ do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
+
+ if (($_POST['name'] && !is_validaliasname($_POST['name'])))
+ {
+ $error_bucket[] = array("error" => gettext("The device name may only consist of the characters a-z, A-Z, 0-9."),
+ "field" => "name");
+ }
+
+ /* check for name conflicts */
+ foreach ($a_raid as $raid)
+ {
+ if (isset($id) && ($a_raid[$id]) && ($a_raid[$id] === $raid))
+ continue;
+
+ if ($raid['name'] == $_POST['name'])
+ {
+ $error_bucket[] = array("error" => gettext("This device already exists in the raid volume list."),
+ "field" => "name");
+ break;
+ }
+ }
+
+ /* check the number of RAID disk for volume */
+
+ if (count($_POST['diskr']) < 2)
+ $error_bucket[] = array("error" => gettext("There must be a minimum of 2 disks in a RAID 0 volume."),
+ "field" => "diskr");
+
+ if (is_array($error_bucket))
+ foreach($error_bucket as $elem)
+ $input_errors[] =& $elem["error"];
+
+ /* if this is an AJAX caller then handle via JSON */
+ if(isAjax() && is_array($error_bucket)) {
+ input_errors2Ajax(NULL, $error_bucket);
+ exit;
+ }
+
+ if (!$input_errors) {
+ $raid = array();
+ $raid['name'] = $_POST['name'];
+ $raid['type'] = "JBOD";
+ $raid['diskr'] = $_POST['diskr'];
+ $raid['desc'] = "Software gstripe RAID 0";
+ $raid['fullname'] = "/dev/stripe/{$raid['name']}";
+
+ if (isset($id) && $a_raid[$id])
+ $a_raid[$id] = $raid;
+ else
+ $a_raid[] = $raid;
+
+ $fd = @fopen("$d_raidconfdirty_path", "a");
+ if (!$fd) {
+ echo "ERR Could not save RAID configuration.\n";
+ exit(0);
+ }
+ fwrite($fd, "$raid[name]\n");
+ fclose($fd);
+
+ write_config();
+
+ pfSenseHeader("disks_raid_gstripe.php");
+ exit;
+ }
+}
+
+include("head.inc");
+/* put your custom HTML head content here */
+/* using some of the $pfSenseHead function calls */
+echo $pfSenseHead->getHTML();
+
+?>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>">
+<?php include("fbegin.inc"); ?>
+<?php if ($input_errors) print_input_errors($input_errors); ?>
+<?php if ($savemsg) print_info_box($savemsg); ?>
+
+<div id="inputerrors"></div>
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td class="tabnavtbl">
+<?php
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Geom Mirror"), false, "disks_raid_gmirror.php");
+ $tab_array[1] = array(gettext("Geom Concat"), false, "disks_raid_gconcat.php");
+ $tab_array[2] = array(gettext("Geom Stripe"), true, "disks_raid_gstripe.php");
+ $tab_array[3] = array(gettext("Geom RAID5"), false, "disks_raid_graid5.php");
+ $tab_array[4] = array(gettext("Geom Vinum"), false, "disks_raid_gvinum.php");
+ display_top_tabs($tab_array);
+?>
+ </td>
+ </tr>
+ <tr>
+ <td class="tabnavtbl">
+<?php
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Manage RAID"), true, "disks_raid_gstripe.php");
+ /* $tab_array[1] = array(gettext("Format RAID"), false, "disks_raid_gmirror_init.php"); */
+ $tab_array[1] = array(gettext("Tools"), false, "disks_raid_gstripe_tools.php");
+ $tab_array[2] = array(gettext("Information"), false, "disks_raid_gstripe_infos.php");
+ display_top_tabs($tab_array);
+?>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div id="mainarea">
+ <form action="disks_raid_gstripe_edit.php" method="post" name="iform" id="iform">
+ <table class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0">
+ <tr>
+ <td width="22%" valign="top" class="vncellreq"><?=gettext("Raid name");?></td>
+ <td width="78%" class="vtable">
+ <input name="name" type="text" class="formfld unknown" id="name" size="20" value="<?=htmlspecialchars($pconfig['name']);?>" />
+ </td>
+ </tr>
+ <tr>
+ <td valign="top" class="vncellreq"><?= gettext("Type"); ?></td>
+ <td class="vtable">
+ RAID 5 (<?= gettext("rotated block-interleaved parity"); ?>)
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq"><?= gettext("Members of this volume"); ?></td>
+ <td width="78%" class="vtable">
+ <?
+ $i=0;
+ $disable_script="";
+
+ foreach ($a_disk as $diskv) {
+ $r_name="";
+
+ foreach($all_raid as $raid) {
+ if (in_array($diskv['fullname'],(array)$raid['diskr'])) {
+ $r_name=$raid['name'];
+ if ($r_name!=$pconfig['name']) $disable_script.="document.getElementById($i).disabled=1;\n";
+ break;
+ }
+ }
+ echo "<input name='diskr[]' id='$i' type='checkbox' value='$diskv[fullname]'".
+ ((is_array($pconfig['diskr']) && in_array($diskv['fullname'],$pconfig['diskr'])) ? " checked=\"checked\"" : "") .
+ " />$diskv[name] ($diskv[size], $diskv[desc])".(($r_name) ? " - assigned to $r_name" : "")."<br />\n";
+ $i++;
+
+ $i++;
+ }
+
+ if ($disable_script)
+ echo "<script type='text/javascript'><!--\n$disable_script--></script>\n";
+ ?>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top">&nbsp;</td>
+ <td width="78%">
+ <input name="Submit" type="submit" class="formbtn" value="Save" />
+ <?php if (isset($id) && $a_raid[$id]): ?>
+ <input name="id" type="hidden" value="<?=$id;?>" />
+ <?php endif; ?>
+ </td>
+ </tr>
+ </table>
+ </form>
+ </div>
+ </td>
+ </tr>
+</table>
+<?php include("fend.inc"); ?>
+</body>
+</html>
diff --git a/packages/freenas/www/disks_raid_gstripe_infos.php b/packages/freenas/www/disks_raid_gstripe_infos.php
new file mode 100644
index 00000000..5d8a6de0
--- /dev/null
+++ b/packages/freenas/www/disks_raid_gstripe_infos.php
@@ -0,0 +1,143 @@
+<?php
+/* $Id$ */
+/* ========================================================================== */
+/*
+ disks_raid_stripe_infos.php
+ part of pfSense (http://www.pfSense.com)
+ Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name>
+ All rights reserved.
+
+ Based on FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ All rights reserved.
+ */
+/* ========================================================================== */
+/*
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+/* ========================================================================== */
+
+$pgtitle = array(gettext("System"),
+ gettext("Disks"),
+ gettext("GEOM Stripe"),
+ gettext("Information"));
+
+require_once("guiconfig.inc");
+require_once("freenas_guiconfig.inc");
+require_once("freenas_functions.inc");
+
+if (! empty($_POST))
+{
+ /* hash */
+ unset($error_bucket);
+ /* simple error list */
+ unset($input_errors);
+
+ if (is_array($error_bucket))
+ foreach($error_bucket as $elem)
+ $input_errors[] =& $elem["error"];
+
+ /* if this is an AJAX caller then handle via JSON */
+ if(isAjax() && is_array($error_bucket)) {
+ input_errors2Ajax(NULL, $error_bucket);
+ exit;
+ }
+
+ if (!$input_errors) {
+ }
+}
+if (!isset($do_action)) {
+}
+
+include("head.inc");
+/* put your custom HTML head content here */
+/* using some of the $pfSenseHead function calls */
+echo $pfSenseHead->getHTML();
+
+?>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>">
+<?php include("fbegin.inc"); ?>
+<?php if ($input_errors) print_input_errors($input_errors); ?>
+<?php if ($savemsg) print_info_box($savemsg); ?>
+
+<div id="inputerrors"></div>
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td class="tabnavtbl">
+<?php
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Geom Mirror"), false, "disks_raid_gmirror.php");
+ $tab_array[1] = array(gettext("Geom Concat"), false, "disks_raid_gconcat.php");
+ $tab_array[2] = array(gettext("Geom Stripe"), true, "disks_raid_gstripe.php");
+ $tab_array[3] = array(gettext("Geom RAID5"), false, "disks_raid_graid5.php");
+ $tab_array[4] = array(gettext("Geom Vinum"), false, "disks_raid_gvinum.php");
+ display_top_tabs($tab_array);
+?>
+ </td>
+ </tr>
+ <tr>
+ <td class="tabnavtbl">
+<?php
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Manage RAID"), false, "disks_raid_gstripe.php");
+ /* $tab_array[1] = array(gettext("Format RAID"), false, "disks_raid_gconcat_init.php"); */
+ $tab_array[1] = array(gettext("Tools"), false, "disks_raid_gstripe_tools.php");
+ $tab_array[2] = array(gettext("Information"), true, "disks_raid_gstripe_infos.php");
+ display_top_tabs($tab_array);
+?>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div id="mainarea">
+ <form action="disks_raid_gstripe_infos.php" method="post" name="iform" id="iform">
+ <table class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0">
+ <tr>
+ <td width="100%" class="vtable">
+ <?php
+ echo "<pre>";
+ echo "<strong>" . gettext("Software RAID information and status") . "</strong><br />";
+
+ exec("/sbin/gstripe list",$rawdata);
+ foreach ($rawdata as $line){
+ echo htmlspecialchars($line) . "<br>";
+ }
+
+ unset ($line);
+ echo "</pre>";
+ ?>
+ </td>
+ </tr>
+ </table>
+ </form>
+ </div>
+ </td>
+ </tr>
+</table>
+<?php include("fend.inc"); ?>
+</body>
+</html>
diff --git a/packages/freenas/www/disks_raid_gstripe_tools.php b/packages/freenas/www/disks_raid_gstripe_tools.php
new file mode 100644
index 00000000..6bc7891a
--- /dev/null
+++ b/packages/freenas/www/disks_raid_gstripe_tools.php
@@ -0,0 +1,187 @@
+<?php
+/*
+ disks_raid_stripe_tools.php
+ part of pfSense (http://www.pfSense.com)
+ Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name>
+ All rights reserved.
+
+ Based on FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ All rights reserved.
+ */
+/* ========================================================================== */
+/*
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+/* ========================================================================== */
+
+$pgtitle = array(gettext("System"),
+ gettext("Disks"),
+ gettext("GEOM Stripe"),
+ gettext("Tools"));
+
+require_once("freenas_config.inc");
+require_once("guiconfig.inc");
+require_once("freenas_guiconfig.inc");
+require_once("freenas_functions.inc");
+
+if (! empty($_POST))
+{
+ /* hash */
+ unset($error_bucket);
+ /* simple error list */
+ unset($input_errors);
+ unset($do_action);
+
+ $reqdfields = explode(" ", "action object");
+ $reqdfieldsn = explode(",", "Action,Object");
+
+ do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
+
+ if (is_array($error_bucket))
+ foreach($error_bucket as $elem)
+ $input_errors[] =& $elem["error"];
+
+ /* if this is an AJAX caller then handle via JSON */
+ if(isAjax() && is_array($error_bucket)) {
+ input_errors2Ajax(NULL, $error_bucket);
+ exit;
+ }
+
+ if (!$input_errors) {
+ $do_action = true;
+ $action = $_POST['action'];
+ $object = $_POST['object'];
+ }
+ }
+ if (!isset($do_action)) {
+ $do_action = false;
+ $action = '';
+ $object = '';
+}
+
+include("head.inc");
+/* put your custom HTML head content here */
+/* using some of the $pfSenseHead function calls */
+echo $pfSenseHead->getHTML();
+
+?>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>">
+<?php include("fbegin.inc"); ?>
+<?php if ($input_errors) print_input_errors($input_errors); ?>
+<?php if ($savemsg) print_info_box($savemsg); ?>
+
+<div id="inputerrors"></div>
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td class="tabnavtbl">
+<?php
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Geom Mirror"), false, "disks_raid_gmirror.php");
+ $tab_array[1] = array(gettext("Geom Concat"), false, "disks_raid_gconcat.php");
+ $tab_array[2] = array(gettext("Geom Stripe"), true, "disks_raid_gstripe.php");
+ $tab_array[3] = array(gettext("Geom RAID5"), false, "disks_raid_graid5.php");
+ $tab_array[4] = array(gettext("Geom Vinum"), false, "disks_raid_gvinum.php");
+ display_top_tabs($tab_array);
+?>
+ </td>
+ </tr>
+ <tr>
+ <td class="tabnavtbl">
+<?php
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Manage RAID"), false, "disks_raid_gstripe.php");
+ /* $tab_array[1] = array(gettext("Format RAID"), false, "disks_raid_gstripe_init.php"); */
+ $tab_array[1] = array(gettext("Tools"), true, "disks_raid_gstripe_tools.php");
+ $tab_array[2] = array(gettext("Information"), false, "disks_raid_gstripe_infos.php");
+ display_top_tabs($tab_array);
+?>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div id="mainarea">
+ <form action="disks_raid_gstripe_tools.php" method="post" name="iform" id="iform">
+ <table class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0">
+ <tr>
+ <td width="22%" valign="top" class="vncellreq"><?=gettext("Object name");?></td>
+ <td width="78%" class="vtable">
+ <input name="object" type="text" class="formfld unknown" id="object" size="20" value="<?=htmlspecialchars($disk);?>" />
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq"><?=gettext("Object name");?></td>
+ <td width="78%" class="vtable">
+ <select name="action" class="formselect" id="action">
+ <option value="list" <?php if ($action == "list") echo "selected"; ?>>list</option>
+ <option value="status" <?php if ($action == "status") echo "selected"; ?>>status</option>
+ <option value="clear" <?php if ($action == "clear") echo "selected"; ?>>clear</option>
+ <option value="stop" <?php if ($action == "stop") echo "selected"; ?>>stop</option>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top">&nbsp;</td>
+ <td width="78%">
+ <input name="Submit" type="submit" class="formbtn" value="Send Command!" />
+ </td>
+ </tr>
+ <tr>
+ <td valign="top" colspan="2">
+ <?
+ if ($do_action) {
+ echo("<strong>" . gettext("GSTRIPE command output:") . "</strong><br />");
+ echo('<pre>');
+ ob_end_flush();
+
+ system("/sbin/gstripe $action " . escapeshellarg($object));
+
+ echo('</pre>');
+ }
+ ?>
+ </td>
+ </tr>
+ <tr>
+ <td align="left" valign="top" colspan="2">
+ <span class="red">
+ <strong>WARNING:</strong><br />
+ </span>
+ <ol>
+ <li><span class="vexpl"><?= gettext("Use these specials actions for debugging only!"); ?></span></li>
+ <li><span class="vexpl"><?= gettext("There is no need of using this menu for start a RAID volume (start automaticaly)."); ?></span></li>
+ </ol>
+ </td>
+ </tr>
+ </table>
+ </form>
+ </div>
+ </td>
+ </tr>
+</table>
+<?php include("fend.inc"); ?>
+</body>
+</html>
diff --git a/packages/freenas/www/disks_raid_gvinum.php b/packages/freenas/www/disks_raid_gvinum.php
index eb18a5f5..134b2fb5 100644
--- a/packages/freenas/www/disks_raid_gvinum.php
+++ b/packages/freenas/www/disks_raid_gvinum.php
@@ -1,36 +1,44 @@
<?php
/* $Id$ */
+/* ========================================================================== */
/*
- disks_manage_edit.php
- part of FreeNAS (http://www.freenas.org)
- Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
- All rights reserved.
-
- Based on m0n0wall (http://m0n0.ch/wall)
- Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
+ disks_raid_gvinum.php
+ part of pfSense (http://www.pfSense.com)
+ Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name>
+ All rights reserved.
+
+ Based on FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ All rights reserved.
+ */
+/* ========================================================================== */
+/*
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+/* ========================================================================== */
$pgtitle = array(gettext("System"),
gettext("Disks"),
@@ -42,14 +50,14 @@ require_once("guiconfig.inc");
require_once("freenas_guiconfig.inc");
require_once("freenas_functions.inc");
-if (!is_array($freenas_config['raid']['vdisk']))
- $freenas_config['raid']['vdisk'] = array();
+if (!is_array($freenas_config['gvinum']['vdisk']))
+ $freenas_config['gvinum']['vdisk'] = array();
gvinum_sort();
$raidstatus=get_sraid_disks_list();
-$a_raid = &$freenas_config['raid']['vdisk'];
+$a_raid = &$freenas_config['gvinum']['vdisk'];
if (! empty($_POST))
{
@@ -59,7 +67,7 @@ if (! empty($_POST))
unset($input_errors);
$pconfig = $_POST;
-
+
if (is_array($error_bucket))
foreach($error_bucket as $elem)
$input_errors[] =& $elem["error"];
@@ -70,33 +78,34 @@ if (! empty($_POST))
exit;
}
- if ($_POST['apply']) {
- $retval = 0;
- if (!file_exists($d_sysrebootreqd_path))
- {
- config_lock();
- /* reload all components that create raid device */
- disks_raid_configure();
- config_unlock();
- write_config();
- }
- $savemsg = get_std_save_message($retval);
- if ($retval == 0) {
- if (file_exists($d_raidconfdirty_path))
- unlink($d_raidconfdirty_path);
- }
- }
-}
-
-if ($_GET['act'] == "del") {
- if ($a_raid[$_GET['id']]) {
- $raidname=$a_raid[$_GET['id']]['name'];
- disks_raid_gvinum_delete($raidname);
- unset($a_raid[$_GET['id']]);
- write_config();
- pfSenseHeader("disks_raid_gvinum.php");
- exit;
- }
+ if ($_POST['apply']) {
+ $retval = 0;
+ if (!file_exists($d_sysrebootreqd_path))
+ {
+ config_lock();
+ /* reload all components that create raid device */
+ disks_raid_gvinum_configure();
+ config_unlock();
+ write_config();
+ }
+ $savemsg = get_std_save_message($retval);
+ if ($retval == 0) {
+ if (file_exists($d_raidconfdirty_path))
+ unlink($d_raidconfdirty_path);
+ }
+ }
+ }
+
+ if ($_GET['act'] == "del") {
+ if ($a_raid[$_GET['id']]) {
+ $raidname=$a_raid[$_GET['id']]['name'];
+ disks_raid_gvinum_delete($raidname);
+ unset($a_raid[$_GET['id']]);
+ write_config();
+ touch($d_raidconfdirty_path);
+ pfSenseHeader("disks_raid_gvinum.php");
+ exit;
+ }
}
include("head.inc");
@@ -122,82 +131,85 @@ echo $pfSenseHead->getHTML();
<tr>
<td class="tabnavtbl">
<?php
- $tab_array = array();
- $tab_array[0] = array(gettext("Geom Mirror"), false, "disks_raid_gmirror.php");
- $tab_array[1] = array(gettext("Geom Vinum (unstable)"), true, "disks_raid_gvinum.php");
- display_top_tabs($tab_array);
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Geom Mirror"), false, "disks_raid_gmirror.php");
+ $tab_array[1] = array(gettext("Geom Concat"), false, "disks_raid_gconcat.php");
+ $tab_array[2] = array(gettext("Geom Stripe"), false, "disks_raid_gstripe.php");
+ $tab_array[3] = array(gettext("Geom RAID5"), false, "disks_raid_graid5.php");
+ $tab_array[4] = array(gettext("Geom Vinum"), true, "disks_raid_gvinum.php");
+ display_top_tabs($tab_array);
?>
</td>
</tr>
<tr>
<td class="tabnavtbl">
<?php
- $tab_array = array();
- $tab_array[0] = array(gettext("Manage RAID"), true, "disks_raid_gvinum.php");
- $tab_array[1] = array(gettext("Format RAID"), false, "disks_raid_gvinum_init.php");
- $tab_array[2] = array(gettext("Tools"), false, "disks_raid_gvinum_tools.php");
- $tab_array[3] = array(gettext("Information"), false, "disks_raid_gvinum_infos.php");
- display_top_tabs($tab_array);
-?>
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Manage RAID"), true, "disks_raid_gvinum.php");
+ /* $tab_array[1] = array(gettext("Format RAID"), false, "disks_raid_gmirror_init.php"); */
+ $tab_array[1] = array(gettext("Tools"), false, "disks_raid_gvinum_tools.php");
+ $tab_array[2] = array(gettext("Information"), false, "disks_raid_gvinum_infos.php");
+ display_top_tabs($tab_array);
+?>
</td>
</tr>
<tr>
<td>
- <div id="mainarea">
+ <div id="mainarea">
<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
- <td class="listhdrr"><?=gettext("Volume name");?></td>
- <td class="listhdrr"><?=gettext("Type");?></td>
+ <td class="listhdrr"><?=gettext("Volume name");?></td>
+ <td class="listhdrr"><?=gettext("Type");?></td>
<td class="listhdrr"><?=gettext("Size");?></td>
<td class="listhdrr"><?=gettext("Status");?></td>
- <td class="list">&nbsp;</td>
+ <td class="list">&nbsp;</td>
</tr>
<?php $i = 0; foreach ($a_raid as $raid): ?>
<tr>
- <td valign="middle" class="listr">
+ <td valign="middle" class="listr">
<?=htmlspecialchars($raid['name']);?>
- </td>
- <td valign="middle" class="listr">
+ </td>
+ <td valign="middle" class="listr">
<?=htmlspecialchars($raid['type']);?>
- </td>
- <td valign="middle" class="listr">
+ </td>
+ <td valign="middle" class="listr">
<?php
- $raidconfiguring = file_exists($d_raidconfdirty_path) &&
+ $raidconfiguring = file_exists($d_raidconfdirty_path) &&
in_array($raid['name']."\n",file($d_raidconfdirty_path));
if ($raidconfiguring)
- echo gettext("configuring");
- else {
- $tempo=$raid['name'];
- echo "{$raidstatus[$tempo]['size']}";
- }
+ echo gettext("configuring");
+ else {
+ $tempo=$raid['name'];
+ echo "{$raidstatus[$tempo]['size']}";
+ }
?>&nbsp;
- </td>
- <td valign="middle" class="listr">
+ </td>
+ <td valign="middle" class="listr">
<?php
if ($raidconfiguring)
- echo "_CONFIGURING";
- else {
- echo "{$raidstatus[$tempo]['desc']}";
- }
- ?>&nbsp;
- </td>
- <td valign="middle" class="list">
+ echo "_CONFIGURING";
+ else {
+ echo "{$raidstatus[$tempo]['desc']}";
+ }
+ ?>&nbsp;
+ </td>
+ <td valign="middle" class="list">
<a href="disks_raid_gvinum_edit.php?id=<?=$i;?>">
<img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" title="<?=gettext("edit raid");?>" width="17" height="17" border="0" alt="" />
</a>
- <a href="disks_raid_gvinum.php?act=del&id=<?=$i;?>">
+ <a href="disks_raid_gvinum.php?act=del&id=<?=$i;?>">
<img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" title="<?=gettext("delete raid");?>" width="17" height="17" border="0" alt="" />
</a>
- </td>
+ </td>
</tr>
<?php $i++; endforeach; ?>
<tr>
- <td class="list" colspan="4"></td>
- <td class="list" nowrap>
- <a href="disks_raid_gvinum_edit.php">
+ <td class="list" colspan="4"></td>
+ <td class="list" nowrap>
+ <a href="disks_raid_gvinum_edit.php">
<img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" title="<?=gettext("add disk");?>" width="17" height="17" border="0" alt="" />
</a>
- </td>
+ </td>
</tr>
<tr>
<td align="left" valign="top" colspan="5">
@@ -215,7 +227,7 @@ echo $pfSenseHead->getHTML();
</table>
</div>
</td>
- </tr>
+ </tr>
</table>
</form>
<?php include("fend.inc"); ?>
diff --git a/packages/freenas/www/disks_raid_gvinum_edit.php b/packages/freenas/www/disks_raid_gvinum_edit.php
index b36baef3..e0245419 100644
--- a/packages/freenas/www/disks_raid_gvinum_edit.php
+++ b/packages/freenas/www/disks_raid_gvinum_edit.php
@@ -1,42 +1,50 @@
<?php
/* $Id$ */
+/* ========================================================================== */
/*
- disks_manage_edit.php
- part of FreeNAS (http://www.freenas.org)
- Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
- All rights reserved.
-
- Based on m0n0wall (http://m0n0.ch/wall)
- Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
+ disks_raid_gvinum_edit.php
+ part of pfSense (http://www.pfSense.com)
+ Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name>
+ All rights reserved.
+
+ Based on FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ All rights reserved.
+ */
+/* ========================================================================== */
+/*
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+/* ========================================================================== */
$pgtitle = array(gettext("System"),
gettext("Disks"),
gettext("GEOM Vinum"),
gettext("RAID"),
- gettext("Edit"));
+ isset($id) ? gettext("Edit") : gettext("Add"));
require_once("freenas_config.inc");
require_once("guiconfig.inc");
@@ -44,27 +52,28 @@ require_once("freenas_guiconfig.inc");
require_once("freenas_functions.inc");
if (!is_array($freenas_config['raid']['vdisk']))
- $freenas_config['raid']['vdisk'] = array();
+ $freenas_config['raid']['vdisk'] = array();
gvinum_sort();
+disks_sort();
-if (!is_array($freenas_config['disks']['disk']))
- $nodisk_errors[] = _DISKSRAIDEDITPHP_MSGADDDISKFIRST;
-else
- disks_sort();
-
-$a_raid = &$freenas_config['raid']['vdisk'];
-
-$a_disk = &$freenas_config['disks']['disk'];
+$a_raid = &$freenas_config['gvinum']['vdisk'];
+$a_disk = get_fstype_disks_list("softraid");
+$all_raid = array_merge((array)$freenas_config['graid5']['vdisk'],(array)$freenas_config['gmirror']['vdisk'],(array)$freenas_config['gvinum']['vdisk'],(array)$freenas_config['gstripe']['vdisk'],(array)$freenas_config['gconcat']['vdisk']);
$id = $_GET['id'];
if (isset($_POST['id']))
- $id = $_POST['id'];
+ $id = $_POST['id'];
+
+if (!sizeof($a_disk)) {
+ $nodisk_errors[] = gettext("You must add disks first.");
+}
if (isset($id) && $a_raid[$id]) {
- $pconfig['name'] = $a_raid[$id]['name'];
- $pconfig['type'] = $a_raid[$id]['type'];
- $pconfig['diskr'] = $a_raid[$id]['diskr'];
+ $pconfig['name'] = $a_raid[$id]['name'];
+ $pconfig['fullname'] = $a_raid[$id]['fullname'];
+ $pconfig['type'] = $a_raid[$id]['type'];
+ $pconfig['diskr'] = $a_raid[$id]['diskr'];
}
if (! empty($_POST))
@@ -73,54 +82,52 @@ if (! empty($_POST))
unset($error_bucket);
/* simple error list */
unset($input_errors);
-
- $reqdfields = explode(" ", "name type");
- $reqdfieldsn = explode(",", "Name,Type");
-
- do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
- if (($_POST['name'] && !is_validaliasname($_POST['name'])))
- {
+ $reqdfields = explode(" ", "name type");
+ $reqdfieldsn = explode(",", "Name,Type");
+
+ do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
+
+ if (($_POST['name'] && !is_validaliasname($_POST['name'])))
+ {
$error_bucket[] = array("error" => gettext("The device name may only consist of the characters a-z, A-Z, 0-9."),
"field" => "name");
- }
-
- /* check for name conflicts */
- foreach ($a_raid as $raid)
- {
- if (isset($id) && ($a_raid[$id]) && ($a_raid[$id] === $raid))
- continue;
-
- if ($raid['name'] == $_POST['name'])
- {
+ }
+
+ /* check for name conflicts */
+ foreach ($a_raid as $raid)
+ {
+ if (isset($id) && ($a_raid[$id]) && ($a_raid[$id] === $raid))
+ continue;
+
+ if ($raid['name'] == $_POST['name'])
+ {
$error_bucket[] = array("error" => gettext("This device already exists in the raid volume list."),
"field" => "name");
- break;
- }
- }
-
- /* check the number of RAID disk for volume */
-
- /* check the number of RAID disk for volume */
-
- switch ($_POST['type'])
- {
- case 0:
- if (count($_POST['diskr']) < 2)
+ break;
+ }
+ }
+
+ /* check the number of RAID disk for volume */
+
+ switch ($_POST['type'])
+ {
+ case 0:
+ if (count($_POST['diskr']) < 2)
$error_bucket[] = array("error" => gettext("There must be a minimum of 2 disks in a RAID 0 volume."),
"field" => "diskr");
- break;
- case 1:
- if (count($_POST['diskr']) != 2)
+ break;
+ case 1:
+ if (count($_POST['diskr']) != 2)
$error_bucket[] = array("error" => gettext("There must be 2 disks in a RAID 1 volume."),
"field" => "diskr");
- break;
- case 5:
- if (count($_POST['diskr']) < 3)
+ break;
+ case 5:
+ if (count($_POST['diskr']) < 3)
$error_bucket[] = array("error" => gettext("There must be a minimum of 3 disks in a RAID 5 volume."),
"field" => "diskr");
- break;
- }
+ break;
+ }
if (is_array($error_bucket))
foreach($error_bucket as $elem)
@@ -132,31 +139,32 @@ if (! empty($_POST))
exit;
}
- if (!$input_errors) {
- $raid = array();
- $raid['name'] = $_POST['name'];
- $raid['type'] = $_POST['type'];
- $raid['diskr'] = $_POST['diskr'];
- $raid['desc'] = "Software RAID {$_POST['type']}";
-
- if (isset($id) && $a_raid[$id])
- $a_raid[$id] = $raid;
- else
- $a_raid[] = $raid;
-
- $fd = @fopen("$d_raidconfdirty_path", "a");
- if (!$fd) {
- echo "_DISKSRAIDEDITPHP_MSGERROR";
- exit(0);
- }
- fwrite($fd, "$raid[name]\n");
- fclose($fd);
-
- write_config();
-
- pfSenseHeader("disks_raid_gvinum.php");
- exit;
- }
+ if (!$input_errors) {
+ $raid = array();
+ $raid['name'] = $_POST['name'];
+ $raid['type'] = $_POST['type'];
+ $raid['diskr'] = $_POST['diskr'];
+ $raid['desc'] = "Software gvinum RAID {$_POST['type']}";
+ $raid['fullname'] = "/dev/gvinum/{$raid['name']}";
+
+ if (isset($id) && $a_raid[$id])
+ $a_raid[$id] = $raid;
+ else
+ $a_raid[] = $raid;
+
+ $fd = @fopen("$d_raidconfdirty_path", "a");
+ if (!$fd) {
+ echo gettext("ERR Could not save RAID configuration.\n");
+ exit(0);
+ }
+ fwrite($fd, "$raid[name]\n");
+ fclose($fd);
+
+ write_config();
+
+ pfSenseHeader("disks_raid_gvinum.php");
+ exit;
+ }
}
include("head.inc");
@@ -176,23 +184,26 @@ echo $pfSenseHead->getHTML();
<tr>
<td class="tabnavtbl">
<?php
- $tab_array = array();
- $tab_array[0] = array(gettext("Geom Mirror"), false, "disks_raid_gmirror.php");
- $tab_array[1] = array(gettext("Geom Vinum (unstable)"), true, "disks_raid_gvinum.php");
- display_top_tabs($tab_array);
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Geom Mirror"), false, "disks_raid_gmirror.php");
+ $tab_array[1] = array(gettext("Geom Concat"), false, "disks_raid_gconcat.php");
+ $tab_array[2] = array(gettext("Geom Stripe"), false, "disks_raid_gstripe.php");
+ $tab_array[3] = array(gettext("Geom RAID5"), false, "disks_raid_graid5.php");
+ $tab_array[4] = array(gettext("Geom Vinum"), true, "disks_raid_gvinum.php");
+ display_top_tabs($tab_array);
?>
</td>
</tr>
<tr>
<td class="tabnavtbl">
<?php
- $tab_array = array();
- $tab_array[0] = array(gettext("Manage RAID"), true, "disks_raid_gvinum.php");
- $tab_array[1] = array(gettext("Format RAID"), false, "disks_raid_gvinum_init.php");
- $tab_array[2] = array(gettext("Tools"), false, "disks_raid_gvinum_tools.php");
- $tab_array[3] = array(gettext("Information"), false, "disks_raid_gvinum_infos.php");
- display_top_tabs($tab_array);
-?>
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Manage RAID"), true, "disks_raid_gvinum.php");
+ /* $tab_array[1] = array(gettext("Format RAID"), false, "disks_raid_gmirror_init.php"); */
+ $tab_array[1] = array(gettext("Tools"), false, "disks_raid_gvinum_tools.php");
+ $tab_array[2] = array(gettext("Information"), false, "disks_raid_gvinum_infos.php");
+ display_top_tabs($tab_array);
+?>
</td>
</tr>
<tr>
@@ -201,7 +212,7 @@ echo $pfSenseHead->getHTML();
<form action="disks_raid_gvinum_edit.php" method="post" name="iform" id="iform">
<table class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0">
<tr>
- <td width="22%" valign="top" class="vncellreq"><?=gettext("Volume name");?></td>
+ <td width="22%" valign="top" class="vncellreq"><?=gettext("Raid name");?></td>
<td width="78%" class="vtable">
<input name="name" type="text" class="formfld unknown" id="name" size="20" value="<?=htmlspecialchars($pconfig['name']);?>" />
</td>
@@ -213,7 +224,6 @@ echo $pfSenseHead->getHTML();
<option value="0" <?php if ($pconfig['type'] == 0) echo "selected=\"selected\""; ?>>RAID 0 (<?= gettext("striping"); ?>)</option>
<option value="1" <?php if ($pconfig['type'] == 1) echo "selected=\"selected\""; ?>>RAID 1 (<?= gettext("mirroring"); ?>)</option>
<option value="5" <?php if ($pconfig['type'] == 5) echo "selected=\"selected\""; ?>>RAID 5 (<?= gettext("rotated block-interleaved parity"); ?>)</option>
-
</select>
</td>
</tr>
@@ -228,7 +238,7 @@ echo $pfSenseHead->getHTML();
$r_name="";
if (strcmp($diskv['fstype'],"raid")==0) {
- foreach($a_raid as $raid) {
+ foreach($all_raid as $raid) {
if (in_array($diskv['name'],$raid['diskr'])) {
$r_name=$raid['name'];
diff --git a/packages/freenas/www/disks_raid_gvinum_infos.php b/packages/freenas/www/disks_raid_gvinum_infos.php
index 329c1de1..71a424fa 100644
--- a/packages/freenas/www/disks_raid_gvinum_infos.php
+++ b/packages/freenas/www/disks_raid_gvinum_infos.php
@@ -1,36 +1,44 @@
<?php
/* $Id$ */
+/* ========================================================================== */
/*
- disks_manage_edit.php
- part of FreeNAS (http://www.freenas.org)
- Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
- All rights reserved.
-
- Based on m0n0wall (http://m0n0.ch/wall)
- Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
+ disks_raid_gvinum_infos.php
+ part of pfSense (http://www.pfSense.com)
+ Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name>
+ All rights reserved.
+
+ Based on FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ All rights reserved.
+ */
+/* ========================================================================== */
+/*
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+/* ========================================================================== */
$pgtitle = array(gettext("System"),
gettext("Disks"),
@@ -59,8 +67,8 @@ if (! empty($_POST))
exit;
}
- if (!$input_errors) {
- }
+ if (!$input_errors) {
+ }
}
if (!isset($do_action)) {
}
@@ -82,23 +90,26 @@ echo $pfSenseHead->getHTML();
<tr>
<td class="tabnavtbl">
<?php
- $tab_array = array();
- $tab_array[0] = array(gettext("Geom Mirror"), false, "disks_raid_gmirror.php");
- $tab_array[1] = array(gettext("Geom Vinum (unstable)"), true, "disks_raid_gvinum.php");
- display_top_tabs($tab_array);
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Geom Mirror"), false, "disks_raid_gmirror.php");
+ $tab_array[1] = array(gettext("Geom Concat"), false, "disks_raid_gconcat.php");
+ $tab_array[2] = array(gettext("Geom Stripe"), false, "disks_raid_gstripe.php");
+ $tab_array[3] = array(gettext("Geom RAID5"), false, "disks_raid_graid5.php");
+ $tab_array[4] = array(gettext("Geom Vinum"), true, "disks_raid_gvinum.php");
+ display_top_tabs($tab_array);
?>
</td>
</tr>
<tr>
<td class="tabnavtbl">
<?php
- $tab_array = array();
- $tab_array[0] = array(gettext("Manage RAID"), false, "disks_raid_gvinum.php");
- $tab_array[1] = array(gettext("Format RAID"), false, "disks_raid_gvinum_init.php");
- $tab_array[2] = array(gettext("Tools"), false, "disks_raid_gvinum_tools.php");
- $tab_array[3] = array(gettext("Information"), true, "disks_raid_gvinum_infos.php");
- display_top_tabs($tab_array);
-?>
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Manage RAID"), false, "disks_raid_gvinum.php");
+ /* $tab_array[1] = array(gettext("Format RAID"), false, "disks_raid_gmirror_init.php"); */
+ $tab_array[1] = array(gettext("Tools"), false, "disks_raid_gvinum_tools.php");
+ $tab_array[2] = array(gettext("Information"), true, "disks_raid_gvinum_infos.php");
+ display_top_tabs($tab_array);
+?>
</td>
</tr>
<tr>
@@ -126,7 +137,7 @@ echo $pfSenseHead->getHTML();
</form>
</div>
</td>
- </tr>
+ </tr>
</table>
<?php include("fend.inc"); ?>
</body>
diff --git a/packages/freenas/www/disks_raid_gvinum_init.php b/packages/freenas/www/disks_raid_gvinum_init.php
index 46c4b4ef..787c416e 100644
--- a/packages/freenas/www/disks_raid_gvinum_init.php
+++ b/packages/freenas/www/disks_raid_gvinum_init.php
@@ -1,36 +1,47 @@
<?php
/* $Id$ */
/*
- disks_manage_edit.php
- part of FreeNAS (http://www.freenas.org)
- Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
- All rights reserved.
-
- Based on m0n0wall (http://m0n0.ch/wall)
- Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
+ disks_raid_gmirror_init.php
+ part of pfSense (http://www.pfSense.com)
+ Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name>
+ All rights reserved.
+
+ Based on FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ All rights reserved.
+ */
+/* ========================================================================== */
+/*
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+/* ========================================================================== */
+
+/* ========================================================================== */
+/* == T H I S F I L E I S C U R R E N T L Y N O T U S E D == */
+/* ========================================================================== */
$pgtitle = array(gettext("System"),
gettext("Disks"),
diff --git a/packages/freenas/www/disks_raid_gvinum_tools.php b/packages/freenas/www/disks_raid_gvinum_tools.php
index 3fb336f8..343fc221 100644
--- a/packages/freenas/www/disks_raid_gvinum_tools.php
+++ b/packages/freenas/www/disks_raid_gvinum_tools.php
@@ -1,36 +1,44 @@
<?php
/* $Id$ */
+/* ========================================================================== */
/*
- disks_manage_edit.php
- part of FreeNAS (http://www.freenas.org)
- Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
- All rights reserved.
-
- Based on m0n0wall (http://m0n0.ch/wall)
- Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
+ disks_raid_gvinum_tools.php
+ part of pfSense (http://www.pfSense.com)
+ Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name>
+ All rights reserved.
+
+ Based on FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ All rights reserved.
+ */
+/* ========================================================================== */
+/*
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+/* ========================================================================== */
$pgtitle = array(gettext("System"),
gettext("Disks"),
@@ -48,11 +56,12 @@ if (! empty($_POST))
unset($error_bucket);
/* simple error list */
unset($input_errors);
-
- $reqdfields = explode(" ", "action object");
- $reqdfieldsn = explode(",", "Action,Object");
+ unset($do_action);
- do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
+ $reqdfields = explode(" ", "action object");
+ $reqdfieldsn = explode(",", "Action,Object");
+
+ do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
if (is_array($error_bucket))
foreach($error_bucket as $elem)
@@ -64,16 +73,16 @@ if (! empty($_POST))
exit;
}
- if (!$input_errors) {
- $do_action = true;
- $action = $_POST['action'];
- $object = $_POST['object'];
- }
-}
-if (!isset($do_action)) {
- $do_action = false;
- $action = '';
- $object = '';
+ if (!$input_errors) {
+ $do_action = true;
+ $action = $_POST['action'];
+ $object = $_POST['object'];
+ }
+ }
+ if (!isset($do_action)) {
+ $do_action = false;
+ $action = '';
+ $object = '';
}
include("head.inc");
@@ -93,23 +102,26 @@ echo $pfSenseHead->getHTML();
<tr>
<td class="tabnavtbl">
<?php
- $tab_array = array();
- $tab_array[0] = array(gettext("Geom Mirror"), false, "disks_raid_gmirror.php");
- $tab_array[1] = array(gettext("Geom Vinum (unstable)"), true, "disks_raid_gvinum.php");
- display_top_tabs($tab_array);
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Geom Mirror"), false, "disks_raid_gmirror.php");
+ $tab_array[1] = array(gettext("Geom Concat"), false, "disks_raid_gconcat.php");
+ $tab_array[2] = array(gettext("Geom Stripe"), false, "disks_raid_gstripe.php");
+ $tab_array[3] = array(gettext("Geom RAID5"), false, "disks_raid_graid5.php");
+ $tab_array[4] = array(gettext("Geom Vinum"), true, "disks_raid_gvinum.php");
+ display_top_tabs($tab_array);
?>
</td>
</tr>
<tr>
<td class="tabnavtbl">
<?php
- $tab_array = array();
- $tab_array[0] = array(gettext("Manage RAID"), false, "disks_raid_gvinum.php");
- $tab_array[1] = array(gettext("Format RAID"), false, "disks_raid_gvinum_init.php");
- $tab_array[2] = array(gettext("Tools"), true, "disks_raid_gvinum_tools.php");
- $tab_array[3] = array(gettext("Information"), false, "disks_raid_gvinum_infos.php");
- display_top_tabs($tab_array);
-?>
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Manage RAID"), false, "disks_raid_gvinum.php");
+ /* $tab_array[1] = array(gettext("Format RAID"), false, "disks_raid_gmirror_init.php"); */
+ $tab_array[1] = array(gettext("Tools"), true, "disks_raid_gvinum_tools.php");
+ $tab_array[2] = array(gettext("Information"), false, "disks_raid_gvinum_infos.php");
+ display_top_tabs($tab_array);
+?>
</td>
</tr>
<tr>
@@ -145,47 +157,47 @@ echo $pfSenseHead->getHTML();
<?php endif; ?>
</td>
</tr>
- <tr>
- <td valign="top" colspan="2">
- <?
+ <tr>
+ <td valign="top" colspan="2">
+ <?
if ($do_action) {
- echo("<strong>" . gettext("GVINUM command output:") . "</strong><br />");
- echo('<pre>');
- ob_end_flush();
-
- switch ($action)
- {
- case "remove":
- /* Remove recursivly object */
- system("/sbin/gvinum rm -r " . escapeshellarg($object));
- break;
- case "start":
- /* Start object */
- system("/sbin/gvinum start " . escapeshellarg($object));
- break;
- case "rebuild":
- /* Rebuild RAID 5 parity */
- system("/sbin/gvinum rebuildparity " . escapeshellarg($object));
- break;
- case "list":
- /* Disaply a detailed list of object */
- system("/sbin/gvinum list " . escapeshellarg($object));
- break;
- case "forceup":
- /* Force object state up */
- system("/sbin/gvinum setstate -f up " . escapeshellarg($object));
- break;
- case "saveconfig":
- /* Save config */
- system("/sbin/gvinum saveconfig");
- break;
- }
-
- echo('</pre>');
- }
- ?>
- </td>
- </tr>
+ echo("<strong>" . gettext("GVINUM command output:") . "</strong><br />");
+ echo('<pre>');
+ ob_end_flush();
+
+ switch ($action)
+ {
+ case "remove":
+ /* Remove recursivly object */
+ system("/sbin/gvinum rm -r " . escapeshellarg($object));
+ break;
+ case "start":
+ /* Start object */
+ system("/sbin/gvinum start " . escapeshellarg($object));
+ break;
+ case "rebuild":
+ /* Rebuild RAID 5 parity */
+ system("/sbin/gvinum rebuildparity " . escapeshellarg($object));
+ break;
+ case "list":
+ /* Disaply a detailed list of object */
+ system("/sbin/gvinum list " . escapeshellarg($object));
+ break;
+ case "forceup":
+ /* Force object state up */
+ system("/sbin/gvinum setstate -f up " . escapeshellarg($object));
+ break;
+ case "saveconfig":
+ /* Save config */
+ system("/sbin/gvinum saveconfig");
+ break;
+ }
+
+ echo('</pre>');
+ }
+ ?>
+ </td>
+ </tr>
<tr>
<td align="left" valign="top" colspan="2">
<span class="red">
@@ -201,7 +213,7 @@ echo $pfSenseHead->getHTML();
</form>
</div>
</td>
- </tr>
+ </tr>
</table>
<?php include("fend.inc"); ?>
</body>
diff --git a/packages/freenas/www/services_afp.php b/packages/freenas/www/services_afp.php
index 07410ded..2487c6f7 100644
--- a/packages/freenas/www/services_afp.php
+++ b/packages/freenas/www/services_afp.php
@@ -1,36 +1,44 @@
<?php
/* $Id$ */
+/* ========================================================================== */
/*
- disks_manage_edit.php
- part of FreeNAS (http://www.freenas.org)
- Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
- All rights reserved.
-
- Based on m0n0wall (http://m0n0.ch/wall)
- Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
+ services_afp.php
+ part of pfSense (http://www.pfSense.com)
+ Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name>
+ All rights reserved.
+
+ Based on FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ All rights reserved.
+ */
+/* ========================================================================== */
+/*
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+/* ========================================================================== */
$pgtitle = array(gettext("Services"),
gettext("AFP"));
@@ -41,7 +49,7 @@ require_once("freenas_guiconfig.inc");
require_once("freenas_functions.inc");
if (!is_array($freenas_config['afp'])) {
- $freenas_config['afp'] = array();
+ $freenas_config['afp'] = array();
}
@@ -57,26 +65,26 @@ if (! empty($_POST))
/* simple error list */
unset($input_errors);
$pconfig = $_POST;
-
+
/* input validation */
$reqdfields = split(" ", "afpname");
$reqdfieldsn = split(",", "Afpname");
-
+
do_input_validation_new($_POST, $reqdfields, $reqdfieldsn, &$error_bucket);
-
- if ($_POST['enable'] && !$_POST['guest'])
- {
- if (!$_POST['local'])
+
+ if ($_POST['enable'] && !$_POST['guest'])
+ {
+ if (!$_POST['local'])
$error_bucket[] = array("error" => gettext("You must select at least one authentication method."),
"field" => "local");
- }
- if ($_POST['enable'] && !$_POST['local'])
- {
- if (!$_POST['guest'])
+ }
+ if ($_POST['enable'] && !$_POST['local'])
+ {
+ if (!$_POST['guest'])
$error_bucket[] = array("error" => gettext("You must select at least one authentication method."),
"field" => "name");
- }
-
+ }
+
if (is_array($error_bucket))
foreach($error_bucket as $elem)
$input_errors[] =& $elem["error"];
@@ -87,27 +95,27 @@ if (! empty($_POST))
exit;
}
- if (!$input_errors)
- {
- $freenas_config['afp']['enable'] = $_POST['enable'] ? true : false;
- $freenas_config['afp']['guest'] = $_POST['guest'] ? true : false;
- $freenas_config['afp']['local'] = $_POST['local'] ? true : false;
- $freenas_config['afp']['afpname'] = $_POST['afpname'];
-
- write_config();
-
- $retval = 0;
- if (!file_exists($d_sysrebootreqd_path))
- {
- /* nuke the cache file */
- config_lock();
- services_afpd_configure();
- services_zeroconf_configure();
- config_unlock();
- }
+ if (!$input_errors)
+ {
+ $freenas_config['afp']['enable'] = $_POST['enable'] ? true : false;
+ $freenas_config['afp']['guest'] = $_POST['guest'] ? true : false;
+ $freenas_config['afp']['local'] = $_POST['local'] ? true : false;
+ $freenas_config['afp']['afpname'] = $_POST['afpname'];
+
+ write_config();
- $savemsg = get_std_save_message($retval);
- }
+ $retval = 0;
+ if (!file_exists($d_sysrebootreqd_path))
+ {
+ /* nuke the cache file */
+ config_lock();
+ services_afpd_configure();
+ services_zeroconf_configure();
+ config_unlock();
+ }
+
+ $savemsg = get_std_save_message($retval);
+ }
}
include("head.inc");
@@ -118,13 +126,13 @@ $jscriptstr = <<<EOD
<script type="text/javascript">
<!--
function enable_change(enable_change) {
- var endis;
-
- endis = !(document.iform.enable.checked || enable_change);
+ var endis;
+
+ endis = !(document.iform.enable.checked || enable_change);
endis ? color = '#D4D0C8' : color = '#FFFFFF';
- document.iform.guest.disabled = endis;
- document.iform.local.disabled = endis;
+ document.iform.guest.disabled = endis;
+ document.iform.local.disabled = endis;
document.iform.afpname.disabled = endis;
/* color adjustments */
document.iform.guest.style.backgroundColor = color;
diff --git a/packages/freenas/www/services_ftp.php b/packages/freenas/www/services_ftp.php
index f70db631..e096befb 100644
--- a/packages/freenas/www/services_ftp.php
+++ b/packages/freenas/www/services_ftp.php
@@ -1,36 +1,44 @@
<?php
/* $Id$ */
+/* ========================================================================== */
/*
- disks_manage_edit.php
- part of FreeNAS (http://www.freenas.org)
- Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
- All rights reserved.
-
- Based on m0n0wall (http://m0n0.ch/wall)
- Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
+ services_ftp.php
+ part of pfSense (http://www.pfSense.com)
+ Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name>
+ All rights reserved.
+
+ Based on FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ All rights reserved.
+ */
+/* ========================================================================== */
+/*
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+/* ========================================================================== */
$pgtitle = array(gettext("Services"),
gettext("FTP"));
@@ -42,8 +50,7 @@ require_once("freenas_functions.inc");
if (!is_array($freenas_config['ftp']))
{
- $freenas_config['ftp'] = array();
-
+ $freenas_config['ftp'] = array();
}
$pconfig['enable'] = isset($freenas_config['ftp']['enable']);
@@ -69,70 +76,70 @@ if (! empty($_POST))
/* simple error list */
unset($input_errors);
$pconfig = $_POST;
-
+
/* input validation */
- if ($_POST['enable']) {
- $reqdfields = array_merge($reqdfields, explode(" ", "numberclients maxconperip timeout port"));
- $reqdfieldsn = array_merge($reqdfieldsn, explode(",", "Numberclients,Maxconperip,Timeout,Port"));
- }
-
- do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
-
- if ($_POST['enable'] && !is_port($_POST['port']))
- {
+ if ($_POST['enable']) {
+ $reqdfields = array_merge($reqdfields, explode(" ", "numberclients maxconperip timeout port"));
+ $reqdfieldsn = array_merge($reqdfieldsn, explode(",", "Numberclients,Maxconperip,Timeout,Port"));
+ }
+
+ do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
+
+ if ($_POST['enable'] && !is_port($_POST['port']))
+ {
$error_bucket[] = array("error" => gettext("The TCP port must be a valid port number."),
"field" => "port");
- }
- if ($_POST['enable'] && !is_numericint($_POST['numberclients'])) {
+ }
+ if ($_POST['enable'] && !is_numericint($_POST['numberclients'])) {
$error_bucket[] = array("error" => gettext("The maximum Number of client must be a number."),
"field" => "numberclients");
- }
-
- if ($_POST['enable'] && !is_numericint($_POST['maxconperip'])) {
+ }
+
+ if ($_POST['enable'] && !is_numericint($_POST['maxconperip'])) {
$error_bucket[] = array("error" => gettext("The max con per ip must be a number."),
"field" => "maxconperip");
- }
- if ($_POST['enable'] && !is_numericint($_POST['timeout'])) {
+ }
+ if ($_POST['enable'] && !is_numericint($_POST['timeout'])) {
$error_bucket[] = array("error" => gettext("The maximum idle time be a number."),
"field" => "timeout");
- }
-
- if ($_POST['enable'] && ($_POST['pasv_address']))
- {
- if (!is_ipaddr($_POST['pasv_address']))
+ }
+
+ if ($_POST['enable'] && ($_POST['pasv_address']))
+ {
+ if (!is_ipaddr($_POST['pasv_address']))
$error_bucket[] = array("error" => gettext("The pasv address must be a public IP address."),
"field" => "pasv_address");
-
- }
-
- if ($_POST['enable'] && ($_POST['pasv_max_port']))
- {
- if (!is_port($_POST['pasv_max_port']))
+
+ }
+
+ if ($_POST['enable'] && ($_POST['pasv_max_port']))
+ {
+ if (!is_port($_POST['pasv_max_port']))
$error_bucket[] = array("error" => gettext("The pasv_max_port port must be a valid port number."),
"field" => "pasv_max_port");
- }
-
- if ($_POST['enable'] && ($_POST['pasv_min_port']))
- {
- if (!is_port($_POST['pasv_min_port']))
+ }
+
+ if ($_POST['enable'] && ($_POST['pasv_min_port']))
+ {
+ if (!is_port($_POST['pasv_min_port']))
$error_bucket[] = array("error" => gettext("The pasv_min_port port must be a valid port number."),
"field" => "pasv_min_port");
-
- }
-
- if (($_POST['passiveip'] && !is_ipaddr($_POST['passiveip']))) {
+
+ }
+
+ if (($_POST['passiveip'] && !is_ipaddr($_POST['passiveip']))) {
$error_bucket[] = array("error" => gettext("A valid IP address must be specified."),
"field" => "passiveip");
-
- }
-
- if (!($_POST['anonymous']) && !($_POST['localuser'])) {
- $input_errors[] = _SRVFTP_MSGVALIDAUTH;
+
+ }
+
+ if (!($_POST['anonymous']) && !($_POST['localuser'])) {
+ $input_errors[] = _SRVFTP_MSGVALIDAUTH;
$error_bucket[] = array("error" => gettext("You must select at minium anonymous or/and local user authentication."),
"field" => "localuser");
-
- }
-
+
+ }
+
if (is_array($error_bucket))
foreach($error_bucket as $elem)
$input_errors[] =& $elem["error"];
@@ -143,36 +150,36 @@ if (! empty($_POST))
exit;
}
- if (!$input_errors)
- {
- $freenas_config['ftp']['numberclients'] = $_POST['numberclients'];
- $freenas_config['ftp']['maxconperip'] = $_POST['maxconperip'];
- $freenas_config['ftp']['timeout'] = $_POST['timeout'];
- $freenas_config['ftp']['port'] = $_POST['port'];
- $freenas_config['ftp']['authentication_backend'] = $_POST['authbackend'];
- $freenas_config['ftp']['anonymous'] = $_POST['anonymous'] ? true : false;
- $freenas_config['ftp']['localuser'] = $_POST['localuser'] ? true : false;
- $freenas_config['ftp']['pasv_max_port'] = $_POST['pasv_max_port'];
- $freenas_config['ftp']['pasv_min_port'] = $_POST['pasv_min_port'];
- $freenas_config['ftp']['pasv_address'] = $_POST['pasv_address'];
- $freenas_config['ftp']['banner'] = $_POST['banner'];
- $freenas_config['ftp']['passiveip'] = $_POST['passiveip'];
- $freenas_config['ftp']['fxp'] = $_POST['fxp'] ? true : false;
- $freenas_config['ftp']['natmode'] = $_POST['natmode'] ? true : false;
- $freenas_config['ftp']['enable'] = $_POST['enable'] ? true : false;
-
- write_config();
-
- $retval = 0;
- if (!file_exists($d_sysrebootreqd_path)) {
- /* nuke the cache file */
- config_lock();
- services_wzdftpd_configure();
- services_zeroconf_configure();
- config_unlock();
- }
- $savemsg = get_std_save_message($retval);
- }
+ if (!$input_errors)
+ {
+ $freenas_config['ftp']['numberclients'] = $_POST['numberclients'];
+ $freenas_config['ftp']['maxconperip'] = $_POST['maxconperip'];
+ $freenas_config['ftp']['timeout'] = $_POST['timeout'];
+ $freenas_config['ftp']['port'] = $_POST['port'];
+ $freenas_config['ftp']['authentication_backend'] = $_POST['authbackend'];
+ $freenas_config['ftp']['anonymous'] = $_POST['anonymous'] ? true : false;
+ $freenas_config['ftp']['localuser'] = $_POST['localuser'] ? true : false;
+ $freenas_config['ftp']['pasv_max_port'] = $_POST['pasv_max_port'];
+ $freenas_config['ftp']['pasv_min_port'] = $_POST['pasv_min_port'];
+ $freenas_config['ftp']['pasv_address'] = $_POST['pasv_address'];
+ $freenas_config['ftp']['banner'] = $_POST['banner'];
+ $freenas_config['ftp']['passiveip'] = $_POST['passiveip'];
+ $freenas_config['ftp']['fxp'] = $_POST['fxp'] ? true : false;
+ $freenas_config['ftp']['natmode'] = $_POST['natmode'] ? true : false;
+ $freenas_config['ftp']['enable'] = $_POST['enable'] ? true : false;
+
+ write_config();
+
+ $retval = 0;
+ if (!file_exists($d_sysrebootreqd_path)) {
+ /* nuke the cache file */
+ config_lock();
+ services_wzdftpd_configure();
+ services_zeroconf_configure();
+ config_unlock();
+ }
+ $savemsg = get_std_save_message($retval);
+ }
}
include("head.inc");
@@ -183,36 +190,36 @@ $jscriptstr = <<<EOD
<script type="text/javascript">
<!--
function enable_change(enable_change) {
- var endis;
-
- endis = !(document.iform.enable.checked || enable_change);
+ var endis;
+
+ endis = !(document.iform.enable.checked || enable_change);
endis ? color = '#D4D0C8' : color = '#FFFFFF';
-
- document.iform.port.disabled = endis;
- document.iform.timeout.disabled = endis;
- document.iform.numberclients.disabled = endis;
- document.iform.maxconperip.disabled = endis;
- document.iform.anonymous.disabled = endis;
- document.iform.localuser.disabled = endis;
- document.iform.banner.disabled = endis;
- document.iform.fxp.disabled = endis;
- document.iform.natmode.disabled = endis;
- document.iform.passiveip.disabled = endis;
- document.iform.pasv_max_port.disabled = endis;
- document.iform.pasv_min_port.disabled = endis;
+
+ document.iform.port.disabled = endis;
+ document.iform.timeout.disabled = endis;
+ document.iform.numberclients.disabled = endis;
+ document.iform.maxconperip.disabled = endis;
+ document.iform.anonymous.disabled = endis;
+ document.iform.localuser.disabled = endis;
+ document.iform.banner.disabled = endis;
+ document.iform.fxp.disabled = endis;
+ document.iform.natmode.disabled = endis;
+ document.iform.passiveip.disabled = endis;
+ document.iform.pasv_max_port.disabled = endis;
+ document.iform.pasv_min_port.disabled = endis;
/* color adjustments */
- document.iform.port.style.backgroundColor = color;
- document.iform.timeout.style.backgroundColor = color;
- document.iform.numberclients.style.backgroundColor = color;
- document.iform.maxconperip.style.backgroundColor = color;
- document.iform.anonymous.style.backgroundColor = color;
- document.iform.localuser.style.backgroundColor = color;
- document.iform.banner.style.backgroundColor = color;
- document.iform.fxp.style.backgroundColor = color;
- document.iform.natmode.style.backgroundColor = color;
- document.iform.passiveip.style.backgroundColor = color;
- document.iform.pasv_max_port.style.backgroundColor = color;
- document.iform.pasv_min_port.style.backgroundColor = color;
+ document.iform.port.style.backgroundColor = color;
+ document.iform.timeout.style.backgroundColor = color;
+ document.iform.numberclients.style.backgroundColor = color;
+ document.iform.maxconperip.style.backgroundColor = color;
+ document.iform.anonymous.style.backgroundColor = color;
+ document.iform.localuser.style.backgroundColor = color;
+ document.iform.banner.style.backgroundColor = color;
+ document.iform.fxp.style.backgroundColor = color;
+ document.iform.natmode.style.backgroundColor = color;
+ document.iform.passiveip.style.backgroundColor = color;
+ document.iform.pasv_max_port.style.backgroundColor = color;
+ document.iform.pasv_min_port.style.backgroundColor = color;
}
//-->
</script>
diff --git a/packages/freenas/www/services_nfs.php b/packages/freenas/www/services_nfs.php
index b99dd11e..70351bf1 100644
--- a/packages/freenas/www/services_nfs.php
+++ b/packages/freenas/www/services_nfs.php
@@ -1,36 +1,44 @@
<?php
/* $Id$ */
+/* ========================================================================== */
/*
- disks_manage_edit.php
- part of FreeNAS (http://www.freenas.org)
- Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
- All rights reserved.
-
- Based on m0n0wall (http://m0n0.ch/wall)
- Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
+ services_nfs.php
+ part of pfSense (http://www.pfSense.com)
+ Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name>
+ All rights reserved.
+
+ Based on FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ All rights reserved.
+ */
+/* ========================================================================== */
+/*
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+/* ========================================================================== */
$pgtitle = array(gettext("Services"),
gettext("NFS"));
@@ -42,14 +50,14 @@ require_once("freenas_functions.inc");
if (!is_array($freenas_config['nfs']))
{
- $freenas_config['nfs'] = array();
+ $freenas_config['nfs'] = array();
}
$pconfig['enable'] = isset($freenas_config['nfs']['enable']);
$pconfig['mapall'] = $freenas_config['nfs']['mapall'];
list($pconfig['network'],$pconfig['network_subnet']) =
- explode('/', $freenas_config['nfs']['nfsnetwork']);
+ explode('/', $freenas_config['nfs']['nfsnetwork']);
if (! empty($_POST))
{
@@ -58,26 +66,26 @@ if (! empty($_POST))
/* simple error list */
unset($input_errors);
$pconfig = $_POST;
-
+
/* input validation */
- $reqdfields = explode(" ", "network network_subnet");
- $reqdfieldsn = explode(",", "Destination network,Destination network bit count");
-
- do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
+ $reqdfields = explode(" ", "network network_subnet");
+ $reqdfieldsn = explode(",", "Destination network,Destination network bit count");
+
+ do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
- if (($_POST['network'] && !is_ipaddr($_POST['network']))) {
+ if (($_POST['network'] && !is_ipaddr($_POST['network']))) {
$error_bucket[] = array("error" => gettext("A valid network must be specified."),
"field" => "network");
- }
-
- if (($_POST['network_subnet'] && !is_numeric($_POST['network_subnet']))) {
+ }
+
+ if (($_POST['network_subnet'] && !is_numeric($_POST['network_subnet']))) {
$error_bucket[] = array("error" => gettext("A valid network bit count must be specified."),
"field" => "network_subnet");
-
- }
-
- $osn = gen_subnet($_POST['network'], $_POST['network_subnet']) . "/" . $_POST['network_subnet'];
-
+
+ }
+
+ $osn = gen_subnet($_POST['network'], $_POST['network_subnet']) . "/" . $_POST['network_subnet'];
+
if (is_array($error_bucket))
foreach($error_bucket as $elem)
$input_errors[] =& $elem["error"];
@@ -88,23 +96,23 @@ if (! empty($_POST))
exit;
}
- if (!$input_errors)
- {
- $freenas_config['nfs']['enable'] = $_POST['enable'] ? true : false;
- $freenas_config['nfs']['mapall'] = $_POST['mapall'];
- $freenas_config['nfs']['nfsnetwork'] = $osn;
- write_config();
-
- $retval = 0;
- if (!file_exists($d_sysrebootreqd_path))
- {
- /* nuke the cache file */
- config_lock();
- services_nfs_configure();
- config_unlock();
- }
- $savemsg = get_std_save_message($retval);
- }
+ if (!$input_errors)
+ {
+ $freenas_config['nfs']['enable'] = $_POST['enable'] ? true : false;
+ $freenas_config['nfs']['mapall'] = $_POST['mapall'];
+ $freenas_config['nfs']['nfsnetwork'] = $osn;
+ write_config();
+
+ $retval = 0;
+ if (!file_exists($d_sysrebootreqd_path))
+ {
+ /* nuke the cache file */
+ config_lock();
+ services_nfs_configure();
+ config_unlock();
+ }
+ $savemsg = get_std_save_message($retval);
+ }
}
include("head.inc");
@@ -115,17 +123,17 @@ $jscriptstr = <<<EOD
<script type="text/javascript">
<!--
function enable_change(enable_change) {
- var endis;
-
- endis = !(document.iform.enable.checked || enable_change);
+ var endis;
+
+ endis = !(document.iform.enable.checked || enable_change);
endis ? color = '#D4D0C8' : color = '#FFFFFF';
- document.iform.mapall.disabled = endis;
- document.iform.network.disabled = endis;
+ document.iform.mapall.disabled = endis;
+ document.iform.network.disabled = endis;
document.iform.network_subnet.disabled = endis;
/* color adjustments */
- document.iform.mapall.style.backgroundColor = color;
- document.iform.network.style.backgroundColor = color;
+ document.iform.mapall.style.backgroundColor = color;
+ document.iform.network.style.backgroundColor = color;
document.iform.network_subnet.style.backgroundColor = color;
}
//-->
@@ -157,10 +165,10 @@ echo $pfSenseHead->getHTML();
<tr>
<td width="22%" valign="top" class="vncellreq"><?=gettext("map all user to root");?></td>
<td width="78%" class="vtable">
- <select name="mapall" class="formselect" id="mapall">
+ <select name="mapall" class="formselect" id="mapall">
<?php
$types = explode(",", "Yes,No");
- $vals = explode(" ", "yes no");
+ $vals = explode(" ", "yes no");
$j = 0;
for ($j = 0; $j < count($vals); $j++):
@@ -178,7 +186,7 @@ echo $pfSenseHead->getHTML();
<td width="22%" valign="top" class="vncellreq"><?=gettext("Authorised network");?></td>
<td width="78%" class="vtable" align="left" valign="middle">
<input name="network" type="text" class="formfld host" id="network" size="20" value="<?=htmlspecialchars($pconfig['network']);?>" />
- /
+ /
<select name="network_subnet" class="formselect" id="network_subnet">
<?php for ($i = 32; $i >= 1; $i--): ?>
<option value="<?=$i;?>" <?php if ($i == $pconfig['network_subnet']) echo "selected=\"selected\""; ?>>
diff --git a/packages/freenas/www/services_rsyncd.php b/packages/freenas/www/services_rsyncd.php
index f5f5522e..39a581be 100644
--- a/packages/freenas/www/services_rsyncd.php
+++ b/packages/freenas/www/services_rsyncd.php
@@ -1,36 +1,44 @@
<?php
/* $Id$ */
+/* ========================================================================== */
/*
- disks_manage_edit.php
- part of FreeNAS (http://www.freenas.org)
- Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
- All rights reserved.
-
- Based on m0n0wall (http://m0n0.ch/wall)
- Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
+ services_rsyncd.php
+ part of pfSense (http://www.pfSense.com)
+ Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name>
+ All rights reserved.
+
+ Based on FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ All rights reserved.
+ */
+/* ========================================================================== */
+/*
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+/* ========================================================================== */
$pgtitle = array(gettext("Services"),
gettext("RSYNCD"),
@@ -43,15 +51,15 @@ require_once("freenas_functions.inc");
/* TODO: use pfSense users/groups. */
if (!is_array($freenas_config['system']['user']))
- $freenas_config['system']['user'] = array();
-
+ $freenas_config['system']['user'] = array();
+
users_sort();
$a_user = &$freenas_config['system']['user'];
if (!is_array($freenas_config['rsync']))
{
- $freenas_config['rsync'] = array();
+ $freenas_config['rsync'] = array();
}
$pconfig['readonly'] = $freenas_config['rsyncd']['readonly'];
@@ -69,25 +77,25 @@ if (! empty($_POST))
unset($input_errors);
unset($do_format);
$pconfig = $_POST;
-
+
/* input validation */
- if ($_POST['enable'])
- {
- $reqdfields = array_merge($reqdfields, explode(" ", "readonly port"));
- $reqdfieldsn = array_merge($reqdfieldsn, explode(",", "Readonly,Port"));
- }
-
- do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
-
- if ($_POST['enable']) {
- if (!is_port($_POST['port']))
+ if ($_POST['enable'])
+ {
+ $reqdfields = array_merge($reqdfields, explode(" ", "readonly port"));
+ $reqdfieldsn = array_merge($reqdfieldsn, explode(",", "Readonly,Port"));
+ }
+
+ do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
+
+ if ($_POST['enable']) {
+ if (!is_port($_POST['port']))
$error_bucket[] = array("error" => gettext("The TCP port must be a valid port number."),
"field" => "port");
- else if (!is_numericint($_POST['maxcon']))
+ else if (!is_numericint($_POST['maxcon']))
$error_bucket[] = array("error" => gettext("The value provided by the maximum connections field is not a number"),
"field" => "maxcon");
- }
-
+ }
+
if (is_array($error_bucket))
foreach($error_bucket as $elem)
$input_errors[] =& $elem["error"];
@@ -98,28 +106,28 @@ if (! empty($_POST))
exit;
}
- if (!$input_errors)
- {
- $freenas_config['rsyncd']['readonly'] = $_POST['readonly'];
- $freenas_config['rsyncd']['port'] = $_POST['port'];
- $freenas_config['rsyncd']['motd'] = $_POST['motd'];
- $freenas_config['rsyncd']['maxcon'] = $_POST['maxcon'];
- $freenas_config['rsyncd']['enable'] = $_POST['enable'] ? true : false;
- $freenas_config['rsyncd']['rsyncd_user'] = $_POST['rsyncd_user'];
-
- write_config();
-
- $retval = 0;
- if (!file_exists($d_sysrebootreqd_path))
- {
- /* nuke the cache file */
- config_lock();
- services_rsyncd_configure();
- services_zeroconf_configure();
- config_unlock();
- }
- $savemsg = get_std_save_message($retval);
- }
+ if (!$input_errors)
+ {
+ $freenas_config['rsyncd']['readonly'] = $_POST['readonly'];
+ $freenas_config['rsyncd']['port'] = $_POST['port'];
+ $freenas_config['rsyncd']['motd'] = $_POST['motd'];
+ $freenas_config['rsyncd']['maxcon'] = $_POST['maxcon'];
+ $freenas_config['rsyncd']['enable'] = $_POST['enable'] ? true : false;
+ $freenas_config['rsyncd']['rsyncd_user'] = $_POST['rsyncd_user'];
+
+ write_config();
+
+ $retval = 0;
+ if (!file_exists($d_sysrebootreqd_path))
+ {
+ /* nuke the cache file */
+ config_lock();
+ services_rsyncd_configure();
+ services_zeroconf_configure();
+ config_unlock();
+ }
+ $savemsg = get_std_save_message($retval);
+ }
}
include("head.inc");
@@ -130,22 +138,22 @@ $jscriptstr = <<<EOD
<script type="text/javascript">
<!--
function enable_change(enable_change) {
- var endis;
-
- endis = !(document.iform.enable.checked || enable_change);
+ var endis;
+
+ endis = !(document.iform.enable.checked || enable_change);
endis ? color = '#D4D0C8' : color = '#FFFFFF';
- document.iform.readonly.disabled = endis;
- document.iform.port.disabled = endis;
- document.iform.motd.disabled = endis;
- document.iform.maxcon.disabled = endis;
- document.iform.rsyncd_user.disabled = endis;
+ document.iform.readonly.disabled = endis;
+ document.iform.port.disabled = endis;
+ document.iform.motd.disabled = endis;
+ document.iform.maxcon.disabled = endis;
+ document.iform.rsyncd_user.disabled = endis;
/* adjust colors */
- document.iform.readonly.style.backgroundColor = color;
- document.iform.port.style.backgroundColor = color;
- document.iform.motd.style.backgroundColor = color;
- document.iform.maxcon.style.backgroundColor = color;
- document.iform.rsyncd_user.style.backgroundColor = color;
+ document.iform.readonly.style.backgroundColor = color;
+ document.iform.port.style.backgroundColor = color;
+ document.iform.motd.style.backgroundColor = color;
+ document.iform.maxcon.style.backgroundColor = color;
+ document.iform.rsyncd_user.style.backgroundColor = color;
}
//-->
</script>
@@ -166,12 +174,13 @@ echo $pfSenseHead->getHTML();
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
-<?php
+ <?php
$tab_array = array();
- $tab_array[0] = array(gettext("Server"), true, "services_rsyncd.php");
- $tab_array[1] = array(gettext("Client"), false, "services_rsyncd_client.php");
+ $tab_array[0] = array(gettext("Server"), true, "services_rsyncd.php");
+ $tab_array[1] = array(gettext("Client"), false, "services_rsyncd_client.php");
+ $tab_array[2] = array(gettext("Local"), false, "services_rsyncd_local.php");
display_top_tabs($tab_array);
-?>
+ ?>
</td>
</tr>
<tr>
@@ -190,11 +199,11 @@ echo $pfSenseHead->getHTML();
<tr>
<td width="22%" valign="top" class="vncellreq"><?= gettext("Read only"); ?></td>
<td width="78%" class="vtable">
- <select name="readonly" class="formselect" id="readonly">
+ <select name="readonly" class="formselect" id="readonly">
<?php
$types = explode(",", "Yes,No");
- $vals = explode(" ", "yes no");
- $j = 0;
+ $vals = explode(" ", "yes no");
+ $j = 0;
for ($j = 0; $j < count($vals); $j++):
?>
@@ -208,14 +217,14 @@ echo $pfSenseHead->getHTML();
<tr>
<td width="22%" valign="top" class="vncellreq"><?= gettext("Map to user"); ?></td>
<td width="78%" class="vtable">
- <select name="rsyncd_user" class="formselect" id="rsyncd_user">
- <option value="ftp"<?php if ($pconfig['rsyncd_user'] == "ftp") echo "selected";?>>
- <?php echo htmlspecialchars("guest"); ?>
- <?php foreach ($a_user as $user): ?>
- <option value="<?=$user['name'];?>"<?php if ($user['name'] == $pconfig['rsyncd_user']) echo "selected";?>>
- <?php echo htmlspecialchars($user['name']); ?>
- </option>
- <?php endforeach; ?>
+ <select name="rsyncd_user" class="formselect" id="rsyncd_user">
+ <option value="ftp"<?php if ($pconfig['rsyncd_user'] == "ftp") echo "selected";?>>
+ <?php echo htmlspecialchars("guest"); ?>
+ <?php foreach ($a_user as $user): ?>
+ <option value="<?=$user['name'];?>"<?php if ($user['name'] == $pconfig['rsyncd_user']) echo "selected";?>>
+ <?php echo htmlspecialchars($user['name']); ?>
+ </option>
+ <?php endforeach; ?>
</select>
</td>
</tr>
@@ -251,7 +260,7 @@ echo $pfSenseHead->getHTML();
</form>
</div>
</td>
- </tr>
+ </tr>
</table>
<?php include("fend.inc"); ?>
<?= checkForInputErrors(); ?>
diff --git a/packages/freenas/www/services_rsyncd_client.php b/packages/freenas/www/services_rsyncd_client.php
index 53d5196b..c1ade277 100644
--- a/packages/freenas/www/services_rsyncd_client.php
+++ b/packages/freenas/www/services_rsyncd_client.php
@@ -1,36 +1,44 @@
<?php
/* $Id$ */
+/* ========================================================================== */
/*
- disks_manage_edit.php
- part of FreeNAS (http://www.freenas.org)
- Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
- All rights reserved.
-
- Based on m0n0wall (http://m0n0.ch/wall)
- Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
+ services_rsyncd_client.php
+ part of pfSense (http://www.pfSense.com)
+ Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name>
+ All rights reserved.
+
+ Based on FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ All rights reserved.
+ */
+/* ========================================================================== */
+/*
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+/* ========================================================================== */
$pgtitle = array(gettext("Services"),
gettext("RSYNCD"),
@@ -41,21 +49,14 @@ require_once("guiconfig.inc");
require_once("freenas_guiconfig.inc");
require_once("freenas_functions.inc");
-/* TODO: use pfSense users/groups. */
-if (!is_array($freenas_config['system']['user']))
- $freenas_config['system']['user'] = array();
-
-users_sort();
-
-$a_user = &$freenas_config['system']['user'];
-
-if (!is_array($freenas_config['rsync']))
+if (!is_array($freenas_config['rsyncclient']))
{
- $freenas_config['rsync'] = array();
+ $freenas_config['rsyncclient'] = array();
}
$a_months = array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
$a_weekdays = array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");
+$a_mount = array();
$pconfig['readonly'] = $freenas_config['rsyncd']['readonly'];
$pconfig['port'] = $freenas_config['rsyncd']['port'];
@@ -64,101 +65,108 @@ $pconfig['maxcon'] = $freenas_config['rsyncd']['maxcon'];
$pconfig['rsyncd_user'] = $freenas_config['rsyncd']['rsyncd_user'];
$pconfig['enable'] = isset($freenas_config['rsyncd']['enable']);
-if (! empty($_POST))
-{
- /* hash */
- unset($error_bucket);
- /* simple error list */
- unset($input_errors);
- unset($do_format);
- $pconfig = $_POST;
-
- /* input validation */
- if ($_POST['enable']){
- $reqdfields = array_merge($reqdfields, explode(" ", "rsyncserverip sharetosync"));
- $reqdfieldsn = array_merge($reqdfieldsn, explode(",", "Rsyncserverip,Sharetosync"));
- }
+if (!is_array($freenas_config['mounts']['mount'])) {
+ $nodisk_errors[] = gettext("You must configure mount point first.");
+} else {
+ if (! empty($_POST))
+ {
+ /* hash */
+ unset($error_bucket);
+ /* simple error list */
+ unset($input_errors);
+ unset($do_format);
+ $pconfig = $_POST;
- do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
-
- if ($_POST['enable']) {
- if (!is_port($_POST['port']))
- $error_bucket[] = array("error" => gettext("The TCP port must be a valid port number."),
- "field" => "port");
- else if (!is_numericint($_POST['maxcon']))
- $error_bucket[] = array("error" => gettext("The value provided by the maximum connections field is not a number"),
- "field" => "maxcon");
- }
+ /* input validation */
+ if ($_POST['enable']){
+ $reqdfields = array_merge($reqdfields, explode(" ", "rsyncserverip sharetosync"));
+ $reqdfieldsn = array_merge($reqdfieldsn, explode(",", "Rsyncserverip,Sharetosync"));
+ }
+
+ do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
+
+ if ($_POST['enable']) {
+ if (!is_port($_POST['port']))
+ $error_bucket[] = array("error" => gettext("The TCP port must be a valid port number."),
+ "field" => "port");
+ else if (!is_numericint($_POST['maxcon']))
+ $error_bucket[] = array("error" => gettext("The value provided by the maximum connections field is not a number"),
+ "field" => "maxcon");
+ }
+
+ if (!is_array($freenas_config['mounts']['mount'])) {
+ $error_bucket[] = array("error" => gettext("You must configure mount point first."),
+ "field" => "none");
+ }
+
+ if ($_POST['enable'] && !is_ipaddr($_POST['rsyncserverip'])) {
+ $error_bucket[] = array("error" => gettext("A valid IP address must be specified."),
+ "field" => "rsyncserverip");
+ }
- if (!is_array($freenas_config['mounts']['mount'])) {
- $error_bucket[] = array("error" => gettext("You must configure mount point first."),
- "field" => "none");
+ if (is_array($error_bucket))
+ foreach($error_bucket as $elem)
+ $input_errors[] =& $elem["error"];
+
+ /* if this is an AJAX caller then handle via JSON */
+ if(isAjax() && is_array($error_bucket)) {
+ input_errors2Ajax(NULL, $error_bucket);
+ exit;
+ }
+
+ if (!$input_errors)
+ {
+ $freenas_config['rsyncclient']['opt_delete'] = $_POST['opt_delete'] ? true : false;;
+ $freenas_config['rsyncclient']['rsyncserverip'] = $_POST['rsyncserverip'];
+ $freenas_config['rsyncclient']['minute'] = $_POST['minutes'];
+ $freenas_config['rsyncclient']['hour'] = $_POST['hours'];
+ $freenas_config['rsyncclient']['day'] = $_POST['days'];
+ $freenas_config['rsyncclient']['month'] = $_POST['months'];
+ $freenas_config['rsyncclient']['weekday'] = $_POST['weekdays'];
+ $freenas_config['rsyncclient']['rsyncshare'] = $_POST['rsyncshare'];
+ $freenas_config['rsyncclient']['enable'] = $_POST['enable'] ? true : false;
+ $freenas_config['rsyncclient']['sharetosync'] = $_POST['sharetosync'];
+ $freenas_config['rsyncclient']['all_mins'] = $_POST['all_mins'];
+ $freenas_config['rsyncclient']['all_hours'] = $_POST['all_hours'];
+ $freenas_config['rsyncclient']['all_days'] = $_POST['all_days'];
+ $freenas_config['rsyncclient']['all_months'] = $_POST['all_months'];
+ $freenas_config['rsyncclient']['all_weekdays'] = $_POST['all_weekdays'];
+
+ write_config();
+
+ $retval = 0;
+
+ if (!file_exists($d_sysrebootreqd_path)){
+ /* nuke the cache file */
+ config_lock();
+ services_rsyncclient_configure();
+ services_cron_configure();
+ config_unlock();
+ }
+
+ $savemsg = get_std_save_message($retval);
+ }
}
- if (is_array($error_bucket))
- foreach($error_bucket as $elem)
- $input_errors[] =& $elem["error"];
-
- /* if this is an AJAX caller then handle via JSON */
- if(isAjax() && is_array($error_bucket)) {
- input_errors2Ajax(NULL, $error_bucket);
- exit;
- }
-
- if (!$input_errors)
- {
- $freenas_config['rsyncclient']['opt_delete'] = $_POST['opt_delete'] ? true : false;;
- $freenas_config['rsyncclient']['rsyncserverip'] = $_POST['rsyncserverip'];
- $freenas_config['rsyncclient']['minute'] = $_POST['minutes'];
- $freenas_config['rsyncclient']['hour'] = $_POST['hours'];
- $freenas_config['rsyncclient']['day'] = $_POST['days'];
- $freenas_config['rsyncclient']['month'] = $_POST['months'];
- $freenas_config['rsyncclient']['weekday'] = $_POST['weekdays'];
- $freenas_config['rsyncclient']['rsyncshare'] = $_POST['rsyncshare'];
- $freenas_config['rsyncclient']['enable'] = $_POST['enable'] ? true : false;
- $freenas_config['rsyncclient']['sharetosync'] = $_POST['sharetosync'];
- $freenas_config['rsyncclient']['all_mins'] = $_POST['all_mins'];
- $freenas_config['rsyncclient']['all_hours'] = $_POST['all_hours'];
- $freenas_config['rsyncclient']['all_days'] = $_POST['all_days'];
- $freenas_config['rsyncclient']['all_months'] = $_POST['all_months'];
- $freenas_config['rsyncclient']['all_weekdays'] = $_POST['all_weekdays'];
-
- write_config();
-
- $retval = 0;
-
- if (!file_exists($d_sysrebootreqd_path)){
- /* nuke the cache file */
- config_lock();
- services_rsyncclient_configure();
- services_cron_configure();
- config_unlock();
- }
-
- $savemsg = get_std_save_message($retval);
- }
-}
-
-if (is_array($freenas_config['mounts']['mount'])) {
- mount_sort();
+ mount_sort();
$a_mount = &$freenas_config['mounts']['mount'];
- $pconfig['opt_delete'] = isset($freenas_config['rsyncclient']['opt_delete']);
- $pconfig['enable'] = isset($freenas_config['rsyncclient']['enable']);
- $pconfig['rsyncserverip'] = $freenas_config['rsyncclient']['rsyncserverip'];
- $pconfig['rsyncshare'] = $freenas_config['rsyncclient']['rsyncshare'];
- $pconfig['minute'] = $freenas_config['rsyncclient']['minute'];
- $pconfig['hour'] = $freenas_config['rsyncclient']['hour'];
- $pconfig['day'] = $freenas_config['rsyncclient']['day'];
- $pconfig['month'] = $freenas_config['rsyncclient']['month'];
- $pconfig['weekday'] = $freenas_config['rsyncclient']['weekday'];
- $pconfig['sharetosync'] = $freenas_config['rsyncclient']['sharetosync'];
- $pconfig['all_mins'] = $freenas_config['rsyncclient']['all_mins'];
- $pconfig['all_hours'] = $freenas_config['rsyncclient']['all_hours'];
- $pconfig['all_days'] = $freenas_config['rsyncclient']['all_days'];
- $pconfig['all_months'] = $freenas_config['rsyncclient']['all_months'];
- $pconfig['all_weekdays'] = $freenas_config['rsyncclient']['all_weekdays'];
-
+ $pconfig['opt_delete'] = isset($freenas_config['rsyncclient']['opt_delete']);
+ $pconfig['enable'] = isset($freenas_config['rsyncclient']['enable']);
+ $pconfig['rsyncserverip'] = $freenas_config['rsyncclient']['rsyncserverip'];
+ $pconfig['rsyncshare'] = $freenas_config['rsyncclient']['rsyncshare'];
+ $pconfig['minute'] = $freenas_config['rsyncclient']['minute'];
+ $pconfig['hour'] = $freenas_config['rsyncclient']['hour'];
+ $pconfig['day'] = $freenas_config['rsyncclient']['day'];
+ $pconfig['month'] = $freenas_config['rsyncclient']['month'];
+ $pconfig['weekday'] = $freenas_config['rsyncclient']['weekday'];
+ $pconfig['sharetosync'] = $freenas_config['rsyncclient']['sharetosync'];
+ $pconfig['all_mins'] = $freenas_config['rsyncclient']['all_mins'];
+ $pconfig['all_hours'] = $freenas_config['rsyncclient']['all_hours'];
+ $pconfig['all_days'] = $freenas_config['rsyncclient']['all_days'];
+ $pconfig['all_months'] = $freenas_config['rsyncclient']['all_months'];
+ $pconfig['all_weekdays'] = $freenas_config['rsyncclient']['all_weekdays'];
+
if ($pconfig['all_mins'] == 1){
$all_mins_all = " checked";
} else {
@@ -214,49 +222,56 @@ if (is_array($a_mount)) {
}
}
+/* Note: In contrast to FreeNAS we are only using
+ * three minutes and one hours field(s)
+ */
$jscriptstr .= <<<EOD
- document.iform.rsyncserverip.disabled = endis;
- document.iform.minutes1.disabled = endis;
- document.iform.minutes2.disabled = endis;
- document.iform.minutes3.disabled = endis;
- document.iform.hours1.disabled = endis;
- document.iform.days1.disabled = endis;
- document.iform.days2.disabled = endis;
- document.iform.months.disabled = endis;
- document.iform.weekdays.disabled = endis;
- document.iform.all_mins1.disabled = endis;
- document.iform.all_mins2.disabled = endis;
- document.iform.all_hours1.disabled = endis;
- document.iform.all_hours2.disabled = endis;
- document.iform.all_days1.disabled = endis;
- document.iform.all_days2.disabled = endis;
- document.iform.all_months1.disabled = endis;
- document.iform.all_months2.disabled = endis;
- document.iform.all_weekdays1.disabled = endis;
- document.iform.all_weekdays2.disabled = endis;
- document.iform.opt_delete.disabled = endis;
+ document.iform.rsyncserverip.disabled = endis;
+ document.iform.minutes1.disabled = endis;
+ document.iform.minutes2.disabled = endis;
+ document.iform.minutes3.disabled = endis;
+ document.iform.hours1.disabled = endis;
+ document.iform.hours2.disabled = endis;
+ document.iform.days1.disabled = endis;
+ document.iform.days2.disabled = endis;
+ document.iform.days3.disabled = endis;
+ document.iform.months.disabled = endis;
+ document.iform.weekdays.disabled = endis;
+ document.iform.all_mins1.disabled = endis;
+ document.iform.all_mins2.disabled = endis;
+ document.iform.all_hours1.disabled = endis;
+ document.iform.all_hours2.disabled = endis;
+ document.iform.all_days1.disabled = endis;
+ document.iform.all_days2.disabled = endis;
+ document.iform.all_months1.disabled = endis;
+ document.iform.all_months2.disabled = endis;
+ document.iform.all_weekdays1.disabled = endis;
+ document.iform.all_weekdays2.disabled = endis;
+ document.iform.opt_delete.disabled = endis;
/* color adjustments */
- document.iform.rsyncserverip.style.backgroundColor = color;
- document.iform.minutes1.style.backgroundColor = color;
- document.iform.minutes2.style.backgroundColor = color;
- document.iform.minutes3.style.backgroundColor = color;
- document.iform.hours1.style.backgroundColor = color;
- document.iform.days1.style.backgroundColor = color;
- document.iform.days2.style.backgroundColor = color;
- document.iform.months.style.backgroundColor = color;
- document.iform.weekdays.style.backgroundColor = color;
- document.iform.all_mins1.style.backgroundColor = color;
- document.iform.all_mins2.style.backgroundColor = color;
- document.iform.all_hours1.style.backgroundColor = color;
- document.iform.all_hours2.style.backgroundColor = color;
- document.iform.all_days1.style.backgroundColor = color;
- document.iform.all_days2.style.backgroundColor = color;
- document.iform.all_months1.style.backgroundColor = color;
- document.iform.all_months2.style.backgroundColor = color;
- document.iform.all_weekdays1.style.backgroundColor = color;
- document.iform.all_weekdays2.style.backgroundColor = color;
- document.iform.opt_delete.style.backgroundColor = color;
+ document.iform.rsyncserverip.style.backgroundColor = color;
+ document.iform.minutes1.style.backgroundColor = color;
+ document.iform.minutes2.style.backgroundColor = color;
+ document.iform.minutes3.style.backgroundColor = color;
+ document.iform.hours1.style.backgroundColor = color;
+ document.iform.hours2.style.backgroundColor = color;
+ document.iform.days1.style.backgroundColor = color;
+ document.iform.days2.style.backgroundColor = color;
+ document.iform.days3.style.backgroundColor = color;
+ document.iform.months.style.backgroundColor = color;
+ document.iform.weekdays.style.backgroundColor = color;
+ document.iform.all_mins1.style.backgroundColor = color;
+ document.iform.all_mins2.style.backgroundColor = color;
+ document.iform.all_hours1.style.backgroundColor = color;
+ document.iform.all_hours2.style.backgroundColor = color;
+ document.iform.all_days1.style.backgroundColor = color;
+ document.iform.all_days2.style.backgroundColor = color;
+ document.iform.all_months1.style.backgroundColor = color;
+ document.iform.all_months2.style.backgroundColor = color;
+ document.iform.all_weekdays1.style.backgroundColor = color;
+ document.iform.all_weekdays2.style.backgroundColor = color;
+ document.iform.opt_delete.style.backgroundColor = color;
}
//-->
</script>
@@ -279,8 +294,9 @@ echo $pfSenseHead->getHTML();
<td>
<?php
$tab_array = array();
- $tab_array[0] = array(gettext("Server"), false, "services_rsyncd.php");
- $tab_array[1] = array(gettext("Client"), true, "services_rsyncd_client.php");
+ $tab_array[0] = array(gettext("Server"), false, "services_rsyncd.php");
+ $tab_array[1] = array(gettext("Client"), true, "services_rsyncd_client.php");
+ $tab_array[2] = array(gettext("Local"), false, "services_rsyncd_local.php");
display_top_tabs($tab_array);
?>
</td>
@@ -319,18 +335,18 @@ echo $pfSenseHead->getHTML();
<?php
$i=0;
if (is_array($freenas_config['mounts']['mount'])) {
- foreach ($a_mount as $mountv) {
- echo "<input name=\"sharetosync[]\" id=\"share_" . $i . "\" type=\"checkbox\" value=\"" . $mountv['sharename'] . "\"";
-
- if (in_array($mountv['sharename'], $pconfig['sharetosync']))
- echo " checked=\"checked\"";
- echo" />";
- echo $mountv['sharename'] . " (" . $mountv['desc'] . ")<br />\n";
- $i++;
- }
+ foreach ($a_mount as $mountv) {
+ echo "<input name=\"sharetosync[]\" id=\"share_" . $i . "\" type=\"checkbox\" value=\"" . $mountv['sharename'] . "\"";
+
+ if (in_array($mountv['sharename'], $pconfig['sharetosync']))
+ echo " checked=\"checked\"";
+ echo" />";
+ echo $mountv['sharename'] . " (" . $mountv['desc'] . ")<br />\n";
+ $i++;
+ }
}
else
- echo "You must configure mount point before!";
+ echo "You must configure mount point before!";
?>
<br />
<?= gettext("This same local share must be present on the Remote Server."); ?>
@@ -356,39 +372,39 @@ echo $pfSenseHead->getHTML();
<label for="all_mins2">Selected ...</label>
</div>
<div id="all_min_select" style="vertical-align: top;">
- <select multiple="multible" class="formselect" size="24" name="minutes[]" id="minutes1" style="vertical-align: top;">
+ <select multiple="multible" class="formselect" size="24" name="minutes[]" id="minutes1" style="vertical-align: top;">
<?php
- $i = 0;
- while ($i <= 23){
- if (isset($pconfig['minute'])) {
+ $i = 0;
+ while ($i <= 23){
+ if (isset($pconfig['minute'])) {
if (in_array($i, $pconfig['minute'])) {
$is_selected = " selected";
- } else {
- $is_selected = "";
- }
- }
-
- echo "<option value=\"" . $i . "\"" . $is_selected . ">" . $i . "\n";
- $i++;
- }
- ?>
+ } else {
+ $is_selected = "";
+ }
+ }
+
+ echo "<option value=\"" . $i . "\"" . $is_selected . ">" . $i . "\n";
+ $i++;
+ }
+ ?>
</select>
- <select multiple="multible" class="formselect" size="24" name="minutes[]" id="minutes2" style="vertical-align: top;">
+ <select multiple="multible" class="formselect" size="24" name="minutes[]" id="minutes2" style="vertical-align: top;">
<?php
- $i = 24;
- while ($i <= 47) {
- if (isset($pconfig['minute'])) {
- if (in_array($i, $pconfig['minute'])) {
+ $i = 24;
+ while ($i <= 47) {
+ if (isset($pconfig['minute'])) {
+ if (in_array($i, $pconfig['minute'])) {
$is_selected = " selected";
- } else {
- $is_selected = "";
- }
- }
-
- echo "<option value=\"" . $i . "\"" . $is_selected . ">" . $i . "\n";
- $i++;
- }
- ?>
+ } else {
+ $is_selected = "";
+ }
+ }
+
+ echo "<option value=\"" . $i . "\"" . $is_selected . ">" . $i . "\n";
+ $i++;
+ }
+ ?>
</select>
<select multiple="multible" class="formselect" size="12" name="minutes[]" id="minutes3" style="vertical-align: top;">
<?php
@@ -553,7 +569,7 @@ echo $pfSenseHead->getHTML();
</form>
</div>
</td>
- </tr>
+ </tr>
</table>
<?php include("fend.inc"); ?>
<?= checkForInputErrors(); ?>
diff --git a/packages/freenas/www/services_rsyncd_local.php b/packages/freenas/www/services_rsyncd_local.php
new file mode 100644
index 00000000..27d78417
--- /dev/null
+++ b/packages/freenas/www/services_rsyncd_local.php
@@ -0,0 +1,584 @@
+<?php
+/* $Id$ */
+/* ========================================================================== */
+/*
+ services_rsyncd_local.php
+ part of pfSense (http://www.pfSense.com)
+ Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name>
+ All rights reserved.
+
+ Based on FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ All rights reserved.
+ */
+/* ========================================================================== */
+/*
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+/* ========================================================================== */
+
+$pgtitle = array(gettext("Services"),
+ gettext("RSYNCD"),
+ gettext("Local"));
+
+require_once("freenas_config.inc");
+require_once("guiconfig.inc");
+require_once("freenas_guiconfig.inc");
+require_once("freenas_functions.inc");
+
+if (!is_array($freenas_config['rsync_local']))
+{
+ $freenas_config['rsync_local'] = array();
+}
+
+$a_months = array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
+$a_weekdays = array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");
+
+$pconfig['readonly'] = $freenas_config['rsyncd']['readonly'];
+$pconfig['port'] = $freenas_config['rsyncd']['port'];
+$pconfig['motd'] = $freenas_config['rsyncd']['motd'];
+$pconfig['maxcon'] = $freenas_config['rsyncd']['maxcon'];
+$pconfig['rsyncd_user'] = $freenas_config['rsyncd']['rsyncd_user'];
+$pconfig['enable'] = isset($freenas_config['rsyncd']['enable']);
+
+if (!is_array($freenas_config['mounts']['mount'])) {
+ $nodisk_errors[] = gettext("You must configure mount point first.");
+} else {
+ if (! empty($_POST))
+ {
+ /* hash */
+ unset($error_bucket);
+ /* simple error list */
+ unset($input_errors);
+
+ $pconfig = $_POST;
+
+ /* input validation */
+ if ($_POST['enable']){
+ $reqdfields = array_merge($reqdfields, explode(" ", "source destination"));
+ $reqdfieldsn = array_merge($reqdfieldsn, explode(",", "Source,Destination"));
+ }
+
+ do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
+
+ if ($_POST['enable'] && (strcmp($_POST['source'],$_POST['destination'])==0)) {
+ $error_bucket[] = array("error" => gettext("You can't have the same mount point for source and destination!"),
+ "field" => "source");
+ }
+
+ if (is_array($error_bucket))
+ foreach($error_bucket as $elem)
+ $input_errors[] =& $elem["error"];
+
+ /* if this is an AJAX caller then handle via JSON */
+ if(isAjax() && is_array($error_bucket)) {
+ input_errors2Ajax(NULL, $error_bucket);
+ exit;
+ }
+
+ if (!$input_errors)
+ {
+ $freenas_config['rsync_local']['opt_delete'] = $_POST['opt_delete'] ? true : false;;
+ $freenas_config['rsync_local']['minute'] = $_POST['minutes'];
+ $freenas_config['rsync_local']['hour'] = $_POST['hours'];
+ $freenas_config['rsync_local']['day'] = $_POST['days'];
+ $freenas_config['rsync_local']['month'] = $_POST['months'];
+ $freenas_config['rsync_local']['weekday'] = $_POST['weekdays'];
+ $freenas_config['rsync_local']['source'] = $_POST['source'];
+ $freenas_config['rsync_local']['destination'] = $_POST['destination'];
+ $freenas_config['rsync_local']['enable'] = $_POST['enable'] ? true : false;
+ $freenas_config['rsync_local']['sharetosync'] = $_POST['sharetosync'];
+ $freenas_config['rsync_local']['all_mins'] = $_POST['all_mins'];
+ $freenas_config['rsync_local']['all_hours'] = $_POST['all_hours'];
+ $freenas_config['rsync_local']['all_days'] = $_POST['all_days'];
+ $freenas_config['rsync_local']['all_months'] = $_POST['all_months'];
+ $freenas_config['rsync_local']['all_weekdays'] = $_POST['all_weekdays'];
+
+ write_config();
+
+ $retval = 0;
+
+ if (!file_exists($d_sysrebootreqd_path)){
+ /* nuke the cache file */
+ config_lock();
+ services_rsync_local_configure();
+ services_cron_configure();
+ config_unlock();
+ }
+
+ $savemsg = get_std_save_message($retval);
+ }
+ }
+
+ mount_sort();
+ $a_mount = &$freenas_config['mounts']['mount'];
+
+ $pconfig['opt_delete'] = isset($freenas_config['rsync_local']['opt_delete']);
+ $pconfig['enable'] = isset($freenas_config['rsync_local']['enable']);
+ $pconfig['source'] = $freenas_config['rsync_local']['source'];
+ $pconfig['destination'] = $freenas_config['rsync_local']['destination'];
+ $pconfig['minute'] = $freenas_config['rsync_local']['minute'];
+ $pconfig['hour'] = $freenas_config['rsync_local']['hour'];
+ $pconfig['day'] = $freenas_config['rsync_local']['day'];
+ $pconfig['month'] = $freenas_config['rsync_local']['month'];
+ $pconfig['weekday'] = $freenas_config['rsync_local']['weekday'];
+ $pconfig['sharetosync'] = $freenas_config['rsync_local']['sharetosync'];
+ $pconfig['all_mins'] = $freenas_config['rsync_local']['all_mins'];
+ $pconfig['all_hours'] = $freenas_config['rsync_local']['all_hours'];
+ $pconfig['all_days'] = $freenas_config['rsync_local']['all_days'];
+ $pconfig['all_months'] = $freenas_config['rsync_local']['all_months'];
+ $pconfig['all_weekdays'] = $freenas_config['rsync_local']['all_weekdays'];
+
+ if ($pconfig['all_mins'] == 1){
+ $all_mins_all = " checked";
+ } else {
+ $all_mins_selected = " checked";
+ }
+
+ if ($pconfig['all_hours'] == 1){
+ $all_hours_all = " checked";
+ } else {
+ $all_hours_selected = " checked";
+ }
+
+ if ($pconfig['all_days'] == 1){
+ $all_days_all = " checked";
+ } else {
+ $all_days_selected = " checked";
+ }
+
+ if ($pconfig['all_months'] == 1){
+ $all_months_all = " checked";
+ } else {
+ $all_months_selected = " checked";
+ }
+
+ if ($pconfig['all_weekdays'] == 1){
+ $all_weekdays_all = " checked";
+ } else {
+ $all_weekdays_selected = " checked";
+ }
+}
+
+include("head.inc");
+/* put your custom HTML head content here */
+/* using some of the $pfSenseHead function calls */
+
+$jscriptstr = <<<EOD
+<script type="text/javascript">
+<!--
+function enable_change(enable_change) {
+ var endis;
+
+ endis = !(document.iform.enable.checked || enable_change);
+ endis ? color = '#D4D0C8' : color = '#FFFFFF';
+
+EOD;
+
+$i = 0;
+
+if (is_array($a_mount)) {
+ foreach ($a_mount as $mountv) {
+ $jscriptstr .= " document.iform.share_" . $i . ".disabled = endis;\n";
+ $i++;
+ }
+}
+
+/* Note: In contrast to FreeNAS we are only using
+ * three minutes and one hours field(s)
+ */
+$jscriptstr .= <<<EOD
+
+ document.iform.source.disabled = endis;
+ document.iform.destination.disabled = endis;
+ document.iform.minutes1.disabled = endis;
+ document.iform.minutes2.disabled = endis;
+ document.iform.minutes3.disabled = endis;
+ document.iform.hours1.disabled = endis;
+ document.iform.hours2.disabled = endis;
+ document.iform.days1.disabled = endis;
+ document.iform.days2.disabled = endis;
+ document.iform.days3.disabled = endis;
+ document.iform.months.disabled = endis;
+ document.iform.weekdays.disabled = endis;
+ document.iform.all_mins1.disabled = endis;
+ document.iform.all_mins2.disabled = endis;
+ document.iform.all_hours1.disabled = endis;
+ document.iform.all_hours2.disabled = endis;
+ document.iform.all_days1.disabled = endis;
+ document.iform.all_days2.disabled = endis;
+ document.iform.all_months1.disabled = endis;
+ document.iform.all_months2.disabled = endis;
+ document.iform.all_weekdays1.disabled = endis;
+ document.iform.all_weekdays2.disabled = endis;
+ document.iform.opt_delete.disabled = endis;
+ /* color adjustments */
+ document.iform.source.style.backgroundColor = color;
+ document.iform.destination.style.backgroundColor = color;
+ document.iform.minutes1.style.backgroundColor = color;
+ document.iform.minutes2.style.backgroundColor = color;
+ document.iform.minutes3.style.backgroundColor = color;
+ document.iform.hours1.style.backgroundColor = color;
+ document.iform.hours2.style.backgroundColor = color;
+ document.iform.days1.style.backgroundColor = color;
+ document.iform.days2.style.backgroundColor = color;
+ document.iform.days3.style.backgroundColor = color;
+ document.iform.months.style.backgroundColor = color;
+ document.iform.weekdays.style.backgroundColor = color;
+ document.iform.all_mins1.style.backgroundColor = color;
+ document.iform.all_mins2.style.backgroundColor = color;
+ document.iform.all_hours1.style.backgroundColor = color;
+ document.iform.all_hours2.style.backgroundColor = color;
+ document.iform.all_days1.style.backgroundColor = color;
+ document.iform.all_days2.style.backgroundColor = color;
+ document.iform.all_months1.style.backgroundColor = color;
+ document.iform.all_months2.style.backgroundColor = color;
+ document.iform.all_weekdays1.style.backgroundColor = color;
+ document.iform.all_weekdays2.style.backgroundColor = color;
+ document.iform.opt_delete.style.backgroundColor = color;
+}
+//-->
+</script>
+
+EOD;
+
+$pfSenseHead->addScript($jscriptstr);
+echo $pfSenseHead->getHTML();
+
+?>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>">
+<?php include("fbegin.inc"); ?>
+
+<?php if ($input_errors) print_input_errors($input_errors); ?>
+<?php if ($savemsg) print_info_box($savemsg); ?>
+<div id="inputerrors"></div>
+<table width="100%" border="0" cellspacing="0" cellpadding="0">
+ <tr>
+ <td>
+<?php
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Server"), false, "services_rsyncd.php");
+ $tab_array[1] = array(gettext("Client"), false, "services_rsyncd_client.php");
+ $tab_array[2] = array(gettext("Local"), true, "services_rsyncd_local.php");
+ display_top_tabs($tab_array);
+?>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div id="mainarea">
+ <form id="iform" name="iform" action="services_rsyncd_local.php" method="post">
+ <table class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0">
+ <tr>
+ <td width="100%" valign="middle" class="listtopic" colspan="2">
+ <span style="vertical-align: middle; position: relative; left: 0px;"><?=gettext("Rsync Client Synchronization");?></span>
+ <span style="vertical-align: middle; position: relative; left: 70%;">
+ <input name="enable" type="checkbox" value="yes" <?php if ($pconfig['enable']) echo "checked=\"checked\""; ?> onClick="enable_change(false)" />&nbsp;<?= gettext("Enable"); ?>
+ </span>
+ </td>
+ </tr>
+ <tr>
+ <td width="16%" valign="top" class="vncellreq"><?= gettext("Source"); ?></td>
+ <td width="84%" class="vtable">
+ <select name="source" class="formfld" id="source">
+ <?php
+ if (is_array($freenas_config['mounts']['mount'])) {
+ foreach ($a_mount as $mountv) {
+ echo "<option value=\"{$mountv['sharename']}\"";
+ if (strcmp($mountv['sharename'],$pconfig['source']) == 0)
+ echo " selected";
+ echo">";
+ echo htmlspecialchars($mountv['sharename']);
+ echo "</option>";
+ }
+ }
+ else
+ echo gettext("You must configure mount point first.");
+ ?>
+ </select>
+ <br />
+ <?= gettext("Source Mount Point."); ?>
+ </td>
+ </tr>
+ <tr>
+ <td width="16%" valign="top" class="vncellreq"><?= gettext("Destination"); ?></td>
+ <td width="84%" class="vtable">
+ <select name="destination" class="formfld" id="destination">
+ <?php
+ if (is_array($freenas_config['mounts']['mount'])) {
+ foreach ($a_mount as $mountv) {
+ echo "<option value=\"{$mountv['sharename']}\"";
+ if (strcmp($mountv['sharename'],$pconfig['destination']) == 0)
+ echo " selected";
+ echo">";
+ echo htmlspecialchars($mountv['sharename']);
+ echo "</option>";
+ }
+ }
+ else
+ echo gettext("You must configure mount point first.");
+ ?>
+ </select>
+ <br />
+ <?= gettext("Destination Mount Point."); ?>
+ </td>
+ </tr>
+ <tr>
+ <td width="16%" valign="top" class="vncellreq"><?= gettext("RSYNC Options"); ?></td>
+ <td width="84%" class="vtable">
+ <input name="opt_delete" id="opt_delete" type="checkbox" value="yes" <?php if ($pconfig['opt_delete']) echo "checked=\"checked\""; ?> />
+ <?= gettext("Delete files that don't exist on sender."); ?>
+ </td>
+ </tr>
+ <tr>
+ <td width="16%" valign="top" class="vncellreq"><?= gettext("Synchronization Time"); ?></td>
+ <td width="84%" class="vtable">
+ <table width="100%" border="1" cellpadding="4" cellspacing="0">
+ <tr>
+ <td align="left" valign="top" class="listtopic"><?= gettext("minutes"); ?></td>
+ <td align="left" valign="top" class="listtopic"><?= gettext("hours"); ?></td>
+ <td align="left" valign="top" class="listtopic"><?= gettext("days"); ?></td>
+ <td align="left" valign="top" class="listtopic"><?= gettext("months"); ?></td>
+ <td align="left" valign="top" class="listtopic"><?= gettext("week days"); ?></td>
+ </tr>
+ <tr>
+ <td align="left" valign="top" class="vncell" nowrap="nowrap">
+ <div id="all_min_rdbtns" style="padding-bottom: 10px;" >
+ <input type="radio" name="all_mins" id="all_mins1" value="1"<?php echo $all_mins_all;?> />
+ <label for="all_mins1">All</label><br />
+ <input type="radio" name="all_mins" id="all_mins2" value="0"<?php echo $all_mins_selected;?> />
+ <label for="all_mins2">Selected ...</label>
+ </div>
+ <div id="all_min_select" style="vertical-align: top;">
+ <select multiple="multible" class="formselect" size="24" name="minutes[]" id="minutes1" style="vertical-align: top;">
+ <?php
+ $i = 0;
+ while ($i <= 23){
+ if (isset($pconfig['minute'])) {
+ if (in_array($i, $pconfig['minute'])) {
+ $is_selected = " selected";
+ } else {
+ $is_selected = "";
+ }
+ }
+
+ echo "<option value=\"" . $i . "\"" . $is_selected . ">" . $i . "\n";
+ $i++;
+ }
+ ?>
+ </select>
+ <select multiple="multible" class="formselect" size="24" name="minutes[]" id="minutes2" style="vertical-align: top;">
+ <?php
+ $i = 24;
+ while ($i <= 47) {
+ if (isset($pconfig['minute'])) {
+ if (in_array($i, $pconfig['minute'])) {
+ $is_selected = " selected";
+ } else {
+ $is_selected = "";
+ }
+ }
+
+ echo "<option value=\"" . $i . "\"" . $is_selected . ">" . $i . "\n";
+ $i++;
+ }
+ ?>
+ </select>
+ <select multiple="multible" class="formselect" size="12" name="minutes[]" id="minutes3" style="vertical-align: top;">
+ <?php
+ $i = 48;
+ while ($i <= 59) {
+ if (isset($pconfig['minute'])) {
+ if (in_array($i, $pconfig['minute'])) {
+ $is_selected = " selected";
+ } else {
+ $is_selected = "";
+ }
+ }
+
+ echo "<option value=\"" . $i . "\"" . $is_selected . ">" . $i . "\n";
+ $i++;
+ }
+ ?>
+ </select>
+ </div>
+ </td>
+ <td align="left" valign="top" class="vncell" nowrap="nowrap">
+ <div id="all_hours_rdbtns" style="padding-bottom: 10px;" >
+ <input type="radio" name="all_hours" id="all_hours1" value="1"<?php echo $all_hours_all;?> />
+ <label for="all_hours1">All</label><br />
+ <input type="radio" name="all_hours" id="all_hours2" value="0"<?php echo $all_hours_selected;?> />
+ <label for="all_hours2">Selected ...</label>
+ </div>
+ <div id="all_hours_select" style="vertical-align: top;">
+ <select multiple size="24" name="hours[]" id="hours1" style="vertical-align: top;">
+ <?php
+ $i = 0;
+ while ($i <= 23) {
+ if (isset($pconfig['hour'])) {
+ if (in_array($i, $pconfig['hour'])) {
+ $is_selected = " selected";
+ } else {
+ $is_selected = "";
+ }
+ }
+
+ echo "<option value=\"" . $i . "\"" . $is_selected . ">" . $i . "\n";
+ $i++;
+ }
+ ?>
+ </select>
+ </div>
+ </td>
+ <td align="left" valign="top" class="vncell" nowrap="nowrap">
+ <div id="all_days_rdbtns" style="padding-bottom: 10px;" >
+ <input type="radio" name="all_days" id="all_days1" value="1" <?php echo $all_days_all;?> />
+ <label for="all_days1">All</label><br />
+ <input type="radio" name="all_days" id="all_days2" value="0"<?php echo $all_days_selected;?> />
+ <label for="all_days2">Selected ...</label>
+ </div>
+ <div id="all_days_select" style="vertical-align: top;">
+ <select multiple size="24" name="days[]" id="days1" style="vertical-align: top;">
+ <?php
+ $i = 1;
+ while ($i <= 24) {
+ if (isset($pconfig['day'])) {
+ if (in_array($i, $pconfig['day'])) {
+ $is_selected = " selected";
+ } else {
+ $is_selected = "";
+ }
+ }
+
+ echo "<option value=\"" . $i . "\"" . $is_selected . ">" . $i . "\n";
+ $i++;
+ }
+ ?>
+ </select>
+ <select multiple size="7" name="days[]" id="days2" style="vertical-align: top;">
+ <?php
+ $i = 25;
+ while ($i <= 31) {
+ if (isset($pconfig['day'])) {
+ if (in_array($i, $pconfig['day'])) {
+ $is_selected = " selected";
+ } else {
+ $is_selected = "";
+ }
+ }
+
+ echo "<option value=\"" . $i . "\"" . $is_selected . ">" . $i . "\n";
+ $i++;
+ }
+ ?>
+ </select>
+ </div>
+ </td>
+ <td align="left" valign="top" class="vncell">
+ <div id="all_months_rdbtns" style="padding-bottom: 10px;" >
+ <input type="radio" name="all_months" id="all_months1" value="1"<?php echo $all_months_all;?> />
+ <label for="all_months1">All</label><br />
+ <input type="radio" name="all_months" id="all_months2" value="0"<?php echo $all_months_selected;?> />
+ <label for="all_months2">Selected ...</label>
+ </div>
+ <div id="all_months_select" style="vertical-align: top;">
+ <select multiple size="12" name="months[]" id="months" style="vertical-align: top;">
+ <?php
+ $i=1;
+ foreach ($a_months as $monthv) {
+ if (isset($pconfig['month'])) {
+ if (in_array($i, $pconfig['month'])) {
+ $is_selected = " selected";
+ } else {
+ $is_selected = "";
+ }
+ }
+
+ echo "<option value=\"" . $i . "\"" . $is_selected . ">" . $monthv . "\n";
+ $i++;
+ }
+ ?>
+ </select>
+ </div>
+ </td>
+ <td align="left" valign="top" class="vncell">
+ <div id="all_weekdays_rdbtns" style="padding-bottom: 10px;" >
+ <input type="radio" name="all_weekdays" id="all_weekdays1" value="1"<?php echo $all_weekdays_all;?> />
+ <label for="all_weekdays1">All</label><br />
+ <input type="radio" name="all_weekdays" id="all_weekdays2" value="0"<?php echo $all_weekdays_selected;?> />
+ <label for="all_weekdays2">Selected ...</label>
+ </div>
+ <div id="all_weekdays_select" style="vertical-align: top;">
+ <select multiple size="7" name="weekdays[]" id="weekdays" style="vertical-align: top;">
+ <?php
+ $i=0;
+ foreach ($a_weekdays as $weekdayv) {
+ if (isset($pconfig['weekday'])){
+ if (in_array($i, $pconfig['weekday'])) {
+ $is_selected = " selected";
+ } else {
+ $is_selected = "";
+ }
+ }
+
+ echo "<option value=\"" . $i . "\"" . $is_selected . ">" . $weekdayv . "\n";
+ $i++;
+ }
+ ?>
+ </select>
+ </div>
+ </td>
+ </tr>
+ <tr>
+ <td align="left" valign="top" class="vncell" colspan="5">
+ <?= gettext("Note: Ctrl-click (or command-click on the Mac) to select and de-select minutes, hours, days and months."); ?>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <td width="16%" valign="top">&nbsp;</td>
+ <td width="84%">
+ <input id="submit" name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" />
+ </td>
+ </tr>
+ </table>
+ </form>
+ </div>
+ </td>
+ </tr>
+</table>
+<?php include("fend.inc"); ?>
+<?= checkForInputErrors(); ?>
+<script type="text/javascript">
+<!--
+enable_change(false);
+//-->
+</script>
+</body>
+</html>
diff --git a/packages/freenas/www/services_samba.php b/packages/freenas/www/services_samba.php
index 0bb71319..928a6798 100644
--- a/packages/freenas/www/services_samba.php
+++ b/packages/freenas/www/services_samba.php
@@ -1,36 +1,44 @@
<?php
/* $Id$ */
+/* ========================================================================== */
/*
- disks_manage_edit.php
- part of FreeNAS (http://www.freenas.org)
- Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
- All rights reserved.
-
- Based on m0n0wall (http://m0n0.ch/wall)
- Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
+ services_samba.php
+ part of pfSense (http://www.pfSense.com)
+ Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name>
+ All rights reserved.
+
+ Based on FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ All rights reserved.
+ */
+/* ========================================================================== */
+/*
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+/* ========================================================================== */
$pgtitle = array(gettext("Services"),
gettext("CIFS"));
@@ -42,11 +50,11 @@ require_once("freenas_functions.inc");
if (!is_array($freenas_config['samba']))
{
- $freenas_config['samba'] = array();
+ $freenas_config['samba'] = array();
}
if (!is_array($freenas_config['mounts']['mount']))
- $freenas_config['mounts']['mount'] = array();
+ $freenas_config['mounts']['mount'] = array();
mount_sort();
@@ -58,7 +66,7 @@ $pconfig['serverdesc'] = $freenas_config['samba']['serverdesc'];
$pconfig['security'] = $freenas_config['samba']['security'];
$pconfig['localmaster'] = $freenas_config['samba']['localmaster'];
$pconfig['winssrv'] = $freenas_config['samba']['winssrv'];
-$pconfig['hidemount'] = $freenas_config['samba']['hidemount'];
+/* $pconfig['hidemount'] = $freenas_config['samba']['hidemount']; */
$pconfig['timesrv'] = $freenas_config['samba']['timesrv'];
$pconfig['unixcharset'] = $freenas_config['samba']['unixcharset'];
$pconfig['doscharset'] = $freenas_config['samba']['doscharset'];
@@ -75,38 +83,38 @@ if (! empty($_POST))
/* simple error list */
unset($input_errors);
$pconfig = $_POST;
-
+
/* input validation */
- if ($_POST['enable']) {
- $reqdfields = array_merge($reqdfields, explode(" ", "netbiosname workgroup security localmaster"));
- $reqdfieldsn = array_merge($reqdfieldsn, explode(",", "Netbiosname,Workgroup,Security, Localmaster"));
- }
-
- do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
+ if ($_POST['enable']) {
+ $reqdfields = array_merge($reqdfields, explode(" ", "netbiosname workgroup security localmaster"));
+ $reqdfieldsn = array_merge($reqdfieldsn, explode(",", "Netbiosname,Workgroup,Security, Localmaster"));
+ }
+
+ do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
- if (($_POST['netbiosname'] && !is_domain($_POST['netbiosname']))) {
+ if (($_POST['netbiosname'] && !is_domain($_POST['netbiosname']))) {
$error_bucket[] = array("error" => gettext("The Netbios name contains invalid characters."),
"field" => "netbiosname");
- }
- if (($_POST['workgroup'] && !is_domain($_POST['workgroup']))) {
+ }
+ if (($_POST['workgroup'] && !is_domain($_POST['workgroup']))) {
$error_bucket[] = array("error" => gettext("The Workgroup name contains invalid characters."),
"field" => "workgroup");
- }
- if (($_POST['winssrv'] && !is_ipaddr($_POST['winssrv']))) {
+ }
+ if (($_POST['winssrv'] && !is_ipaddr($_POST['winssrv']))) {
$error_bucket[] = array("error" => gettext("The WINS server must be an IP address."),
"field" => "winssrv");
- }
-
- if (!is_numericint($_POST['sndbuf'])) {
+ }
+
+ if (!is_numericint($_POST['sndbuf'])) {
$error_bucket[] = array("error" => gettext("PediaXThe SND Buffer value must be a number."),
"field" => "sndbuf");
- }
-
- if (!is_numericint($_POST['rcvbuf'])) {
+ }
+
+ if (!is_numericint($_POST['rcvbuf'])) {
$error_bucket[] = array("error" => gettext("The RCV Buffer value must be a number."),
"field" => "rcvbuf");
- }
-
+ }
+
if (is_array($error_bucket))
foreach($error_bucket as $elem)
$input_errors[] =& $elem["error"];
@@ -117,36 +125,36 @@ if (! empty($_POST))
exit;
}
- if (!$input_errors)
- {
- $freenas_config['samba']['netbiosname'] = $_POST['netbiosname'];
- $freenas_config['samba']['workgroup'] = $_POST['workgroup'];
- $freenas_config['samba']['serverdesc'] = $_POST['serverdesc'];
- $freenas_config['samba']['security'] = $_POST['security'];
- $freenas_config['samba']['localmaster'] = $_POST['localmaster'];
- $freenas_config['samba']['winssrv'] = $_POST['winssrv'];
- $freenas_config['samba']['hidemount'] = $_POST['hidemount'];
- $freenas_config['samba']['timesrv'] = $_POST['timesrv'];
- $freenas_config['samba']['doscharset'] = $_POST['doscharset'];
- $freenas_config['samba']['unixcharset'] = $_POST['unixcharset'];
- $freenas_config['samba']['loglevel'] = $_POST['loglevel'];
- $freenas_config['samba']['sndbuf'] = $_POST['sndbuf'];
- $freenas_config['samba']['rcvbuf'] = $_POST['rcvbuf'];
- $freenas_config['samba']['recyclebin'] = $_POST['recyclebin'] ? true : false;
- $freenas_config['samba']['enable'] = $_POST['enable'] ? true : false;
-
- write_config();
-
- $retval = 0;
- if (!file_exists($d_sysrebootreqd_path)) {
- /* nuke the cache file */
- config_lock();
- services_samba_configure();
- services_zeroconf_configure();
- config_unlock();
- }
- $savemsg = get_std_save_message($retval);
- }
+ if (!$input_errors)
+ {
+ $freenas_config['samba']['netbiosname'] = $_POST['netbiosname'];
+ $freenas_config['samba']['workgroup'] = $_POST['workgroup'];
+ $freenas_config['samba']['serverdesc'] = $_POST['serverdesc'];
+ $freenas_config['samba']['security'] = $_POST['security'];
+ $freenas_config['samba']['localmaster'] = $_POST['localmaster'];
+ $freenas_config['samba']['winssrv'] = $_POST['winssrv'];
+ /* $freenas_config['samba']['hidemount'] = $_POST['hidemount']; */
+ $freenas_config['samba']['timesrv'] = $_POST['timesrv'];
+ $freenas_config['samba']['doscharset'] = $_POST['doscharset'];
+ $freenas_config['samba']['unixcharset'] = $_POST['unixcharset'];
+ $freenas_config['samba']['loglevel'] = $_POST['loglevel'];
+ $freenas_config['samba']['sndbuf'] = $_POST['sndbuf'];
+ $freenas_config['samba']['rcvbuf'] = $_POST['rcvbuf'];
+ $freenas_config['samba']['recyclebin'] = $_POST['recyclebin'] ? true : false;
+ $freenas_config['samba']['enable'] = $_POST['enable'] ? true : false;
+
+ write_config();
+
+ $retval = 0;
+ if (!file_exists($d_sysrebootreqd_path)) {
+ /* nuke the cache file */
+ config_lock();
+ services_samba_configure();
+ services_zeroconf_configure();
+ config_unlock();
+ }
+ $savemsg = get_std_save_message($retval);
+ }
}
include("head.inc");
@@ -157,38 +165,38 @@ $jscriptstr = <<<EOD
<script type="text/javascript">
<!--
function enable_change(enable_change) {
- var endis;
-
- endis = !(document.iform.enable.checked || enable_change);
+ var endis;
+
+ endis = !(document.iform.enable.checked || enable_change);
endis ? color = '#D4D0C8' : color = '#FFFFFF';
- document.iform.netbiosname.disabled = endis;
- document.iform.workgroup.disabled = endis;
- document.iform.localmaster.disabled = endis;
- document.iform.winssrv.disabled = endis;
- document.iform.timesrv.disabled = endis;
- document.iform.serverdesc.disabled = endis;
- document.iform.doscharset.disabled = endis;
- document.iform.unixcharset.disabled = endis;
- document.iform.loglevel.disabled = endis;
- document.iform.sndbuf.disabled = endis;
- document.iform.rcvbuf.disabled = endis;
- document.iform.recyclebin.disabled = endis;
- document.iform.security.disabled = endis;
+ document.iform.netbiosname.disabled = endis;
+ document.iform.workgroup.disabled = endis;
+ document.iform.localmaster.disabled = endis;
+ document.iform.winssrv.disabled = endis;
+ document.iform.timesrv.disabled = endis;
+ document.iform.serverdesc.disabled = endis;
+ document.iform.doscharset.disabled = endis;
+ document.iform.unixcharset.disabled = endis;
+ document.iform.loglevel.disabled = endis;
+ document.iform.sndbuf.disabled = endis;
+ document.iform.rcvbuf.disabled = endis;
+ document.iform.recyclebin.disabled = endis;
+ document.iform.security.disabled = endis;
/* color adjustments */
- document.iform.netbiosname.style.backgroundColor = color;
- document.iform.workgroup.style.backgroundColor = color;
- document.iform.localmaster.style.backgroundColor = color;
- document.iform.winssrv.style.backgroundColor = color;
- document.iform.timesrv.style.backgroundColor = color;
- document.iform.serverdesc.style.backgroundColor = color;
- document.iform.doscharset.style.backgroundColor = color;
- document.iform.unixcharset.style.backgroundColor = color;
- document.iform.loglevel.style.backgroundColor = color;
- document.iform.sndbuf.style.backgroundColor = color;
- document.iform.rcvbuf.style.backgroundColor = color;
- document.iform.recyclebin.style.backgroundColor = color;
- document.iform.security.style.backgroundColor = color;
+ document.iform.netbiosname.style.backgroundColor = color;
+ document.iform.workgroup.style.backgroundColor = color;
+ document.iform.localmaster.style.backgroundColor = color;
+ document.iform.winssrv.style.backgroundColor = color;
+ document.iform.timesrv.style.backgroundColor = color;
+ document.iform.serverdesc.style.backgroundColor = color;
+ document.iform.doscharset.style.backgroundColor = color;
+ document.iform.unixcharset.style.backgroundColor = color;
+ document.iform.loglevel.style.backgroundColor = color;
+ document.iform.sndbuf.style.backgroundColor = color;
+ document.iform.rcvbuf.style.backgroundColor = color;
+ document.iform.recyclebin.style.backgroundColor = color;
+ document.iform.security.style.backgroundColor = color;
}
//-->
</script>
@@ -203,11 +211,25 @@ echo $pfSenseHead->getHTML();
<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>">
<?php include("fbegin.inc"); ?>
-<?php if ($input_errors) print_input_errors($input_errors); ?>
-<?php if ($savemsg) print_info_box($savemsg); ?>
- <div id="inputerrors"></div>
- <form id="iform" name="iform" action="services_samba.php" method="post">
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
+<form id="iform" name="iform" action="services_samba.php" method="post">
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td class="tabnavtbl">
+<?php
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Settings"), true, "services_samba.php");
+ $tab_array[1] = array(gettext("Shares"), false, "services_samba_share.php");
+ display_top_tabs($tab_array);
+?>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div id="mainarea">
+ <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
+ <?php if ($input_errors) print_input_errors($input_errors); ?>
+ <?php if ($savemsg) print_info_box($savemsg); ?>
+ <div id="inputerrors"></div>
<tr>
<td width="100%" valign="middle" class="listtopic" colspan="2">
<span style="vertical-align: middle; position: relative; left: 0px;"><?=gettext("CIFS share");?></span>
@@ -219,10 +241,10 @@ echo $pfSenseHead->getHTML();
<tr>
<td width="22%" valign="top" class="vncellreq"><?=gettext("Authentication");?></td>
<td width="78%" class="vtable">
- <select name="security" class="formselect" id="security">
+ <select name="security" class="formselect" id="security">
<?php
$types = explode(",", "Anonymous,Local User,Domain");
- $vals = explode(" ", "share user domain");
+ $vals = explode(" ", "share user domain");
$j = 0;
for ($j = 0; $j < count($vals); $j++):
@@ -259,10 +281,10 @@ echo $pfSenseHead->getHTML();
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("Dos charset");?></td>
<td width="78%" class="vtable" align="left" valign="middle">
- <select name="doscharset" class="formselect" id="doscharset">
- <?php
+ <select name="doscharset" class="formselect" id="doscharset">
+ <?php
$types = explode(",", "CP850,CP852,CP437,ASCII");
- $vals = explode(" ", "CP850 CP852 CP437 ASCII");
+ $vals = explode(" ", "CP850 CP852 CP437 ASCII");
$j = 0;
for ($j = 0; $j < count($vals); $j++):
@@ -277,10 +299,10 @@ echo $pfSenseHead->getHTML();
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("Unix charset");?></td>
<td width="78%" class="vtable" align="left" valign="middle">
- <select name="unixcharset" class="formselect" id="unixcharset">
- <?php
+ <select name="unixcharset" class="formselect" id="unixcharset">
+ <?php
$types = explode(",", "UTF-8,iso-8859-1,iso-8859-15,gb2312,ASCII");
- $vals = explode(" ", "UTF-8 iso-8859-1 iso-8859-15 gb2312 ASCII");
+ $vals = explode(" ", "UTF-8 iso-8859-1 iso-8859-15 gb2312 ASCII");
$j = 0;
for ($j = 0; $j < count($vals); $j++):
@@ -295,10 +317,10 @@ echo $pfSenseHead->getHTML();
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("Log level");?></td>
<td width="78%" class="vtable" align="left" valign="middle">
- <select name="loglevel" class="formselect" id="loglevel">
+ <select name="loglevel" class="formselect" id="loglevel">
<?php
$types = explode(",", "Minimum,Normal,Full,Debug");
- $vals = explode(" ", "1 2 3 10");
+ $vals = explode(" ", "1 2 3 10");
$j = 0;
for ($j = 0; $j < count($vals); $j++):
@@ -313,10 +335,10 @@ echo $pfSenseHead->getHTML();
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("Local Master Browser");?></td>
<td width="78%" class="vtable" align="left" valign="middle">
- <select name="localmaster" class="formselect" id="localmaster">
+ <select name="localmaster" class="formselect" id="localmaster">
<?php
$types = explode(",", "Yes,No");
- $vals = explode(" ", "yes no");
+ $vals = explode(" ", "yes no");
$j = 0;
for ($j = 0; $j < count($vals); $j++):
@@ -333,10 +355,10 @@ echo $pfSenseHead->getHTML();
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("Time Server");?></td>
<td width="78%" class="vtable" align="left" valign="middle">
- <select name="timesrv" class="formselect" id="timesrv">
+ <select name="timesrv" class="formselect" id="timesrv">
<?php
$types = explode(",", "Yes,No");
- $vals = explode(" ", "yes no");
+ $vals = explode(" ", "yes no");
$j = 0;
for ($j = 0; $j < count($vals); $j++):
@@ -367,22 +389,6 @@ echo $pfSenseHead->getHTML();
</td>
</tr>
<tr>
- <td width="22%" valign="top" class="vncell"><?=gettext("Share to hide.");?></td>
- <td width="78%" class="vtable" align="left" valign="middle">
- <?
- $i=0;
- foreach ($a_mount as $mountv) {
- echo "<input name='hidemount[]' id='$i' type='checkbox' value='$mountv[sharename]'".
- ((is_array($pconfig['hidemount']) && in_array($mountv['sharename'],$pconfig['hidemount'])) ? " checked=\"checked\"" : "") .
- " />$mountv[sharename] <br />\n";
- $i++;
- }
- ?>
- <br />
- <?= gettext("Select the CIFS share to hide from browsing."); ?>
- </td>
- </tr>
- <tr>
<td width="22%" valign="top" class="vncell"><?=gettext("Send Buffer Size");?></td>
<td width="78%" class="vtable" align="left" valign="middle">
<input name="sndbuf" type="text" class="formfld unknown" id="sndbuf" size="30" value="<?=htmlspecialchars($pconfig['sndbuf']);?>" />
@@ -405,7 +411,11 @@ echo $pfSenseHead->getHTML();
</td>
</tr>
</table>
- </form>
+ </div>
+ </td>
+ </tr>
+</table>
+</form>
<?php include("fend.inc"); ?>
<?= checkForInputErrors(); ?>
<script type="text/javascript">
diff --git a/packages/freenas/www/services_samba_share.php b/packages/freenas/www/services_samba_share.php
new file mode 100644
index 00000000..95f1fe0b
--- /dev/null
+++ b/packages/freenas/www/services_samba_share.php
@@ -0,0 +1,165 @@
+<?php
+/* $Id$ */
+/* ========================================================================== */
+/*
+ services_samba_share.php
+ part of pfSense (http://www.pfSense.com)
+ Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name>
+ All rights reserved.
+
+ Based on FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ All rights reserved.
+ */
+/* ========================================================================== */
+/*
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+/* ========================================================================== */
+
+$pgtitle = array(gettext("Services"),
+ gettext("CIFS"),
+ gettext("Shares"));
+
+require_once("freenas_config.inc");
+require_once("guiconfig.inc");
+require_once("freenas_guiconfig.inc");
+require_once("freenas_functions.inc");
+
+if (!is_array($freenas_config['mounts']['mount']))
+ $freenas_config['mounts']['mount'] = array();
+
+mount_sort();
+
+$a_mount = &$freenas_config['mounts']['mount'];
+
+if (! empty($_POST))
+{
+ /* hash */
+ unset($error_bucket);
+ /* simple error list */
+ unset($input_errors);
+ $pconfig = $_POST;
+
+ if (is_array($error_bucket))
+ foreach($error_bucket as $elem)
+ $input_errors[] =& $elem["error"];
+
+ /* if this is an AJAX caller then handle via JSON */
+ if(isAjax() && is_array($error_bucket)) {
+ input_errors2Ajax(NULL, $error_bucket);
+ exit;
+ }
+
+ if (!$input_errors)
+ {
+ if($_POST['apply']) {
+ $retval = 0;
+ if(!file_exists($d_sysrebootreqd_path)) {
+ config_lock();
+ services_samba_configure();
+ services_zeroconf_configure();
+ config_unlock();
+ }
+
+ $savemsg = get_std_save_message($retval);
+
+ if(0 == $retval) {
+ if(file_exists($d_smbshareconfdirty_path))
+ unlink($d_smbshareconfdirty_path);
+ }
+ }
+ }
+}
+
+if($_GET['act'] == "ret") {
+ pfSenseHeader("services_samba_share.php");
+ exit;
+}
+
+include("head.inc");
+/* put your custom HTML head content here */
+/* using some of the $pfSenseHead function calls */
+
+echo $pfSenseHead->getHTML();
+
+?>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>">
+<?php include("fbegin.inc"); ?>
+
+<form id="iform" name="iform" action="services_samba_share.php" method="post">
+<?php if ($savemsg) print_info_box($savemsg); ?>
+<?php if (file_exists($d_smbshareconfdirty_path)): ?>
+<?php print_info_box_np(gettext("The shares has been modified.") . "<br />" .
+ gettext("You must apply the changes in order for them to take effect."));?>
+<?php endif; ?>
+<?php if ($input_errors) print_input_errors($input_errors); ?>
+<div id="inputerrors"></div>
+
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td class="tabnavtbl">
+<?php
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Settings"), false, "services_samba.php");
+ $tab_array[1] = array(gettext("Shares"), true, "services_samba_share.php");
+ display_top_tabs($tab_array);
+?>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div id="mainarea">
+ <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td width="20%" class="listhdrr"><?= gettext("Share Name"); ?></td>
+ <td width="25%" class="listhdrr"><?= gettext("Description"); ?></td>
+ <td width="20%" class="listhdrr"><?= gettext("Browseable"); ?></td>
+ <td width="10%" class="list"></td>
+ </tr>
+ <?php $i = 0; foreach($a_mount as $mountv): ?>
+ <tr>
+ <td class="listr"><?=htmlspecialchars($mountv['sharename']);?>&nbsp;</td>
+ <td class="listr"><?=htmlspecialchars($mountv['desc']);?>&nbsp;</td>
+ <td class="listbg"><?=htmlspecialchars((is_array($config['samba']['hidemount']) && in_array($mountv['sharename'],$config['samba']['hidemount']))? gettext("No") : gettext("Yes"));?></td>
+ <td valign="middle" nowrap class="list">
+ <?php if(isset($config['samba']['enable']))
+ echo("<a href='services_samba_share_edit.php?id={$i}'><img src='./themes/" . $g['theme'] . "/images/icons/icon_e.gif' title='" . gettext("Edit Share") . "' width='17' height='17' border='0'></a>");
+ ?>
+ </td>
+ </tr>
+ <?php $i++; endforeach; ?>
+ </table>
+ </div>
+ </td>
+ </tr>
+</table>
+</form>
+<?php include("fend.inc"); ?>
+<?= checkForInputErrors(); ?>
+</body>
+</html>
diff --git a/packages/freenas/www/services_samba_share_edit.php b/packages/freenas/www/services_samba_share_edit.php
new file mode 100644
index 00000000..7c89a4c5
--- /dev/null
+++ b/packages/freenas/www/services_samba_share_edit.php
@@ -0,0 +1,156 @@
+<?php
+/* $Id$ */
+/* ========================================================================== */
+/*
+ services_samba_share_edit.php
+ part of pfSense (http://www.pfSense.com)
+ Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name>
+ All rights reserved.
+
+ Based on FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ All rights reserved.
+ */
+/* ========================================================================== */
+/*
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+/* ========================================================================== */
+
+$pgtitle = array(gettext("Services"),
+ gettext("CIFS"),
+ gettext("Shares"),
+ gettext("Edit"));
+
+require_once("freenas_config.inc");
+require_once("guiconfig.inc");
+require_once("freenas_guiconfig.inc");
+require_once("freenas_functions.inc");
+
+$id = $_GET['id'];
+if (isset($_POST['id']))
+ $id = $_POST['id'];
+
+if (!is_array($freenas_config['mounts']['mount']))
+ $freenas_config['mounts']['mount'] = array();
+
+mount_sort();
+
+if(!is_array($freenas_config['samba']['hidemount']))
+ $freenas_config['samba']['hidemount'] = array();
+
+if (! empty($_POST))
+{
+ /* hash */
+ unset($error_bucket);
+ /* simple error list */
+ unset($input_errors);
+
+ if (is_array($error_bucket))
+ foreach($error_bucket as $elem)
+ $input_errors[] =& $elem["error"];
+
+ /* if this is an AJAX caller then handle via JSON */
+ if(isAjax() && is_array($error_bucket)) {
+ input_errors2Ajax(NULL, $error_bucket);
+ exit;
+ }
+
+ if (!$input_errors)
+ {
+ if(!$_POST['browseable']) {
+ $freenas_config['samba']['hidemount'] = array_merge($freenas_config['samba']['hidemount'],array($freenas_config['mounts']['mount'][$id]['sharename']));
+ } else {
+ if(is_array($freenas_config['samba']['hidemount']) && in_array($freenas_config['mounts']['mount'][$id]['sharename'],$freenas_config['samba']['hidemount'])) {
+ $freenas_config['samba']['hidemount'] = array_diff($freenas_config['samba']['hidemount'],array($freenas_config['mounts']['mount'][$id]['sharename']));
+ }
+ }
+
+ touch($d_smbshareconfdirty_path);
+ write_config();
+ pfSenseHeader("services_samba_share.php");
+ exit;
+ }
+}
+
+include("head.inc");
+/* put your custom HTML head content here */
+/* using some of the $pfSenseHead function calls */
+echo $pfSenseHead->getHTML();
+
+?>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>">
+<?php include("fbegin.inc"); ?>
+
+<?php if ($input_errors) print_input_errors($input_errors); ?>
+<?php if ($savemsg) print_info_box($savemsg); ?>
+ <div id="inputerrors"></div>
+ <form id="iform" name="iform" action="disks_mount_edit.php" method="post">
+ <table width="100%" border="0" cellpadding="6" cellspacing="0">
+ <tr>
+ <td width="22%" valign="top" class="vncellreq"><?= gettext("Share Name"); ?></td>
+ <td width="78%" class="vtable">
+ <input type="text" class="formfld" size="30" value="<?=htmlspecialchars($freenas_config['mounts']['mount'][$id]['sharename']);?>" disabled="disabled" />
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq"><?= gettext("Description"); ?></td>
+ <td width="78%" class="vtable">
+ <input type="text" class="formfld" size="30" value="<?=htmlspecialchars($freenas_config['mounts']['mount'][$id]['desc']);?>" disabled="disabled">
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell"><?= gettext("Browseable"); ?></td>
+ <td width="78%" class="vtable">
+ <select name="browseable" class="formfld" id="browseable">
+ <?php
+ $text = array(gettext("Yes"),gettext("No"));
+ $vals = explode(" ","1 0"); $j = 0;
+ for($j = 0; $j < count($vals); $j++):
+ ?>
+ <option value="<?=$vals[$j];?>" <?php if(is_array($freenas_config['samba']['hidemount']) && in_array($freenas_config['mounts']['mount'][$id]['sharename'],$freenas_config['samba']['hidemount'])) echo "selected=\"selected\"";?>>
+ <?=htmlspecialchars($text[$j]);?>
+ </option>
+ <?php endfor;?>
+ </select>
+ <br><?= gettext("This controls whether this share is seen in the list of available shares in a net view and in the browse list."); ?>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top">&nbsp;</td>
+ <td width="78%"> <input name="Submit" type="submit" class="formbtn" value="<?= gettext("Save"); ?>">
+ <?php if(isset($id)): ?>
+ <input name="id" type="hidden" value="<?=$id;?>">
+ <?php endif; ?>
+ </td>
+ </tr>
+ </table>
+ </form>
+<?php include("fend.inc"); ?>
+<?= checkForInputErrors(); ?>
+</body>
+</html>
diff --git a/packages/freenas/www/services_unison.php b/packages/freenas/www/services_unison.php
new file mode 100644
index 00000000..50c3dd24
--- /dev/null
+++ b/packages/freenas/www/services_unison.php
@@ -0,0 +1,245 @@
+<?php
+/* $Id$ */
+/* ========================================================================== */
+/*
+ services_unison.php
+ part of pfSense (http://www.pfSense.com)
+ Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name>
+ All rights reserved.
+
+ Based on FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ All rights reserved.
+ */
+/* ========================================================================== */
+/*
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+/* ========================================================================== */
+
+/*
+ *************************
+
+ Unison Installation Notes
+
+ To work, unison requires an environment variable UNISON to point at
+ a writable directory. Unison keeps information there between syncs to
+ speed up the process.
+
+ When a user runs the unison client, it will try to invoke ssh to
+ connect to the this server. Giving the local ssh a UNISON environment
+ variable without compromising ssh turned out to be non-trivial.
+ The solution is to modify the default path found in /etc/login.conf.
+ The path is seeded with "UNISON=/mnt" and this updated by the
+ /etc/inc/services.inc file.
+
+ Todo:
+ * Arguably, a full client install could be done too to
+ allow FreeNAS to FreeNAS syncing.
+
+ *************************
+*/
+
+$pgtitle = array(gettext("Services"),
+ gettext("Unison"));
+
+require_once("freenas_config.inc");
+require_once("guiconfig.inc");
+require_once("freenas_guiconfig.inc");
+require_once("freenas_functions.inc");
+
+if (!is_array($freenas_config['unison'])) {
+ $freenas_config['unison'] = array();
+}
+
+$pconfig['enable'] = isset($freenas_config['unison']['enable']);
+$pconfig['share'] = $freenas_config['unison']['share'];
+$pconfig['workdir'] = isset($freenas_config['unison']['workdir']);
+$pconfig['makedir'] = isset($freenas_config['unison']['makedir']);
+
+if (! empty($_POST))
+{
+ /* hash */
+ unset($error_bucket);
+ /* simple error list */
+ unset($input_errors);
+ $pconfig = $_POST;
+
+ /* input validation */
+ $reqdfields = split(" ", "share workdir");
+ $reqdfieldsn = split(",", "Share,Working Directory");
+
+ do_input_validation_new($_POST, $reqdfields, $reqdfieldsn, &$error_bucket);
+
+ $fullpath = "/mnt/{$_POST['share']}/{$_POST['workdir']}";
+
+ if (!$_POST['makedir'] && ($fullpath) && (!file_exists($fullpath))) {
+ $error_bucket[] = array("error" => gettext("The combination of share and working directory does not exist."),
+ "field" => "workdir");
+ }
+
+ if (is_array($error_bucket))
+ foreach($error_bucket as $elem)
+ $input_errors[] =& $elem["error"];
+
+ /* if this is an AJAX caller then handle via JSON */
+ if(isAjax() && is_array($error_bucket)) {
+ input_errors2Ajax(NULL, $error_bucket);
+ exit;
+ }
+
+ if (!$input_errors)
+ {
+ $freenas_config['unison']['share'] = $_POST['share'];
+ $freenas_config['unison']['workdir'] = $_POST['workdir'];
+ $freenas_config['unison']['enable'] = $_POST['enable'] ? true : false;
+ $freenas_config['unison']['makedir'] = $_POST['makedir'] ? true : false;
+
+ write_config();
+
+ $retval = 0;
+ if (!file_exists($d_sysrebootreqd_path))
+ {
+ /* nuke the cache file */
+ config_lock();
+ services_unison_configure();
+ /* services_zeroconf_configure(); */
+ config_unlock();
+ }
+
+ $savemsg = get_std_save_message($retval);
+ }
+}
+
+/* retrieve mounts to build list of share names */
+if (!is_array($freenas_config['mounts']['mount']))
+ $freenas_config['mounts']['mount'] = array();
+
+mount_sort();
+
+$a_mount = &$freenas_config['mounts']['mount'];
+
+include("head.inc");
+/* put your custom HTML head content here */
+/* using some of the $pfSenseHead function calls */
+
+$jscriptstr = <<<EOD
+<script type="text/javascript">
+<!--
+function enable_change(enable_change) {
+ var endis;
+
+ endis = !(document.iform.enable.checked || enable_change);
+ endis ? color = '#D4D0C8' : color = '#FFFFFF';
+
+ document.iform.share.disabled = endis;
+ document.iform.workdir.disabled = endis;
+ document.iform.makedir.disabled = endis;
+ /* color adjustments */
+ document.iform.share.style.backgroundColor = color;
+ document.iform.workdir.style.backgroundColor = color;
+ document.iform.makedir.style.backgroundColor = color;
+}
+//-->
+</script>
+
+EOD;
+
+$pfSenseHead->addScript($jscriptstr);
+echo $pfSenseHead->getHTML();
+
+?>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>">
+<?php include("fbegin.inc"); ?>
+
+<?php if ($input_errors) print_input_errors($input_errors); ?>
+<?php if ($savemsg) print_info_box($savemsg); ?>
+ <div id="inputerrors"></div>
+ <form id="iform" name="iform" action="services_unison.php" method="post">
+ <table width="100%" border="0" cellpadding="6" cellspacing="0">
+ <tr>
+ <td width="100%" valign="middle" class="listtopic" colspan="2">
+ <span style="vertical-align: middle; position: relative; left: 0px;"><?=gettext("AFP Server");?></span>
+ <span style="vertical-align: middle; position: relative; left: 84%;">
+ <input name="enable" type="checkbox" value="yes" <?php if ($pconfig['enable']) echo "checked=\"checked\""; ?> onClick="enable_change(false)" />&nbsp;<?= gettext("Enable"); ?>
+ </span>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell"><?=gettext("Share");?></td>
+ <td width="78%" class="vtable">
+ <select name="share" class="formselect" id="share">
+ <?php foreach ($a_mount as $mount): $tmp=$mount['sharename']; ?>
+ <option value="<?=$tmp;?>"
+ <?php if ($tmp == $pconfig['share']) echo "selected=\"selected\"";?>><?=$tmp?></option>
+ <?php endforeach; ?>
+ </select>
+ <br />
+ <?= gettext("You may need enough space to duplicate all files being synced."); ?>.</td>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell"><?=gettext("Working Directory");?></td>
+ <td width="78%" class="vtable" align="left" valign="middle">
+ <input name="workdir" type="text" class="formfld file" id="workdir" size="20" value="<?=htmlspecialchars($pconfig['workdir']);?>" />
+ <?= gettext("Where the working files will be stored"); ?>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell"><?=gettext("Create");?></td>
+ <td width="78%" class="vtable" align="left" valign="middle">
+ <input name="makedir" type="checkbox" id="makedir" value="yes" <?php if ($pconfig['makedir']) echo "checked=\"checked\""; ?> />
+ <?= gettext("Create work directory if it doesn't exist"); ?>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top">&nbsp;</td>
+ <td width="78%">
+ <input id="submit" name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" />
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top">&nbsp;</td>
+ <td width="78%">
+ <span class="red">
+ <strong><?= gettext("Note"); ?>:</strong>
+ </span>
+ <br />
+ <?= gettext("<a href='/services_sshd.php'>SSHD</a> must be enabled for Unison to work, and the <a href='/access_users.php'>user</a> must have Full Shell enabled."); ?>
+ </td>
+ </tr>
+ </table>
+ </form>
+<?php include("fend.inc"); ?>
+<?= checkForInputErrors(); ?>
+<script type="text/javascript">
+<!--
+enable_change(false);
+//-->
+</script>
+</body>
+</html>
diff --git a/packages/freenas/www/status_disks.php b/packages/freenas/www/status_disks.php
index 7ab8bed8..704bc467 100644
--- a/packages/freenas/www/status_disks.php
+++ b/packages/freenas/www/status_disks.php
@@ -1,36 +1,44 @@
<?php
/* $Id$ */
+/* ========================================================================== */
/*
- disks_manage_edit.php
- part of FreeNAS (http://www.freenas.org)
- Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
- All rights reserved.
-
- Based on m0n0wall (http://m0n0.ch/wall)
- Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
+ status_disks.php
+ part of pfSense (http://www.pfSense.com)
+ Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name>
+ All rights reserved.
+
+ Based on FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ All rights reserved.
+ */
+/* ========================================================================== */
+/*
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+/* ========================================================================== */
$pgtitle = array(gettext("Status"),
gettext("Disks"));
@@ -40,8 +48,8 @@ require_once("freenas_guiconfig.inc");
require_once("freenas_functions.inc");
if (!is_array($freenas_config['disks']['disk']))
- $freenas_config['disks']['disk'] = array();
-
+ $freenas_config['disks']['disk'] = array();
+
disks_sort();
$raidstatus=get_sraid_disks_list();
@@ -68,8 +76,8 @@ echo $pfSenseHead->getHTML();
<td width="5%" class="listhdrr">Size</td>
<td width="60%" class="listhdrr">Description</td>
<td width="10%" class="listhdr">Status</td>
- </tr>
- <?php foreach ($a_disk_conf as $disk): ?>
+ </tr>
+ <?php foreach ($a_disk_conf as $disk): ?>
<tr>
<td class="listr">
<?=htmlspecialchars($disk['name']);?>
@@ -85,10 +93,10 @@ echo $pfSenseHead->getHTML();
$stat=disks_status($disk);
echo $stat;?>&nbsp;
</td>
- </tr>
- <?php endforeach; ?>
- <?php if (isset($raidstatus)): ?>
- <?php foreach ($raidstatus as $diskk => $diskv): ?>
+ </tr>
+ <?php endforeach; ?>
+ <?php if (isset($raidstatus)): ?>
+ <?php foreach ($raidstatus as $diskk => $diskv): ?>
<tr>
<td class="listr">
<?=htmlspecialchars($diskk);?>
@@ -103,16 +111,16 @@ echo $pfSenseHead->getHTML();
<td class="listr">
<?=htmlspecialchars($diskv['desc']);?>&nbsp;
</td>
- </tr>
- <?php endforeach; ?>
- <?php endif; ?>
+ </tr>
+ <?php endforeach; ?>
+ <?php endif; ?>
</table>
</form>
<?php include("fend.inc"); ?>
<?= checkForInputErrors(); ?>
<script type="text/javascript">
<!--
-enable_change(false);
+// enable_change(false);
//-->
</script>
</body>