entrypoint.sh 964 B

12345678910111213141516171819202122232425
  1. for opt in "$@"
  2. do
  3. [ "${opt:0:1}" != "-" ] && break
  4. if [[ "${opt}" =~ "I" ]] || [[ "${opt}" =~ "E" ]]; then
  5. # Environment variables are disabled ($PYTHONHOME). Let's run in a safe
  6. # mode from the raw Python binary inside the AppImage
  7. "$APPDIR/opt/{{ python }}/bin/{{ python }}" "$@"
  8. exit "$?"
  9. fi
  10. done
  11. # Get the executable name, i.e. the AppImage or the python binary if running from an
  12. # extracted image
  13. executable="${APPDIR}/opt/{{ python }}/{{ python }}"
  14. if [[ "${ARGV0}" =~ "/" ]]; then
  15. executable="$(cd $(dirname ${ARGV0}) && pwd)/$(basename ${ARGV0})"
  16. elif [[ "${ARGV0}" != "" ]]; then
  17. executable=$(which "${ARGV0}")
  18. fi
  19. # Wrap the call to Python in order to mimic a call from the source
  20. # executable ($ARGV0), but potentially located outside of the Python
  21. # install ($PYTHONHOME)
  22. (PYTHONHOME="${APPDIR}/opt/{{ python }}" exec -a "${executable}" "$APPDIR/opt/{{ python }}/bin/{{ python }}" "$@")
  23. exit "$?"