mirror of
https://github.com/Llewellynvdm/Tomb.git
synced 2024-11-29 08:14:08 +00:00
fix to last open date saved
now using /.last in tomb to save and retrieve the time when tomb was last opened, fixes behaviour with tomb filenames containing dots.
This commit is contained in:
parent
66205c3e5c
commit
15273c9f19
15
tomb
15
tomb
@ -1824,6 +1824,8 @@ mount_tomb() {
|
|||||||
|
|
||||||
# print out when it was opened the last time, by whom and where
|
# print out when it was opened the last time, by whom and where
|
||||||
[[ -r ${tombmount}/.last ]] && {
|
[[ -r ${tombmount}/.last ]] && {
|
||||||
|
tombsince=$(_cat ${tombmount}/.last)
|
||||||
|
tombsince=$(date --date=@$tombsince +%c)
|
||||||
tombtty=$(_cat ${tombmount}/.tty)
|
tombtty=$(_cat ${tombmount}/.tty)
|
||||||
tombhost=$(_cat ${tombmount}/.host)
|
tombhost=$(_cat ${tombmount}/.host)
|
||||||
tomblast=$(_cat ${tombmount}/.last)
|
tomblast=$(_cat ${tombmount}/.last)
|
||||||
@ -1833,7 +1835,7 @@ mount_tomb() {
|
|||||||
tombuser=${tombuser[(ws@:@)1]}
|
tombuser=${tombuser[(ws@:@)1]}
|
||||||
|
|
||||||
_message "Last visit by ::1 user::(::2 tomb build::) from ::3 tty:: on ::4 host::" $tombuser $tombuid $tombtty $tombhost
|
_message "Last visit by ::1 user::(::2 tomb build::) from ::3 tty:: on ::4 host::" $tombuser $tombuid $tombtty $tombhost
|
||||||
_message "on date ::1 date::" "`date --date=@${tomblast} +%c`"
|
_message "on date ::1 date::" $tombsince
|
||||||
}
|
}
|
||||||
# write down the UID and TTY that opened the tomb
|
# write down the UID and TTY that opened the tomb
|
||||||
rm -f ${tombmount}/.uid
|
rm -f ${tombmount}/.uid
|
||||||
@ -1986,10 +1988,15 @@ awk "/mapper/"' { print $2 ";" $3 ";" $4 ";" $5 }'`
|
|||||||
tombavail=${ts[(ws:;:)3]}
|
tombavail=${ts[(ws:;:)3]}
|
||||||
tombpercent=${ts[(ws:;:)4]}
|
tombpercent=${ts[(ws:;:)4]}
|
||||||
tombp=${tombpercent%%%}
|
tombp=${tombpercent%%%}
|
||||||
tombsince=`date --date=@${mapper[(ws:.:)3]} +%c`
|
|
||||||
|
# obsolete way to get the last open date from /dev/mapper
|
||||||
|
# which doesn't work when tomb filename contain dots
|
||||||
|
# tombsince=`date --date=@${mapper[(ws:.:)3]} +%c`
|
||||||
|
|
||||||
# find out who opens it from where
|
# find out who opens it from where
|
||||||
[[ -r ${tombmount}/.tty ]] && {
|
[[ -r ${tombmount}/.tty ]] && {
|
||||||
|
tombsince=$(_cat ${tombmount}/.last)
|
||||||
|
tombsince=$(date --date=@$tombsince +%c)
|
||||||
tombtty=$(_cat ${tombmount}/.tty)
|
tombtty=$(_cat ${tombmount}/.tty)
|
||||||
tombhost=$(_cat ${tombmount}/.host)
|
tombhost=$(_cat ${tombmount}/.host)
|
||||||
tombuid=$(_cat ${tombmount}/.uid | tr -d ' ')
|
tombuid=$(_cat ${tombmount}/.uid | tr -d ' ')
|
||||||
@ -2081,10 +2088,10 @@ list_tomb_binds() {
|
|||||||
|
|
||||||
# list bind hooks on util-linux 2.20 (Debian 7)
|
# list bind hooks on util-linux 2.20 (Debian 7)
|
||||||
mount -l \
|
mount -l \
|
||||||
| awk -vtomb="$1" '
|
| awk -vname="$1" '
|
||||||
BEGIN { main="" }
|
BEGIN { main="" }
|
||||||
/^\/dev\/mapper\/tomb/ {
|
/^\/dev\/mapper\/tomb/ {
|
||||||
if($7!=tomb) next;
|
if($7!=name) next;
|
||||||
if(main=="") { main=$1; next; }
|
if(main=="") { main=$1; next; }
|
||||||
if(main==$1)
|
if(main==$1)
|
||||||
print $1 ";" $3 ";" $5 ";" $6 ";" $7
|
print $1 ";" $3 ";" $5 ";" $6 ";" $7
|
||||||
|
Loading…
Reference in New Issue
Block a user