Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
OpnSense
Commits
228eaee9
Commit
228eaee9
authored
Apr 01, 2015
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
src: remove symlink trickery for /etc/hosts
parent
5337532e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
19 deletions
+23
-19
services.inc
src/etc/inc/services.inc
+1
-1
system.inc
src/etc/inc/system.inc
+21
-12
rc
src/etc/rc
+1
-6
No files found.
src/etc/inc/services.inc
View file @
228eaee9
...
...
@@ -1755,7 +1755,7 @@ function services_dnsmasq_configure()
$args
=
""
;
if
(
isset
(
$config
[
'dnsmasq'
][
'regdhcp'
]))
{
$args
.=
" --dhcp-hostsfile=
{
$g
[
'varetc_path'
]
}
/hosts "
;
$args
.=
" --dhcp-hostsfile=
/etc
/hosts "
;
}
/* Setup listen port, if non-default */
...
...
src/etc/inc/system.inc
View file @
228eaee9
...
...
@@ -306,7 +306,7 @@ function system_hosts_generate()
sigkillbypid
(
"
{
$g
[
'varrun_path'
]
}
/dhcpleases.pid"
,
"TERM"
);
@
unlink
(
"
{
$g
[
'varrun_path'
]
}
/dhcpleases.pid"
);
}
$fd
=
fopen
(
"
{
$g
[
'varetc_path'
]
}
/hosts"
,
"w"
);
$fd
=
fopen
(
'/etc/hosts'
,
'w'
);
if
(
!
$fd
)
{
log_error
(
"Error: cannot open hosts file in system_hosts_generate().
\n
"
);
return
1
;
...
...
@@ -333,20 +333,29 @@ function system_dhcpleases_configure()
||
(
isset
(
$config
[
'unbound'
][
'enable'
])
&&
isset
(
$config
[
'unbound'
][
'regdhcp'
])))
{
/* Make sure we do not error out */
mwexec
(
"/bin/mkdir -p
{
$g
[
'dhcpd_chroot_path'
]
}
/var/db"
);
if
(
!
file_exists
(
"
{
$g
[
'dhcpd_chroot_path'
]
}
/var/db/dhcpd.leases"
))
if
(
!
file_exists
(
"
{
$g
[
'dhcpd_chroot_path'
]
}
/var/db/dhcpd.leases"
))
{
@
touch
(
"
{
$g
[
'dhcpd_chroot_path'
]
}
/var/db/dhcpd.leases"
);
if
(
isvalidpid
(
"
{
$g
[
'varrun_path'
]
}
/dhcpleases.pid"
))
}
if
(
isvalidpid
(
"
{
$g
[
'varrun_path'
]
}
/dhcpleases.pid"
))
{
sigkillbypid
(
"
{
$g
[
'varrun_path'
]
}
/dhcpleases.pid"
,
"HUP"
);
else
{
}
else
{
/* To ensure we do not start multiple instances of dhcpleases, perform some clean-up first. */
if
(
is_process_running
(
"dhcpleases"
))
mwexec
(
'/bin/pkill dhcpleases'
);
@
unlink
(
"
{
$g
[
'varrun_path'
]
}
/dhcpleases.pid"
);
if
(
isset
(
$config
[
'unbound'
][
'enable'
]))
$dns_pid
=
"unbound.pid"
;
else
$dns_pid
=
"dnsmasq.pid"
;
mwexec
(
"/usr/local/sbin/dhcpleases -l
{
$g
[
'dhcpd_chroot_path'
]
}
/var/db/dhcpd.leases -d
{
$config
[
'system'
][
'domain'
]
}
-p
{
$g
[
'varrun_path'
]
}
/
{
$dns_pid
}
-h
{
$g
[
'varetc_path'
]
}
/hosts"
);
killbyname
(
'dhcpleases'
);
@
unlink
(
'/var/run/dhcpleases.pid'
);
if
(
isset
(
$config
[
'unbound'
][
'enable'
]))
{
$dns_pid
=
'unbound.pid'
;
}
else
{
$dns_pid
=
'dnsmasq.pid'
;
}
mwexecf
(
'/usr/local/sbin/dhcpleases -l %s -d %s -p %s -h %s'
,
array
(
"
{
$g
[
'dhcpd_chroot_path'
]
}
/var/db/dhcpd.leases"
,
$config
[
'system'
][
'domain'
],
"/var/run/
{
$dns_pid
}
"
,
'/etc/hosts'
)
);
}
}
else
{
sigkillbypid
(
"
{
$g
[
'varrun_path'
]
}
/dhcpleases.pid"
,
"TERM"
);
...
...
src/etc/rc
View file @
228eaee9
...
...
@@ -169,14 +169,9 @@ if [ ! -L /etc/syslog.conf ]; then
/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
# Remove symlinks that are no longer needed
if
[
-L
/etc/resolv.conf
]
;
then
rm
/etc/resolv.conf
;
fi
if
[
-L
/etc/hosts
]
;
then
/bin/rm /etc/hosts
;
fi
# Setup compatibility link for packages that
# have trouble overriding the PREFIX configure
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment