upgrade: Avoid confussion.
authorzrj <rimvydas.jasinskas@gmail.com>
Sat, 11 Nov 2017 10:53:10 +0000 (12:53 +0200)
committerzrj <zrj@dragonflybsd.org>
Sat, 11 Nov 2017 12:53:22 +0000 (14:53 +0200)
Some people tend to skip over entries in UPDATING and miss important details.
Convert REMOVE_OPENSSL_FILES to an action that actually warns user about it.

Files being removed(optionally) are peformed as a last step in make upgrade
step in constrast to standard TO_REMOVE that does it before updating /etc/ dir.

It should be assumed that users are allowed and will use REMOVE_DEPRECATED=yes
in their /etc/make.conf, so anything requiring user intervention should still
go in etc/Makefile: upgrade_check: target (like it already does for mailers).
Addition is not a magic fix for all problems and should be used responsibly!

While there, convert old pam removal using csh to plain TO_REMOVE.

Approved-after-very-long-discussions-by: swildner
Makefile_upgrade.inc
etc/Makefile

index f3569dc..fe8fe6a 100644 (file)
@@ -1,4 +1,5 @@
 # Append all obsolete files to this file
+# Late variant is special and requires approval from other committers first
 # Avoid constructs like {foo,bar}.  It is parsed by /bin/sh
 # Formatted manual pages (i.e., cat[1-9]) need not be specified separately
 
@@ -653,6 +654,17 @@ TO_REMOVE+=/usr/share/man/man8/dhcpd.8.gz
 TO_REMOVE+=/usr/share/man/man8/dhcrelay.8.gz
 TO_REMOVE+=/usr/include/machine/pci_cfgreg.h
 TO_REMOVE+=/usr/include/libusbhid.h
+TO_REMOVE+=/etc/pam.conf
+TO_REMOVE+=/usr/lib/pam_cleartext_pass_ok.so
+TO_REMOVE+=/usr/lib/pam_deny.so
+TO_REMOVE+=/usr/lib/pam_opie.so
+TO_REMOVE+=/usr/lib/pam_opieaccess.so
+TO_REMOVE+=/usr/lib/pam_permit.so
+TO_REMOVE+=/usr/lib/pam_radius.so
+TO_REMOVE+=/usr/lib/pam_skey.so
+TO_REMOVE+=/usr/lib/pam_ssh.so
+TO_REMOVE+=/usr/lib/pam_tacplus.so
+TO_REMOVE+=/usr/lib/pam_unix.so
 TO_REMOVE+=/usr/share/examples/cvsup/DragonFly-cvs-supfile
 TO_REMOVE+=/usr/share/examples/cvsup/DragonFly-preview-supfile
 TO_REMOVE+=/usr/share/examples/cvsup/DragonFly-release1_2-supfile
@@ -3282,19 +3294,18 @@ TO_REMOVE+=/usr/share/installer/sources.conf
 TO_REMOVE+=/usr/share/man/man8/installer.8.gz
 .endif
 
-.if defined(REMOVE_OPENSSL_FILES)
-TO_REMOVE+=/lib/libcrypto.so.5
-TO_REMOVE+=/usr/lib/libssl.a
-TO_REMOVE+=/usr/lib/libssl.so
-TO_REMOVE+=/usr/lib/libssl.so.5
-TO_REMOVE+=/usr/lib/engines
-TO_REMOVE+=/usr/lib/libcrypto.so
-TO_REMOVE+=/usr/lib/libcrypto.a
-TO_REMOVE+=/usr/lib/profile/libssl.a
-TO_REMOVE+=/usr/lib/profile/libcrypto.a
-TO_REMOVE+=/usr/include/openssl
-TO_REMOVE+=/usr/share/openssl
-.endif
+# Very special cases only.
+TO_REMOVE_LATE+=/lib/libcrypto.so.5
+TO_REMOVE_LATE+=/usr/lib/libssl.a
+TO_REMOVE_LATE+=/usr/lib/libssl.so
+TO_REMOVE_LATE+=/usr/lib/libssl.so.5
+TO_REMOVE_LATE+=/usr/lib/engines
+TO_REMOVE_LATE+=/usr/lib/libcrypto.so
+TO_REMOVE_LATE+=/usr/lib/libcrypto.a
+TO_REMOVE_LATE+=/usr/lib/profile/libssl.a
+TO_REMOVE_LATE+=/usr/lib/profile/libcrypto.a
+TO_REMOVE_LATE+=/usr/include/openssl
+TO_REMOVE_LATE+=/usr/share/openssl
 
 # XXX Remove when pfsync(4) has been fixed
 TO_REMOVE+=/usr/share/man/man4/pfsync.4.gz
