Date: Sun, 15 Aug 1999 09:34:24 -0400 From: "David S. Jackson" <dsj@dsj.net> Cc: ilia@cgilh.chel.su, freebsd-questions@FreeBSD.ORG Subject: Re: Mount CDROM from User Account Message-ID: <19990815093424.D44880@juno.dsj.net> In-Reply-To: <19990815090841.C44880@juno.dsj.net>; from David S. Jackson on Sun, Aug 15, 1999 at 09:08:41AM -0400 References: <19990815090841.C44880@juno.dsj.net>
next in thread | previous in thread | raw e-mail | index | archive | help
So then David S. Jackson (dsj@dsj.net) said . . . > How could you do 'su -c "$mountcmd $device $mountpt"' in a script in > BSD? Something like 'su -c root "$mountcmd $device $mountpt"' ? I > didn't see an example in the manpage. Okay, I get it now. It's more similar to the SysV way than I thought: su root -c "$mountcmd $device $mountpt" So, this should work: ===SNIP=== #! /bin/sh device="/dev/wcd0c" mountpt="/cdrom" ftpmountpt="/home/ftp/pub/cdrom" mntcmd="mount -t cd9660" case $1 in -f) su root -c "$mntcmd $device $ftpmountpt" ;; -l) mount ;; -u) check=$(mount | grep /cdrom) check1=$(mount | grep /home/ftp/pub/cdrom) check2=$(mount | grep /dev/wcd0c) if [ -n "$check" ]; then echo "unmounting $check" su root -c "umount $device" elif [ -n "$check1" ]; then echo "unmounting $check1" su root -c "umount $device" elif [ -n "$check2" ]; then echo "unmounting $check2" su root -c "umount $device" else echo "$device is not mounted" fi ;; -m) su root -c "$mntcmd $device $mountpt" ;; *) echo -e "usage: cdm -f (for ftp users: requires root access) \n or -l (to show mounted directories) \n or -u (to umount /dev/wcd0c: requires root access) \n or * (to show this help resource) \n or -m (to mount to normal mount position: /cdrom -- Requires root access)" esac ===SNIP=== Let me know what you think! :-) -- David S. Jackson http://www.dsj.net =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Out ed0, through the firewall, over the analog line, into usr1, past another firewall, through the gateway, out the T-3, off core2 in Atlanta . . . nothin' but Net. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19990815093424.D44880>