mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
feat(installer): fiddling with powershell launcher
This commit is contained in:
parent
10c46c86da
commit
fd1c3087f6
@ -11,8 +11,7 @@ Coauthored by Lincoln Stein, Eugene Brodsky, and Joshua Kimsey
|
|||||||
Copyright 2023, The InvokeAI Development Team
|
Copyright 2023, The InvokeAI Development Team
|
||||||
#>
|
#>
|
||||||
|
|
||||||
# Stop on all errors
|
[console]::TreatControlCAsInput = $true
|
||||||
$ErrorActionPreference = "Stop"
|
|
||||||
|
|
||||||
# Ensure we're in the correct folder in case user's CWD is somewhere else
|
# Ensure we're in the correct folder in case user's CWD is somewhere else
|
||||||
$scriptdir = Split-Path -Parent $MyInvocation.MyCommand.Definition
|
$scriptdir = Split-Path -Parent $MyInvocation.MyCommand.Definition
|
||||||
@ -33,9 +32,9 @@ function invokeai_update {
|
|||||||
# Use the install dir as a proxy for the update helper having retrieved the installer
|
# Use the install dir as a proxy for the update helper having retrieved the installer
|
||||||
if (Test-Path invokeai-update) {
|
if (Test-Path invokeai-update) {
|
||||||
# Must deactivate first to avoid issues with the installer
|
# Must deactivate first to avoid issues with the installer
|
||||||
& .venv\Scripts\Deactivate.ps1
|
deactivate
|
||||||
# Run the installer
|
# Run the installer
|
||||||
& .\invokeai-update\InvokeAI-Installer\install.ps1 --root $scriptdir
|
& .\invokeai-update\InvokeAI-Installer\install.bat --root $scriptdir
|
||||||
# Clean up
|
# Clean up
|
||||||
Remove-Item invokeai-update -Recurse -Force
|
Remove-Item invokeai-update -Recurse -Force
|
||||||
# Always exit after an update - user must re-run the script to get new options
|
# Always exit after an update - user must re-run the script to get new options
|
||||||
@ -49,12 +48,13 @@ function do_choice {
|
|||||||
1 {
|
1 {
|
||||||
Clear-Host
|
Clear-Host
|
||||||
Write-Host "Generate images with a browser-based interface"
|
Write-Host "Generate images with a browser-based interface"
|
||||||
& invokeai-web @script:PARAMS
|
invokeai-web @script:PARAMS
|
||||||
}
|
}
|
||||||
2 {
|
2 {
|
||||||
Clear-Host
|
Clear-Host
|
||||||
Write-Host "Open the developer console"
|
Write-Host "Open the developer console`n"
|
||||||
& powershell -NoExit -Command "$MyInvocation.MyCommand.Definition"
|
Write-Host "You are now in the system shell with Invoke's python venv activated. Type ``exit`` to quit.`n"
|
||||||
|
powershell -NoExit -Command "& .venv\Scripts\Activate.ps1; python --version;"
|
||||||
}
|
}
|
||||||
3 {
|
3 {
|
||||||
Clear-Host
|
Clear-Host
|
||||||
@ -64,19 +64,20 @@ function do_choice {
|
|||||||
4 {
|
4 {
|
||||||
Clear-Host
|
Clear-Host
|
||||||
Write-Host "Command-line help"
|
Write-Host "Command-line help"
|
||||||
& invokeai-web --help
|
invokeai-web --help
|
||||||
}
|
}
|
||||||
default {
|
default {
|
||||||
Clear-Host
|
Clear-Host
|
||||||
Write-Host "Exiting..."
|
Write-Host "Exiting..."
|
||||||
|
deactivate
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Clear-Host
|
# Clear-Host
|
||||||
}
|
}
|
||||||
|
|
||||||
function do_line_input {
|
function do_line_input {
|
||||||
Clear-Host
|
# Clear-Host
|
||||||
Write-Host "What would you like to do?"
|
Write-Host "What would you like to do?"
|
||||||
Write-Host "1: Generate images using the browser-based interface"
|
Write-Host "1: Generate images using the browser-based interface"
|
||||||
Write-Host "2: Open the developer console"
|
Write-Host "2: Open the developer console"
|
||||||
@ -87,15 +88,9 @@ function do_line_input {
|
|||||||
$choice = Read-Host "Please enter 1-4, Q: [1]"
|
$choice = Read-Host "Please enter 1-4, Q: [1]"
|
||||||
if (!$choice) { $choice = '1' }
|
if (!$choice) { $choice = '1' }
|
||||||
do_choice $choice
|
do_choice $choice
|
||||||
Clear-Host
|
# Clear-Host
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($MyInvocation.InvocationName -ne 'powershell') {
|
do {
|
||||||
do {
|
|
||||||
do_line_input
|
do_line_input
|
||||||
} while ($true)
|
} while ($true)
|
||||||
} else { # in developer console
|
|
||||||
python --version
|
|
||||||
Write-Host "Press CTRL+D to exit"
|
|
||||||
$env:PS1 = "(InvokeAI) \u@\h \w> "
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user