From b705b9f900bdf8334fe02b98eded2f467f78d347 Mon Sep 17 00:00:00 2001 From: Benjamin Barenblat Date: Thu, 25 Jun 2015 19:53:55 -0400 Subject: Allow fresh builds in build script --- build | 14 ++++++++++++-- urwiki.urp | 2 -- 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