From 053eb5c68c74eb098bf5f47db2bfe7bfe5021a29 Mon Sep 17 00:00:00 2001 From: Ivan Gulakov Date: Fri, 6 Mar 2026 11:02:59 +0100 Subject: [PATCH] Fix a state where db is corrupt If the script aborts (for examply by typing a wrong region name), then ngdp exits with an error (bad db state). This fix checks whether DB is empty or missing or ngdp could not read it. If so -> recreate it. --- craft.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/craft.sh b/craft.sh index f21b21c..a88d74e 100755 --- a/craft.sh +++ b/craft.sh @@ -233,6 +233,13 @@ check_directory() { init_hearthstone else pushd hearthstone + # Reinitialize ngdp if db is corrupt/empty + if [ ! -s .ngdp/keg.db ] || ! $NGDP_BIN fsck >/dev/null 2>&1; then + warn "keg database is empty or corrupt, reinitializing ..." + set_region + $NGDP_BIN init + $NGDP_BIN remote add http://${REGION}.patch.battle.net:1119/hsb + fi fi # Update procedure