. 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. */ 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); } } function system_set_termcap() { global $config; if (isset($config['diag']['ipfstatentries'])) { $lines = $config['diag']['ipfstatentries'] + 6; } else { $lines = 306; } $termcap = <<:ti@:te@:tc=xterm: xterm|xterm-color|X11 terminal emulator:\ :ti@:te@:tc=xterm-xfree86: xterm-xfree86|XFree86 xterm:\ :k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:\ :k5=\E[15~:k6=\E[17~:k7=\E[18~:k8=\E[19~:\ :k9=\E[20~:k;=\E[21~:F1=\E[23~:F2=\E[24~:\ :kH=\EOF:@7=\EOF:kI=\E[2~:\ :kh=\EOH:*6=\EOF:kP=\E[5~:kN=\E[6~:\ :ku=\EOA:kd=\EOB:kr=\EOC:kl=\EOD:Km=\E[M:tc=xterm-basic: xterm-basic|xterm common (XFree86):\ :li#24:co#80:am:kn#12:km:mi:ms:xn:bl=^G:\ :is=\E[!p\E[?3;4l\E[4l\E>:rs=\E[!p\E[?3;4l\E[4l\E>:le=^H:\ :AL=\E[%dL:DL=\E[%dM:DC=\E[%dP:al=\E[L:dc=\E[P:dl=\E[M:\ :UP=\E[%dA:DO=\E[%dB:LE=\E[%dD:RI=\E[%dC:\ :ho=\E[H:cd=\E[J:ce=\E[K:cl=\E[H\E[2J:cm=\E[%i%d;%dH:cs=\E[%i%d;%dr:\ :im=\E[4h:ei=\E[4l:ks=\E[?1h\E=:ke=\E[?1l\E>:kD=\E[3~:kb=^H:\ :sf=\n:sr=\EM:st=\EH:ct=\E[3g:sc=\E7:rc=\E8:\ :eA=\E(B\E)0:as=^N:ae=^O:ml=\El:mu=\Em:up=\E[A:nd=\E[C:\ :md=\E[1m:me=\E[m^O:mr=\E[7m:so=\E[7m:se=\E[27m:us=\E[4m:ue=\E[24m:\ :ti=\E[?1049h:te=\E[?1049l:vi=\E[?25l:ve=\E[?25h:\ :ut:Co#8:pa#64:op=\E[39;49m:AB=\E[4%dm:AF=\E[3%dm:\ EOD; 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); 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; } function system_user_masterpasswd() { /* Create the master.passwd file*/ global $config, $g; $masterpasswd = << /dev/null 2>&1")) return 1; return 0; } ?>