diff options
Diffstat (limited to 'packages/freenas')
-rw-r--r-- | packages/freenas/pkg/freenas.inc | 22 | ||||
-rw-r--r-- | packages/freenas/pkg/freenas_services.inc | 112 | ||||
-rw-r--r-- | packages/freenas/www/disks_mount.php | 2 | ||||
-rw-r--r-- | packages/freenas/www/services_afp.php | 2 | ||||
-rw-r--r-- | packages/freenas/www/services_ftp.php | 4 |
5 files changed, 80 insertions, 62 deletions
diff --git a/packages/freenas/pkg/freenas.inc b/packages/freenas/pkg/freenas.inc index bb0685df..d00440a3 100644 --- a/packages/freenas/pkg/freenas.inc +++ b/packages/freenas/pkg/freenas.inc @@ -232,6 +232,8 @@ function oninstall_setup_config() { } function custom_php_install_command() { + global $g; + oninstall_copy_kernel_binaries(); oninstall_copy_misc_binaries(); adjust_package_contents(); @@ -240,27 +242,43 @@ function custom_php_install_command() { if (! file_exists("/usr/local/etc/rc.d")) mwexec("mkdir -p /usr/local/etc/rc.d"); + if (! file_exists("{$g['varrun_path']}/dbus")) + mkdir("{$g['varrun_path']}/dbus"); + + if (! file_exists("{$g['varrun_path']}/avahi-daemon")) + mkdir("{$g['varrun_path']}/avahi-daemon"); + rename("/usr/local/pkg/rc.freenas", "/usr/local/etc/rc.d/freenas.sh"); chmod ("/usr/local/etc/rc.d/freenas.sh", 0755); mwexec("ln -s /usr/local/etc/uams/uams_passwd.so /usr/local/etc/uams/uams_clrtxt.so"); mwexec("ln -s /usr/local/etc/uams/uams_dhx_passwd.so /usr/local/etc/uams/uams_dhx.so"); + /* hack cause I linked netatalk against db44 instead of db42 */ + mwexec("ln -s /usr/local/lib/libdb-4.4.so.0 /usr/local/lib/libdb-4.2.so.2"); } function custom_php_deinstall_command() { - global $config; + global $config, $g; oninstall_copy_kernel_binaries("deinstall"); oninstall_copy_misc_binaries("deinstall"); if (! file_exists("/usr/local/etc/rc.d")) - mwexec("rm -rf /usr/local/etc/rc.d"); } + mwexec("rm -rf /usr/local/etc/rc.d"); + + if (! file_exists("{$g['varrun_path']}/dbus")) + mwexec("rm -rf {$g['varrun_path']}/dbus"); + + if (! file_exists("{$g['varrun_path']}/avahi-daemon")) + mwexec("rm -rf {$g['varrun_path']}/avahi-daemon"); unlink_if_exists("/usr/local/etc/uams/uams_clrtxt.so"); unlink_if_exists("/usr/local/etc/uams/uams_dhx.so"); unlink_if_exists("/usr/local/etc/rc.d/freenas.sh"); + unlink_if_exists("/usr/local/lib/libdb-4.2.so.2"); unset($config['installedpackages']['freenas']); write_config(); conf_mount_ro(); +} ?> diff --git a/packages/freenas/pkg/freenas_services.inc b/packages/freenas/pkg/freenas_services.inc index 840a03c5..6020a4f6 100644 --- a/packages/freenas/pkg/freenas_services.inc +++ b/packages/freenas/pkg/freenas_services.inc @@ -195,7 +195,7 @@ EOD; /* Unmount filesystem if not booting mode*/ $sambaconf .= <<<EOD - + [{$mountent['sharename']}] comment = {$mountent['desc']} path = /mnt/{$mountent['sharename']} @@ -269,7 +269,7 @@ function services_rsyncd_configure() { if ($g['booting']) echo "Starting RSYNC daemon... "; - + /* If no share configured, exit */ if (!is_array($freenas_config['mounts']['mount'])) return 1; @@ -351,7 +351,7 @@ EOD; EOD; fwrite($fd, $motd); - fclose($fd); + fclose($fd); } /* run rsync Daemon */ @@ -442,36 +442,36 @@ EOD; } function services_ftpd_configure() { - global $freenas_config, $g; - // services_vsftpd_configure(); - // services_pureftpd_configure(); - services_wzdftpd_configure(); + global $freenas_config, $g; + // services_vsftpd_configure(); + // services_pureftpd_configure(); + services_wzdftpd_configure(); } function services_wzdftpd_configure() { global $freenas_config, $g; - + /* kill any WZDFTPD */ killbyname("wzdftpd"); if (isset($freenas_config['ftp']['enable'])) { - + if ($g['booting']) echo "Starting FTP server... "; if (! file_exists("/var/log/wzdftpd")) mkdir("/var/log/wzdftpd"); - - if (! file_exists("{$g['varetc_path']}/wzdftpd")) - mkdir("{$g['varetc_path']}/wzdftpd"); + + if (! file_exists("/usr/local/etc/wzdftpd")) + mkdir("/usr/local/etc/wzdftpd"); /* generate wzd.cfg */ - $fd = fopen("{$g['varetc_path']}/wzdftpd/wzd.cfg", "w"); + $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 [GLOBAL] config version = 0.7.2 @@ -482,23 +482,23 @@ 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']} +pasv_low_range = {$freenas_config['ftp']['pasv_min_port']} +pasv_high_range = {$freenas_config['ftp']['pasv_max_port']} EOD; } $ftpconf .= <<<EOD -pasv_low_range = 2500 -pasv_high_range = 3000 pasv_ip = {$freenas_config['ftp']['pasv_address']} dir_message = .message logfile = /var/log/wzdftpd/wzd.log +xferlog = /var/log/wzdftpd/xferlog +logdir = /var/log/wzdftpd max_threads = 32 -backend = ${datarootdir}/wzdftpd/backends/libwzdplaintext.so > 124 -backend = ${datarootdir}/wzdftpd/backends/libwzdpam.so +backend = /usr/local/share/wzdftpd/backends/libwzdplaintext.so > 124 +backend = /usr/local/share/wzdftpd/backends/libwzdpam.so max_ul_speed = 0 max_dl_speed = 0 @@ -581,17 +581,17 @@ site_vfsadd = +O site_vfsdel = +O [modules] -${datarootdir}/wzdftpd/modules/libwzd_debug.so = deny -${datarootdir}/wzdftpd/modules/libwzd_test.so = deny -${datarootdir}/wzdftpd/modules/libwzd_sfv.so = allow -${datarootdir}/wzdftpd/modules/libwzd_tcl.so = deny -${datarootdir}/wzdftpd/modules/libwzd_perl.so = deny +/usr/local/share/wzdftpd/modules/libwzd_debug.so = deny +/usr/local/share/wzdftpd/modules/libwzd_test.so = deny +/usr/local/share/wzdftpd/modules/libwzd_sfv.so = allow +/usr/local/share/wzdftpd/modules/libwzd_tcl.so = deny +/usr/local/share/wzdftpd/modules/libwzd_perl.so = deny EOD; if (empty($config['system']['zeroconf_disable'])) { $ftpconf .= <<<EOD -${datarootdir}/wzdftpd/modules/libwzd_zeroconf.so = allow +/usr/local/share/wzdftpd/modules/libwzd_zeroconf.so = allow [ZEROCONF] zeroconf_port = {$freenas_config['ftp']['port']} @@ -613,7 +613,7 @@ other_completebar = [WzD] - ( %.0mM %fF - COMPLETE ) - [WzD] param = /usr/local/etc/wzdftpd/users [sections] -ALL = /* ^([]\[A-Za-z0-9_.'() \t+-])*$ +ALL = /* ^([]\[A-Za-z0-9_.'() \\t+-])*\$ [cron] @@ -643,13 +643,13 @@ EOD; fclose($fd); /* run vsftpd */ - mwexec("/usr/local/sbin/wzdftpd -f {$g['varetc_path']}/wzdftpd/wzd.cfg"); + mwexec("/usr/local/sbin/wzdftpd -f /usr/local/etc/wzdftpd/wzd.cfg"); if ($g['booting']) echo "done\n"; } - + return 0; } @@ -795,7 +795,7 @@ EOD; if ($freenas_config['ftp']['pasv_address']) $cmd .= "-P {$freenas_config['ftp']['pasv_address']} "; - + if ($freenas_config['ftp']['natmode']) $cmd .= "-N "; @@ -824,7 +824,7 @@ function services_smart_configure() { killbyname("smartd"); if (isset($config['system']['smart'])) { - + if ($g['booting']) echo "Starting smartd... "; @@ -935,7 +935,7 @@ EOD; // 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']) @@ -1091,7 +1091,7 @@ function services_afpd_configure() /* If no share configured, exit */ if (!is_array($freenas_config['mounts']['mount'])) return 1; - + if ($g['booting']) echo "Starting AFP server... "; @@ -1106,18 +1106,18 @@ function services_afpd_configure() 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 - -noslp -fqdn {$config['system']['hostname']} -uamlist + -noslp -fqdn {$config['system']['hostname']}.{$config['system']['domain']} -uamlist EOD; } else { $afpconf .= <<<EOD - -uamlist + -noslp -nozeroconf -uamlist EOD; } @@ -1156,17 +1156,15 @@ EOD; /mnt/{$mount['sharename']} "{$mount['sharename']}" EOD; - + } fwrite($fd, $AppleVolumes); fclose($fd); - /* run afpdpd */ mwexec("/usr/local/sbin/afpd -F {$g['varetc_path']}/afpd.conf"); - if ($g['booting']) echo "done\n"; } @@ -1193,7 +1191,7 @@ function services_iscsi_configure() 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"; } @@ -1201,7 +1199,7 @@ function services_iscsi_configure() return 0; } -function service_zeroconf_configure() { +function services_zeroconf_configure() { //services_mdnsresponder_configure(); //services_howl_configure(); services_avahi_configure(); @@ -1226,12 +1224,14 @@ function services_avahi_configure() { </service-group> EOD; - + /* kill any running dbus daemon */ - sigkillbypid("{$g['varrun_path']}/dbus/dbus.pid", "TERM"); - + sigkillbypid("{$g['varrun_path']}/dbus/dbus.pid", "TERM"); + + unlink_if_exists("{$g['varrun_path']}/dbus/dbus.pid"); + /* kill any running avahi daemons */ - mwexec("/usr/local/sbin/avahi-daemon -k"); + mwexec("/usr/local/sbin/avahi-daemon -k"); if (isset($config['system']['zeroconf_disable'])) @@ -1239,7 +1239,7 @@ EOD; 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'], @@ -1268,7 +1268,7 @@ EOD; $webservice = str_replace("@TXT_RECORDS@", "", $webservice); - + file_put_contents("/usr/local/etc/avahi/services/http.service", $webservice); } @@ -1295,7 +1295,7 @@ EOD; file_put_contents("/usr/local/etc/avahi/services/rsync.service", $rsyncservice); } - if (isset($config['sshd']['enable'])) { + if (isset($config['system']['enablesshd'])) { $sshservice = str_replace("@PORT@", "22", $service_template); @@ -1316,7 +1316,7 @@ EOD; /* NOP */ } - if (isset($freenas_config['samba']['enable'])) { + if (isset($freenas_config['samba']['enable'])) { $cifsservice = str_replace("@PORT@", "139", $service_template); @@ -1333,14 +1333,14 @@ EOD; file_put_contents("/usr/local/etc/avahi/services/cifs.service", $cifsservice); } - if (isset($freenas_config['nfs']['enable'])) { + 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); @@ -1363,11 +1363,11 @@ EOD; } - /* run dbus */ - mwexec("/usr/local/bin/dbus-daemon --system"); - - /* run avahi */ - mwexec("/usr/local/sbin/avahi-daemon -D"); + /* run dbus */ + mwexec("/usr/local/bin/dbus-daemon --system"); + + /* run avahi */ + mwexec("/usr/local/sbin/avahi-daemon -D"); if ($g['booting']) echo "done\n"; diff --git a/packages/freenas/www/disks_mount.php b/packages/freenas/www/disks_mount.php index 2a68a509..432eab34 100644 --- a/packages/freenas/www/disks_mount.php +++ b/packages/freenas/www/disks_mount.php @@ -172,7 +172,7 @@ echo $pfSenseHead->getHTML(); <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="" /> + <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> diff --git a/packages/freenas/www/services_afp.php b/packages/freenas/www/services_afp.php index 64817c1a..521e1203 100644 --- a/packages/freenas/www/services_afp.php +++ b/packages/freenas/www/services_afp.php @@ -160,7 +160,7 @@ echo $pfSenseHead->getHTML(); <tr> <td width="22%" valign="top" class="vncell"><?=gettext("Server Name");?></td> <td width="78%" class="vtable"> - <input name="afpname" type="text" class="formfld" id="afpname" size="20" value="<?=htmlspecialchars($pconfig['afpname']);?>" /> + <input name="afpname" type="text" class="formfld unknown" id="afpname" size="20" value="<?=htmlspecialchars($pconfig['afpname']);?>" /> </td> </tr> <tr> diff --git a/packages/freenas/www/services_ftp.php b/packages/freenas/www/services_ftp.php index 88683e57..1d0ad6d4 100644 --- a/packages/freenas/www/services_ftp.php +++ b/packages/freenas/www/services_ftp.php @@ -165,7 +165,7 @@ if (! empty($_POST)) if (!file_exists($d_sysrebootreqd_path)) { /* nuke the cache file */ config_lock(); - services_ftpd_configure(); + services_wzdftpd_configure(); services_zeroconf_configure(); config_unlock(); } @@ -332,7 +332,7 @@ echo $pfSenseHead->getHTML(); <tr> <td width="22%" valign="top"> </td> <td width="78%"> - <input id="submit" name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" /> + <input id="submitt" name="Submitt" type="submit" class="formbtn" value="<?=gettext("Save");?>" /> </td> </tr> </table> |