From 20a6fe7e28467b319cfab2af6c2fe465b73a01bc Mon Sep 17 00:00:00 2001 From: "B. Stack" Date: Wed, 30 Aug 2023 18:54:10 -0400 Subject: prepare documentation --- entrypoint.sh | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) (limited to 'entrypoint.sh') diff --git a/entrypoint.sh b/entrypoint.sh index 89a6ee4..04cca64 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -9,6 +9,22 @@ test ! -f /newspipe/instance/sqlite.py && { cp -pf /newspipe/orig/sqlite.py /new test ! -f /newspipe/instance/newspipe.db && { cp -pf /newspipe/orig/newspipe.db /newspipe/instance/ 2>/dev/null ; } test -z "${NEWSPIPE_BRANCH}" && NEWSPIPE_BRANCH=ldap-auth +prepare() { + cd /newspipe + git fetch || : ; + test -f instance/sqlite.py && cp -pf instance/sqlite.py instance/sqlite.py1 + git checkout -f "${NEWSPIPE_BRANCH}" || { echo "Invalid branch ${NEWSPIPE_BRANCH}" 1>&2 ; exit 1 ; } + git pull || : ; + test -f instance/sqlite.py1 && mv -f instance/sqlite.py1 instance/sqlite.py + test "${1}" = "sleep" && shift + _host="${1:-${NEWSPIPE_HOST}}" + _port="${2:-${NEWSPIPE_PORT}}" + set -x + # If you need to add new pip packages quickly: + #poetry run pip3 install dnspython + poetry run flask db_init || : +} + # Options case "${1}" in "init" | "create_admin") @@ -16,21 +32,14 @@ case "${1}" in _pass="${3:-${ADMIN_PASSWORD}}" poetry run flask create_admin --nickname "${_nick}" --password "${_pass}" ;; - *) - cd /newspipe - git fetch || : ; - test -f instance/sqlite.py && cp -pf instance/sqlite.py instance/sqlite.py1 - git checkout -f "${NEWSPIPE_BRANCH}" || { echo "Invalid branch ${NEWSPIPE_BRANCH}" 1>&2 ; exit 1 ; } - git pull || : ; - test -f instance/sqlite.py1 && mv -f instance/sqlite.py1 instance/sqlite.py - _host="${1:-${NEWSPIPE_HOST}}" - _port="${2:-${NEWSPIPE_PORT}}" - set -x - # If you need to add new pip packages quickly: - #poetry run pip3 install dnspython - poetry run flask db_init || : + sleep) + prepare "${@}" sleep 80000 # and now connect to this container and run in bash: - # poetry run flask run -h "${_host:-0.0.0.0}" -p "${_port:-8081}" + #poetry run flask run -h "${_host:-0.0.0.0}" -p "${_port:-8081}" + ;; + *) + prepare "${@}" + poetry run flask run -h "${_host:-0.0.0.0}" -p "${_port:-8081}" ;; esac -- cgit