#!/bin/sh # This script exists because Debian does not package short_url in a dpkg test -r /etc/default/hex-zero && . /etc/default/hex-zero # check global python for short_url echo "import short_url" | $( which python3 2>/dev/null ) 2>/dev/null && exit 0 # short-circuit if we find it # So if we get here, it was not installed globally, # so we need to check the configured user, if we are not that user already. test "${UWSGI_USER}" != "${USER}" && { echo "Will attempt to switch user to ${UWSGI_USER} and check for short_url." 1>&2 echo "import short_url" | sudo su "${UWSGI_USER}" -s /bin/sh -c "$( which python3 2>/dev/null ) 2>/dev/null" && exit 0 # short-circuit if we find it } echo "Please run something similar to the following, before running hex-zero:" echo "sudo su ${UWSGI_USER} -s /bin/sh -c 'pip3 install --user short_url'" exit 1