Skip to content

Commit

Permalink
Add --version and fix jinja for py2 (thinkst#194)
Browse files Browse the repository at this point in the history
* Add --version and fix jinja for py2

* .
  • Loading branch information
jayjb authored Jun 23, 2022
1 parent 3b6f7d4 commit 3cd4077
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
7 changes: 5 additions & 2 deletions bin/opencanaryd
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ PIDFILE="${DIR}/opencanaryd.pid"
cmd=$1

function usage() {
echo -e "\n OpenCanary v1.0\n"
echo -e "\topencanaryd [ --start | --dev | --stop | --restart | --copyconfig | --usermodule | --help ]\n\n"
echo -e "\n OpenCanary\n"
echo -e "\topencanaryd [ --start | --dev | --stop | --restart | --copyconfig | --usermodule | --version | --help ]\n\n"
echo -e "\t\t--start\tStarts the opencanaryd process"
echo -e "\t\t--dev\tRun the opencanaryd process in the foreground"
echo -e "\t\t--stop\tStops the opencanaryd process"
echo -e "\t\t--usermodule\tRun opencanaryd in foreground with only usermodules enabled"
echo -e "\t\t--copyconfig\tCreates a default config file at /etc/opencanaryd/opencanary.conf"
echo -e "\t\t--version\tDisplays the current opencanary version."
echo -e "\t\t--"
echo -e "\t\t--help\tThis help\n"

Expand Down Expand Up @@ -55,6 +56,8 @@ elif [ "${cmd}" == "--copyconfig" ]; then
sudo cp "${defaultconf}" /etc/opencanaryd/opencanary.conf
echo -e "[*] A sample config file is ready /etc/opencanaryd/opencanary.conf\n"
echo "[*] Edit your configuration, then launch with \"opencanaryd --start\""
elif [ "${cmd}" == "--version" ]; then
python -c "from opencanary import __version__; print(__version__);"
else
usage
exit 1
Expand Down
10 changes: 9 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
from setuptools import setup, find_packages
import sys

PY3 = sys.version_info > (3,)

# Only check unicode on Python 2, In Python 3 unicode is the default and we can just return the input.
if sys.version_info[0] < 3:
jinja_version = '2.10.1'
else:
jinja_version = '3.0.1'


def read(rel_path):
here = os.path.abspath(os.path.dirname(__file__))
Expand Down Expand Up @@ -31,7 +39,7 @@ def get_version(rel_path):
'PyPDF2==1.26.0',
'fpdf==1.7.2',
'passlib==1.7.1',
'Jinja2==3.0.1',
'Jinja2=={}'.format(jinja_version),
'ntlmlib==0.72',
'bcrypt==3.1.7',
'setuptools==44.0.0',
Expand Down

0 comments on commit 3cd4077

Please sign in to comment.