Commit aa3a73bf authored by Franco Fichtner's avatar Franco Fichtner

globals: mostly zap cf_conf_path for #1

Also style, license prettify, obvious bugs along the way.
parent 3f8a9f08
...@@ -91,7 +91,7 @@ if($g['booting'] && file_exists("/cf/conf/config.xml")) { ...@@ -91,7 +91,7 @@ if($g['booting'] && file_exists("/cf/conf/config.xml")) {
} }
/* if our config file exists bail out, we're already set. */ /* if our config file exists bail out, we're already set. */
else if ($g['booting'] and !file_exists($g['cf_conf_path'] . "/config.xml") ) { else if ($g['booting'] && !file_exists('/cf/conf/config.xml')) {
if($g['booting']) echo "."; if($g['booting']) echo ".";
/* find the device where config.xml resides and write out an fstab */ /* find the device where config.xml resides and write out an fstab */
unset($cfgdevice); unset($cfgdevice);
...@@ -124,7 +124,7 @@ else if ($g['booting'] and !file_exists($g['cf_conf_path'] . "/config.xml") ) { ...@@ -124,7 +124,7 @@ else if ($g['booting'] and !file_exists($g['cf_conf_path'] . "/config.xml") ) {
if (strstr($mountdisk, "md")) if (strstr($mountdisk, "md"))
continue; continue;
if (mwexec("/sbin/mount -r /dev/{$mountdisk}a {$g['cf_path']}") == 0) { if (mwexec("/sbin/mount -r /dev/{$mountdisk}a {$g['cf_path']}") == 0) {
if (file_exists("{$g['cf_conf_path']}/config.xml")) { if (file_exists('cf/conf/config.xml')) {
/* found it */ /* found it */
$cfgdevice = $mountdisk; $cfgdevice = $mountdisk;
$cfgpartition = $cfgdevice . "a"; $cfgpartition = $cfgdevice . "a";
...@@ -139,7 +139,7 @@ else if ($g['booting'] and !file_exists($g['cf_conf_path'] . "/config.xml") ) { ...@@ -139,7 +139,7 @@ else if ($g['booting'] and !file_exists($g['cf_conf_path'] . "/config.xml") ) {
} }
if (mwexec("/sbin/mount -r /dev/{$mountdisk}d {$g['cf_path']}") == 0) { if (mwexec("/sbin/mount -r /dev/{$mountdisk}d {$g['cf_path']}") == 0) {
if($g['booting']) echo "."; if($g['booting']) echo ".";
if (file_exists("{$g['cf_conf_path']}/config.xml")) { if (file_exists('/cf/conf/config.xml')) {
/* found it */ /* found it */
$cfgdevice = $mountdisk; $cfgdevice = $mountdisk;
$cfgpartition = $cfgdevice . "d"; $cfgpartition = $cfgdevice . "d";
......
<?php <?php
/****h* pfSense/config
* NAME
* config.lib.inc - Functions to manipulate config.xml
* DESCRIPTION
* This include contains various config.xml specific functions.
* HISTORY
* $Id$
******
config.lib.inc /*
Ported from config.inc by Erik Kristensen Ported from config.inc by Erik Kristensen
Copyright (C) 2004-2010 Scott Ullrich Copyright (C) 2004-2010 Scott Ullrich
All rights reserved.
originally part of m0n0wall (http://m0n0.ch/wall)
Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>. Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
All rights reserved. All rights reserved.
...@@ -37,10 +26,6 @@ ...@@ -37,10 +26,6 @@
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 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 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE. POSSIBILITY OF SUCH DAMAGE.
pfSense_BUILDER_BINARIES: /sbin/mount /sbin/umount /sbin/halt /sbin/fsck
pfSense_MODULE: config
*/ */
/****f* config/encrypted_configxml /****f* config/encrypted_configxml
...@@ -520,10 +505,10 @@ function write_config($desc = 'Unknown', $backup = true) ...@@ -520,10 +505,10 @@ function write_config($desc = 'Unknown', $backup = true)
$xmlconfig = dump_xml_config($config, $g['xml_rootobj']); $xmlconfig = dump_xml_config($config, $g['xml_rootobj']);
/* write new configuration */ /* write new configuration */
if (!safe_write_file("{$g['cf_conf_path']}/config.xml", $xmlconfig, false)) { if (!safe_write_file('/cf/conf/config.xml', $xmlconfig, false)) {
log_error(gettext("WARNING: Config contents could not be save. Could not open file!")); log_error(gettext("WARNING: Config contents could not be save. Could not open file!"));
unlock($lockkey); unlock($lockkey);
file_notice("config.xml", sprintf(gettext("Unable to open %s/config.xml for writing in write_config()%s"), $g['cf_conf_path'], "\n")); file_notice('config.xml', sprintf("%s\n", gettext('Unable to open /cf/conf/config.xml for writing in write_config()')));
return -1; return -1;
} }
...@@ -580,7 +565,7 @@ function reset_factory_defaults($lock = false) { ...@@ -580,7 +565,7 @@ function reset_factory_defaults($lock = false) {
$lockkey = lock('config', LOCK_EX); $lockkey = lock('config', LOCK_EX);
/* create conf directory, if necessary */ /* create conf directory, if necessary */
safe_mkdir("{$g['cf_conf_path']}"); safe_mkdir('/cf/conf');
/* clear out /conf */ /* clear out /conf */
$dh = opendir($g['conf_path']); $dh = opendir($g['conf_path']);
...@@ -619,7 +604,7 @@ function config_restore($conffile) { ...@@ -619,7 +604,7 @@ function config_restore($conffile) {
$lockkey = lock('config', LOCK_EX); $lockkey = lock('config', LOCK_EX);
unlink_if_exists("{$g['tmp_path']}/config.cache"); unlink_if_exists("{$g['tmp_path']}/config.cache");
copy($conffile, "{$g['cf_conf_path']}/config.xml"); copy($conffile, '/cf/conf/config.xml');
disable_security_checks(); disable_security_checks();
...@@ -736,7 +721,7 @@ function cleanup_backupcache($lock = false) { ...@@ -736,7 +721,7 @@ function cleanup_backupcache($lock = false) {
$baktimes = array(); $baktimes = array();
} }
$newbaks = array(); $newbaks = array();
$bakfiles = glob($g['cf_conf_path'] . "/backup/config-*"); $bakfiles = glob('/cf/conf/backup/config-*');
$tocache = array(); $tocache = array();
foreach($bakfiles as $backup) { // Check for backups in the directory not represented in the cache. foreach($bakfiles as $backup) { // Check for backups in the directory not represented in the cache.
...@@ -785,7 +770,7 @@ function cleanup_backupcache($lock = false) { ...@@ -785,7 +770,7 @@ function cleanup_backupcache($lock = false) {
} }
$tocache = $newcache; $tocache = $newcache;
} }
$bakout = fopen($g['cf_conf_path'] . '/backup/backup.cache', "w"); $bakout = fopen('/cf/conf/backup/backup.cache', 'w');
fwrite($bakout, serialize($tocache)); fwrite($bakout, serialize($tocache));
fclose($bakout); fclose($bakout);
conf_mount_ro(); conf_mount_ro();
...@@ -794,10 +779,10 @@ function cleanup_backupcache($lock = false) { ...@@ -794,10 +779,10 @@ function cleanup_backupcache($lock = false) {
unlock($lockkey); unlock($lockkey);
} }
function get_backups() { function get_backups()
global $g; {
if(file_exists("{$g['cf_conf_path']}/backup/backup.cache")) { if (file_exists('/cf/conf/backup/backup.cache')) {
$confvers = unserialize(file_get_contents("{$g['cf_conf_path']}/backup/backup.cache")); $confvers = unserialize(file_get_contents('/cf/conf/backup/backup.cache'));
$bakvers = array_keys($confvers); $bakvers = array_keys($confvers);
$toreturn = array(); $toreturn = array();
sort($bakvers); sort($bakvers);
...@@ -811,37 +796,39 @@ function get_backups() { ...@@ -811,37 +796,39 @@ function get_backups() {
return $toreturn; return $toreturn;
} }
function backup_config() { function backup_config()
global $config, $g; {
conf_mount_rw(); conf_mount_rw();
/* Create backup directory if needed */ /* Create backup directory if needed */
safe_mkdir("{$g['cf_conf_path']}/backup"); safe_mkdir('/cf/conf/backup');
if($config['revision']['time'] == "") { if ($config['revision']['time'] == '') {
$baktime = 0; $baktime = 0;
} else { } else {
$baktime = $config['revision']['time']; $baktime = $config['revision']['time'];
} }
if($config['revision']['description'] == "") {
$bakdesc = "Unknown"; if ($config['revision']['description'] == '') {
} else { $bakdesc = 'Unknown';
$bakdesc = $config['revision']['description']; } else {
} $bakdesc = $config['revision']['description'];
}
$bakver = ($config['version'] == "") ? "?" : $config['version'];
$bakfilename = $g['cf_conf_path'] . '/backup/config-' . $baktime . '.xml'; $bakver = ($config['version'] == '') ? '?' : $config['version'];
copy($g['cf_conf_path'] . '/config.xml', $bakfilename); $bakfilename = '/cf/conf/backup/config-' . $baktime . '.xml';
if(file_exists($g['cf_conf_path'] . '/backup/backup.cache')) { copy('/cf/conf/config.xml', $bakfilename);
$backupcache = unserialize(file_get_contents($g['cf_conf_path'] . '/backup/backup.cache'));
} else { if (file_exists('/cf/conf/backup/backup.cache')) {
$backupcache = array(); $backupcache = unserialize(file_get_contents('/cf/conf/backup/backup.cache'));
} } else {
$backupcache = array();
}
$backupcache[$baktime] = array('description' => $bakdesc, 'version' => $bakver, 'filesize' => filesize($bakfilename)); $backupcache[$baktime] = array('description' => $bakdesc, 'version' => $bakver, 'filesize' => filesize($bakfilename));
$bakout = fopen($g['cf_conf_path'] . '/backup/backup.cache', "w"); $bakout = fopen('/cf/conf/backup/backup.cache', 'w');
fwrite($bakout, serialize($backupcache)); fwrite($bakout, serialize($backupcache));
fclose($bakout); fclose($bakout);
conf_mount_ro(); conf_mount_ro();
......
...@@ -46,7 +46,6 @@ $g = array( ...@@ -46,7 +46,6 @@ $g = array(
"tmp_path" => "/tmp", "tmp_path" => "/tmp",
"conf_path" => "/conf", "conf_path" => "/conf",
"cf_path" => "/cf", "cf_path" => "/cf",
"cf_conf_path" => "/cf/conf",
"xml_rootobj" => "pfsense", "xml_rootobj" => "pfsense",
"admin_group" => "admins", "admin_group" => "admins",
"product_name" => "OPNsense", "product_name" => "OPNsense",
......
<?php <?php
/* $Id$ */
/*
Copyright (C) 2010 Seth Mos <seth.mos@dds.nl>
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.
*/
/* /*
pfSense_BUILDER_BINARIES: /bin/rm /usr/bin/nice /usr/local/bin/rrdtool /bin/cd Copyright (C) 2010 Seth Mos <seth.mos@dds.nl>
pfSense_MODULE: rrd 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 */ function dump_rrd_to_xml($rrddatabase, $xmldumpfile)
{
$rrdtool = '/usr/local/bin/rrdtool';
function dump_rrd_to_xml($rrddatabase, $xmldumpfile) {
$rrdtool = "/usr/bin/nice -n20 /usr/local/bin/rrdtool";
unlink_if_exists($xmldumpfile); unlink_if_exists($xmldumpfile);
exec("$rrdtool dump " . escapeshellarg($rrddatabase) . " {$xmldumpfile} 2>&1", $dumpout, $dumpret); exec("$rrdtool dump " . escapeshellarg($rrddatabase) . " {$xmldumpfile} 2>&1", $dumpout, $dumpret);
...@@ -43,22 +37,24 @@ function dump_rrd_to_xml($rrddatabase, $xmldumpfile) { ...@@ -43,22 +37,24 @@ function dump_rrd_to_xml($rrddatabase, $xmldumpfile) {
$dumpout = implode(" ", $dumpout); $dumpout = implode(" ", $dumpout);
log_error(sprintf(gettext('RRD dump failed exited with %1$s, the error is: %2$s'), $dumpret, $dumpout)); log_error(sprintf(gettext('RRD dump failed exited with %1$s, the error is: %2$s'), $dumpret, $dumpout));
} }
return($dumpret); return($dumpret);
} }
function restore_rrd() { function restore_rrd()
{
global $g, $config; global $g, $config;
$rrddbpath = "/var/db/rrd/"; $rrddbpath = '/var/db/rrd/';
$rrdtool = "/usr/bin/nice -n20 /usr/local/bin/rrdtool"; $rrdtool = '/usr/local/bin/rrdtool';
$rrdrestore = ""; $rrdrestore = "";
$rrdreturn = ""; $rrdreturn = "";
if (file_exists("{$g['cf_conf_path']}/rrd.tgz")) { if (file_exists('/cf/conf/rrd.tgz')) {
foreach (glob("{$rrddbpath}/*.xml") as $xml_file) { foreach (glob("{$rrddbpath}/*.xml") as $xml_file) {
@unlink($xml_file); @unlink($xml_file);
} }
$_gb = exec("cd /;LANG=C /usr/bin/tar -xzf {$g['cf_conf_path']}/rrd.tgz 2>&1", $rrdrestore, $rrdreturn); $_gb = exec('cd /;LANG=C /usr/bin/tar -xzf /cf/conf/rrd.tgz 2>&1', $rrdrestore, $rrdreturn);
$rrdrestore = implode(" ", $rrdrestore); $rrdrestore = implode(" ", $rrdrestore);
if($rrdreturn != 0) { if($rrdreturn != 0) {
log_error("RRD restore failed exited with $rrdreturn, the error is: $rrdrestore\n"); log_error("RRD restore failed exited with $rrdreturn, the error is: $rrdrestore\n");
...@@ -81,7 +77,7 @@ function restore_rrd() { ...@@ -81,7 +77,7 @@ function restore_rrd() {
} }
/* If this backup is still there on a full install, but we aren't going to use ram disks, remove the archive since this is a transition. */ /* If this backup is still there on a full install, but we aren't going to use ram disks, remove the archive since this is a transition. */
if (($g['platform'] == "pfSense") && !isset($config['system']['use_mfs_tmpvar'])) { if (($g['platform'] == "pfSense") && !isset($config['system']['use_mfs_tmpvar'])) {
unlink_if_exists("{$g['cf_conf_path']}/rrd.tgz"); unlink_if_exists('/cf/conf/rrd.tgz');
} }
return true; return true;
} }
......
<?php <?php
/*
services.inc
part of the pfSense project (https://www.pfsense.org)
originally part of m0n0wall (http://m0n0.ch/wall) /*
Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>. Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
Copyright (C) 2010 Ermal Luci Copyright (C) 2010 Ermal Luci
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without
...@@ -30,14 +27,6 @@ ...@@ -30,14 +27,6 @@
POSSIBILITY OF SUCH DAMAGE. POSSIBILITY OF SUCH DAMAGE.
*/ */
/*
pfSense_BUILDER_BINARIES: /usr/bin/killall /bin/pgrep /bin/sh /usr/local/sbin/dhcpd /usr/local/sbin/igmpproxy
pfSense_BUILDER_BINARIES: /sbin/ifconfig /usr/local/sbin/dnsmasq
pfSense_BUILDER_BINARIES: /usr/local/sbin/miniupnpd /usr/sbin/radvd
pfSense_BUILDER_BINARIES: /usr/local/sbin/dhcleases6 /usr/sbin/bsnmpd
pfSense_MODULE: utils
*/
define('DYNDNS_PROVIDER_VALUES', 'dnsomatic dyndns dyndns-static dyndns-custom dhs dyns easydns noip noip-free ods zoneedit loopia freedns dnsexit opendns namecheap he-net he-net-v6 he-net-tunnelbroker selfhost route53 cloudflare custom custom-v6 eurodns gratisdns ovh-dynhost citynetwork'); define('DYNDNS_PROVIDER_VALUES', 'dnsomatic dyndns dyndns-static dyndns-custom dhs dyns easydns noip noip-free ods zoneedit loopia freedns dnsexit opendns namecheap he-net he-net-v6 he-net-tunnelbroker selfhost route53 cloudflare custom custom-v6 eurodns gratisdns ovh-dynhost citynetwork');
define('DYNDNS_PROVIDER_DESCRIPTIONS', 'DNS-O-Matic,DynDNS (dynamic),DynDNS (static),DynDNS (custom),DHS,DyNS,easyDNS,No-IP,No-IP (free),ODS.org,ZoneEdit,Loopia,freeDNS,DNSexit,OpenDNS,Namecheap,HE.net,HE.net (v6),HE.net Tunnelbroker,SelfHost,Route 53,CloudFlare,Custom,Custom (v6),Euro Dns,GratisDNS,OVH DynHOST,City Network'); define('DYNDNS_PROVIDER_DESCRIPTIONS', 'DNS-O-Matic,DynDNS (dynamic),DynDNS (static),DynDNS (custom),DHS,DyNS,easyDNS,No-IP,No-IP (free),ODS.org,ZoneEdit,Loopia,freeDNS,DNSexit,OpenDNS,Namecheap,HE.net,HE.net (v6),HE.net Tunnelbroker,SelfHost,Route 53,CloudFlare,Custom,Custom (v6),Euro Dns,GratisDNS,OVH DynHOST,City Network');
...@@ -360,18 +349,18 @@ function services_dhcpdv4_configure() ...@@ -360,18 +349,18 @@ function services_dhcpdv4_configure()
if ($g['booting']) { if ($g['booting']) {
/* restore the leases, if we have them */ /* restore the leases, if we have them */
if (file_exists("{$g['cf_conf_path']}/dhcpleases.tgz")) { if (file_exists('/cf/conf/dhcpleases.tgz')) {
$dhcprestore = ""; $dhcprestore = '';
$dhcpreturn = ""; $dhcpreturn = '';
exec("cd /;LANG=C /usr/bin/tar -xzf {$g['cf_conf_path']}/dhcpleases.tgz 2>&1", $dhcprestore, $dhcpreturn); exec('cd /;LANG=C /usr/bin/tar -xzf /cf/conf/dhcpleases.tgz 2>&1', $dhcprestore, $dhcpreturn);
$dhcprestore = implode(" ", $dhcprestore); $dhcprestore = implode(' ', $dhcprestore);
if($dhcpreturn <> 0) { if($dhcpreturn <> 0) {
log_error(sprintf(gettext('DHCP leases restore failed exited with %1$s, the error is: %2$s%3$s'), $dhcpreturn, $dhcprestore, "\n")); log_error(sprintf(gettext('DHCP leases restore failed exited with %1$s, the error is: %2$s%3$s'), $dhcpreturn, $dhcprestore, "\n"));
} }
} }
/* If this backup is still there on a full install, but we aren't going to use ram disks, remove the archive since this is a transition. */ /* If this backup is still there on a full install, but we aren't going to use ram disks, remove the archive since this is a transition. */
if (($g['platform'] == "pfSense") && !isset($config['system']['use_mfs_tmpvar'])) { if (($g['platform'] == "pfSense") && !isset($config['system']['use_mfs_tmpvar'])) {
unlink_if_exists("{$g['cf_conf_path']}/dhcpleases.tgz"); unlink_if_exists('/cf/conf/dhcpleases.tgz');
} }
} }
...@@ -988,16 +977,21 @@ function services_dhcpdv6_configure($blacklist = array()) ...@@ -988,16 +977,21 @@ function services_dhcpdv6_configure($blacklist = array())
if ($g['booting']) { if ($g['booting']) {
if ($g['platform'] != "pfSense") { if ($g['platform'] != "pfSense") {
/* restore the leases, if we have them */ /* restore the leases, if we have them */
if (file_exists("{$g['cf_conf_path']}/dhcp6leases.tgz")) { if (file_exists('/cf/conf/dhcp6leases.tgz')) {
$dhcprestore = ""; $dhcprestore = '';
$dhcpreturn = ""; $dhcpreturn = '';
exec("cd /;LANG=C /usr/bin/tar -xzf {$g['cf_conf_path']}/dhcp6leases.tgz 2>&1", $dhcprestore, $dhcpreturn); exec('cd /;LANG=C /usr/bin/tar -xzf /cf/conf/dhcp6leases.tgz 2>&1', $dhcprestore, $dhcpreturn);
$dhcprestore = implode(" ", $dhcprestore); $dhcprestore = implode(' ', $dhcprestore);
if($dhcpreturn <> 0) { if($dhcpreturn <> 0) {
log_error("DHCP leases v6 restore failed exited with $dhcpreturn, the error is: $dhcprestore\n"); log_error("DHCP leases v6 restore failed exited with $dhcpreturn, the error is: $dhcprestore\n");
} }
} }
} }
/* If this backup is still there on a full install, but we aren't going to use ram disks, remove the archive since this is a transition. */
if (($g['platform'] == "pfSense") && !isset($config['system']['use_mfs_tmpvar'])) {
unlink_if_exists('/cf/conf/dhcp6leases.tgz');
}
} }
$syscfg = $config['system']; $syscfg = $config['system'];
......
...@@ -1913,7 +1913,7 @@ function upgrade_054_to_055() { ...@@ -1913,7 +1913,7 @@ function upgrade_054_to_055() {
/* restore the databases, if we have one */ /* restore the databases, if we have one */
if (restore_rrd()) { if (restore_rrd()) {
/* Make sure to move the rrd backup out of the way. We will make a new one after converting. */ /* Make sure to move the rrd backup out of the way. We will make a new one after converting. */
rename("{$g['cf_conf_path']}/rrd.tgz", "{$g['cf_conf_path']}/backup"); rename('/cf/conf/rrd.tgz', '/cf/conf/backup');
} }
} }
...@@ -2031,7 +2031,7 @@ function upgrade_054_to_055() { ...@@ -2031,7 +2031,7 @@ function upgrade_054_to_055() {
enable_rrd_graphing(); enable_rrd_graphing();
/* Let's save the RRD graphs after we run enable RRD graphing */ /* Let's save the RRD graphs after we run enable RRD graphing */
/* The function will restore the rrd.tgz so we will save it after */ /* The function will restore the rrd.tgz so we will save it after */
exec("cd /; LANG=C NO_REMOUNT=1 RRDDBPATH='{$rrddbpath}' CF_CONF_PATH='{$g['cf_conf_path']}' /usr/local/etc/rc.backup_rrd.sh"); exec("cd /; LANG=C NO_REMOUNT=1 RRDDBPATH='{$rrddbpath}' CF_CONF_PATH='/cf/conf' /usr/local/etc/rc.backup_rrd.sh");
unlink_if_exists("{$g['vardb_path']}/rrd/*.xml"); unlink_if_exists("{$g['vardb_path']}/rrd/*.xml");
if ($g['booting']) if ($g['booting'])
echo "Updating configuration..."; echo "Updating configuration...";
...@@ -2576,7 +2576,7 @@ function upgrade_080_to_081() { ...@@ -2576,7 +2576,7 @@ function upgrade_080_to_081() {
/* restore the databases, if we have one */ /* restore the databases, if we have one */
if (restore_rrd()) { if (restore_rrd()) {
/* Make sure to move the rrd backup out of the way. We will make a new one after converting. */ /* Make sure to move the rrd backup out of the way. We will make a new one after converting. */
@rename("{$g['cf_conf_path']}/rrd.tgz", "{$g['cf_conf_path']}/backup/rrd.tgz"); @rename('/cf/conf/rrd.tgz', '/cf/conf/backup/rrd.tgz');
} }
} }
...@@ -2713,7 +2713,7 @@ function upgrade_080_to_081() { ...@@ -2713,7 +2713,7 @@ function upgrade_080_to_081() {
enable_rrd_graphing(); enable_rrd_graphing();
/* Let's save the RRD graphs after we run enable RRD graphing */ /* Let's save the RRD graphs after we run enable RRD graphing */
/* The function will restore the rrd.tgz so we will save it after */ /* The function will restore the rrd.tgz so we will save it after */
exec("cd /; LANG=C NO_REMOUNT=1 RRDDBPATH='{$rrddbpath}' CF_CONF_PATH='{$g['cf_conf_path']}' /usr/local/etc/rc.backup_rrd.sh"); exec("cd /; LANG=C NO_REMOUNT=1 RRDDBPATH='{$rrddbpath}' CF_CONF_PATH='/cf/conf' /usr/local/etc/rc.backup_rrd.sh");
if ($g['booting']) if ($g['booting'])
echo "Updating configuration..."; echo "Updating configuration...";
foreach($config['filter']['rule'] as & $rule) { foreach($config['filter']['rule'] as & $rule) {
...@@ -3023,7 +3023,7 @@ function upgrade_095_to_096() { ...@@ -3023,7 +3023,7 @@ function upgrade_095_to_096() {
/* restore the databases, if we have one */ /* restore the databases, if we have one */
if (restore_rrd()) { if (restore_rrd()) {
/* Make sure to move the rrd backup out of the way. We will make a new one after converting. */ /* Make sure to move the rrd backup out of the way. We will make a new one after converting. */
rename("{$g['cf_conf_path']}/rrd.tgz", "{$g['cf_conf_path']}/backup"); rename('/cf/conf/rrd.tgz', '/cf/conf/backup');
} }
} }
...@@ -3046,7 +3046,7 @@ function upgrade_095_to_096() { ...@@ -3046,7 +3046,7 @@ function upgrade_095_to_096() {
enable_rrd_graphing(); enable_rrd_graphing();
/* Let's save the RRD graphs after we run enable RRD graphing */ /* Let's save the RRD graphs after we run enable RRD graphing */
/* The function will restore the rrd.tgz so we will save it after */ /* The function will restore the rrd.tgz so we will save it after */
exec("cd /; LANG=C NO_REMOUNT=1 RRDDBPATH='{$rrddbpath}' CF_CONF_PATH='{$g['cf_conf_path']}' /usr/local/etc/rc.backup_rrd.sh"); exec("cd /; LANG=C NO_REMOUNT=1 RRDDBPATH='{$rrddbpath}' CF_CONF_PATH='/cf/conf' /usr/local/etc/rc.backup_rrd.sh");
} }
function upgrade_096_to_097() { function upgrade_096_to_097() {
......
<?php <?php
/* $Id$ */
/* /*
Copyright (C) 2014 Deciso B.V. Copyright (C) 2014 Deciso B.V.
Copyright (C) 2004-2009 Scott Ullrich Copyright (C) 2004-2009 Scott Ullrich
Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>. Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
All rights reserved. All rights reserved.
...@@ -548,7 +548,7 @@ if ($_POST) { ...@@ -548,7 +548,7 @@ if ($_POST) {
} else if ($mode == "restore_ver") { } else if ($mode == "restore_ver") {
$input_errors[] = gettext("XXX - this feature may hose your config (do NOT backrev configs!) - billm"); $input_errors[] = gettext("XXX - this feature may hose your config (do NOT backrev configs!) - billm");
if ($ver2restore <> "") { if ($ver2restore <> "") {
$conf_file = "{$g['cf_conf_path']}/bak/config-" . strtotime($ver2restore) . ".xml"; $conf_file = '/cf/conf/backup/config-' . strtotime($ver2restore) . ".xml";
if (config_install($conf_file) == 0) { if (config_install($conf_file) == 0) {
mark_subsystem_dirty("restore"); mark_subsystem_dirty("restore");
} else { } else {
......
<?php <?php
/* $Id$ */
/* /*
Copyright (C) 2014 Deciso B.V. Copyright (C) 2014 Deciso B.V.
Copyright (C) 2005 Colin Smith Copyright (C) 2005 Colin Smith
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
POSSIBILITY OF SUCH DAMAGE. POSSIBILITY OF SUCH DAMAGE.
*/ */
require("guiconfig.inc"); require_once("guiconfig.inc");
if (isset($_POST['backupcount'])) { if (isset($_POST['backupcount'])) {
if (is_numeric($_POST['backupcount']) && ($_POST['backupcount'] >= 0)) { if (is_numeric($_POST['backupcount']) && ($_POST['backupcount'] >= 0)) {
...@@ -46,7 +46,7 @@ if (isset($_POST['backupcount'])) { ...@@ -46,7 +46,7 @@ if (isset($_POST['backupcount'])) {
} }
conf_mount_rw(); conf_mount_rw();
$confvers = unserialize(file_get_contents($g['cf_conf_path'] . '/backup/backup.cache')); $confvers = unserialize(file_get_contents('/cf/conf/backup/backup.cache'));
if($_POST['newver'] != "") { if($_POST['newver'] != "") {
if(config_restore($g['conf_path'] . '/backup/config-' . $_POST['newver'] . '.xml') == 0) if(config_restore($g['conf_path'] . '/backup/config-' . $_POST['newver'] . '.xml') == 0)
$savemsg = sprintf(gettext('Successfully reverted to timestamp %1$s with description "%2$s".'), date(gettext("n/j/y H:i:s"), $_POST['newver']), $confvers[$_POST['newver']]['description']); $savemsg = sprintf(gettext('Successfully reverted to timestamp %1$s with description "%2$s".'), date(gettext("n/j/y H:i:s"), $_POST['newver']), $confvers[$_POST['newver']]['description']);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment