shithub: front

Download patch

ref: 6a049aafed49313b2b4c1e2803ac525fdda82307
parent: 1ca26f9924c1a6159b01027a83ca6f18ca4dddf3
author: Ori Bernstein <ori@eigenstate.org>
date: Thu Jul 18 12:49:31 EDT 2024

history: add support for gefs dumps

--- a/rc/bin/history
+++ b/rc/bin/history
@@ -31,7 +31,7 @@
 		echo history: warning: $file does not exist >[1=2]
 
 	old=()
-	ls -Qqr /n/$dump/*/*/$file >[2] /dev/null |
+	list $file |
 	sed  's/\(([^ ]*) *([^ ]*) *([^ ]*)\)/\1\2\3/p' |
 	awk '"/n/'$dump/$since'" <= $2 {next}
 	     $1 != qid {
@@ -46,7 +46,7 @@
 	}
 }
 
-flagfmt='D,a,b,f,c,e,m,n,w,u,d:dump,s since'
+flagfmt='D,a,b,f,c,e,m,n,w,u,t:tag tag,d:dump,s since'
 args='[ -Dabcemnw ] [ -uf ] [ -d dumpfilesystem ] [ -s yyyymmdd ] files ...'
 if(! ifs=() eval `{aux/getflags $*} || 
    ~ $#* 0 ||
@@ -58,7 +58,8 @@
 
 if(~ $#dump 0)
 	dump=dump
-
+if(~ $#tag 0)
+	tag=main
 if(~ $#flags 0)
 	flags=`{date -f 'YYYYMMDD'}
 
@@ -65,7 +66,15 @@
 if(~ $#flagu 1)
 	flagu=-u
 
-since=`{date -f 'YYYY\/MMDD' `{seconds -f 'YYYYMMDD' $flags}}
+# probably gefs
+if(test -e /n/$dump/adm){
+	fn list { ls -Qqr /n/$dump/$tag@day.*/$1  >[2] /dev/null }
+	since=`{date -f '[main@day.]YYYY.MM.DD[_]hh:mm:ss' `{seconds -f 'YYYYMMDD' $flags}}
+}
+if not {
+	fn list { ls -Qqr /n/$dump/*/*/$1  >[2] /dev/null }
+	since=`{date -f 'YYYY\/MMDD' `{seconds -f 'YYYYMMDD' $flags}}
+}
 
 9fs $dump
 
--- a/sys/man/1/history
+++ b/sys/man/1/history
@@ -9,8 +9,11 @@
 .B -fu
 ] [
 .B -d
-.I dumpfilesystem
+.I dumpfs
 ] [
+.B -t
+.I snaptag
+] [
 .B -s
 .I yyyymmdd
 ]
@@ -63,6 +66,13 @@
 .B -d
 option selects some other dump file system such as
 .IR /n/bootesdump .
+.PP
+The
+.B -t
+option selects some other snapshot tag within the file system.
+If not specified, it defaults to the
+.I main
+snapshot tag.
 .PP
 The
 .B -f
--