bbj/setup.sh

35 lines
843 B
Bash
Raw Normal View History

2017-04-02 07:35:58 +00:00
#!/bin/bash
DEPS=(
cherrypy
markdown
)
2017-04-02 14:53:55 +00:00
case $1 in
--help )
cat <<EOF
This script initializes the deps and files for bbj and also sets up its database.
It takes the following flags:
--help to print this
--dbset only runs the sql script
2017-04-02 07:35:58 +00:00
2017-04-02 14:53:55 +00:00
You can optionally pass a different python interpreter to use (such as
a virtual environment), with no arguments this will use the system python3
EOF
exit;;
--dbset )
sqlite3 data.sqlite < schema.sql
echo cleared
2017-04-05 22:24:43 +00:00
chmod 600 data.sqlite
2017-04-02 14:53:55 +00:00
exit;;
esac
2017-04-02 07:35:58 +00:00
2017-04-02 14:53:55 +00:00
PYTHON=`which python3`
[[ -e logs ]] || mkdir logs; mkdir logs/exceptions
[[ -z $1 ]] || PYTHON=$1
echo Using $PYTHON...
$PYTHON -m pip install ${DEPS[*]}
2017-04-02 07:35:58 +00:00
echo "Enter [i] to initialize a new database"
read CLEAR
2017-04-05 22:24:43 +00:00
[[ $CLEAR == "i" ]] && sqlite3 data.sqlite < schema.sql; chmod 600 data.sqlite