tech-x11 archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Fixing /etc for native X.Org



Hi,

The attached patch does the following:

  1. Move rc.d/{xdm,xfs} to xetc.tgz
  2. Let the build descend into etc/rc.d for obj and dependall
  3. Introduce FILESBUILD_<file> as discussed on tech-userlevel
  4. Use it to build the xdm and xfs rc.d scripts
  5. Sprinkle /usr/X11R7 into all the relevant profile/cshrc/whatever,
     giving it priority over /usr/X11R6.
  6. Change postinstall(8) so that it is generated at build time to
     get the value of X11ROOTDIR hard-coded.
  7. Change postinstall(8) so that it is able to generate xdm and xfs
     when run with a source directory as input.

Now a few remarks.

The issue I have with 1 is how to deal with non-x11 (either flavour)
update builds;  build.sh will find extra files in DESTDIR.  I'm not
sure if they can be "obsoleted" in any way though.

I don't think 2 will have any ill effect.  Maybe I should filter the
targets allowed for descent into rc.d still?

Arguably, we could generate all the files touched for 5.  It's more
work, but would allow use to have clean files for non-x11 builds.

The wacky way I do 6 is only so that the source file is not renamed, so
that CVS history is not lost.  I'm fine with renaming it postinstall.in
and doing the transformation in a more traditional way.  Now, as for the
debate that will surely arise as to whether or not postinstall(8) should
have embedded information, I'll say that postinstall ships with the base
system, in base.tgz, so it has to match said base system, so generating
it is ok.

I don't think 7 is too perverted, and could probably be used for other
things in the future.

Now a bit of generalisation.  I realise that /usr/X11R7 might not have
been such a good idea after all.  I'm still opposed to /usr/X11R6, and
still don't think /usr is workable.  (And I don't think I opposed
/usr/X11 If I recall correctly.)  OTOH, moving XFree86 to /usr/X11 is
not a trivial task either, and using /usr/X11R7 or /usr/X11 for X.Org
matters little if XFree86 is not moved to the same base directory
altoether.

Comments?  I'm aware I still have to deal with the path to xauth
embedded in ssh, but I'll look at it later.  Also, I'm not used to
hacking postinstall, there might be better ways to do what I make it do
and I'll be fine with any cosmetics remarks for that part of the patch.

-- 
Quentin Garnier - cube%cubidou.net@localhost - cube%NetBSD.org@localhost
"See the look on my face from staying too long in one place
[...] every time the morning breaks I know I'm closer to falling"
KT Tunstall, Saving My Face, Drastic Fantastic, 2007.
Index: etc/Makefile
===================================================================
RCS file: /cvsroot/src/etc/Makefile,v
retrieving revision 1.359
diff -u -r1.359 Makefile
--- etc/Makefile        19 Oct 2008 22:05:20 -0000      1.359
+++ etc/Makefile        28 Oct 2008 18:57:44 -0000
@@ -632,7 +632,10 @@
 clean:
        -rm -rf ${CDROM.dir} ${CDROM.pathlist} ${OBSOLETE.dir}
 
+SUBDIR=        rc.d
+
 .include <bsd.prog.mk>
+.include <bsd.subdir.mk>
 
 test:
        @echo ${OBSOLETE.files}
Index: etc/login.conf
===================================================================
RCS file: /cvsroot/src/etc/login.conf,v
retrieving revision 1.2
diff -u -r1.2 login.conf
--- etc/login.conf      1 Jun 2007 19:01:51 -0000       1.2
+++ etc/login.conf      28 Oct 2008 18:57:44 -0000
@@ -13,7 +13,7 @@
 # class.
 #
 #default:\
-#      :path=/usr/bin /bin /usr/sbin /sbin /usr/X11R6/bin /usr/pkg/bin 
/usr/pkg/sbin /usr/local/bin:\
+#      :path=/usr/bin /bin /usr/sbin /sbin /usr/X11R7/bin /usr/X11R6/bin 
/usr/pkg/bin /usr/pkg/sbin /usr/local/bin:\
 #      :umask=022:\
 #      :datasize-max=512M:\
 #      :datasize-cur=512M:\
Index: etc/man.conf
===================================================================
RCS file: /cvsroot/src/etc/man.conf,v
retrieving revision 1.22
diff -u -r1.22 man.conf
--- etc/man.conf        30 May 2006 00:40:22 -0000      1.22
+++ etc/man.conf        28 Oct 2008 18:57:44 -0000
@@ -5,6 +5,7 @@
 
 # The whatis/apropos database.
 _whatdb                /usr/share/man/whatis.db
