From a6cb09d6671e4dee123e76bb82f15cc897f919ad Mon Sep 17 00:00:00 2001 From: Daniel Stefan Haischt Date: Thu, 4 Jan 2007 12:35:03 +0000 Subject: * synced freenas package to current FreeNAS trunk * unison package file needs to be added to pfsense.com * rc script needs to be tested --- packages/freenas/pkg/freenas_system.inc | 1038 +++++++++++++++---------------- 1 file changed, 496 insertions(+), 542 deletions(-) (limited to 'packages/freenas/pkg/freenas_system.inc') 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 @@ . - All rights reserved. - - Modified for FreeNAS (http://freenas.org) by Olivier Cochard - - 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 + All rights reserved. + + Based on FreeNAS (http://www.freenas.org) + Copyright (C) 2005-2006 Olivier Cochard-Labbé . + All rights reserved. + + Based on m0n0wall (http://m0n0.ch/wall) + Copyright (C) 2003-2006 Manuel Kasper . + 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 = << /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 -- cgit v1.2.3