From fabf020a2ee703a4adf22c213759840f2a55261a Mon Sep 17 00:00:00 2001
From: Daniel Hokka Zakrisson <dhokka@cs.princeton.edu>
Date: Sat, 16 Oct 2010 19:10:31 -0400
Subject: [PATCH] Fix version output when missing.

---
 plc.d/db | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/plc.d/db b/plc.d/db
index 644a3ad6..6bf63887 100755
--- a/plc.d/db
+++ b/plc.d/db
@@ -30,7 +30,7 @@ function extend_db()
 	extension=${script##*.}
 	version=$(psql -U $PLC_DB_USER --quiet --tuples-only --no-align -c \
 		  "SELECT version FROM plc_db_extensions WHERE name='$name' LIMIT 1" \
-		  $PLC_DB_NAME 2>/dev/null | awk '/^[0-9]+$/ { ver=$1 } END { print ver }')
+		  $PLC_DB_NAME 2>/dev/null | awk 'BEGIN { ver=0 } /^[0-9]+$/ { ver=$1 } END { print ver }')
 	if [ $version -eq 0 ]; then
 	    if [ "$extension" = "sql" ] ; then
 	        dialog " - $script (dbdumped)"
-- 
2.47.0