+_whatdb                /usr/X11R7/man/whatis.db
 _whatdb                /usr/X11R6/man/whatis.db
 _whatdb                /usr/pkg/man/whatis.db
 _whatdb                /usr/local/man/whatis.db
@@ -33,9 +34,10 @@
 # directory with all of the subdirectories listed for the keyword _subdir.
 
 # default
-_default       /usr/{share,X11R6,pkg,local}/man/
+_default       /usr/{share,X11R7,X11R6,pkg,local}/man/
 
 # Other sections that represent complete man subdirectories.
+X11R7          /usr/X11R7/man/
 X11R6          /usr/X11R6/man/
 packages       /usr/pkg/man/
 local          /usr/local/man/
Index: etc/rc.d/Makefile
===================================================================
RCS file: /cvsroot/src/etc/rc.d/Makefile,v
retrieving revision 1.68
diff -u -r1.68 Makefile
--- etc/rc.d/Makefile   18 Jun 2008 09:06:26 -0000      1.68
+++ etc/rc.d/Makefile   28 Oct 2008 18:57:45 -0000
@@ -30,9 +30,19 @@
                staticroute swap1 swap2 sysctl sysdb syslogd \
                timed tpctl ttys \
                veriexec virecover wdogctl wpa_supplicant wscons wsmoused \
-               xdm xfs \
                ypbind yppasswdd ypserv
 FILESDIR=      /etc/rc.d
 FILESMODE=     ${BINMODE}
 
+.if (${MKX11} != "no" || ${MKXORG} != "no")
+CONFIGFILES+=  xdm xfs
+FILESBUILD_xdm=        yes
+FILESBUILD_xfs=        yes
+
+.SUFFIXES: .in
+.in:
+       ${_MKTARGET_CREATE}
+       ${TOOL_SED} -e 's,@X11ROOTDIR@,${X11ROOTDIR},g' < ${.IMPSRC} > 
${.TARGET}
+.endif
+
 .include <bsd.prog.mk>
--- /dev/null   2008-10-28 19:30:52.000000000 +0000
+++ etc/rc.d/xdm.in     2008-10-17 21:48:35.000000000 +0000
@@ -0,0 +1,20 @@
+#!/bin/sh
+#
+# $NetBSD$
+#
+
+# PROVIDE: xdm
+# REQUIRE: DAEMON LOGIN wscons
+# KEYWORD: shutdown
+
+$_rc_subr_loaded . /etc/rc.subr
+
+name="xdm"
+rcvar=$name
+command="@X11ROOTDIR@/bin/${name}"
+pidfile="/var/run/${name}.pid"
+required_files="/etc/X11/xdm/xdm-config"
+extra_commands="reload"
+
+load_rc_config $name
+run_rc_command "$1"
--- /dev/null   2008-10-28 19:30:52.000000000 +0000
+++ etc/rc.d/xfs.in     2008-10-17 21:48:29.000000000 +0000
@@ -0,0 +1,20 @@
+#!/bin/sh
+#
+# $NetBSD$
+#
+
+# PROVIDE: xfs
+# REQUIRE: mountall cleartmp
+# BEFORE:  LOGIN
+
+$_rc_subr_loaded . /etc/rc.subr
+
+name="xfs"
+rcvar=$name
+command="@X11ROOTDIR@/bin/${name}"
+command_args="& sleep 2"
+required_files="/etc/X11/fs/config"
+extra_commands="reload"
+
+load_rc_config $name
+run_rc_command "$1"
Index: etc/root/dot.cshrc
===================================================================
RCS file: /cvsroot/src/etc/root/dot.cshrc,v
retrieving revision 1.16
diff -u -r1.16 dot.cshrc
--- etc/root/dot.cshrc  31 Aug 2006 22:33:14 -0000      1.16
+++ etc/root/dot.cshrc  28 Oct 2008 18:57:45 -0000
@@ -21,7 +21,7 @@
 setenv BLOCKSIZE 1k
 
 set history=1000
-set path=(/sbin /usr/sbin /bin /usr/bin /usr/pkg/sbin /usr/pkg/bin 
/usr/X11R6/bin /usr/local/sbin /usr/local/bin)
+set path=(/sbin /usr/sbin /bin /usr/bin /usr/pkg/sbin /usr/pkg/bin 
/usr/X11R7/bin /usr/X11R6/bin /usr/local/sbin /usr/local/bin)
 
 # directory stuff: cdpath/cd/back
 set 
