SHA256
1
0
forked from pool/gromox
gromox/0001-snapshot-safer-parsing-of-snapshot.cfg.patch

33 lines
958 B
Diff

From 61b4c3b06c260fcc3d5c13cf455ea919e34d3cc8 Mon Sep 17 00:00:00 2001
From: Jan Engelhardt <jengelh@inai.de>
Date: Mon, 13 Mar 2023 07:09:08 +0100
Subject: [PATCH] snapshot: safer parsing of snapshot.cfg
---
tools/gromox-snapshot | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git tools/gromox-snapshot tools/gromox-snapshot
index 44dc904dd..0fe3fac78 100755
--- tools/gromox-snapshot
+++ tools/gromox-snapshot
@@ -9,7 +9,14 @@ retention_hours=0
subvolume_root="/var/lib/gromox"
snapshot_archive="/var/lib/gromox-snapshots"
if [ -e /etc/gromox/snapshot.cfg ]; then
- . /etc/gromox/snapshot.cfg
+ str=$(awk -F= '{if($1=="subvolume_root"){print$2}}' /etc/gromox/snapshot.cfg)
+ if [ -n "$str" ]; then
+ subvolume_root="$str"
+ fi
+ str=$(awk -F= '{if($1=="snapshot_archive"){print$2}}' /etc/gromox/snapshot.cfg)
+ if [ -n "$str" ]; then
+ snapshot_archive="$str"
+ fi
fi
DB="$subvolume_root"
S="$snapshot_archive"
--
2.39.2