Update the build scripts for generating the installers

This commit is contained in:
cmdr2 2022-10-26 11:26:10 +05:30
parent f732fa9736
commit 1b4ba3b396
2 changed files with 58 additions and 61 deletions

View File

@ -8,40 +8,42 @@
set /p answer=Are you a developer of this project (Y/N)?
if /i "%answer:~,1%" NEQ "Y" exit /b
@set PYTHONNOUSERSITE=1
mkdir dist\win\stable-diffusion-ui
mkdir dist\linux-mac\stable-diffusion-ui
@mkdir dist\stable-diffusion-ui
@rem copy the installer files for Windows
@echo "Downloading components for the installer.."
copy scripts\on_env_start.bat dist\win\stable-diffusion-ui\scripts\
copy scripts\bootstrap.bat dist\win\stable-diffusion-ui\scripts\
copy "scripts\Start Stable Diffusion UI.cmd" dist\win\stable-diffusion-ui\
copy LICENSE dist\win\stable-diffusion-ui\
copy "CreativeML Open RAIL-M License" dist\win\stable-diffusion-ui\
copy "\How to install and run.txt" dist\win\stable-diffusion-ui\
echo. > dist\win\stable-diffusion-ui\scripts\install_status.txt
@call conda env create --prefix installer -f environment.yaml
@call conda activate .\installer
@rem copy the installer files for Linux and Mac
@echo "Creating a distributable package.."
copy scripts\on_env_start.sh dist\linux-mac\stable-diffusion-ui\scripts\
copy scripts\bootstrap.sh dist\linux-mac\stable-diffusion-ui\scripts\
copy scripts\start.sh dist\linux-mac\stable-diffusion-ui\
copy LICENSE dist\linux-mac\stable-diffusion-ui\
copy "CreativeML Open RAIL-M License" dist\linux-mac\stable-diffusion-ui\
copy "\How to install and run.txt" dist\linux-mac\stable-diffusion-ui\
echo. > dist\linux-mac\stable-diffusion-ui\scripts\install_status.txt
@call conda install -c conda-forge -y conda-pack
@call conda pack --n-threads -1 --prefix installer --format tar
@rem make the zip
@cd dist\stable-diffusion-ui
@mkdir installer
cd dist\win
call powershell Compress-Archive -Path stable-diffusion-ui -DestinationPath ..\stable-diffusion-ui-win-x64.zip
cd ..\..
@call tar -xf ..\..\installer.tar -C installer
cd dist\linux-mac
call powershell Compress-Archive -Path stable-diffusion-ui -DestinationPath ..\stable-diffusion-ui-linux-x64.zip
call powershell Compress-Archive -Path stable-diffusion-ui -DestinationPath ..\stable-diffusion-ui-linux-arm64.zip
call powershell Compress-Archive -Path stable-diffusion-ui -DestinationPath ..\stable-diffusion-ui-mac-x64.zip
call powershell Compress-Archive -Path stable-diffusion-ui -DestinationPath ..\stable-diffusion-ui-mac-arm64.zip
cd ..\..
@mkdir scripts
echo "Build ready. Upload the zip files inside the 'dist' folder."
@copy ..\..\scripts\on_env_start.bat scripts\
@copy "..\..\scripts\Start Stable Diffusion UI.cmd" .
@copy ..\..\LICENSE .
@copy "..\..\CreativeML Open RAIL-M License" .
@copy "..\..\How to install and run.txt" .
@echo. > scripts\install_status.txt
@echo "Build ready. Zip the 'dist\stable-diffusion-ui' folder."
@echo "Cleaning up.."
@cd ..\..
@rmdir /s /q installer
@del installer.tar
pause

View File

@ -11,45 +11,40 @@ case $yn in
* ) exit;;
esac
export PYTHONNOUSERSITE=1
mkdir -p dist/win/stable-diffusion-ui
mkdir -p dist/linux-mac/stable-diffusion-ui
mkdir -p dist/stable-diffusion-ui
# copy the installer files for Windows
echo "Downloading components for the installer.."
cp scripts/on_env_start.bat dist/win/stable-diffusion-ui/scripts/
cp scripts/bootstrap.bat dist/win/stable-diffusion-ui/scripts/
cp "scripts/Start Stable Diffusion UI.cmd" dist/win/stable-diffusion-ui/
cp LICENSE dist/win/stable-diffusion-ui/
cp "CreativeML Open RAIL-M License" dist/win/stable-diffusion-ui/
cp "/How to install and run.txt" dist/win/stable-diffusion-ui/
echo. > dist/win/stable-diffusion-ui/scripts/install_status.txt
source ~/miniconda3/etc/profile.d/conda.sh
# copy the installer files for Linux and Mac
conda install -c conda-forge -y conda-pack
cp scripts/on_env_start.sh dist/linux-mac/stable-diffusion-ui/scripts/
cp scripts/bootstrap.sh dist/linux-mac/stable-diffusion-ui/scripts/
cp scripts/start.sh dist/linux-mac/stable-diffusion-ui/
cp LICENSE dist/linux-mac/stable-diffusion-ui/
cp "CreativeML Open RAIL-M License" dist/linux-mac/stable-diffusion-ui/
cp "/How to install and run.txt" dist/linux-mac/stable-diffusion-ui/
echo. > dist/linux-mac/stable-diffusion-ui/scripts/install_status.txt
conda env create --prefix installer -f environment.yaml
conda activate ./installer
echo "Creating a distributable package.."
conda pack --n-threads -1 --prefix installer --format tar
cd dist/stable-diffusion-ui
mkdir installer
tar -xf ../../installer.tar -C installer
mkdir scripts
cp ../../scripts/on_env_start.sh scripts/
cp ../../scripts/start.sh .
cp ../../LICENSE .
cp "../../CreativeML Open RAIL-M License" .
cp "../../How to install and run.txt" .
echo "" > scripts/install_status.txt
chmod u+x start.sh
echo "Build ready. Zip the 'dist/stable-diffusion-ui' folder."
echo "Cleaning up.."
# make the zip
cd dist/win
zip -r ../stable-diffusion-ui-win-x64.zip stable-diffusion-ui
cd ../..
rm -rf installer
cd dist/linux-mac
zip -r ../stable-diffusion-ui-linux-x64.zip stable-diffusion-ui
zip -r ../stable-diffusion-ui-linux-arm64.zip stable-diffusion-ui
zip -r ../stable-diffusion-ui-mac-x64.zip stable-diffusion-ui
zip -r ../stable-diffusion-ui-mac-arm64.zip stable-diffusion-ui
cd ../..
rm installer.tar
echo "Build ready. Upload the zip files inside the 'dist' folder."