cdpath=(/usr/src/{sys,bin,sbin,usr.{bin,sbin},lib,libexec,share,local,games,gnu/{usr.{bin,sbin},libexec,lib,games}})
Index: etc/root/dot.profile
===================================================================
RCS file: /cvsroot/src/etc/root/dot.profile,v
retrieving revision 1.18
diff -u -r1.18 dot.profile
--- etc/root/dot.profile        22 Feb 2005 09:12:17 -0000      1.18
+++ etc/root/dot.profile        28 Oct 2008 18:57:45 -0000
@@ -1,7 +1,7 @@
 #      $NetBSD: dot.profile,v 1.18 2005/02/22 09:12:17 sketch Exp $
 
 export PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/pkg/sbin:/usr/pkg/bin
-export PATH=${PATH}:/usr/X11R6/bin:/usr/local/sbin:/usr/local/bin
+export 
PATH=${PATH}:/usr/X11R7/bin:/usr/X11R6/bin:/usr/local/sbin:/usr/local/bin
 
 export BLOCKSIZE=1k
 
Index: etc/skel/dot.cshrc
===================================================================
RCS file: /cvsroot/src/etc/skel/dot.cshrc,v
retrieving revision 1.3
diff -u -r1.3 dot.cshrc
--- etc/skel/dot.cshrc  24 Apr 2003 01:02:26 -0000      1.3
+++ etc/skel/dot.cshrc  28 Oct 2008 18:57:45 -0000
@@ -21,7 +21,7 @@
 setenv EXINIT  'set autoindent'
 setenv PAGER   more
 
