summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2016-11-21 14:05:01 -0200
committerRenato Botelho <renato@netgate.com>2016-11-21 14:06:16 -0200
commitfc84b222e75c9d92e394a2e9ddb80c5ead382f52 (patch)
tree6d6882e1f9de2c725bf2f6894cce8c904990a839
parenta5dd605a246065e480b3b05c47da8e5aee1885e3 (diff)
downloadpfsense-fc84b222e75c9d92e394a2e9ddb80c5ead382f52.zip
pfsense-fc84b222e75c9d92e394a2e9ddb80c5ead382f52.tar.gz
Remove config files symlinks from /etc to /var/etc. Fixes #5538
-rw-r--r--src/etc/inc/services.inc2
-rw-r--r--src/etc/inc/system.inc12
-rwxr-xr-xsrc/etc/pfSense-rc32
-rw-r--r--src/etc/pfSense.obsoletedfiles4
-rw-r--r--src/usr/local/www/status_interfaces.php2
5 files changed, 20 insertions, 32 deletions
diff --git a/src/etc/inc/services.inc b/src/etc/inc/services.inc
index e453fd7..ed76676 100644
--- a/src/etc/inc/services.inc
+++ b/src/etc/inc/services.inc
@@ -2096,7 +2096,7 @@ function services_dnsmasq_configure($restart_dhcp = true) {
$args = "";
if (isset($config['dnsmasq']['regdhcp'])) {
- $args .= " --dhcp-hostsfile={$g['varetc_path']}/hosts ";
+ $args .= " --dhcp-hostsfile={$g['etc_path']}/hosts ";
}
/* Setup listen port, if non-default */
diff --git a/src/etc/inc/system.inc b/src/etc/inc/system.inc
index d9a723b..883c09f 100644
--- a/src/etc/inc/system.inc
+++ b/src/etc/inc/system.inc
@@ -171,7 +171,7 @@ function system_resolvconf_generate($dynupdate = false) {
$dnslock = lock('resolvconf', LOCK_EX);
- $fd = fopen("{$g['varetc_path']}/resolv.conf", "w");
+ $fd = fopen("{$g['etc_path']}/resolv.conf", "w");
if (!$fd) {
printf("Error: cannot open resolv.conf in system_resolvconf_generate().\n");
unlock($dnslock);
@@ -182,7 +182,7 @@ function system_resolvconf_generate($dynupdate = false) {
fclose($fd);
// Prevent resolvconf(8) from rewriting our resolv.conf
- $fd = fopen("{$g['varetc_path']}/resolvconf.conf", "w");
+ $fd = fopen("{$g['etc_path']}/resolvconf.conf", "w");
if (!$fd) {
printf("Error: cannot open resolvconf.conf in system_resolvconf_generate().\n");
return 1;
@@ -418,7 +418,7 @@ function system_hosts_generate() {
@unlink("{$g['varrun_path']}/dhcpleases.pid");
}
- $fd = fopen("{$g['varetc_path']}/hosts", "w");
+ $fd = fopen("{$g['etc_path']}/hosts", "w");
if (!$fd) {
log_error(gettext("Error: cannot open hosts file in system_hosts_generate()."));
return 1;
@@ -477,7 +477,7 @@ function system_dhcpleases_configure() {
sigkillbyname('dhcpleases', "TERM");
}
@unlink($pidfile);
- mwexec("/usr/local/sbin/dhcpleases -l {$g['dhcpd_chroot_path']}/var/db/dhcpd.leases -d {$config['system']['domain']} -p {$g['varrun_path']}/{$dns_pid} {$unbound_conf} -h {$g['varetc_path']}/hosts");
+ mwexec("/usr/local/sbin/dhcpleases -l {$g['dhcpd_chroot_path']}/var/db/dhcpd.leases -d {$config['system']['domain']} -p {$g['varrun_path']}/{$dns_pid} {$unbound_conf} -h {$g['etc_path']}/hosts");
} elseif (isvalidpid($pidfile)) {
sigkillbypid($pidfile, "TERM");
@unlink($pidfile);
@@ -1011,7 +1011,7 @@ EOD;
EOD;
}
/* write syslog.conf */
- if (!@file_put_contents("{$g['varetc_path']}/syslog.conf", $syslogconf)) {
+ if (!@file_put_contents("{$g['etc_path']}/syslog.conf", $syslogconf)) {
printf(gettext("Error: cannot open syslog.conf in system_syslogd_start().%s"), "\n");
unset($syslogconf);
return 1;
@@ -1036,7 +1036,7 @@ EOD;
}
}
- $syslogd_extra = "-f {$g['varetc_path']}/syslog.conf {$sourceip}";
+ $syslogd_extra = "-f {$g['etc_path']}/syslog.conf {$sourceip}";
}
$log_sockets = array("{$g['dhcpd_chroot_path']}/var/run/log");
diff --git a/src/etc/pfSense-rc b/src/etc/pfSense-rc
index 38c8894..afa2a93 100755
--- a/src/etc/pfSense-rc
+++ b/src/etc/pfSense-rc
@@ -219,31 +219,15 @@ if [ -L /usr/local/etc/strongswan.conf ]; then
rm -f /usr/local/etc/strongswan.conf
fi
-echo -n "Creating symlinks..."
-# Repair symlinks if they are broken
-if [ ! -L /etc/syslog.conf ]; then
- /bin/rm -rf /etc/syslog.conf
- if [ ! -f /var/etc/syslog.conf ]; then
- touch /var/etc/syslog.conf
+# Remove deprecated symlinks - #5538
+for f in /etc/hosts \
+ /etc/resolv.conf \
+ /etc/resolvconf.conf \
+ /etc/syslog.conf; do
+ if [ -L "${f}" ]; then
+ rm -f ${f}
fi
- /bin/ln -s /var/etc/syslog.conf /etc/syslog.conf
-fi
-
-# Repair symlinks if they are broken
-if [ ! -L /etc/hosts ]; then
- /bin/rm -rf /etc/hosts
- /bin/ln -s /var/etc/hosts /etc/hosts
-fi
-
-if [ ! -L /etc/resolv.conf ]; then
- /bin/rm -rf /etc/resolv.conf
- /bin/ln -s /var/etc/resolv.conf /etc/resolv.conf
-fi
-
-if [ ! -L /etc/resolvconf.conf ]; then
- /bin/rm -rf /etc/resolvconf.conf
- /bin/ln -s /var/etc/resolvconf.conf /etc/resolvconf.conf
-fi
+done
# Setup compatibility link for packages that
# have trouble overriding the PREFIX configure
diff --git a/src/etc/pfSense.obsoletedfiles b/src/etc/pfSense.obsoletedfiles
index 4de3fe1..aaf596b 100644
--- a/src/etc/pfSense.obsoletedfiles
+++ b/src/etc/pfSense.obsoletedfiles
@@ -1093,7 +1093,11 @@
/var/db/rrd/71
/var/db/rrd/index.html
/var/dhcpd/lib/libc.so.6
+/var/etc/hosts
/var/etc/pppoe-vpn
+/var/etc/resolv.conf
+/var/etc/resolvconf.conf
+/var/etc/syslog.conf
/var/mail/_relayd
/var/mail/unbound
/usr/local/www/d3pie
diff --git a/src/usr/local/www/status_interfaces.php b/src/usr/local/www/status_interfaces.php
index 05e0671..42be7df 100644
--- a/src/usr/local/www/status_interfaces.php
+++ b/src/usr/local/www/status_interfaces.php
@@ -124,7 +124,7 @@ foreach ($ifdescrs as $ifdescr => $ifname):
showDef($ifinfo['subnetv6'], gettext('Subnet mask IPv6'), $ifinfo['subnetv6']);
showDef($ifinfo['gatewayv6'], gettext("Gateway IPv6"), $config['interfaces'][$ifdescr]['gatewayv6'] . " " . $ifinfo['gatewayv6']);
- if ($ifdescr == "wan" && file_exists("{$g['varetc_path']}/resolv.conf")) {
+ if ($ifdescr == "wan" && file_exists("{$g['etc_path']}/resolv.conf")) {
$dns_servers = get_dns_servers();
$dnscnt = 0;
foreach ($dns_servers as $dns) {
OpenPOWER on IntegriCloud