public inbox for development@lists.ipfire.org
 help / color / mirror / Atom feed
* [PATCH v2] core194: Fix cert name and change other check to ! -s
@ 2025-05-01  7:41 Adolf Belka
  0 siblings, 0 replies; only message in thread
From: Adolf Belka @ 2025-05-01  7:41 UTC (permalink / raw)
  To: development; +Cc: Adolf Belka

- This v2 version corrects the b! -z to ! -s
- Error in hostcert extension
- -z is for use with strings and not with files. This should have been ! -s. Thanks to
   @Nick for spotting this and flagging it up. Th ! -z would do the test against the
   filename string and as this doesn't change then it would always come up true.
- I thought I had tested the original patch of this change but obviously not because
   there was missing whitespace and filenames not quoted plus the fixes I have added
   in this patch.
- I definitely tested this out this time by copying it from the update.sh and applying
   it to my vm system. I have also tested this out with the hostcert.pem file present
   and not and with the index.txt file empty and containing something. This now works
   as it should, which is to only carry out the edit on the serial file if the
   hostcert.pem file is present AND the index.txt file is empty.
- I clearly need to look more carefully at and test even more carefully at any bash
   statements that I put together.

Tested-by: Adolf Belka <adolf.belka@ipfire.org>
Signed-off-by: Adolf Belka <adolf.belka@ipfire.org>
---
 config/rootfiles/core/194/update.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/config/rootfiles/core/194/update.sh b/config/rootfiles/core/194/update.sh
index b758c7bf6..344045ff4 100644
--- a/config/rootfiles/core/194/update.sh
+++ b/config/rootfiles/core/194/update.sh
@@ -104,7 +104,7 @@ ldconfig
 /usr/local/bin/filesystem-cleanup
 
 # Increment ipsec serial file if x509 certificates present and no content in index.txt
-if [ -e "/var/ipfire/certs/hostcert.pm" ] && [ -z "/var/ipfire/certs/index.txt" ]; then
+if [ -e "/var/ipfire/certs/hostcert.pem" ] && [ ! -s "/var/ipfire/certs/index.txt" ]; then
     sed -i "s/01/02/" /var/ipfire/certs/serial
 fi
 
-- 
2.49.0



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-05-01  7:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-05-01  7:41 [PATCH v2] core194: Fix cert name and change other check to ! -s Adolf Belka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox