summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbuild14
-rw-r--r--urwiki.urp2
2 files changed, 12 insertions, 4 deletions
diff --git a/build b/build
index 8be6a10..56aa398 100755
--- a/build
+++ b/build
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash -eu
# Copyright 2015 the Massachusetts Institute of Technology
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
@@ -13,4 +13,14 @@
# License for the specific language governing permissions and limitations under
# the License.
-exec urweb -dbms sqlite -db "dbname=urwiki.sqlite3" -output urwiki urwiki
+if [[ 1 < $# ]]; then
+ echo "usage: $0 [fresh]" >&2
+ exit 1
+fi
+
+urweb -dbms sqlite -db "dbname=urwiki.sqlite3" -sql initialize.sql -output urwiki urwiki
+
+if [[ $# == 1 && $1 == "fresh" ]]; then
+ rm urwiki.sqlite3
+ sqlite3 urwiki.sqlite3 <initialize.sql
+fi
diff --git a/urwiki.urp b/urwiki.urp
index 0c26327..88d050b 100644
--- a/urwiki.urp
+++ b/urwiki.urp
@@ -1,3 +1 @@
-sql initialize.sql
-
main \ No newline at end of file