summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Barenblat <bbaren@mit.edu>2015-06-25 19:53:55 -0400
committerBenjamin Barenblat <bbaren@mit.edu>2015-06-25 19:53:55 -0400
commitb705b9f900bdf8334fe02b98eded2f467f78d347 (patch)
tree1a6ffda02023173b3c3207494c483adc8ba059e2
parent19f42f400b88dd199685e3bd6960877f29eed407 (diff)
Allow fresh builds in build script
-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