patch: Solaris lacks test -e

David Collier-Brown David.Collier-Brown at Sun.COM
Fri Mar 3 17:22:56 GMT 2006


   Solaris /bin/test does know about -e, as do bash, ksh, etc
just not sh.

--dave

Bjoern JACKE wrote:
> for the svn log:
> 
> - Solaris' /bin/sh doesn't know "test -e" - let's use "test -f" instead
> 
> Some volunteer wanna check this in? :)
> 
> Cheers
> Bjoern
> 
> 
> ------------------------------------------------------------------------
> 
> Index: source/script/installdat.sh
> ===================================================================
> --- source/script/installdat.sh	(Revision 13793)
> +++ source/script/installdat.sh	(Arbeitskopie)
> @@ -25,7 +25,7 @@
>  	if test "$mode" = 'install'; then
>  		echo "Installing $f as $FNAME "
>  		cp "$f" "$FNAME"
> -		if test ! -e "$FNAME"; then
> +		if test ! -f "$FNAME"; then
>  			echo "Cannot install $FNAME.  Does $USER have privileges? "
>  			exit 1
>  		fi
> @@ -33,7 +33,7 @@
>  	elif test "$mode" = 'uninstall'; then
>  		echo "Removing $FNAME "
>  		rm -f "$FNAME"
> -		if test -e "$FNAME"; then
> +		if test -f "$FNAME"; then
>  			echo "Cannot remove $FNAME.  Does $USER have privileges? "
>  			exit 1
>  		fi
> Index: source/script/installswat.sh
> ===================================================================
> --- source/script/installswat.sh	(Revision 13793)
> +++ source/script/installswat.sh	(Arbeitskopie)
> @@ -51,14 +51,14 @@
>      echo $FNAME
>      if test "$mode" = 'install'; then
>        cp "$f" "$FNAME"
> -      if test ! -e "$FNAME"; then
> +      if test ! -f "$FNAME"; then
>          echo "Cannot install $FNAME. Does $USER have privileges? "
>          exit 1
>        fi
>        chmod 0644 "$FNAME"
>      elif test "$mode" = 'uninstall'; then
>        rm -f "$FNAME"
> -      if test -e "$FNAME"; then
> +      if test -f "$FNAME"; then
>          echo "Cannot remove $FNAME.  Does $USER have privileges? "
>          exit 1
>        fi
> @@ -84,14 +84,14 @@
>        f=$f.tmp
>        cp "$f" "$FNAME"
>        rm -f "$f"
> -      if test ! -e "$FNAME"; then
> +      if test ! -f "$FNAME"; then
>          echo "Cannot install $FNAME. Does $USER have privileges? "
>          exit 1
>        fi
>        chmod 0644 "$FNAME"
>      elif test "$mode" = 'uninstall'; then
>        rm -f "$FNAME"
> -      if test -e "$FNAME"; then
> +      if test -f "$FNAME"; then
>          echo "Cannot remove $FNAME.  Does $USER have privileges? "
>          exit 1
>        fi
> @@ -107,14 +107,14 @@
>        echo $FNAME
>        if test "$mode" = 'install'; then
>          cp "$f" "$FNAME"
> -        if test ! -e "$FNAME"; then
> +        if test ! -f "$FNAME"; then
>            echo "Cannot install $FNAME. Does $USER have privileges? "
>            exit 1
>          fi
>          chmod 0644 $FNAME
>        elif test "$mode" = 'uninstall'; then
>          rm -f "$FNAME"
> -        if test -e "$FNAME"; then
> +        if test -f "$FNAME"; then
>            echo "Cannot remove $FNAME.  Does $USER have privileges? "
>            exit 1
>          fi
> @@ -130,14 +130,14 @@
>        echo $FNAME
>        if test "$mode" = 'install'; then
>          cp "$f" "$FNAME"
> -        if test ! -e "$FNAME"; then
> +        if test ! -f "$FNAME"; then
>            echo "Cannot install $FNAME. Does $USER have privileges? "
>            exit 1
>          fi
>          chmod 0644 $FNAME
>        elif test "$mode" = 'uninstall'; then
>          rm -f "$FNAME"
> -        if test -e "$FNAME"; then
> +        if test -f "$FNAME"; then
>            echo "Cannot remove $FNAME.  Does $USER have privileges? "
>            exit 1
>          fi
> @@ -171,14 +171,14 @@
>  	  echo $FNAME
>            if test "$mode" = 'install'; then
>              cp "$f" "$FNAME"
> -            if test ! -e "$FNAME"; then
> +            if test ! -f "$FNAME"; then
>                echo "Cannot install $FNAME. Does $USER have privileges? "
>                exit 1
>              fi
>              chmod 0644 $FNAME
>            elif test "$mode" = 'uninstall'; then
>              rm -f "$FNAME"
> -            if test -e "$FNAME"; then
> +            if test -f "$FNAME"; then
>                echo "Cannot remove $FNAME.  Does $USER have privileges? "
>                exit 1
>              fi
> @@ -198,14 +198,14 @@
>                echo $FNAME
>                if test "$mode" = 'install'; then
>                  cp "$f" "$FNAME"
> -                if test ! -e "$FNAME"; then
> +                if test ! -f "$FNAME"; then
>                    echo "Cannot install $FNAME. Does $USER have privileges? "
>                    exit 1
>                  fi
>                  chmod 0644 $FNAME
>                elif test "$mode" = 'uninstall'; then
>                  rm -f "$FNAME"
> -                if test -e "$FNAME"; then
> +                if test -f "$FNAME"; then
>                    echo "Cannot remove $FNAME.  Does $USER have privileges? "
>                    exit 1
>                  fi
> @@ -238,14 +238,14 @@
>          echo $FNAME
>          if test "$mode" = 'install'; then
>            cp "$f" "$FNAME"
> -          if test ! -e "$FNAME"; then
> +          if test ! -f "$FNAME"; then
>              echo "Cannot install $FNAME. Does $USER have privileges? "
>              exit 1
>            fi
>            chmod 0644 $FNAME
>          elif test "$mode" = 'uninstall'; then
>            rm -f "$FNAME"
> -          if test -e "$FNAME"; then
> +          if test -f "$FNAME"; then
>              echo "Cannot remove $FNAME.  Does $USER have privileges? "
>              exit 1
>            fi
> @@ -257,14 +257,14 @@
>          echo $FNAME
>          if test "$mode" = 'install'; then
>            cp "$f" "$FNAME"
> -          if test ! -e "$FNAME"; then
> +          if test ! -f "$FNAME"; then
>              echo "Cannot install $FNAME. Does $USER have privileges? "
>              exit 1
>            fi
>            chmod 0644 $FNAME
>          elif test "$mode" = 'uninstall'; then
>            rm -f "$FNAME"
> -          if test -e "$FNAME"; then
> +          if test -f "$FNAME"; then
>              echo "Cannot remove $FNAME.  Does $USER have privileges? "
>              exit 1
>            fi
> @@ -278,14 +278,14 @@
>          echo $FNAME
>          if test "$mode" = 'install'; then
>            cp "$f" "$FNAME"
> -          if test ! -e "$FNAME"; then
> +          if test ! -f "$FNAME"; then
>              echo "Cannot install $FNAME. Does $USER have privileges? "
>              exit 1
>            fi
>            chmod 0644 $FNAME
>          elif test "$mode" = 'uninstall'; then
>            rm -f "$FNAME"
> -          if test -e "$FNAME"; then
> +          if test -f "$FNAME"; then
>              echo "Cannot remove $FNAME.  Does $USER have privileges? "
>              exit 1
>            fi
> Index: source/script/installmsg.sh
> ===================================================================
> --- source/script/installmsg.sh	(Revision 13793)
> +++ source/script/installmsg.sh	(Arbeitskopie)
> @@ -26,7 +26,7 @@
>  	if test "$mode" = 'install'; then
>  		echo "Installing $f as $FNAME "
>  		cp "$f" "$FNAME"
> -		if test ! -e "$FNAME"; then
> +		if test ! -f "$FNAME"; then
>  			echo "Cannot install $FNAME.  Does $USER have privileges? "
>  			exit 1
>  		fi
> @@ -34,7 +34,7 @@
>  	elif test "$mode" = 'uninstall'; then
>  		echo "Removing $FNAME "
>  		rm -f "$FNAME"
> -		if test -e "$FNAME"; then
> +		if test -f "$FNAME"; then
>  			echo "Cannot remove $FNAME.  Does $USER have privileges? "
>  			exit 1
>  		fi
> Index: source/script/uninstallbin.sh
> ===================================================================
> --- source/script/uninstallbin.sh	(Revision 13793)
> +++ source/script/uninstallbin.sh	(Arbeitskopie)
> @@ -25,7 +25,7 @@
>    fi
>  
>    # this is a special case, mount needs this in a specific location
> -  if test "$p2" = smbmount -a -e "$DESTDIR/sbin/mount.smbfs"; then
> +  if test "$p2" = smbmount -a -f "$DESTDIR/sbin/mount.smbfs"; then
>      echo "Removing $DESTDIR/sbin/mount.smbfs "
>      rm -f "$DESTDIR/sbin/mount.smbfs"
>    fi

-- 
David Collier-Brown,      | Always do right. This will gratify
Sun Microsystems, Toronto | some people and astonish the rest
davecb at canada.sun.com     |                      -- Mark Twain
(416) 263-5733 (x65733)   |


More information about the samba-technical mailing list