PATCH for 6.2-R backwards compat (was Re: rc.conf startup dirs vs
X11R6 symlink)
Howard Goldstein
hg at queue.to
Sun Apr 22 16:07:33 UTC 2007
Brooks Davis wrote:
> On Wed, Apr 18, 2007 at 10:45:34PM -0400, Howard Goldstein wrote:
>> Heads up, when not overridden locally the /usr/X11R6->/usr/local symlink
>> will cause everything in /usr/local/etc/rc.d twice on startup. The
>> trivial patch for /etc/defaults/rc.conf fixes this. All sorts of
>> ports-related ugliness will surely ensue at sites that have populated
>> /usr/local/etc/rc.d directories
>
> Hmm, I can't decide if this is the right fix or if we should add a step
> in processing local_startup where we run realpath on the names and
> remove dupes. I worry this is going to cause problems for 6.2-RELEASE
> users post switch so something we could apply as an eratta that would
> work either way might be nice.
>
Follows is the patch that should be backwards compatible with 6.2-R for
use when reconfiguring a site for X11BASE==/usr/local with the symlink.
Although a trivial sort | uniq solution works it didn't seem like the
right approach because it wouldn't preserve the local_startup ordering.
There's probably better ways to do this but my sh script fu is not up to it.
-------------- next part --------------
*** etc/rc.subr.orig Sat Mar 31 20:35:33 2007
--- etc/rc.subr Sun Apr 22 11:55:00 2007
***************
*** 1454,1465 ****
echo ${devices2}
}
! # Find scripts in local_startup directories that use the old syntax
#
find_local_scripts_old () {
zlist=''
slist=''
! for dir in ${local_startup}; do
if [ -d "${dir}" ]; then
for file in ${dir}/[0-9]*.sh; do
grep '^# PROVIDE:' $file >/dev/null 2>&1 &&
--- 1454,1466 ----
echo ${devices2}
}
! # Find scripts in unique local_startup directories that use the old syntax
#
find_local_scripts_old () {
+ find_uniq_local_startup
zlist=''
slist=''
! for dir in ${uniq_local_startup}; do
if [ -d "${dir}" ]; then
for file in ${dir}/[0-9]*.sh; do
grep '^# PROVIDE:' $file >/dev/null 2>&1 &&
***************
*** 1476,1483 ****
}
find_local_scripts_new () {
local_rc=''
! for dir in ${local_startup}; do
if [ -d "${dir}" ]; then
for file in `grep -l '^# PROVIDE:' ${dir}/* 2>/dev/null`; do
case "$file" in
--- 1477,1485 ----
}
find_local_scripts_new () {
+ find_uniq_local_startup
local_rc=''
! for dir in ${uniq_local_startup}; do
if [ -d "${dir}" ]; then
for file in `grep -l '^# PROVIDE:' ${dir}/* 2>/dev/null`; do
case "$file" in
***************
*** 1489,1494 ****
--- 1491,1513 ----
esac
done
fi
+ done
+ }
+
+ # Resolve local_startup directories into unique real pathnames
+ find_uniq_local_startup () {
+ uniq_local_startup=''
+ for dir in ${local_startup}; do
+ if [ -d "${dir}" ]; then
+ target_dir=`realpath ${dir}`
+ for udir in ${uniq_local_startup}; do
+ if [ "x${target_dir}" = "x${udir}" ]; then
+ target_dir=''
+ break
+ fi
+ done
+ uniq_local_startup="$uniq_local_startup $target_dir"
+ fi
done
}
More information about the freebsd-x11
mailing list