sysutils/freebsd-snapshot provides a convenient wrapper for maintaining UFS2 snapshots. the documentation mentions an optional dependency on amd(8) to enable unprivileged users to browse snapshots. this dependency is mandatory in the current version, ie. the "snapshot" script won't run properly without it. also, a function is included to use a snapshot as a regular filesystem. the directory used for the mountpoint is hardwired to "/mnt". the most recent version from the developers website has dropped UFS2 support in favour of ZFS, but even that version fixes only the amd(8) issue, not the hardwired mountpoint. the little patch below uses the automounter check only if it is actually running and makes the auxiliary mountpoint runtime configurable. Fix: run the following patch: How-To-Repeat: try to use "snapshot list" without amd(8) running: the command won't complete trying to read from a pipe. there's no way to set the mountpoint for the "visit" sub-command.
State Changed From-To: open->feedback Awaiting maintainers feedback (via the GNATS Auto Assign Tool)
Responsible Changed From-To: freebsd-ports-bugs->rafan I'll take it.
hi rafan, my patch was incorrect. i had stopped amd(8), but somehow "amq -p" will immediately error out instead of hanging. when amd(8) has never been started, amq(8) hangs. might be it checks for the pid file in var/run/amd.pid. ralf engelschall solved this problem in his current (ZFS) version in another way: he checks for this pid file instead of relying on amq(8). thus my new patch does the same, and it works. sorry for the confusion, regards, clemens --- /l/sbin/snapshot 2007-11-10 15:00:27.000000000 +0100 +++ /root/bin/snapshot.sh 2007-11-14 15:27:56.000000000 +0100 @@ -33,6 +33,7 @@ # option defaults fs_subdir=".snap" +mnt_dir="/mnt" verbose=no help=no @@ -41,6 +42,7 @@ echo "Usage: snapshot [<option> ...] <operation> <argument> ..." echo "Global <option> arguments are:" echo " -d <subdir> filesystem sub-directory of snapshots" + echo " -m <subdir> filesystem mount-directory for snapshots" echo " -v enable verbose messages" echo " -h display usage help (this message)" echo "Operations <operations> and their arguments <argument> are:" @@ -54,7 +56,7 @@ usage exit 0 fi -args=`getopt vhd: $*` +args=`getopt vhd:m: $*` if [ $? != 0 ]; then echo "snapshot:ERROR: invalid command line arguments" 1>&2 exit 2 @@ -66,6 +68,7 @@ -v ) verbose=yes; shift ;; -h ) help=yes; shift ;; -d ) fs_subdir="$2"; shift; shift ;; + -m ) mnt_dir="$2"; shift; shift ;; -- ) shift; break ;; esac done @@ -145,8 +148,12 @@ continue fi # make sure filesystem isn't an already automounted snapshot - if [ ".`amq $fs_dir 2>&1 | grep 'not automounted'`" = . ]; then - continue + if [ -f /var/run/amd.pid ]; then + if kill -0 `cat /var/run/amd.pid` 2>/dev/null; then + if [ ".`amq $fs_dir 2>&1 | grep 'not automounted'`" = . ]; then + continue + fi + fi fi for snap in $fs_dir/$fs_subdir/*; do if [ -f $snap ]; then @@ -269,16 +276,16 @@ fi # mount snapshot - op_mount $fs_dir:$fs_tag.$fs_gen /mnt + op_mount $fs_dir:$fs_tag.$fs_gen "$mnt_dir" # enter interactive shell oldpwd=`pwd` - system cd /mnt || exit $? + system cd "$mnt_dir" || exit $? system ${SHELL-"/bin/sh"} system cd $oldpwd # unmount snapshot - op_umount /mnt + op_umount "$mnt_dir" return 0 }
State Changed From-To: feedback->closed Committed. Thanks!
State Changed From-To: closed->open Reopen. I closed the wrong PR.
rafan 2007-12-17 01:34:31 UTC FreeBSD ports repository Modified files: sysutils/freebsd-snapshot Makefile distinfo sysutils/freebsd-snapshot/files pkg-message.in Log: - Update to 20071207.1 [1] - Update pkg-message to reflect ZFS functionality [2] PR: ports/118008 [1], ports/118025 [2] Submitted by: rafan [1], clemens fischer <ino-news at spotteswoode.dnsalias.org> [2] Approved by: Graham Todd <gtodd at bellanet.org> (maintainer) Revision Changes Path 1.6 +2 -3 ports/sysutils/freebsd-snapshot/Makefile 1.3 +3 -3 ports/sysutils/freebsd-snapshot/distinfo 1.2 +3 -3 ports/sysutils/freebsd-snapshot/files/pkg-message.in _______________________________________________ cvs-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/cvs-all To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
State Changed From-To: open->closed Committed with relevant changes (pkg-message). Rest are updated in upstream.