Create setup script

This commit is contained in:
Alan O'Cull 2024-08-31 11:06:27 -04:00
parent d5b7a44cfd
commit 6b7a50147a
3 changed files with 31 additions and 2 deletions

10
Makefile Normal file
View File

@ -0,0 +1,10 @@
.PHONY: clean setup all
all: clean setup
clean:
@rm -rf workspace/
setup:
@mkdir -p workspace/
@./setup/setup.sh Blender4.2 blender-4.2.1-linux-x64.tar.xz

View File

@ -7,3 +7,6 @@ render_api = 'OPTIX' # NONE, CUDA, OPTIX, HIP, ONEAPI
bpy.context.preferences.addons["cycles"].preferences.compute_device_type = render_api
bpy.ops.wm.save_userpref()
# Exit blender now that we're done
bpy.ops.wm.quit_blender()

20
setup/setup.sh Normal file → Executable file
View File

@ -1,3 +1,19 @@
TARBALL=$2
DIRECTORY="workspace/${TARBALL%.tar.xz}"
BINARY=$DIRECTORY/blender
SCRIPTS=$(pwd)/setup
echo $TARBALL - $DIRECTORY - $BINARY - $SCRIPTS
# Download blender from URL and write it to workspace
wget https://download.blender.org/release/$1/$2 -O workspace/$2
# Create directory for writing
mkdir -p workspace/
# Ensure blender workspace does not exist
rm -rf workspace/$DIRECTORY/
# Download blender from URL and write it to workspacem and extract the tarball
wget https://download.blender.org/release/$1/$TARBALL -O workspace/$TARBALL
tar -xf workspace/$TARBALL -C workspace/
# Export binary location and perform setup
export blender=workspace/$BINARY
echo | whereis blender
blender -b -P $SCRIPTS/setup.py