Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/postinstall postinstall: fix x11 migration of /usr/...



details:   https://anonhg.NetBSD.org/src/rev/a661907c72f6
branches:  trunk
changeset: 359452:a661907c72f6
user:      lukem <lukem%NetBSD.org@localhost>
date:      Fri Jan 07 01:03:02 2022 +0000

description:
postinstall: fix x11 migration of /usr/X11R6/lib/X11

Fix the x11 check if /usr/X11R6/lib/X11/* needs to migrate to /etc/X11/*
by ensuring that the former actually is detected.

Avoids false migration errors for paths such as /fs if /usr/X11R6
doesn't exist, such as:
        x11 check:
                Migrate /fs to /etc/X11/fs

The original implemention handled this correctly, but the bug
crept in postinstall 1.110 on 2010/11/21.

diffstat:

 usr.sbin/postinstall/postinstall.in |  50 +++++++++++++++++++-----------------
 1 files changed, 27 insertions(+), 23 deletions(-)

diffs (75 lines):

diff -r 6f79fea4e1b4 -r a661907c72f6 usr.sbin/postinstall/postinstall.in
--- a/usr.sbin/postinstall/postinstall.in       Thu Jan 06 22:10:39 2022 +0000
+++ b/usr.sbin/postinstall/postinstall.in       Fri Jan 07 01:03:02 2022 +0000
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: postinstall.in,v 1.41 2021/08/21 10:06:33 andvar Exp $
+# $NetBSD: postinstall.in,v 1.42 2022/01/07 01:03:02 lukem Exp $
 #
 # Copyright (c) 2002-2021 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -2300,6 +2300,7 @@
 
        failed=0
        _etcx11="${DEST_DIR}/etc/X11"
+       _libx11=""
        if [ ! -d "${_etcx11}" ]; then
                msg "${_etcx11} is not a directory; skipping check"
                return 0
@@ -2318,30 +2319,33 @@
                _notfixed="${NOT_FIXED}"
        fi
 
-       for d in \
-                   fs lbxproxy proxymngr rstart twm xdm xinit xserver xsm \
-           ; do
-               sd="${_libx11}/${d}"
-               ld="/etc/X11/${d}"
-               td="${DEST_DIR}${ld}"
-               if [ -h "${sd}" ]; then
-                       continue
-               elif [ -d "${sd}" ]; then
-                       tdfiles="$(find "${td}" \! -type d)"
-                       if [ -n "${tdfiles}" ]; then
-                               msg "${sd} exists yet ${td} already" \
-                                   "contains files${_notfixed}"
+       # check if /usr/X11R6/lib/X11 needs to migrate to /etc/X11
+       if [ -n "${_libx11}" ]; then
+               for d in \
+                           fs lbxproxy proxymngr rstart twm xdm xinit xserver xsm \
+                   ; do
+                       sd="${_libx11}/${d}"
+                       ld="/etc/X11/${d}"
+                       td="${DEST_DIR}${ld}"
+                       if [ -h "${sd}" ]; then
+                               continue
+                       elif [ -d "${sd}" ]; then
+                               tdfiles="$(find "${td}" \! -type d)"
+                               if [ -n "${tdfiles}" ]; then
+                                       msg "${sd} exists yet ${td} already" \
+                                           "contains files${_notfixed}"
+                               else
+                                       msg "Migrate ${sd} to ${td}${_notfixed}"
+                               fi
+                               failed=1
+                       elif [ -e "${sd}" ]; then
+                               msg "Unexpected file ${sd}${_notfixed}"
+                               continue
                        else
-                               msg "Migrate ${sd} to ${td}${_notfixed}"
+                               continue
                        fi
-                       failed=1
-               elif [ -e "${sd}" ]; then
-                       msg "Unexpected file ${sd}${_notfixed}"
-                       continue
-               else
-                       continue
-               fi
-       done
+               done
+       fi
 
        # check if xdm resources have been updated
        if [ -r ${_etcx11}/xdm/Xresources ] && \



Home | Main Index | Thread Index | Old Index