diff --git a/helpers/geo_helper.py b/helpers/geo_helper.py index d858111..8e8af52 100644 --- a/helpers/geo_helper.py +++ b/helpers/geo_helper.py @@ -51,7 +51,12 @@ class Geo_helper: self.PATH_TO_JSON = cfg.get('RedisMap', 'path_countrycode_to_coord_JSON') self.CHANNELDISP = cfg.get('RedisMap', 'channelDisp') - self.reader = geoip2.database.Reader(self.PATH_TO_DB) + try: + self.reader = geoip2.database.Reader(self.PATH_TO_DB) + except PermissionError as error: + print(error) + print("Please fix the above and try again.") + sys.exit(126) self.country_to_iso = { country.name: country.alpha_2 for country in pycountry.countries} with open(self.PATH_TO_JSON) as f: self.country_code_to_coord = json.load(f) diff --git a/install_dependencies.sh b/install_dependencies.sh index 51d86b6..3a0747d 100755 --- a/install_dependencies.sh +++ b/install_dependencies.sh @@ -1,12 +1,21 @@ #!/bin/bash -set -e +## disable -e for production systems +#set -e + +## Debug mode #set -x sudo apt-get install python3-virtualenv virtualenv screen redis-server unzip -y if [ -z "$VIRTUAL_ENV" ]; then - virtualenv -p python3 DASHENV + virtualenv -p python3 DASHENV ; DASH_VENV=$? + + if [[ "$DASH_VENV" != "0" ]]; then + echo "Something went wrong with either the update or install of the virtualenv." + echo "Please investigate manually." + exit $DASH_VENV + fi . ./DASHENV/bin/activate fi @@ -35,7 +44,13 @@ mkdir -p css fonts js popd mkdir -p temp -wget https://www.misp-project.org/assets/images/misp-small.png -O static/pics/MISP.png +NET_WGET=$(wget --no-cache -q https://www.misp-project.org/assets/images/misp-small.png -O static/pics/MISP.png; echo $?) + +if [[ "$NET_WGET" != "0" ]]; then + echo "The first wget we tried failed, please investigate manually." + exit $NET_WGET +fi + wget https://www.misp-project.org/favicon.ico -O static/favicon.ico # jquery