install_to_venv.sh 853 B

1234567891011121314151617181920212223242526272829303132
  1. #!/bin/sh
  2. #
  3. # Create a new Python virtualenv and install pwman into it.
  4. #
  5. # By default the virtualenv is created in the directory 'pwman-venv'.
  6. # Another directory may be selected as an argument to this script.
  7. #
  8. basedir="$(realpath "$0" | xargs dirname)"
  9. die()
  10. {
  11. echo "ERROR: $*" >&2
  12. exit 1
  13. }
  14. if [ $# -eq 0 ]; then
  15. venvdir="$basedir/pwman-venv"
  16. elif [ $# -eq 1 ]; then
  17. venvdir="$1"
  18. else
  19. die "Usage: $0 [VENV_PATH]"
  20. fi
  21. [ "$(id -u)" != "0" ] || die "Don't run this script as root."
  22. cd "$basedir" || die "Failed to cd to basedir."
  23. virtualenv --clear --system-site-packages "$venvdir" || die "virtualenv failed."
  24. . "$venvdir"/bin/activate || die "venv activate failed."
  25. pip3 install pycryptodomex || die "pip install pycryptodomex failed."
  26. pip3 install pyaes || die "pip install pyaes failed."
  27. ./setup.py install || die "Failed to install pwman."