On Mon, 2014-11-17 at 15:12 +0000, Mark Felder wrote:
> Author: feld (ports committer)
> Date: Mon Nov 17 15:12:46 2014
> New Revision: 274630
> URL: https://svnweb.freebsd.org/changeset/base/274630
> 
> Log:
>   Add logic for detecting non-persistent filesystems being utilized by
>   workdir which would break the upgrade process upon reboot.
>   
>   Currently we check for tmpfs and mdmfs.
>   
>   PR:         195006
>   Differential Revision:      https://reviews.freebsd.org/D1163
>   Approved by:        cperciva
> 
> Modified:
>   head/usr.sbin/freebsd-update/freebsd-update.sh
> 
> Modified: head/usr.sbin/freebsd-update/freebsd-update.sh
> ==============================================================================
> --- head/usr.sbin/freebsd-update/freebsd-update.sh    Mon Nov 17 14:56:02 
> 2014        (r274629)
> +++ head/usr.sbin/freebsd-update/freebsd-update.sh    Mon Nov 17 15:12:46 
> 2014        (r274630)
> @@ -580,6 +580,7 @@ fetchupgrade_check_params () {
>       _KEYPRINT_z="Key must be given via -k option or configuration file."
>       _KEYPRINT_bad="Invalid key fingerprint: "
>       _WORKDIR_bad="Directory does not exist or is not writable: "
> +     _WORKDIR_bad2="Directory is not on a persistent filesystem: "
>  
>       if [ -z "${SERVERNAME}" ]; then
>               echo -n "`basename $0`: "
> @@ -603,6 +604,14 @@ fetchupgrade_check_params () {
>               echo ${WORKDIR}
>               exit 1
>       fi
> +     for i in tmpfs mdmfs; do
> +             if df -t ${i} ${WORKDIR} >/dev/null 2>1; then
> +                     echo -n "`basename $0`: "
> +                     echo -n "${_WORKDIR_bad2}"
> +                     echo ${WORKDIR}
> +                     exit 1
> +             fi
> +     done
>       chmod 700 ${WORKDIR}
>       cd ${WORKDIR} || exit 1
>  
> 

This doesn't look quite right.  There is no mdmfs filesystem, that's
just the name of the tool that creates a UFS filesystem on an md(4)
device.  On one of my systems where /var is set up by /etc/rc.d/var
and /tmp by an fstab entry of: "md  /tmp  mfs  rw,noatime,-s128m 0 0"

I see this from df:

root@bb:~ # df -hT
Filesystem         Type     Size    Used   Avail Capacity  Mounted on
172.22.42.240:/bb  nfs      504G    280G    184G    60%    /
devfs              devfs    1.0K    1.0K      0B   100%    /dev
/dev/md0           ufs      124M     24K    114M     0%    /tmp
/dev/md1           ufs       31M    360K     28M     1%    /var

Something like this should work:

  case $(df -T ${WORKDIR}) in
    */dev/md[0-9]* | *tmpfs* ) 
        echo error messages and stuff
        exit 1
        ;;
  esac

-- Ian


_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to