index 6712437..4194b32 100644 (file)
@@ -91,6 +91,33 @@ remove-obsolete-files:
                fi; \
        done
 
+remove-deprecated-files:
+.if defined(REMOVE_DEPRECATED)
+       @echo "===> Remove now deprecated files"
+       @for item in ${TO_REMOVE_LATE}; do \
+               if [ -e ${DESTDIR}$${item} -o -L ${DESTDIR}$${item} ]; then \
+                       echo "${DESTDIR}$${item}"; \
+                       chflags -Rf noschg "${DESTDIR}$${item}"; \
+                       rm -rf "${DESTDIR}$${item}"; \
+               fi; \
+       done;
+.else
+       @echo "===> Checking for deprecated files"
+       @count=0; for item in ${TO_REMOVE_LATE}; do \
+               if [ -e ${DESTDIR}$${item} -o -L ${DESTDIR}$${item} ]; then \
+                       echo "${DESTDIR}$${item} is deprecated"; \
+                       count=`expr $$count + 1`; \
+               fi; \
+       done; \
+       if [ "$$count" -gt 0 ]; then \
+               echo "==================================================================" ; \
+               echo "= You have $$count now deprecated files." ; \
+               echo "= Once you are sure that none of your third party (ports or local)" ; \
+               echo "= software are still using them, rerun with REMOVE_DEPRECATED set." ; \
+               echo "==================================================================" ; \
+       fi;
+.endif
+
 preupgrade:
        (pw -V ${DESTDIR}/etc usershow mail -q > /dev/null) || \
                pw -V ${DESTDIR}/etc useradd mail -u 6 -g 6 \
@@ -131,7 +158,7 @@ upgrade_check:
                /usr/bin/false ; \
        fi
 
-upgrade_etc:   upgrade_check preupgrade remove-obsolete-files
+upgrade_base:  upgrade_check preupgrade remove-obsolete-files
        # files that should be dirs (not possible with Makefile_upgrade.inc)
 .for f in usr/include/dev/misc/ppi usr/share/initrd/sbin
        [ -d ${DESTDIR}/${f} ] || rm -f ${DESTDIR}/${f}
@@ -177,9 +204,6 @@ upgrade_etc:        upgrade_check preupgrade remove-obsolete-files
 .endif
 .endfor
 .endif
-       # these removals must occur AFTER any pam conversion
-       csh -c "rm -f /usr/lib/pam_{cleartext_pass_ok,deny,opie,opieaccess,permit,radius,skey,ssh,tacplus,unix}.so"
-       rm -f /etc/pam.conf
 .if !defined(BINARY_UPGRADE) # binary upgrade just copies these files
        cd ${UPGRADE_SRCDIR}/..; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
            COPYRIGHT ${DESTDIR}/
@@ -245,6 +269,9 @@ upgrade_etc:        upgrade_check preupgrade remove-obsolete-files
                echo "  make install"; \
        fi
 
+upgrade_etc:   upgrade_base remove-deprecated-files
+       @echo "Upgrade was successful"
+
 distribution:
        cd ${.CURDIR}; \
            ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \