Date: Sun, 22 Apr 2007 12:07:30 -0400 From: Howard Goldstein <hg@queue.to> To: freebsd-x11@freebsd.org Cc: brooks@freebsd.org Subject: PATCH for 6.2-R backwards compat (was Re: rc.conf startup dirs vs X11R6 symlink) Message-ID: <462B8842.5020205@queue.to> In-Reply-To: <20070419141721.GA74693@lor.one-eyed-alien.net> References: <4626D7CE.6070909@queue.to> <20070419141721.GA74693@lor.one-eyed-alien.net>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
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.
[-- Attachment #2 --]
*** 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
}
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?462B8842.5020205>