-set path = (~/bin /bin /sbin /usr/{bin,sbin,X11R6/bin,pkg/{,s}bin,games} \
+set path = (~/bin /bin /sbin 
/usr/{bin,sbin,X11R7/bin,X11R6/bin,pkg/{,s}bin,games} \
            /usr/local/{,s}bin)
 
 if ($?prompt) then
Index: etc/skel/dot.profile
===================================================================
RCS file: /cvsroot/src/etc/skel/dot.profile,v
retrieving revision 1.4
diff -u -r1.4 dot.profile
--- etc/skel/dot.profile        31 Aug 2006 22:49:55 -0000      1.4
+++ etc/skel/dot.profile        28 Oct 2008 18:57:45 -0000
@@ -9,7 +9,7 @@
 # See sh(1) for details.
 #
 
-PATH=$HOME/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin:/usr/pkg/bin
+PATH=$HOME/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R7/bin:/usr/X11R6/bin:/usr/pkg/bin
 PATH=${PATH}:/usr/pkg/sbin:/usr/games:/usr/local/bin:/usr/local/sbin
 export PATH
 
Index: distrib/sets/lists/etc/mi
===================================================================
RCS file: /cvsroot/src/distrib/sets/lists/etc/mi,v
retrieving revision 1.200
diff -u -r1.200 mi
--- distrib/sets/lists/etc/mi   18 Jun 2008 09:06:26 -0000      1.200
+++ distrib/sets/lists/etc/mi   28 Oct 2008 18:57:48 -0000
@@ -272,8 +272,6 @@
 ./etc/rc.d/wpa_supplicant                      etc-net-rc
 ./etc/rc.d/wscons                              etc-sys-rc
 ./etc/rc.d/wsmoused                            etc-sys-rc
-./etc/rc.d/xdm                                 etc-x11-rc
-./etc/rc.d/xfs                                 etc-x11-rc
 ./etc/rc.d/xntpd                               etc-obsolete            obsolete
 ./etc/rc.d/ypbind                              etc-nis-rc
 ./etc/rc.d/yppasswdd                           etc-nis-rc
Index: distrib/sets/lists/xetc/mi
===================================================================
RCS file: /cvsroot/src/distrib/sets/lists/xetc/mi,v
retrieving revision 1.10
diff -u -r1.10 mi
--- distrib/sets/lists/xetc/mi  26 Sep 2008 07:02:57 -0000      1.10
+++ distrib/sets/lists/xetc/mi  28 Oct 2008 18:57:48 -0000
@@ -85,3 +85,7 @@
 ./etc/fonts/fonts.dtd                                  -unknown-       xorg
 ./etc/mtree/set.xetc                                   xetc-sys-root   x11
 ./etc/mtree/set.xetc                                   xetc-sys-root   xorg
+./etc/rc.d/xdm                                         etc-x11-rc      x11
+./etc/rc.d/xdm                                         etc-x11-rc      xorg
+./etc/rc.d/xfs                                         etc-x11-rc      x11
+./etc/rc.d/xfs                                         etc-x11-rc      xorg
Index: share/mk/bsd.files.mk
===================================================================
RCS file: /cvsroot/src/share/mk/bsd.files.mk,v
retrieving revision 1.39
diff -u -r1.39 bsd.files.mk
--- share/mk/bsd.files.mk       25 Aug 2008 08:11:04 -0000      1.39
+++ share/mk/bsd.files.mk       28 Oct 2008 18:57:50 -0000
@@ -8,6 +8,7 @@
 .if !target(__fileinstall)
 ##### Basic targets
 realinstall:   filesinstall
+realall:       filesbuild
 
 ##### Default values
 FILESDIR?=     ${BINDIR}
@@ -15,6 +16,10 @@
 FILESGRP?=     ${BINGRP}
 FILESMODE?=    ${NONBINMODE}
 
+##### Build rules
+filesbuild:
+.PHONY:                filesbuild
+
 ##### Install rules
 filesinstall:: # ensure existence
 .PHONY:                filesinstall
@@ -36,19 +41,25 @@
 _FDIR:=                ${FILESDIR_${F}:U${FILESDIR}}           # dir override
 _FNAME:=       ${FILESNAME_${F}:U${FILESNAME:U${F:T}}} # name override
 _F:=           ${DESTDIR}${_FDIR}/${_FNAME}            # installed path
+_FDOBUILD:=    ${FILESBUILD_${F}:Uno}
 
 .if ${MKUPDATE} == "no"
 ${_F}!         ${F} __fileinstall                      # install rule
-.if !defined(BUILD) && !make(all) && !make(${F})
+.if !defined(BUILD) && !make(all) && !make(${F}) && (${_FDOBUILD} == "no")
 ${_F}!         .MADE                                   # no build at install
 .endif
 .else
 ${_F}:         ${F} __fileinstall                      # install rule
-.if !defined(BUILD) && !make(all) && !make(${F})
+.if !defined(BUILD) && !make(all) && !make(${F}) && (${_FDOBUILD} == "no")
 ${_F}:         .MADE                                   # no build at install
 .endif
 .endif
 
+.if ${_FDOBUILD} != "no"
+filesbuild:    ${F}
+CLEANFILES+=   ${F}
+.endif
+
 filesinstall:: ${_F}
 .PRECIOUS:     ${_F}                                   # keep if install fails
 .endfor
@@ -63,19 +74,25 @@
 _FDIR:=                ${FILESDIR_${F}:U${FILESDIR}}           # dir override
 _FNAME:=       ${FILESNAME_${F}:U${FILESNAME:U${F:T}}} # name override
 _F:=           ${DESTDIR}${_FDIR}/${_FNAME}            # installed path
+_FDOBUILD:=    ${FILESBUILD_${F}:Uno}
 
 .if ${MKUPDATE} == "no"
 ${_F}!         ${F} __fileinstall      # install rule
-.if !defined(BUILD) && !make(all) && !make(${F})
+.if !defined(BUILD) && !make(all) && !make(${F}) && (${_FDOBUILD} == "no")
 ${_F}!         .MADE                                   # no build at install
 .endif
 .else
 ${_F}:         ${F} __fileinstall      # install rule
-.if !defined(BUILD) && !make(all) && !make(${F})
+.if !defined(BUILD) && !make(all) && !make(${F}) && (${_FDOBUILD} == "no")
 ${_F}:         .MADE                                   # no build at install
 .endif
 .endif
 
+.if ${_FDOBUILD} != "no"
+filesbuild:    ${F}
+CLEANFILES+=   ${F}
+.endif
+
 configfilesinstall::   ${_F}
 .PRECIOUS:     ${_F}                                   # keep if install fails
 .endfor
Index: share/mk/bsd.prog.mk
===================================================================
RCS file: /cvsroot/src/share/mk/bsd.prog.mk,v
retrieving revision 1.239
diff -u -r1.239 bsd.prog.mk
--- share/mk/bsd.prog.mk        19 Oct 2008 15:22:50 -0000      1.239
+++ share/mk/bsd.prog.mk        28 Oct 2008 18:57:50 -0000
@@ -27,11 +27,6 @@
        echo "source ${__gdbinit}" >> .gdbinit
 .endfor
 
-cleanextra: .PHONY
-.if defined(CLEANFILES) && !empty(CLEANFILES)
-       rm -f ${CLEANFILES}
-.endif
-
 cleanobjs: .PHONY
 
 cleanprog: .PHONY cleanobjs cleanextra
@@ -455,6 +450,11 @@
 .include <bsd.sys.mk>
 .include <bsd.dep.mk>
 
+cleanextra: .PHONY
+.if defined(CLEANFILES) && !empty(CLEANFILES)
+       rm -f ${CLEANFILES}
+.endif
+
 ${TARGETS}:    # ensure existence
 
 .endif # HOSTPROG
Index: usr.sbin/postinstall/Makefile
===================================================================
RCS file: /cvsroot/src/usr.sbin/postinstall/Makefile,v
retrieving revision 1.1
diff -u -r1.1 Makefile
--- usr.sbin/postinstall/Makefile       17 Apr 2005 15:15:49 -0000      1.1
+++ usr.sbin/postinstall/Makefile       28 Oct 2008 18:57:50 -0000
@@ -1,9 +1,15 @@
 # $NetBSD: Makefile,v 1.1 2005/04/17 15:15:49 lukem Exp $
 
-FILES=         postinstall
+FILES=         postinstall.ni
 MAN=           postinstall.8
 
 FILESDIR=      /usr/sbin
 FILESMODE=     ${BINMODE}
+FILESNAME_postinstall.ni=      postinstall
+FILESBUILD_postinstall.ni=     yes
+
+.PRECIOUS: postinstall.ni
+postinstall.ni:        postinstall
+       ${TOOL_SED} -e 's,@X11ROOTDIR@,${X11ROOTDIR},g' < ${.ALLSRC} > 
${.TARGET}
 
 .include <bsd.prog.mk>
Index: usr.sbin/postinstall/postinstall
===================================================================
RCS file: /cvsroot/src/usr.sbin/postinstall/postinstall,v
retrieving revision 1.75
diff -u -r1.75 postinstall
--- usr.sbin/postinstall/postinstall    17 Oct 2008 21:31:55 -0000      1.75
+++ usr.sbin/postinstall/postinstall    28 Oct 2008 18:57:50 -0000
@@ -899,11 +899,18 @@
        [ -n "$1" ] || err 3 "USAGE: do_rc  fix|check"
        op="$1"
        failed=0
+       generated_scripts="xdm xfs"
 
        compare_dir "${op}" "${SRC_DIR}/etc" "${DEST_DIR}/etc" 644 \
                rc rc.subr rc.shutdown
        failed=$(( ${failed} + $? ))
 
+       if ! ${SOURCEMODE}; then
+               extra_scripts="${generated_scripts}"
+       else
+               extra_scripts=""
+       fi
+
        compare_dir "${op}" "${SRC_DIR}/etc/rc.d" "${DEST_DIR}/etc/rc.d" 555 \
                DAEMON LOGIN NETWORKING SERVERS \
                accounting altqd amd apmd \
@@ -927,10 +934,23 @@
                staticroute swap1 swap2 sysctl sysdb syslogd \
                timed tpctl ttys \
                veriexec virecover wdogctl wpa_supplicant wscons wsmoused \
-               xdm xfs \
-               ypbind yppasswdd ypserv
+               ypbind yppasswdd ypserv \
+               ${extra_scripts}
        failed=$(( ${failed} + $? ))
 
+       if $SOURCEMODE; then
+               # generate scripts
+               mkdir "${SCRATCHDIR}/rc"
+               for f in ${generated_scripts}; do
+                       sed -e 's,@X11''ROOTDIR@,@X11ROOTDIR@,g' \
+                           < "${SRC_DIR}/etc/rc.d/${f}.in" \
+                           > "${SCRATCHDIR}/rc/${f}"
+               done
+               compare_dir "${op}" "${SCRATCHDIR}/rc"
+                   "${DEST_DIR}/etc/rc.d" 555 \
+                   ${generated_scipts}
+       fi
+
                # check for obsolete rc.d files
        for f in NETWORK btcontrol btuartd fsck.sh kerberos nfsiod servers \
            systemfs daemon gated login portmap sunndd xntpd; do
@@ -1152,7 +1172,7 @@
                msg "${_etcx11} is not a directory; skipping check"
                return 0
        fi
-       _libx11="${DEST_DIR}/usr/X11R6/lib/X11"
+       _libx11="${DEST_DIR}@X11ROOTDIR@/lib/X11"
        if [ ! -d "${_libx11}" ]; then
                msg "${_libx11} is not a directory; skipping check"
                return 0
@@ -1235,7 +1255,7 @@
                obsolete_libs /lib
                obsolete_libs /usr/lib
                obsolete_libs /usr/lib/i18n
-               obsolete_libs /usr/X11R6/lib
+               obsolete_libs @X11ROOTDIR@/lib
        ) | obsolete_paths "${op}"
        failed=$(( ${failed} + $? ))
 

Attachment: pgp9lYuYzae62.pgp
Description: PGP signature



Home | Main Index | Thread Index | Old Index