Index: usr.sbin/freebsd-update/freebsd-update.sh =================================================================== --- usr.sbin/freebsd-update/freebsd-update.sh +++ usr.sbin/freebsd-update/freebsd-update.sh @@ -2907,12 +2907,16 @@ sort -k 1,1 -t '|' $1 | tr '|' ' ' | while read FPATH TYPE OWNER GROUP PERM FLAGS HASH LINK; do - # A file may change to a directory on upgrade (PR273661). - # If that happens rm the file first so that install can create - # the directory in its place. + # A file may change to a directory on upgrade (PR273661) or + # vice-versa. If that happens rm the file or rm -rf the + # directory first so that install can create the directory or + # file in its place. if [ -e "${BASEDIR}/${FPATH}" ]; then if [ ${TYPE} = d ] && ! [ -d "${BASEDIR}/${FPATH}" ]; then rm -f -- "${BASEDIR}/${FPATH}" + elif [ ${TYPE} = f -o ${TYPE} = L ] && \ + [ -d "${BASEDIR}/${FPATH}" ]; then + rm -rf -- "${BASEDIR}/${FPATH}" fi fi case ${TYPE} in @@ -2969,11 +2973,8 @@ d) rmdir ${BASEDIR}/${FPATH} ;; - f) - rm ${BASEDIR}/${FPATH} - ;; - L) - rm ${BASEDIR}/${FPATH} + f|L) + rm -f "${BASEDIR}/${FPATH}" ;; esac done < killfiles