Patch to xfce-utils/scripts/xfmountdev4

edscott wilson garcia edscott at imp.mx
Wed Feb 26 02:03:45 CET 2003


El mar, 25-02-2003 a las 16:51, Benedikt Meurer escribió:
> Hello again,
> 
> I prepared a patch to get xfmountdev4 working on Net/OpenBSD. Perhaps the
> xfmountdev4 script should be rewritten to be a C program instead of a
> shell script, cause the various semantics for eject(1) and friends
> differ a lot from platform to platform, whereas the system interface
> (the ioctl's for removeable media) doesn't differ that much.
> 
> Opinions?

If you contribute the source C for ioctl's I'll make sure they end up in
the forthcoming mount/umount  stuff for xffm. I have no idea how the
ioctl's should be dealt with.

Edscott


> 
> regards,
> Benedikt
> 
> -- 
> Those who do not understand Unix are condemned to reinvent it, poorly.
>     -- Henry Spencer
> ----
> 

> --- ./scripts/xfmountdev4.orig	Tue Feb 25 23:18:40 2003
> +++ ./scripts/xfmountdev4	Tue Feb 25 23:45:35 2003
> @@ -3,6 +3,7 @@
>  #  xfce4
>  #
>  #  Copyright (C) 1999 Olivier Fourdan (fourdan at xfce.org)
> +#  Copyright (c) 2003 Benedikt Meurer (benedikt.meurer at unix-ag.uni-siegen.de)
>  #
>  #  This program is free software; you can redistribute it and/or modify
>  #  it under the terms of the GNU General Public License as published by
> @@ -51,13 +52,26 @@
>          	$MOUNTCMD "$MOUNTPNT" $*
>                  echo Browsing media...
>                  $FILEMANAGER "$MOUNTPNT"
> -                echo Unmounting media...
> -        	$UNMOUNTCMD "$MOUNTPNT"
> -		if [ "x$EJECTCMD" != "xno" ]; then
> -                        echo Ejecting media...
> -			$EJECTCMD "$MOUNTPNT"
> -		fi
> -                exit 0
> +		case `uname -s` in
> +		NetBSD|OpenBSD)
> +			# NetBSD eject cannot eject a mountpath; and eject
> +			# do umount automagically, this requires eject to
> +			# be set setuid to root, since only root can do
> +			# umount(2)
> +			DEVICE=`${MOUNTCMD} | awk "\\$3 == \"${MOUNTPNT}\" { print \\$1}" | xargs basename | sed 's/[a-z]$//'`
> +			echo "Unmouting and ejecting media..."
> +			${EJECTCMD} ${DEVICE}
> +			;;
> +		*)
> +			# This will hopefully work for most other systems
> +	                echo Unmounting media...
> +        		$UNMOUNTCMD "$MOUNTPNT"
> +			if [ "x$EJECTCMD" != "xno" ]; then
> +	                        echo Ejecting media...
> +				$EJECTCMD "$MOUNTPNT"
> +			fi
> +			;;
> +		esac
>          else
>  		echo $0: The mount point $1 does not exist
>          	exit -2





More information about the Xfce4-dev mailing list