InvokeAI/installer/templates/update.sh.in
Lincoln Stein 4fd97ceddd
remove redundant code line (#2068)
* remove redundant code line

install.bat was copying the requirements file into the install folder
twice, causing an error message on the second try. This fixes the
issue.

* add further improvements to installer

- Windows version will unzip to have requirements.txt already in
  the right location, to prevent problems when users try to run
  the .bat script from within a mounted read-only zip file manager.

- Do not assume that "pip" is on the path in either the .bat or shell
  versions of the update script.
2022-12-19 14:57:41 +00:00

53 lines
1.7 KiB
Bash

#!/usr/bin/env bash
set -eu
if [ $# -ge 1 ] && [ "${1:0:4}" != "http" ]; then
echo "Usage: update.sh <release URL>.zip"
echo "Updates InvokeAI to use the indicated version of the code base."
echo "Find the zip file for the release you want, and pass it as the argument."
echo "For example update.sh https://github.com/invoke-ai/InvokeAI/archive/refs/tags/v2.2.3.zip"
echo ""
echo "If no argument provided then will install the most recent development version, equivalent to"
echo "update.sh https://github.com/invoke-ai/InvokeAI/archive/main.zip"
exit -1
fi
INVOKE_AI_SRC=${1:-https://github.com/invoke-ai/InvokeAI/archive/main.zip}
# ensure we're in the correct folder in case user's CWD is somewhere else
scriptdir=$(dirname "$0")
cd "$scriptdir"
function _err_exit {
if test "$1" -ne 0
then
echo "Something went wrong while installing InvokeAI and/or its requirements."
echo "Update cannot continue. Please report this error to https://github.com/invoke-ai/InvokeAI/issues"
echo -e "Error code $1; Error caught was '$2'"
read -p "Press any key to exit..."
exit
fi
}
echo This script will update InvokeAI and all its dependencies from $INVOKE_AI_SRC.
echo If you do not want to do this, press control-C now!
read -p "Press any key to continue, or CTRL-C to exit..."
. .venv/bin/activate
./.venv/bin/python -mpip install -r requirements.txt
_err_exit $? "The pip program failed to install InvokeAI's requirements."
./.venv/bin/python -mpip install $INVOKE_AI_SRC
_err_exit $? "The pip program failed to install InvokeAI."
./.venv/bin/python .venv/bin/configure_invokeai.py --root .
_err_exit $? "The configure script failed to run successfully."