Module Name: src
Committed By: apb
Date: Tue Oct 13 07:47:01 UTC 2009
Modified Files:
src/usr.sbin/postinstall: postinstall
Log Message:
/usr/X11R7/lib/X11/xkb/symbols/pc used to be a directory, but changed
to a file on 2009-06-12. Fixing this requires removing the directory
(which we can do) and re-extracting the xbase set (which we can't do),
or at least adding that one file (which we may be able to do if X11SRCDIR
is available).
Reviewed by mrg, snj
To generate a diff of this commit:
cvs rdiff -u -r1.105 -r1.106 src/usr.sbin/postinstall/postinstall
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.sbin/postinstall/postinstall
diff -u src/usr.sbin/postinstall/postinstall:1.105 src/usr.sbin/postinstall/postinstall:1.106
--- src/usr.sbin/postinstall/postinstall:1.105 Tue Sep 29 23:56:35 2009
+++ src/usr.sbin/postinstall/postinstall Tue Oct 13 07:47:00 2009
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# $NetBSD: postinstall,v 1.105 2009/09/29 23:56:35 tsarna Exp $
+# $NetBSD: postinstall,v 1.106 2009/10/13 07:47:00 apb Exp $
#
# Copyright (c) 2002-2008 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -49,6 +49,7 @@
# This script is executed as part of a cross build. Allow the build
# environment to override the locations of some tools.
: ${AWK:=awk}
+: ${EGREP:=egrep}
: ${FGREP:=fgrep}
: ${GREP:=grep}
: ${MAKE:=make}
@@ -623,7 +624,7 @@
detect_x11()
{
if $SOURCEMODE; then
- get_makevar MKX11 X11ROOTDIR
+ get_makevar MKX11 X11ROOTDIR X11SRCDIR
else
if [ -f "${SRC_DIR}/etc/mtree/set.xetc" ]; then
MKX11=yes
@@ -632,6 +633,7 @@
MKX11=no
X11ROOTDIR=
fi
+ X11SRCDIR=/nonexisent/xsrc
fi
}
@@ -1348,6 +1350,71 @@
}
#
+# xkb
+#
+# /usr/X11R7/lib/X11/xkb/symbols/pc used to be a directory, but changed
+# to a file on 2009-06-12. Fixing this requires removing the directory
+# (which we can do) and re-extracting the xbase set (which we can't do),
+# or at least adding that one file (which we may be able to do if X11SRCDIR
+# is available).
+#
+additem xkb "clean up for xkbdata to xkeyboard-config upgrade"
+do_xkb()
+{
+ [ -n "$1" ] || err 3 "USAGE: do_xkb fix|check"
+ op="$1"
+ failed=0
+
+ pcpath="/usr/X11R7/lib/X11/xkb/symbols/pc"
+ pcsrcdir="${X11SRCDIR}/external/mit/xkeyboard-config/dist/symbols"
+
+ filemsg="\
+${pcpath} was a directory, should be a file.
+ To fix, extract the xbase set again."
+
+ _notfixed=""
+ if [ "${op}" = "fix" ]; then
+ _notfixed="${NOT_FIXED}"
+ fi
+
+ if [ ! -d "${DESTDIR}${pcpath}" ]; then
+ return 0
+ fi
+
+ # Delete obsolete files in the directory, and the directory
+ # itself. If the directory contains unexpected extra files
+ # then it will not be deleted.
+ ( [ -f "${DEST_DIR}"/var/db/obsolete/xbase ] \
+ && sort -ru "${DEST_DIR}"/var/db/obsolete/xbase \
+ | ${EGREP} "^\\.?${pcpath}/" ;
+ echo "${pcpath}" ) \
+ | obsolete_paths "${op}"
+ failed=$(( ${failed} + $? ))
+
+ # If the directory was removed above, then try to replace it with
+ # a file.
+ if [ -d "${DESTDIR}${pcpath}" ]; then
+ msg "${filemsg}${_notfixed}"
+ failed=$(( ${failed} + 1 ))
+ else
+ if ! find_file_in_dirlist pc "${pcpath}" \
+ "${pcsrcdir}" "${SRC_DIR}${pcpath%/*}"
+ then
+ msg "${filemsg}${_notfixed}"
+ failed=$(( ${failed} + 1 ))
+ else
+ # ${dir} is set by find_file_in_dirlist()
+ populate_dir "${op}" true \
+ "${dir}" "${DEST_DIR}${pcpath%/*}" 444 \
+ pc
+ failed=$(( ${failed} + $? ))
+ fi
+ fi
+
+ return $failed
+}
+
+#
# uid
#
additem uid "required users in /etc/master.passwd"