From owner-svn-src-stable-7@FreeBSD.ORG Fri Jan 15 03:39:04 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0E30D1065670; Fri, 15 Jan 2010 03:39:04 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EE9998FC15; Fri, 15 Jan 2010 03:39:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o0F3d3R4035299; Fri, 15 Jan 2010 03:39:03 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o0F3d3V4035296; Fri, 15 Jan 2010 03:39:03 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201001150339.o0F3d3V4035296@svn.freebsd.org> From: Doug Barton Date: Fri, 15 Jan 2010 03:39:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r202338 - stable/7/usr.sbin/mergemaster X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jan 2010 03:39:04 -0000 Author: dougb Date: Fri Jan 15 03:39:03 2010 New Revision: 202338 URL: http://svn.freebsd.org/changeset/base/202338 Log: MFC r200416: Simplify handling of MTREEFILE relative to DESTDIR Make the message about a missing MTREEFILE combined with -U more informative MFC r200425: Over time things that used to be files/directories/links can change to something else. So add code to detect when things don't match and give the user choices about how to fix it. If we're using -P and something in the above check needs to be moved we need to have the directory there for it, so create it at the beginning and delete empty versions of it at the end. The case where something used to be a file or link and now is supposed to be a directory (e.g., /etc/security) is especially dangerous, so make failure to install a necessary directory in $DESTDIR a fatal error. MFC r200700: In the places where find is used that the user may see the results, first pipe it to sort so that order of processing will be deterministic and like things will be grouped together. MFC r200701: Fix an indentation issue, no functional changes MFC r200708: Fix a problem with how mergemaster handles the hard links for /.cshrc and /.profile. The problem is that install(1) will unlink the old file before it installs the new one, which means that in the best case we have to compare the changes for the old file twice. So, change the logic to first test to see if the link exists, then install the file. Then if the link was there and we're using -i, just create the link in /root and be done with it. Otherwise display the message to the user and give them the option. Because we are now sorting things before doing the comparison we can know conclusively that the files in / should be the sources, and the files in /root will be the targets, so adjust the paths accordingly. While I'm here, split a too-long error message into two lines and just return at the end of handling these files instead of setting the variable that says "do nothing" and then returning at the end of the function anyway. MFC r201291: Add some patches contributed by jhb: 1. Don't prompt the user for "-U but no db" error if we're using -a 2. Add an option to delete stale rc.d files automatically if the user has DELETE_STALE_RC_FILES in their rc file. Lack of command line option for this is not an oversight. 3. Add []'s around the terminal $ for the $FreeBSD$ test for -F For one bug raised by jhb I did a more thorough solution: There were a lot of things that "snuck in" between the end of the test for -r and the start of the comparison. One of them is the creation of the mtree db, as pointed out by jhb. Fix this problem more thoroughly by moving the end of the test down to where it should/used to be, right before the comparison. As a result, indent the interloping code to match. MFC r201292: Document the DELETE_STALE_RC_FILES option introduced in r201291. This is an "rc file only" option by design. While I'm here, update the comments in the example rc file to indicate which command line options they relate to, and correct the defaults for a couple of options. MFC r201293: It's not necessary to include both Op and Fl for command line options included in the text, so use only the latter. Clarify that using -U doesn't make sense in combination with -a MFC r201323: If we are using -p it does not make any sense to even create the MTREENEW file since it will never be used. MFC r201765: Update copyright date Update delete_temproot() to include the error message if it fails, and clean up the places where it's called. If there are no files left in temproot when the comparison is done delete it without prompting. This should make "automated" runs of mergemaster without -a a little easier. Document the new behavior in the man page. Modified: stable/7/usr.sbin/mergemaster/mergemaster.8 stable/7/usr.sbin/mergemaster/mergemaster.sh Directory Properties: stable/7/usr.sbin/mergemaster/ (props changed) Modified: stable/7/usr.sbin/mergemaster/mergemaster.8 ============================================================================== --- stable/7/usr.sbin/mergemaster/mergemaster.8 Fri Jan 15 03:28:46 2010 (r202337) +++ stable/7/usr.sbin/mergemaster/mergemaster.8 Fri Jan 15 03:39:03 2010 (r202338) @@ -1,4 +1,4 @@ -.\" Copyright (c) 1998-2009 Douglas Barton +.\" Copyright (c) 1998-2010 Douglas Barton .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 18, 2009 +.Dd January 7, 2010 .Dt MERGEMASTER 8 .Os .Sh NAME @@ -61,10 +61,10 @@ down, populating that environment with t files. You can specify a different source directory with the -.Op Fl m +.Fl m command line option, or specify the destination directory with the -.Op Fl D +.Fl D option. It then compares each file in that environment to its installed counterpart. @@ -91,10 +91,10 @@ compares the files themselves. You can also specify that the script ignore the Id strings and compare every file with the -.Op Fl s +.Fl s option. Using the -.Op Fl F +.Fl F option .Nm will install the new file for you if they differ only by @@ -126,7 +126,7 @@ installing an updated version of this fi probably run .Xr pwd_mkdb 8 with the -.Op Fl p +.Fl p option to rebuild your password databases and recreate .Pa /etc/passwd . @@ -165,6 +165,14 @@ which will be read before Options specified on the command line are updated last, and therefore can override both files. .Pp +When the comparison is done if there are any files remaining +in the temproot directory they will be listed, and if the +.Fl a +option is not in use the user will be given the option of +deleting the temproot directory. +If there are no files remaining in the temproot directory +it will be deleted. +.Pp The options are as follows: .Bl -tag -width Fl .It Fl s @@ -198,11 +206,13 @@ If the directory exists, it creates a new one in a previously non-existent directory. This option unsets the verbose flag, -but is compatible with all other options. +but other than +.Fl U +it is compatible with all other options. Setting -.Op Fl a +.Fl a makes -.Op Fl w +.Fl w superfluous. .It Fl h Display usage and help information. @@ -253,7 +263,7 @@ instead of the default Add the date and time to the name of the temporary root directory. If -.Op Fl t +.Fl t is specified, this option must follow it if you want the date added too. .It Fl u Ar N @@ -320,44 +330,44 @@ with all values commented out: # These are options for mergemaster, with their default values listed # The following options have command line overrides # -# The target architecture (unset by default) +# The target architecture (-A, unset by default) #ARCHSTRING='TARGET_ARCH=' # -# Sourcedir is the directory to do the 'make' in (where the new files are) +# Sourcedir is the directory to do the 'make' in (-m) #SOURCEDIR='/usr/src' # -# Directory to install the temporary root environment into +# Directory to install the temporary root environment into (-t) #TEMPROOT='/var/tmp/temproot' # -# Specify the destination directory for the installed files +# Specify the destination directory for the installed files (-D) #DESTDIR= # -# Strict comparison skips the VCS Id test and compares every file +# Strict comparison skips the VCS Id test and compares every file (-s) #STRICT=no # -# Type of diff, such as unified, context, etc. +# Type of diff, such as unified, context, etc. (-c) #DIFF_FLAG='-u' # -# Install the new file if it differs only by VCS Id ($FreeBSD) +# Install the new file if it differs only by VCS Id ($FreeBSD, -F) #FREEBSD_ID= # -# Verbose mode includes more details and additional checks +# Verbose mode includes more details and additional checks (-v) #VERBOSE= # -# Automatically install files that do not exist on the system already +# Automatically install files that do not exist on the system already (-i) #AUTO_INSTALL= # -# Automatically upgrade files that have not been user modified +# Automatically upgrade files that have not been user modified (-U) #AUTO_UPGRADE= # -# Compare /etc/rc.conf[.local] to /etc/defaults/rc.conf -#COMP_CONFS=yes +# Compare /etc/rc.conf[.local] to /etc/defaults/rc.conf (-C) +#COMP_CONFS= # -# Preserve files that you replace -#PRESERVE_FILES=yes +# Preserve files that you replace (-P) +#PRESERVE_FILES= #PRESERVE_FILES_DIR=/var/tmp/mergemaster/preserved-files-`date +%y%m%d-%H%M%S` # -# The umask for mergemaster to compare the default file's modes to +# The umask for mergemaster to compare the default file's modes to (-u) #NEW_UMASK=022 # # The following options have no command line overrides @@ -377,6 +387,9 @@ with all values commented out: # If you set 'yes' above, make sure to include the PATH to your pager #PATH=/bin:/usr/bin:/usr/sbin # +# Delete stale files in /etc/rc.d without prompting +#DELETE_STALE_RC_FILES= +# # Specify the path to scripts to run before the comparison starts, # and/or after the script has finished its work #MM_PRE_COMPARE_SCRIPT= Modified: stable/7/usr.sbin/mergemaster/mergemaster.sh ============================================================================== --- stable/7/usr.sbin/mergemaster/mergemaster.sh Fri Jan 15 03:28:46 2010 (r202337) +++ stable/7/usr.sbin/mergemaster/mergemaster.sh Fri Jan 15 03:39:03 2010 (r202338) @@ -5,7 +5,7 @@ # Compare files created by /usr/src/etc/Makefile (or the directory # the user specifies) with the currently installed copies. -# Copyright 1998-2009 Douglas Barton +# Copyright 1998-2010 Douglas Barton # DougB@FreeBSD.org # $FreeBSD$ @@ -263,7 +263,7 @@ fi # Assign the location of the mtree database # -MTREEDB=${MTREEDB:-/var/db} +MTREEDB=${MTREEDB:-${DESTDIR}/var/db} MTREEFILE="${MTREEDB}/mergemaster.mtree" # Check the command line options @@ -345,18 +345,24 @@ done # Don't force the user to set this in the mergemaster rc file if [ -n "${PRESERVE_FILES}" -a -z "${PRESERVE_FILES_DIR}" ]; then PRESERVE_FILES_DIR=/var/tmp/mergemaster/preserved-files-`date +%y%m%d-%H%M%S` + mkdir -p ${PRESERVE_FILES_DIR} fi # Check for the mtree database in DESTDIR case "${AUTO_UPGRADE}" in '') ;; # If the option is not set no need to run the test or warn the user *) - if [ ! -s "${DESTDIR}${MTREEFILE}" ]; then + if [ ! -s "${MTREEFILE}" ]; then echo '' - echo "*** Unable to find mtree database. Skipping auto-upgrade on this run." + echo "*** Unable to find mtree database (${MTREEFILE})." + echo " Skipping auto-upgrade on this run." echo " It will be created for the next run when this one is complete." echo '' - press_to_continue + case "${AUTO_RUN}" in + '') + press_to_continue + ;; + esac unset AUTO_UPGRADE fi ;; @@ -463,9 +469,9 @@ MM_MAKE="make ${ARCHSTRING} -m ${SOURCED # Check DESTDIR against the mergemaster mtree database to see what # files the user changed from the reference files. # -if [ -n "${AUTO_UPGRADE}" -a -s "${DESTDIR}${MTREEFILE}" ]; then +if [ -n "${AUTO_UPGRADE}" -a -s "${MTREEFILE}" ]; then CHANGED=: - for file in `mtree -eqL -f ${DESTDIR}${MTREEFILE} -p ${DESTDIR}/ \ + for file in `mtree -eqL -f ${MTREEFILE} -p ${DESTDIR}/ \ 2>/dev/null | awk '($2 == "changed") {print $1}'`; do if [ -f "${DESTDIR}/$file" ]; then CHANGED="${CHANGED}${DESTDIR}/${file}:" @@ -505,7 +511,7 @@ CVS_ID_TAG=FreeBSD delete_temproot () { rm -rf "${TEMPROOT}" 2>/dev/null chflags -R 0 "${TEMPROOT}" 2>/dev/null - rm -rf "${TEMPROOT}" || exit 1 + rm -rf "${TEMPROOT}" || { echo "*** Unable to delete ${TEMPROOT}"; exit 1; } } case "${RERUN}" in @@ -536,7 +542,7 @@ case "${RERUN}" in echo '' echo " *** Deleting the old ${TEMPROOT}" echo '' - delete_temproot || exit 1 + delete_temproot unset TEST_TEMP_ROOT ;; [tT]) @@ -663,31 +669,32 @@ case "${RERUN}" in for file in ${IGNORE_FILES}; do test -e ${TEMPROOT}/${file} && unlink ${TEMPROOT}/${file} done - ;; # End of the "RERUN" test -esac -# We really don't want to have to deal with files like login.conf.db, pwd.db, -# or spwd.db. Instead, we want to compare the text versions, and run *_mkdb. -# Prompt the user to do so below, as needed. -# -rm -f ${TEMPROOT}/etc/*.db ${TEMPROOT}/etc/passwd + # We really don't want to have to deal with files like login.conf.db, pwd.db, + # or spwd.db. Instead, we want to compare the text versions, and run *_mkdb. + # Prompt the user to do so below, as needed. + # + rm -f ${TEMPROOT}/etc/*.db ${TEMPROOT}/etc/passwd -# We only need to compare things like freebsd.cf once -find ${TEMPROOT}/usr/obj -type f -delete 2>/dev/null + # We only need to compare things like freebsd.cf once + find ${TEMPROOT}/usr/obj -type f -delete 2>/dev/null -# Delete stuff we do not need to keep the mtree database small, -# and to make the actual comparison faster. -find ${TEMPROOT}/usr -type l -delete 2>/dev/null -find ${TEMPROOT} -type f -size 0 -delete 2>/dev/null -find -d ${TEMPROOT} -type d -empty -delete 2>/dev/null + # Delete stuff we do not need to keep the mtree database small, + # and to make the actual comparison faster. + find ${TEMPROOT}/usr -type l -delete 2>/dev/null + find ${TEMPROOT} -type f -size 0 -delete 2>/dev/null + find -d ${TEMPROOT} -type d -empty -delete 2>/dev/null -# Build the mtree database in a temporary location. -MTREENEW=`mktemp -t mergemaster.mtree` -case "${PRE_WORLD}" in -'') mtree -ci -p ${TEMPROOT} -k size,md5digest > ${MTREENEW} 2>/dev/null - ;; -*) # We don't want to mess with the mtree database on a pre-world run. - ;; + # Build the mtree database in a temporary location. + case "${PRE_WORLD}" in + '') MTREENEW=`mktemp -t mergemaster.mtree` + mtree -ci -p ${TEMPROOT} -k size,md5digest > ${MTREENEW} 2>/dev/null + ;; + *) # We don't want to mess with the mtree database on a pre-world run or + # when re-scanning a previously-built tree. + ;; + esac + ;; # End of the "RERUN" test esac # Get ready to start comparing files @@ -818,7 +825,8 @@ mm_install () { if [ -n "${DESTDIR}${INSTALL_DIR}" -a ! -d "${DESTDIR}${INSTALL_DIR}" ]; then DIR_MODE=`find_mode "${TEMPROOT}/${INSTALL_DIR}"` - install -d -o root -g wheel -m "${DIR_MODE}" "${DESTDIR}${INSTALL_DIR}" + install -d -o root -g wheel -m "${DIR_MODE}" "${DESTDIR}${INSTALL_DIR}" || + install_error $1 ${DESTDIR}${INSTALL_DIR} fi FILE_MODE=`find_mode "${1}"` @@ -837,32 +845,39 @@ mm_install () { DONT_INSTALL=yes ;; /.cshrc | /.profile) - case "${AUTO_INSTALL}" in - '') - case "${LINK_EXPLAINED}" in - '') - echo " *** Historically BSD derived systems have had a" - echo " hard link from /.cshrc and /.profile to" - echo " their namesakes in /root. Please indicate" - echo " your preference below for bringing your" - echo " installed files up to date." - echo '' - LINK_EXPLAINED=yes - ;; - esac + local st_nlink - echo " Use 'd' to delete the temporary ${COMPFILE}" - echo " Use 'l' to delete the existing ${DESTDIR}${COMPFILE#.} and create the link" - echo '' - echo " Default is to leave the temporary file to deal with by hand" - echo '' - echo -n " How should I handle ${COMPFILE}? [Leave it to install later] " - read HANDLE_LINK - ;; - *) # Part of AUTO_INSTALL - HANDLE_LINK=l - ;; - esac + # install will unlink the file before it installs the new one, + # so we have to restore/create the link afterwards. + # + st_nlink=0 # In case the file does not yet exist + eval $(stat -s ${DESTDIR}${COMPFILE#.} 2>/dev/null) + + do_install_and_rm "${FILE_MODE}" "${1}" "${DESTDIR}${INSTALL_DIR}" + + if [ -n "${AUTO_INSTALL}" -a $st_nlink -gt 1 ]; then + HANDLE_LINK=l + else + case "${LINK_EXPLAINED}" in + '') + echo " *** Historically BSD derived systems have had a" + echo " hard link from /.cshrc and /.profile to" + echo " their namesakes in /root. Please indicate" + echo " your preference below for bringing your" + echo " installed files up to date." + echo '' + LINK_EXPLAINED=yes + ;; + esac + + echo " Use 'd' to delete the temporary ${COMPFILE}" + echo " Use 'l' to delete the existing ${DESTDIR}/root/${COMPFILE##*/} and create the link" + echo '' + echo " Default is to leave the temporary file to deal with by hand" + echo '' + echo -n " How should I handle ${COMPFILE}? [Leave it to install later] " + read HANDLE_LINK + fi case "${HANDLE_LINK}" in [dD]*) @@ -872,19 +887,19 @@ mm_install () { ;; [lL]*) echo '' - rm -f "${DESTDIR}${COMPFILE#.}" - if ln "${DESTDIR}/root/${COMPFILE##*/}" "${DESTDIR}${COMPFILE#.}"; then + unlink ${DESTDIR}/root/${COMPFILE##*/} + if ln ${DESTDIR}${COMPFILE#.} ${DESTDIR}/root/${COMPFILE##*/}; then echo " *** Link from ${DESTDIR}${COMPFILE#.} to ${DESTDIR}/root/${COMPFILE##*/} installed successfully" - rm "${COMPFILE}" else - echo " *** Error linking ${DESTDIR}${COMPFILE#.} to ${DESTDIR}/root/${COMPFILE##*/}, ${COMPFILE} will remain to install by hand" + echo " *** Error linking ${DESTDIR}${COMPFILE#.} to ${DESTDIR}/root/${COMPFILE##*/}" + echo " *** ${COMPFILE} will remain for your consideration" fi ;; *) echo " *** ${COMPFILE} will remain for your consideration" ;; esac - DONT_INSTALL=yes + return ;; esac @@ -955,6 +970,12 @@ if [ -z "${PRE_WORLD}" -a -z "${RERUN}" esac sleep 2 ;; + *) + if [ -n "${DELETE_STALE_RC_FILES}" ]; then + echo ' *** Deleting ... ' + rm ${STALE_RC_FILES} + echo ' done.' + fi esac ;; esac @@ -967,7 +988,58 @@ if [ -r "${MM_PRE_COMPARE_SCRIPT}" ]; th . "${MM_PRE_COMPARE_SCRIPT}" fi -for COMPFILE in `find . -type f`; do +# Things that were files/directories/links in one version can sometimes +# change to something else in a newer version. So we need to explicitly +# test for this, and warn the user if what we find does not match. +# +for COMPFILE in `find . | sort` ; do + if [ -e "${DESTDIR}${COMPFILE#.}" ]; then + INSTALLED_TYPE=`stat -f '%HT' ${DESTDIR}${COMPFILE#.}` + else + continue + fi + TEMPROOT_TYPE=`stat -f '%HT' $COMPFILE` + + if [ ! "$TEMPROOT_TYPE" = "$INSTALLED_TYPE" ]; then + [ "$COMPFILE" = '.' ] && continue + TEMPROOT_TYPE=`echo $TEMPROOT_TYPE | tr [:upper:] [:lower:]` + INSTALLED_TYPE=`echo $INSTALLED_TYPE | tr [:upper:] [:lower:]` + + echo "*** The installed file ${DESTDIR}${COMPFILE#.} has the type \"$INSTALLED_TYPE\"" + echo " but the new version has the type \"$TEMPROOT_TYPE\"" + echo '' + echo " How would you like to handle this?" + echo '' + echo " Use 'r' to remove ${DESTDIR}${COMPFILE#.}" + case "$TEMPROOT_TYPE" in + 'symbolic link') + TARGET=`readlink $COMPFILE` + echo " and create a link to $TARGET in its place" ;; + *) echo " You will be able to install it as a \"$TEMPROOT_TYPE\"" ;; + esac + echo '' + echo " Use 'i' to ignore this" + echo '' + echo -n " How to proceed? [i] " + read ANSWER + case "$ANSWER" in + [rR]) case "${PRESERVE_FILES}" in + [Yy][Ee][Ss]) + mv ${DESTDIR}${COMPFILE#.} ${PRESERVE_FILES_DIR}/ || exit 1 ;; + *) rm -rf ${DESTDIR}${COMPFILE#.} ;; + esac + case "$TEMPROOT_TYPE" in + 'symbolic link') ln -sf $TARGET ${DESTDIR}${COMPFILE#.} ;; + esac ;; + *) echo '' + echo "*** See the man page about adding ${COMPFILE#.} to the list of IGNORE_FILES" + press_to_continue ;; + esac + echo '' + fi +done + +for COMPFILE in `find . -type f | sort`; do # First, check to see if the file exists in DESTDIR. If not, the # diff_loop function knows how to handle it. @@ -1032,7 +1104,7 @@ for COMPFILE in `find . -type f`; do # If the user chose the -F option, test for that before proceeding # if [ -n "$FREEBSD_ID" ]; then - if diff -q -I'[$]FreeBSD:.*$' "${DESTDIR}${COMPFILE#.}" "${COMPFILE}" > \ + if diff -q -I'[$]FreeBSD.*[$]' "${DESTDIR}${COMPFILE#.}" "${COMPFILE}" > \ /dev/null 2>&1; then if mm_install "${COMPFILE}"; then echo "*** Updated revision control Id for ${DESTDIR}${COMPFILE#.}" @@ -1061,8 +1133,8 @@ echo "*** Comparison complete" if [ -s "${MTREENEW}" ]; then echo "*** Saving mtree database for future upgrades" - test -e "${DESTDIR}${MTREEFILE}" && unlink ${DESTDIR}${MTREEFILE} - mv ${MTREENEW} ${DESTDIR}${MTREEFILE} + test -e "${MTREEFILE}" && unlink ${MTREEFILE} + mv ${MTREENEW} ${MTREEFILE} fi echo '' @@ -1070,30 +1142,28 @@ echo '' TEST_FOR_FILES=`find ${TEMPROOT} -type f -size +0 2>/dev/null` if [ -n "${TEST_FOR_FILES}" ]; then echo "*** Files that remain for you to merge by hand:" - find "${TEMPROOT}" -type f -size +0 + find "${TEMPROOT}" -type f -size +0 | sort echo '' -fi - -case "${AUTO_RUN}" in -'') - echo -n "Do you wish to delete what is left of ${TEMPROOT}? [no] " - read DEL_TEMPROOT - case "${DEL_TEMPROOT}" in - [yY]*) - if delete_temproot; then - echo " *** ${TEMPROOT} has been deleted" - else - echo " *** Unable to delete ${TEMPROOT}" - fi - ;; - *) - echo " *** ${TEMPROOT} will remain" + case "${AUTO_RUN}" in + '') + echo -n "Do you wish to delete what is left of ${TEMPROOT}? [no] " + read DEL_TEMPROOT + case "${DEL_TEMPROOT}" in + [yY]*) + delete_temproot + ;; + *) + echo " *** ${TEMPROOT} will remain" + ;; + esac ;; + *) ;; esac - ;; -*) ;; -esac +else + echo "*** ${TEMPROOT} is empty, deleting" + delete_temproot +fi case "${AUTO_INSTALLED_FILES}" in '') ;; @@ -1268,5 +1338,9 @@ case "${PRE_WORLD}" in ;; esac -exit 0 +if [ -n "${PRESERVE_FILES}" ]; then + find -d $PRESERVE_FILES_DIR -type d -empty -delete 2>/dev/null + rmdir $PRESERVE_FILES_DIR 2>/dev/null +fi +exit 0