From 0f3b8ab3f7d9f642f61c437b219c7c87c2bcce86 Mon Sep 17 00:00:00 2001 From: CyberLeo Date: Mon, 1 Mar 2010 00:03:51 -0600 Subject: [PATCH] script/gentree; sbin/saveconfig: use /COPYRIGHT as the saveconfig time anchor, as read-only media should be immutable --- script/gentree | 2 ++ src/overlay/sbin/saveconfig | 4 ++-- todo | 1 - 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/script/gentree b/script/gentree index 5e6caae..770e8c9 100755 --- a/script/gentree +++ b/script/gentree @@ -219,6 +219,8 @@ do_imgetc() { # etc requires special handling to ensure everything is properly arranged. log Create etc confpack chk touch "${sroot}/etc/diskless" + # Touch /COPYRIGHT to provide an immutable time anchor for saveconfig + chk touch "${sroot}/COPYRIGHT" chk sleep 1 # Make sure diskless is at least one second older than everything in custom chk mkdir -p "${stage}/pack" chk mv "${sroot}/etc" "${stage}/pack" diff --git a/src/overlay/sbin/saveconfig b/src/overlay/sbin/saveconfig index 6f9048d..bcc1390 100755 --- a/src/overlay/sbin/saveconfig +++ b/src/overlay/sbin/saveconfig @@ -10,10 +10,10 @@ then exit 1 fi -# Find all files newer than /etc/diskless and print them out +# Find all files newer than /COPYRIGHT and print them out find_newer_files() { [ -d "${1}" ] || return 1 - find "${1}" -type f -not -regex '.*/tmp/*.' -newer /etc/diskless -print + find "${1}" -type f -not -regex '.*/tmp/*.' -newer /COPYRIGHT -print } # Archive all newer files into a gzipped cpio archive diff --git a/todo b/todo index da082a5..0634ff8 100644 --- a/todo +++ b/todo @@ -3,7 +3,6 @@ Nabihi (remember (understand, perceive, notice)) * permanent system altroot for zpools * saveconfig: - make sure the relation file (for timestamp checks) is on read-only media, to avoid tampering use /conf/tmp as a proc lock. /conf/tmp/pid stores the saveconfig pid. If /conf/tmp is more than 5 minutes(?) old, or saveconfig isn't running as that pid, then wipe it and start over. If not, then complain and exit. -- 2.42.0